Palmer Eldritch created CLI-229:
-----------------------------------

             Summary: Missing place holder in required argument
                 Key: CLI-229
                 URL: https://issues.apache.org/jira/browse/CLI-229
             Project: Commons CLI
          Issue Type: Bug
          Components: CLI-1.x
    Affects Versions: 1.2
         Environment: Windows 7 x64, Java 1.7.9
            Reporter: Palmer Eldritch
            Priority: Minor
             Fix For: 1.3


The code below :
{code}
@SuppressWarnings("static-access")
public class CliArgBug {

        private static final Options OPTIONS = new Options();
        static {
                // FIXME : bug ? usage prints --seq1 --seq2 <arg> - notice <arg>
                // missing in seq1 - corrected by adding .withArgName("file1")
                OPTIONS.addOption(OptionBuilder
                                .withLongOpt("seq1")
                                .withDescription(
                                                "REQUIRED : the file containing 
sequence 1")
                                .hasArg().isRequired().create());
                OPTIONS.addOption(OptionBuilder
                                .withLongOpt("seq2")
                                .withDescription(
                                                "REQUIRED : the file containing 
sequence 2")
                                .hasArg().isRequired().create());
        }

        public static void main(String[] args) {
                HelpFormatter formatter = new HelpFormatter();
                formatter.printHelp("Notice <arg> is missing in seq1", OPTIONS, 
true);
        }
}
{code}

Produces :
{code}
usage: Notice <arg> is missing in seq1 --seq1 --seq2 <arg>
    --seq1         REQUIRED : the file containing sequence 
    --seq2 <arg>   REQUIRED : the file containing sequence 2
{code}

Also I was not able to find any info on where this placeholder <arg> is defined 
- please add this to the javadoc

Thanks

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to