urfave / cli

A simple, fast, and fun package for building command line apps in Go
https://cli.urfave.org
MIT License
21.89k stars 1.69k forks source link

Remove [command [command options]] from help text if there are no sub commands #1921

Open marwan-at-work opened 3 weeks ago

marwan-at-work commented 3 weeks ago

Hi there, I think it would help readability a lot if cli/v3 can check for subcommands first before printing the help of a command.

For example, right now this is the help that I get:

NAME:
   app cmd1 cmd2 - does something cool

USAGE:
   app cmd1 cmd2 [command [command options]] <myArgUsage>

OPTIONS:
   --flag value  (default: 1)
   --help, -h     show help (default: false)

Note that cmd2 has no sub-commands which makes it distracting from reading and understanding the USAGE. So what I'd love to instead see is:

NAME:
   app cmd1 cmd2 - does something cool

USAGE:
   app cmd1 cmd2 <myArgUsage>

OPTIONS:
   --flag value  (default: 1)
   --help, -h     show help (default: false)
dearchap commented 2 days ago

@marwan-at-work want to make a PR for me to review for this ?