Print SubCommand-specific usage messages
ben3000 opened this issue ยท 5 comments
CmdLineParser.getArguments()
returns an OptionHandler
for each Argument
, including those used to define sub-commands, but there is no access to the SubCommand
objects from the Argument
. Make it so that if an Argument
has associated sub-commands, the usage message for these is also printed using the various cli.printUsage(..)
methods.
+1. Not having usage printed for sub-commands makes the feature of sub-commands practically unusable.
+1
+1
+1. Printing usage of sub-commands is really needed
Actually you can print out the subcommands usage information, you just need to create the cliParser for the given subCommand class that represents the command instead of the arguments object. E.g.
Program has SubCommand(name="help", impl=HelpCommand.class ) then to display the command command usage you just use new CmdLineParser(HelpCommand.class).printUsage(System.out), using this on the top level, just outputs the commands, not the help for each subcommand.
A good enhancement might be to allow this, but it doesn't make it unuseable. We done, and thanks for a great and easy to use library.