You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "dave rodgman (JIRA)" <ji...@apache.org> on 2009/12/10 16:32:18 UTC

[jira] Created: (CLI-192) single character arguments are wrongly interpreted as short options

single character arguments are wrongly interpreted as short options
-------------------------------------------------------------------

                 Key: CLI-192
                 URL: https://issues.apache.org/jira/browse/CLI-192
             Project: Commons CLI
          Issue Type: Bug
    Affects Versions: 1.1
         Environment: linux
            Reporter: dave rodgman


If I have a command line which supports "-o"  or equivalently "--option", and "-foo", then

--foo o

gets interpreted as if I had typed "--foo -o", i.e. the "o" is (wrongly) seen as an option instead of an argument to "--foo". Foo then (wrongly) has no arguments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (CLI-192) single character arguments are wrongly interpreted as short options

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-192?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bourg updated CLI-192:
-------------------------------

    Description: 
If I have a command line which supports "-o"
or equivalently "--option", and "-foo", then

--foo o

gets interpreted as if I had typed "--foo -o", i.e. the "o" is (wrongly) seen as an option
instead of an argument to "--foo". Foo then (wrongly) has no arguments.

  was:
If I have a command line which supports "-o"  or equivalently "--option", and "-foo", then

--foo o

gets interpreted as if I had typed "--foo -o", i.e. the "o" is (wrongly) seen as an option instead of an argument to "--foo". Foo then (wrongly) has no arguments.


> single character arguments are wrongly interpreted as short options
> -------------------------------------------------------------------
>
>                 Key: CLI-192
>                 URL: https://issues.apache.org/jira/browse/CLI-192
>             Project: Commons CLI
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: linux
>            Reporter: dave rodgman
>
> If I have a command line which supports "-o"
> or equivalently "--option", and "-foo", then
> --foo o
> gets interpreted as if I had typed "--foo -o", i.e. the "o" is (wrongly) seen as an option
> instead of an argument to "--foo". Foo then (wrongly) has no arguments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CLI-192) single character arguments are wrongly interpreted as short options

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12880566#action_12880566 ] 

Emmanuel Bourg commented on CLI-192:
------------------------------------

I tried to reproduce your issue with this test:

{code}
Options options = new Options();
options.addOption(OptionBuilder.withLongOpt("option").create("o"));
options.addOption(OptionBuilder.withLongOpt("foo").hasArg().create());

CommandLine cmd = parser.parse(options, new String[] { "--foo", "o" });

assertTrue(cmd.hasOption("foo"));
assertFalse(cmd.hasOption("o"));
assertEquals("o", cmd.getOptionValue("foo"));
{code}

I ran it against CLI 1.1 and 1.2, with the Posix, GNU and Basic parsers. It worked every time. It works also with the default parser on the trunk.

Could you show me how you configured your options please?


> single character arguments are wrongly interpreted as short options
> -------------------------------------------------------------------
>
>                 Key: CLI-192
>                 URL: https://issues.apache.org/jira/browse/CLI-192
>             Project: Commons CLI
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: linux
>            Reporter: dave rodgman
>
> If I have a command line which supports "-o"
> or equivalently "--option", and "-foo", then
> --foo o
> gets interpreted as if I had typed "--foo -o", i.e. the "o" is (wrongly) seen as an option
> instead of an argument to "--foo". Foo then (wrongly) has no arguments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (CLI-192) single character arguments are wrongly interpreted as short options

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/CLI-192?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Emmanuel Bourg resolved CLI-192.
--------------------------------

    Resolution: Cannot Reproduce

I wasn't able to reproduce the issue. Please reopen and attach a test case if you encounter this issue with the code from the trunk.

> single character arguments are wrongly interpreted as short options
> -------------------------------------------------------------------
>
>                 Key: CLI-192
>                 URL: https://issues.apache.org/jira/browse/CLI-192
>             Project: Commons CLI
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: linux
>            Reporter: dave rodgman
>
> If I have a command line which supports "-o"
> or equivalently "--option", and "-foo", then
> --foo o
> gets interpreted as if I had typed "--foo -o", i.e. the "o" is (wrongly) seen as an option
> instead of an argument to "--foo". Foo then (wrongly) has no arguments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (CLI-192) single character arguments are wrongly interpreted as short options

Posted by "Emmanuel Bourg (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/CLI-192?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12877877#action_12877877 ] 

Emmanuel Bourg commented on CLI-192:
------------------------------------

Dave do you have a code snippet that reproduces this issue? The parser you used and the options you configured matter to understand the issue.

> single character arguments are wrongly interpreted as short options
> -------------------------------------------------------------------
>
>                 Key: CLI-192
>                 URL: https://issues.apache.org/jira/browse/CLI-192
>             Project: Commons CLI
>          Issue Type: Bug
>    Affects Versions: 1.1
>         Environment: linux
>            Reporter: dave rodgman
>
> If I have a command line which supports "-o"  or equivalently "--option", and "-foo", then
> --foo o
> gets interpreted as if I had typed "--foo -o", i.e. the "o" is (wrongly) seen as an option instead of an argument to "--foo". Foo then (wrongly) has no arguments.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.