From 3602f82a2d2db9c9efbaf9c6b1a33def9a9ea725 Mon Sep 17 00:00:00 2001
From: Ken Dombeck
From e98489e582ed63935715ef018b34695ce4b25111 Mon Sep 17 00:00:00 2001
From: Ken Dombeck
* 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().longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().option("f").get());
+ * options.addOption(Option.builder().longOpt("version").desc("Print the version of the application").option("v").get());
+ * options.addOption(Option.builder().longOpt("help").option("h").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);
*
*
* 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().longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().option("f").get());
+ * options.addOption(Option.builder().longOpt("version").desc("Print the version of the application").option("v").get());
+ * options.addOption(Option.builder().longOpt("help").option("h").get());
*
* String header = "Do something useful with an input file\n\n";
* String footer = "\nPlease report issues at https://example.com/issues";
From 63484f7b8bb8501fac17aaded12f186c5b0e562f Mon Sep 17 00:00:00 2001
From: Ken Dombeck
* Options options = new Options();
- * options.addOption(Option.builder().longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().option("f").get());
- * options.addOption(Option.builder().longOpt("version").desc("Print the version of the application").option("v").get());
- * options.addOption(Option.builder().longOpt("help").option("h").get());
+ * 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 c5295a4f7..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,9 +31,9 @@ Licensed to the Apache Software Foundation (ASF) under one or more
*
*
* Options options = new Options();
- * options.addOption(Option.builder().longOpt("file").desc("The file to be processed").hasArg().argName("FILE").required().option("f").get());
- * options.addOption(Option.builder().longOpt("version").desc("Print the version of the application").option("v").get());
- * options.addOption(Option.builder().longOpt("help").option("h").get());
+ * 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";