commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "cynthia avishegnath (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CLI-243) helpful -help option in a sea of required options
Date Fri, 15 Nov 2013 15:35:20 GMT
cynthia avishegnath created CLI-243:
---------------------------------------

             Summary: helpful -help option in a sea of required options
                 Key: CLI-243
                 URL: https://issues.apache.org/jira/browse/CLI-243
             Project: Commons CLI
          Issue Type: Bug
          Components: Options definition, Parser
    Affects Versions: 1.2
         Environment: Java obviously.
            Reporter: cynthia avishegnath
             Fix For: 1.3


Let's say we have the required options a, b, c, d, e, f, ...., z.

And we have a single optional option "help".

So, I enter 
>java blah..blah ..blah mainClass -help.

It ends up with catching the missing option exception. There is no way of specifying that
if -help is supplied then all mandatory options are ignored.

The way around it is to double parse the args, or to override the parser, the hassle of which
defeats the purpose of using CLI.

You should have a new method

>     public void parse(
           CommandLine cmd,   Options options, String[] arguments,
           Properties properties, boolean stopAtNonOption)
       throws ParseException;

So that, on exception, I could still have a handle to cmd object, which I would determine
if "-help" was specified.



--
This message was sent by Atlassian JIRA
(v6.1#6144)

Mime
View raw message