You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Adrien CABARBAYE (JIRA)" <ji...@apache.org> on 2016/04/05 18:29:25 UTC
[jira] [Updated] (CLI-264) Short/Long options can be called using
either '-' or '--' hyphens with no limitation
[ https://issues.apache.org/jira/browse/CLI-264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Adrien CABARBAYE updated CLI-264:
---------------------------------
Description:
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.
was:
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.
> 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)