diff --git a/src/main/java/org/apache/commons/cli/HelpFormatter.java b/src/main/java/org/apache/commons/cli/HelpFormatter.java index fb9da62e9..febdf4c8f 100644 --- a/src/main/java/org/apache/commons/cli/HelpFormatter.java +++ b/src/main/java/org/apache/commons/cli/HelpFormatter.java @@ -44,9 +44,9 @@ Licensed to the Apache Software Foundation (ASF) under one or more *
*
* Options options = new Options();
- * options.addOption(OptionBuilder.withLongOpt("file").withDescription("The file to be processed").hasArg().withArgName("FILE").isRequired().create('f'));
- * options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version of the application").create('v'));
- * options.addOption(OptionBuilder.withLongOpt("help").create('h'));
+ * options.addOption(Option.builder("f").longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().get());
+ * options.addOption(Option.builder("v").longOpt("version").desc("Print the version of the application").get());
+ * options.addOption(Option.builder("h").longOpt("help").get());
*
* String header = "Do something useful with an input file\n\n";
* String footer = "\nPlease report issues at https://example.com/issues";
diff --git a/src/main/java/org/apache/commons/cli/help/HelpFormatter.java b/src/main/java/org/apache/commons/cli/help/HelpFormatter.java
index c4081ec4b..f0723706a 100644
--- a/src/main/java/org/apache/commons/cli/help/HelpFormatter.java
+++ b/src/main/java/org/apache/commons/cli/help/HelpFormatter.java
@@ -31,14 +31,14 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*
*
* Options options = new Options();
- * options.addOption(OptionBuilder.withLongOpt("file").withDescription("The file to be processed").hasArg().withArgName("FILE").isRequired().create('f'));
- * options.addOption(OptionBuilder.withLongOpt("version").withDescription("Print the version of the application").create('v'));
- * options.addOption(OptionBuilder.withLongOpt("help").create('h'));
+ * options.addOption(Option.builder("f").longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().get());
+ * options.addOption(Option.builder("v").longOpt("version").desc("Print the version of the application").get());
+ * options.addOption(Option.builder("h").longOpt("help").get());
*
* String header = "Do something useful with an input file";
* String footer = "Please report issues at https://example.com/issues";
*
- * HelpFormatter formatter = new HelpFormatter();
+ * HelpFormatter formatter = HelpFormatter.builder().get();
* formatter.printHelp("myapp", header, options, footer, true);
*
*