Claudenw commented on code in PR #277:
URL: https://github.com/apache/commons-cli/pull/277#discussion_r1605796694


##########
src/site/xdoc/usage.xml:
##########
@@ -466,145 +465,141 @@ catch (ParseException exp) {
               <code>deprecated</code> method.
 
               Usage of the deprecated option is announced when the presence of 
the option is checked
-              or the value of the option is retrieved.  By default the 
announcement printed to Standard out.
+              or the value of the option is retrieved.  By default, the 
announcement printed to Standard out.
 
-              The HelpFormatter output will be default show the description 
prefixed by "[Deprecated]"
+              The HelpFormatter output will by default show the description 
prefixed by "[Deprecated]"
           </p>
           <p>
               The examples below will implement <code>doSomething</code> in 
the following code block.
               <source>
-                  public static void main(String[] args) {
-                      Option n = Option.builder("n")
-                          .deprecated(DeprecatedAttributes.builder()
-                              .setDescription("Use '-count' instead")
-                              .setForRemoval(true)
-                              .setSince("now").get())
-                          .hasArg()
-                          .desc("the number of things")
-                          .type(Integer.class)
-                          .build();
-                      Option count = Option.builder("count")
-                          .hasArg()
-                          .desc("the number of things")
-                          .type(Integer.class)
-                          .build();
-                      Options options = new 
Options().addOption(n).addOption(count);
+  public static void main(String[] args) {
+      Option n = Option.builder("n")
+          .deprecated(DeprecatedAttributes.builder()
+              .setDescription("Use '-count' instead")
+              .setForRemoval(true)
+              .setSince("now").get())
+          .hasArg()
+          .desc("the number of things")
+          .type(Integer.class)
+          .build();
+      Option count = Option.builder("count")
+          .hasArg()
+          .desc("the number of things")
+          .type(Integer.class)
+          .build();
+      Options options = new Options().addOption(n).addOption(count);
 
-                      doSomething(options);
-                  }
-              </source>
+      doSomething(options);
+  }           </source>
           </p>
 
           <subsection name="Changing Usage Announcement">
               <p>
-                  The usage announcement may be changed by providing a 
<code>Consumer&gt;Option&lt;></code> to the
-                  <code>CommandLine.Builder.deprecatedHandler</code> method.
+                  The usage announcement may be changed by providing a 
<code>Consumer&lt;Option></code> to the
+                  <code>CommandLine.Builder.deprecatedHandler</code> method.  
This is commonly used to log usage
+                  of deprecated options rather than printing them on the 
standard output.
               </p>
               <p>
                   for example if <code>doSomething</code> is implemented as:
               </p>
-              <sorce>
-                  void doSomething(Options options) {
-                      CommandLineParser parser = new DefaultParser();
-                      CommandLine line;
-                      try {
-                          // parse the command line arguments
-                          line = parser.parse(options, new String[] {"-n", 
"5"});
-                          System.out.println( 
"n="+line.getParsedOptionValue("n"));
-                      } catch (ParseException exp) {
-                          // oops, something went wrong
-                          System.err.println("Parsing failed.  Reason: " + 
exp.getMessage());
-                      }
-                  }
-              </sorce>
+              <source>
+  void doSomething(Options options) {
+      CommandLineParser parser = new DefaultParser();
+      CommandLine line;
+      try {
+          // parse the command line arguments
+          line = parser.parse(options, new String[] {"-n", "5"});
+          System.out.println( "n="+line.getParsedOptionValue("n"));

Review Comment:
   not: `System.out.println("n=" + line.getParsedOptionValue("n"));` ?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to