Skip to content

Commit c4dddc7

Browse files
kdombeckKen Dombeck
andauthored
[CLI-352] Correct HelpFormatter Javadoc (#418)
* [CLI-352] Correct HelpFormatter Javadoc * [CLI-352] Correct HelpFormatter Javadoc * Use overloaded builder method to define option rather than specifiying it separately. This will be more consistent with other documented uses. --------- Co-authored-by: Ken Dombeck <[email protected]>
1 parent 5c24f49 commit c4dddc7

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/main/java/org/apache/commons/cli/HelpFormatter.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ Licensed to the Apache Software Foundation (ASF) under one or more
4444
* </p>
4545
* <pre>
4646
* Options options = new Options();
47-
* options.addOption(OptionBuilder.withLongOpt("file").withDescription("The file to be processed").hasArg().withArgName("FILE").isRequired().create('f'));
48-
* options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version of the application").create('v'));
49-
* options.addOption(OptionBuilder.withLongOpt("help").create('h'));
47+
* options.addOption(Option.builder("f").longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().get());
48+
* options.addOption(Option.builder("v").longOpt("version").desc("Print the version of the application").get());
49+
* options.addOption(Option.builder("h").longOpt("help").get());
5050
*
5151
* String header = "Do something useful with an input file\n\n";
5252
* String footer = "\nPlease report issues at https://example.com/issues";

src/main/java/org/apache/commons/cli/help/HelpFormatter.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ Licensed to the Apache Software Foundation (ASF) under one or more
3131
*
3232
* <pre>
3333
* Options options = new Options();
34-
* options.addOption(OptionBuilder.withLongOpt("file").withDescription("The file to be processed").hasArg().withArgName("FILE").isRequired().create('f'));
35-
* options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version of the application").create('v'));
36-
* options.addOption(OptionBuilder.withLongOpt("help").create('h'));
34+
* options.addOption(Option.builder("f").longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().get());
35+
* options.addOption(Option.builder("v").longOpt("version").desc("Print the version of the application").get());
36+
* options.addOption(Option.builder("h").longOpt("help").get());
3737
*
3838
* String header = "Do something useful with an input file";
3939
* String footer = "Please report issues at https://example.com/issues";
4040
*
41-
* HelpFormatter formatter = new HelpFormatter();
41+
* HelpFormatter formatter = HelpFormatter.builder().get();
4242
* formatter.printHelp("myapp", header, options, footer, true);
4343
* </pre>
4444
* <p>

0 commit comments

Comments
 (0)