[prev in list] [next in list] [prev in thread] [next in thread] 

List:       jakarta-commons-dev
Subject:    [jira] Updated: (CLI-186) Standard help text will not show
From:       "Kristoff Kiefer (JIRA)" <jira () apache ! org>
Date:       2009-07-31 22:04:14
Message-ID: 2061231152.1249077854829.JavaMail.jira () brutus
[Download RAW message or body]


     [ 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.


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic