improve trashed message

This commit is contained in:
Lilian Jónsdóttir 2024-07-15 21:31:59 -07:00
parent 3fb12e3c44
commit e7e7b79e99
2 changed files with 8 additions and 1 deletions

View file

@ -84,6 +84,7 @@ func FindTrash(trashdir, ogdir string, f *filter.Filter) (files Files, outerr er
trashedpath := strings.Replace(strings.Replace(path, "info", "files", 1), trash_info_ext, "", 1) trashedpath := strings.Replace(strings.Replace(path, "info", "files", 1), trash_info_ext, "", 1)
info, err := os.Stat(trashedpath) info, err := os.Stat(trashedpath)
if err != nil { if err != nil {
// TODO: do something about it
log.Errorf("error reading %s: %s", trashedpath, err) log.Errorf("error reading %s: %s", trashedpath, err)
return nil return nil
} }

View file

@ -536,7 +536,13 @@ func confirmTrash(fs files.Files) error {
if err != nil { if err != nil {
return err return err
} }
fmt.Printf("trashed %d files\n", trashed) var f string
if trashed == 1 {
f = "file"
} else {
f = "files"
}
fmt.Printf("trashed %d %s\n", trashed, f)
} else { } else {
fmt.Printf("not doing anything\n") fmt.Printf("not doing anything\n")
return nil return nil