Skip to content

Add support for IDefaultValueProvider  #321

@remkop

Description

@remkop

Add support for IDefaultValueProvider on @Command and potentially on individual @Option and @Parameters.

See discussion under #261.

Proposed API:

interface IDefaultValueProvider {
    /** Returns the default value for an option or positional parameter or {@code null}.
     * The returned value is converted to the type of the option/positional parameter
     * via the same type converter used when populating this option/positional
     * parameter from a command line argument.
     * @param argSpec the option or positional parameter, never {@code null}
     * @return the default value for the option or positional parameter, or {@code null} if
     *       this provider has no default value for the specified option or positional parameter
     */
    String defaultValue(ArgSpec argSpec);
}

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions