select all if filenames are used when trashing

This commit is contained in:
Lilian Jónsdóttir 2024-06-28 11:30:23 -07:00
parent 281c32c2a0
commit 92a74b0283

View file

@ -133,6 +133,7 @@ var (
Before: beforeTrash, Before: beforeTrash,
Action: func(ctx *cli.Context) error { Action: func(ctx *cli.Context) error {
var files_to_trash files.Files var files_to_trash files.Files
var selectall bool
for _, arg := range ctx.Args().Slice() { for _, arg := range ctx.Args().Slice() {
file, e := files.New(arg) file, e := files.New(arg)
if e != nil { if e != nil {
@ -141,6 +142,7 @@ var (
continue continue
} }
files_to_trash = append(files_to_trash, file) files_to_trash = append(files_to_trash, file)
selectall = true
} }
// if none of the args were files, then process find files based on filter // if none of the args were files, then process find files based on filter
@ -154,10 +156,11 @@ var (
return nil return nil
} }
files_to_trash = append(files_to_trash, fls...) files_to_trash = append(files_to_trash, fls...)
selectall = !f.Blank()
} }
log.Debugf("what is workdir? it's %s", workdir) log.Debugf("what is workdir? it's %s", workdir)
indices, err := tables.FilesTable(files_to_trash, termwidth, termheight, false, !f.Blank(), workdir) indices, err := tables.FilesTable(files_to_trash, termwidth, termheight, false, selectall, workdir)
if err != nil { if err != nil {
return err return err
} }