jcommander icon indicating copy to clipboard operation
jcommander copied to clipboard

Combining required=true with defaults

Open mkarg opened this issue 3 years ago • 1 comments

Currently required=true enforces the explicit provision of a parameter at the command line. In fact, it would be very useful, is a default would be considered, i. e. the error message requesting the missing parameter only pops up if the default (provided either by a static initializationg function or by a IDefaultProvider) actually is null. The idea behind this is that an essential parameter can be loaded by a default provider, but if that fails the user can override by explicitly provide the parameter.

mkarg avatar May 12 '21 13:05 mkarg

this feature would be helpful when initializing a class through some environment variable loading and then wanting them provided on the command line, only if not pre-populated.

nbuesing avatar Mar 29 '23 19:03 nbuesing