Uploaded image for project: 'Commons CLI'
  1. Commons CLI
  2. CLI-229

Missing place holder in required argument

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Duplicate
    • 1.2
    • 1.3
    • CLI-1.x
    • None
    • Windows 7 x64, Java 1.7.9

    Description

      The code below :

      @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);
      	}
      }
      

      Produces :

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

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

      Thanks

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              mr_and_mrs_d Palmer Eldritch
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: