From 5eb6573e3292d012f0490a55f4957009372c476c Mon Sep 17 00:00:00 2001
From: jvergara <jvergara@localhost>
Date: Mon, 03 Mar 2008 17:58:08 +0000
Subject: [PATCH] Fix for issue 2809 (Missing option -V in cli usage)
---
opends/src/messages/messages/core.properties | 2 --
opends/src/server/org/opends/server/util/args/ArgumentParser.java | 28 +++++++++++++++++++++++++---
2 files changed, 25 insertions(+), 5 deletions(-)
diff --git a/opends/src/messages/messages/core.properties b/opends/src/messages/messages/core.properties
index 5f52ab8..86ca354 100644
--- a/opends/src/messages/messages/core.properties
+++ b/opends/src/messages/messages/core.properties
@@ -587,8 +587,6 @@
INFO_DSCORE_DESCRIPTION_CONFIG_FILE_282=Path to the file \
containing the information needed by the configuration handler to obtain the \
Directory Server configuration
-INFO_DSCORE_DESCRIPTION_VERSION_283=Display Directory Server version \
- information
INFO_DSCORE_DESCRIPTION_FULLVERSION_284=Display extended Directory Server \
version information
INFO_DSCORE_DESCRIPTION_SYSINFO_285=Display general system information
diff --git a/opends/src/server/org/opends/server/util/args/ArgumentParser.java b/opends/src/server/org/opends/server/util/args/ArgumentParser.java
index 4953a33..9b86d2d 100644
--- a/opends/src/server/org/opends/server/util/args/ArgumentParser.java
+++ b/opends/src/server/org/opends/server/util/args/ArgumentParser.java
@@ -79,6 +79,10 @@
// The argument that will be used to trigger the display of usage information.
private Argument usageArgument;
+ // The argument that will be used to trigger the display of the OpenDS
+ // version.
+ private Argument versionArgument;
+
// The set of unnamed trailing arguments that were provided for this parser.
private ArrayList<String> trailingArguments;
@@ -610,6 +614,24 @@
throw new ArgumentException(message);
}
+ if (versionArgument != null)
+ {
+ if (shortID == versionArgument.getShortIdentifier())
+ {
+ // Update the version argument to not display its short identifier.
+ try {
+ versionArgument = new BooleanArgument(
+ OPTION_LONG_PRODUCT_VERSION,
+ null,
+ OPTION_LONG_PRODUCT_VERSION,
+ INFO_DESCRIPTION_PRODUCT_VERSION.get());
+ this.generalArgGroup.addArgument(versionArgument);
+ } catch (ArgumentException e) {
+ // ignore
+ }
+ }
+ }
+
String longID = argument.getLongIdentifier();
if (longID != null)
{
@@ -1700,12 +1722,12 @@
this.argumentGroups.add(ioArgGroup);
try {
- Argument version = new BooleanArgument(
+ versionArgument = new BooleanArgument(
OPTION_LONG_PRODUCT_VERSION,
- null,
+ OPTION_SHORT_PRODUCT_VERSION,
OPTION_LONG_PRODUCT_VERSION,
INFO_DESCRIPTION_PRODUCT_VERSION.get());
- this.generalArgGroup.addArgument(version);
+ this.generalArgGroup.addArgument(versionArgument);
} catch (ArgumentException e) {
// ignore
}
--
Gitblit v1.10.0