Details
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
- duplicates
-
CLI-186 Standard help text will not show mandatory arguments for first option
- Closed