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

Kristoff Kiefer updated CLI-186:
--------------------------------

    Attachment: HelpFormatterTest.java

> Standard help text will not show mandatory arguments for first option
> ---------------------------------------------------------------------
>
>                 Key: CLI-186
>                 URL: https://issues.apache.org/jira/browse/CLI-186
>             Project: Commons CLI
>          Issue Type: Bug
>          Components: Help formatter
>    Affects Versions: 1.3
>         Environment: Mac OS X 10.5 Java 6, Windows XP Java 6
>            Reporter: Kristoff Kiefer
>         Attachments: HelpFormatterTest.java
>
>
> The generated help text will not show "<arg>" for the first argument added.
> See following test case:
> public void testArgsFormattingCorrect(){
>               Options options = new Options();
>               
>               OptionBuilder.isRequired();
>               OptionBuilder.hasArg();
>               OptionBuilder.withDescription("Description");
>               OptionBuilder.withLongOpt("a-a");
>               options.addOption(OptionBuilder.create("a"));
>               
>               OptionBuilder.isRequired();
>               OptionBuilder.hasArg();
>               OptionBuilder.withDescription("Description");
>               OptionBuilder.withLongOpt("b-b");
>               options.addOption(OptionBuilder.create("b"));
>               
>               ByteArrayOutputStream out = new ByteArrayOutputStream();
>               
>               HelpFormatter formatter = new HelpFormatter();
>               PrintWriter pw = new PrintWriter(out);
>               formatter.printHelp(pw, 80, "command", "", options, 0, 0, "");
>               pw.flush();
>               assertTrue(options.getOption("a").hasArg());
>               assertEquals("usage: 
> command\n-a,--a-a<arg>Description\n-b,--b-b <arg>Description\n", 
> out.toString());
>       }

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

Reply via email to