From 79e274e9fca40b54b0cba240b906af7be4965e74 Mon Sep 17 00:00:00 2001 From: CHIKAMATSU Naohiro Date: Tue, 30 Jan 2024 22:21:54 +0900 Subject: [PATCH] Fix reviewdog and coderabbit --- ui/s3hub/command.go | 2 +- ui/s3hub/list.go | 13 +++---------- ui/s3hub/root.go | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ui/s3hub/command.go b/ui/s3hub/command.go index 4fd02fd..9dcd6bd 100644 --- a/ui/s3hub/command.go +++ b/ui/s3hub/command.go @@ -39,7 +39,7 @@ type fetchS3Keys struct { keys []model.S3Key } -// fetchS3KeysCmd fetches the list of the S3 bucket objects. +// fetchS3KeysCmd creates a command to fetch the keys of objects stored in a specified S3 bucket. func fetchS3KeysCmd(ctx context.Context, app *di.S3App, bucket model.Bucket) tea.Cmd { return tea.Cmd(func() tea.Msg { output, err := app.S3ObjectsLister.ListS3Objects(ctx, &usecase.S3ObjectsListerInput{ diff --git a/ui/s3hub/list.go b/ui/s3hub/list.go index d94946d..9e9cff4 100644 --- a/ui/s3hub/list.go +++ b/ui/s3hub/list.go @@ -367,21 +367,14 @@ func (m *s3hubListS3ObjectModel) s3ObjectListStrWithCheckbox() string { startIndex = len(m.s3Keys) - windowHeight endIndex = len(m.s3Keys) } - } else { - if len(m.s3Keys) > windowHeight { - endIndex = windowHeight - } + } else if len(m.s3Keys) > windowHeight { + endIndex = windowHeight } m.status = s3hubListS3ObjectStatusListed s := fmt.Sprintf("S3 objects %d/%d (profile=%s)\n\n", m.choice.Choice+1, len(m.s3Keys), m.awsProfile.String()) for i := startIndex; i < endIndex; i++ { - s += fmt.Sprintf("%s\n", - ui.Checkbox( - fmt.Sprintf( - "%s", - color.GreenString("%s", m.bucket.Join(m.s3Keys[i]))), - m.choice.Choice == i)) + s += fmt.Sprintf("%s\n", ui.Checkbox(color.GreenString("%s", m.bucket.Join(m.s3Keys[i])), m.choice.Choice == i)) } s += ui.Subtle("\n: return | : quit | up/down: select\n") s += ui.Subtle(", : choose bucket\n\n") diff --git a/ui/s3hub/root.go b/ui/s3hub/root.go index 7beff0b..de721b0 100644 --- a/ui/s3hub/root.go +++ b/ui/s3hub/root.go @@ -135,7 +135,7 @@ func (m *s3hubRootModel) choicesView() string { choices := fmt.Sprintf( "%s\n%s\n%s\n%s\n", ui.Checkbox("Create the S3 bucket", c == s3hubTopMinChoice), - ui.Checkbox("List S3 buckets (Download S3 Objects)", c == 1), + ui.Checkbox("List and download S3 objects", c == 1), ui.Checkbox("Delete contents from the S3 bucket", c == 2), ui.Checkbox("Delete the S3 bucket", c == s3hubTopMaxChoice), )