Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion cmd/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ cp -r ss:///bucket/docs .
Example: `rm -r ss:///bucket/docs
rm ss:///bucket/docs/example.md ss:///bucket/readme.md
`,
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
return rm.Run(cmd.Context(), args, recursive, afero.NewOsFs())
},
Expand Down
15 changes: 14 additions & 1 deletion internal/storage/rm/rm.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,22 @@ func Run(ctx context.Context, paths []string, recursive bool, fsys afero.Fs) err
if err != nil {
return err
}
if len(groups) == 0 {
if !recursive {
return errors.New(errMissingFlag)
}
buckets, err := api.ListBuckets(ctx)
if err != nil {
return err
}
for _, b := range buckets {
groups[b.Name] = []string{""}
}
}
console := utils.NewConsole()
for bucket, prefixes := range groups {
confirm := fmt.Sprintf("Confirm deleting files in bucket %v?", utils.Bold(bucket))
if shouldDelete, err := utils.NewConsole().PromptYesNo(ctx, confirm, false); err != nil {
if shouldDelete, err := console.PromptYesNo(ctx, confirm, false); err != nil {
return err
} else if !shouldDelete {
continue
Expand Down