3 ms·
I write a lot of tui/cli apps and I've never even considered doing sub commands. I always do --my-action-1 and --my-action-2. I can't think of any huge positiv
by swozey 3y ago
I write a lot of tui/cli apps and I've never even considered doing sub commands. I always do --my-action-1 and --my-action-2.
I can't think of any huge positives from using subcommands. I know for a fact that that will take longer to write and add some complexity to --args-* and I also feel like getting a quick --help option would be a lot more cumbersome.
Maybe a good way there is to list commands then tabbed/dashed indented under the root command list its subcommands.
- gbalduzzi 3y agoI like that sub-commands usually have a different --help output git --help git add --help The former returns general information about the whole git executable, while the latter returns specific details about the add command. It also gives an immediate intuition of entering a whole different flow that can not be composed with other flows, something that you don't have with --args There is a hierarchy between commands and options that is not expressed when both use the -- syntax