args4j icon indicating copy to clipboard operation
args4j copied to clipboard

Print SubCommand-specific usage messages

Open ben3000 opened this issue 10 years ago • 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.

ben3000 avatar Mar 05 '15 05:03 ben3000

+1. Not having usage printed for sub-commands makes the feature of sub-commands practically unusable.

msugakov avatar Oct 19 '15 10:10 msugakov

+1

matt-hammond-001 avatar Feb 09 '16 00:02 matt-hammond-001

+1

nilsga avatar Aug 10 '16 06:08 nilsga

+1. Printing usage of sub-commands is really needed

pradyot21 avatar Aug 25 '16 20:08 pradyot21

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.

trevorgetty avatar Sep 26 '16 17:09 trevorgetty