[ 
https://issues.apache.org/jira/browse/CLI-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Isuranga Perera updated CLI-264:
--------------------------------
    Attachment:     (was: temp.html)

> Short/Long options can be called using either '-' or '--' hyphens with no 
> limitation
> ------------------------------------------------------------------------------------
>
>                 Key: CLI-264
>                 URL: https://issues.apache.org/jira/browse/CLI-264
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: CLI-1.x
>    Affects Versions: 1.3.1
>            Reporter: Adrien CABARBAYE
>              Labels: features
>
> When using DefaultParser, any options can be accessed using either '\-' or 
> '\-\-' as a prefix and so regardless whether they have been defined as short 
> or long.
> the problem is in handleToken:
> 237        else if (token.startsWith("\-\-"))
> 238        {
> 239            handleLongOption(token);
> 240        }
> 241        else if (token.startsWith("\-") && !"\-".equals(token))
> 242        {
> 243            handleShortAndLongOption(token);
> 244        }
> Some logic should be added so that if an option has been defined as short  
> (e.g. \-h), if \-\-h is used, for instance, in the command line, an exception 
> should be raised. Similarly for long options which are being called using 
> only '\-' instead of '\-\-' as a prefix, an exception should also be fired.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to