cbeust / jcommander

Command line parsing framework for Java
Apache License 2.0
1.95k stars 332 forks source link

Support for default command #513

Open mkarg opened 3 years ago

mkarg commented 3 years ago

For some applications it might be beneficial to have a default command which will be invoked if no command is explicitly provided. Currently in this situation usage() is executed, but it might be a good thing if instead the default command gets executed if one is declared:

 // don't show usage() but instead invoke this command if none is provided at runtime
jCommander.setDefaultCommand(command);
mkarg commented 2 years ago

@cbeust I would provide a PR if you think this feature is benefical.