cbeust / jcommander

Command line parsing framework for Java

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Combining required=true with defaults

mkarg opened this issue · 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.

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.