Skip to content

Interpreter should reset options and positional parameters to their initial value before parsing new input #354

@remkop

Description

@remkop

Currently, if a CommandSpec is constructed programmatically, each option and positional parameter by default has an ObjectBinding where the value(s) matched on the command line is/are stored.

These values should be reset to their initial value every time before new input is parsed.

Note that in most cases this is not a problem since the interpreter already keeps track of whether an option has previously been seen or not, and initializes a new Collection or Map the first time the option or positional parameter is encountered.

However, it is best to call option.setValue(option.initialValue()) for all options and positional parameters so there is consistent behaviour for all types, not just java.util classes.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions