improve command help text

This commit is contained in:
Lilian Jónsdóttir 2024-07-30 14:31:45 -07:00
parent 7c0f78f4d6
commit 8d7db7cfa7

33
main.go
View file

@ -202,11 +202,12 @@ var (
} }
doTrash = &cli.Command{ doTrash = &cli.Command{
Name: "trash", Name: "trash",
Aliases: []string{"tr"}, Aliases: []string{"tr"},
Usage: "Trash a file or files", Usage: "Trash a file or files",
Flags: slices.Concat(trashingFlags, filterFlags), UsageText: "[command options] [filename(s)]",
Before: beforeTrash, Flags: slices.Concat(trashingFlags, filterFlags),
Before: beforeTrash,
Action: func(ctx *cli.Context) error { Action: func(ctx *cli.Context) error {
var filesToTrash files.Files var filesToTrash files.Files
for _, arg := range ctx.Args().Slice() { for _, arg := range ctx.Args().Slice() {
@ -280,11 +281,12 @@ var (
} }
doRestore = &cli.Command{ doRestore = &cli.Command{
Name: "restore", Name: "restore",
Aliases: []string{"re"}, Aliases: []string{"re"},
Usage: "Restore a trashed file or files", Usage: "Restore a trashed file or files",
Flags: slices.Concat(cleanRestoreFlags, trashedFlags, filterFlags), UsageText: "[command options] [filename(s)]",
Before: beforeCommands, Flags: slices.Concat(cleanRestoreFlags, trashedFlags, filterFlags),
Before: beforeCommands,
Action: func(_ *cli.Context) error { Action: func(_ *cli.Context) error {
log.Debugf("searching in directory %s for files", trashDir) log.Debugf("searching in directory %s for files", trashDir)
@ -311,11 +313,12 @@ var (
} }
doClean = &cli.Command{ doClean = &cli.Command{
Name: "clean", Name: "clean",
Aliases: []string{"cl"}, Aliases: []string{"cl"},
Usage: "Clean files from trash", Usage: "Clean files from trash",
Flags: slices.Concat(cleanRestoreFlags, trashedFlags, filterFlags), UsageText: "[command options] [filename(s)]",
Before: beforeCommands, Flags: slices.Concat(cleanRestoreFlags, trashedFlags, filterFlags),
Before: beforeCommands,
Action: func(_ *cli.Context) error { Action: func(_ *cli.Context) error {
fls, err := files.FindTrash(trashDir, ogdir, fltr) fls, err := files.FindTrash(trashDir, ogdir, fltr)
if len(fls) == 0 { if len(fls) == 0 {