From bae9398cc148d37215ff0c6f2e2dcc347f4dc134 Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Thu, 12 Feb 2015 10:56:08 +0000
Subject: [PATCH] CR-6060 OPENDJ-1785 Add "extra" doc into code for generated content

---
 opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java |   22 +++++++++++++++++++++-
 1 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
index 5734756..f6fb9d0 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/SubCommandArgumentParser.java
@@ -22,7 +22,7 @@
  *
  *
  *      Copyright 2006-2010 Sun Microsystems, Inc.
- *      Portions Copyright 2011-2015 ForgeRock AS
+ *      Portions Copyright 2011-2015 ForgeRock AS.
  */
 package com.forgerock.opendj.cli;
 
@@ -1176,6 +1176,14 @@
         sb.append(" <title>").append(nameRef).append("</title>").append(EOL);
         sb.append(" <para>").append(sc.getDescription()).append("</para>").append(EOL);
 
+        // If there is a supplement to the description for this subcommand,
+        // then it is formatted for use in generated reference documentation.
+        // In other words, it is already DocBook XML, so append it as is.
+        final LocalizableMessage scDocDescriptionSupplement = sc.getDocDescriptionSupplement();
+        if (!LocalizableMessage.EMPTY.equals(scDocDescriptionSupplement)) {
+            sb.append(scDocDescriptionSupplement.toString()).append(EOL);
+        }
+
         if (!sc.getArguments().isEmpty()) {
             sb.append(" <refsect3 xml:id=\"").append(idRef).append("-options\">").append(EOL);
             sb.append("   <title>Options</title>").append(EOL);
@@ -1202,6 +1210,18 @@
                 }
                 if (subCommandUsageHandler != null) {
                     subCommandUsageHandler.appendArgumentAdditionalInfo(sb, sc, a, nameOption);
+                } else {
+                    final String defaultValue = a.getDefaultValue();
+                    if (defaultValue != null && !defaultValue.isEmpty()) {
+                        sb.append("         <para>Default: ").append(defaultValue).append("</para>").append(EOL);
+                    }
+
+                    // If there is a supplement to the description for this argument,
+                    // then for now it is already formatted in DocBook XML.
+                    final LocalizableMessage aDocDescriptionSupplement = a.getDocDescriptionSupplement();
+                    if (!LocalizableMessage.EMPTY.equals(aDocDescriptionSupplement)) {
+                        sb.append(aDocDescriptionSupplement.toString()).append(EOL);
+                    }
                 }
                 sb.append("       </listitem>").append(EOL);
                 sb.append("     </varlistentry>").append(EOL);

--
Gitblit v1.10.0