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

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

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


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