You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Balz Guenat (Jira)" <ji...@apache.org> on 2019/11/25 15:28:00 UTC

[jira] [Created] (CLI-301) More consideration for option overriding

Balz Guenat created CLI-301:
-------------------------------

             Summary: More consideration for option overriding
                 Key: CLI-301
                 URL: https://issues.apache.org/jira/browse/CLI-301
             Project: Commons CLI
          Issue Type: Wish
          Components: CLI-1.x, Options definition, Parser
    Affects Versions: 1.4
         Environment: Any
            Reporter: Balz Guenat


It is currently quite cumbersome to define options where later occurrences override previous ones.

For one thing, a CommandLine.getLastOptionValue() would help. But this is easy to implement yourself.

Another pain point are options with optional arguments. Say you have a boolean argument foo that takes an optional argument "true" or "false". If no argument is given, it should be set to true.

To get the correct value for foo, you first have to find the last occurrence of the option, then check if it has a value and then return either the given value or a default (which is likely different from the default value where the option doesn't occur).



--
This message was sent by Atlassian Jira
(v8.3.4#803005)