From 184ed890c828220c114f60ee165ce2230ada3d7c Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Tue, 15 May 2007 08:10:13 +0000
Subject: [PATCH] issue 1430 fix (all utilities should provide as standard option -V/--version) to specify the LDAP protocol version number, we should use now      -V/--ldapVersion  to get the 'product' version    --version

---
 opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java b/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
index 83ac61e..2f0f862 100644
--- a/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
+++ b/opends/src/server/org/opends/server/util/args/SubCommandArgumentParser.java
@@ -35,10 +35,13 @@
 import java.util.LinkedList;
 import java.util.Properties;
 
+import org.opends.server.core.DirectoryServer;
+
 import static org.opends.server.messages.MessageHandler.*;
 import static org.opends.server.messages.UtilityMessages.*;
 import static org.opends.server.util.ServerConstants.*;
 import static org.opends.server.util.StaticUtils.*;
+import static org.opends.server.tools.ToolConstants.*;
 
 
 
@@ -714,6 +717,18 @@
               return;
             }
             else
+            if (argName.equals(OPTION_LONG_PRODUCT_VERSION))
+            {
+              // "--version" will always be interpreted as requesting usage
+              // information.
+              try
+              {
+                DirectoryServer.printVersion(usageOutputStream);
+              } catch (Exception e) {}
+
+              return;
+            }
+            else
             {
               // There is no such global argument.
               int msgID = MSGID_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_LONG_ID;
@@ -738,6 +753,18 @@
                 return;
               }
               else
+              if (argName.equals(OPTION_LONG_PRODUCT_VERSION))
+              {
+                // "--version" will always be interpreted as requesting usage
+                // information.
+                try
+                {
+                  DirectoryServer.printVersion(usageOutputStream);
+                } catch (Exception e) {}
+
+                return;
+              }
+              else
               {
                 // There is no such global or subcommand argument.
                 int    msgID   = MSGID_SUBCMDPARSER_NO_ARGUMENT_FOR_LONG_ID;
@@ -853,6 +880,17 @@
               return;
             }
             else
+            if (argCharacter == OPTION_SHORT_PRODUCT_VERSION)
+            {
+              // "-V" will always be interpreted as requesting
+              // version information.
+              try
+                {
+                getUsage(usageOutputStream);
+              } catch (Exception e) {}
+              return;
+            }
+            else
             {
               // There is no such argument registered.
               int msgID = MSGID_SUBCMDPARSER_NO_GLOBAL_ARGUMENT_FOR_SHORT_ID;
@@ -876,6 +914,17 @@
                 return;
               }
               else
+              if (argCharacter == OPTION_SHORT_PRODUCT_VERSION)
+              {
+                // "-V" will always be interpreted as requesting
+                // version information.
+                try
+                {
+                  getUsage(usageOutputStream);
+                } catch (Exception e) {}
+                return;
+              }
+              else
               {
                 // There is no such argument registered.
                 int    msgID   = MSGID_SUBCMDPARSER_NO_ARGUMENT_FOR_SHORT_ID;

--
Gitblit v1.10.0