From 393249210669ee74243e155f33d37055efe35c18 Mon Sep 17 00:00:00 2001
From: Mark Craig <mark.craig@forgerock.com>
Date: Wed, 08 Apr 2015 07:08:08 +0000
Subject: [PATCH] CR-6580 OPENDJ-1796 Use static hostname in reference docs

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

diff --git a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
index 5e69c18..98d2da7 100644
--- a/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
+++ b/opendj-cli/src/main/java/com/forgerock/opendj/cli/ArgumentParser.java
@@ -816,6 +816,12 @@
                     continue;
                 }
 
+                // Return a generic FQDN for localhost as the default hostname
+                // in reference documentation.
+                if (isHostNameArgument(a)) {
+                    a.setDefaultValue("localhost.localdomain");
+                }
+
                 // The help argument should be added at the end.
                 if (isUsageArgument(a)) {
                     helpArgument = a;
@@ -845,6 +851,21 @@
     }
 
     /**
+     * Returns true if this argument is for setting a hostname.
+     * @param a The argument.
+     * @return true if this argument is for setting a hostname.
+     */
+    boolean isHostNameArgument(final Argument a) {
+        final String name = a.getName();
+        return name.equalsIgnoreCase(OPTION_LONG_HOST)
+                || name.equalsIgnoreCase(OPTION_LONG_REFERENCED_HOST_NAME)
+                || name.equalsIgnoreCase("host1")
+                || name.equalsIgnoreCase("host2")
+                || name.equalsIgnoreCase("hostSource")
+                || name.equalsIgnoreCase("hostDestination");
+    }
+
+    /**
      * Returns a map containing information about an argument option.
      * @param   a   The argument
      * @return      A map containing information about an argument option

--
Gitblit v1.10.0