From b2aecb495242d055dca4109ff9f6889507af7f72 Mon Sep 17 00:00:00 2001
From: lutoff <lutoff@localhost>
Date: Mon, 23 Apr 2007 07:06:28 +0000
Subject: [PATCH] Fix for Issue 1427 (CLIs should handled both -? and -H for help)
---
opends/src/statuspanel/org/opends/statuspanel/StatusCli.java | 14 ++++++++------
opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties | 6 +++---
opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java | 15 ++++++++++++---
opends/src/server/org/opends/server/util/args/ArgumentParser.java | 15 +++++++++++++++
opends/src/statuspanel/org/opends/statuspanel/resources/Resources.properties | 4 ++--
5 files changed, 40 insertions(+), 14 deletions(-)
diff --git a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
index bf03e38..1d5041b 100644
--- a/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
+++ b/opends/src/quicksetup/org/opends/quicksetup/resources/Resources.properties
@@ -35,7 +35,7 @@
Server.\n\Usage: {0} {options}\n where {options} include:\n\
--cli\n\ Specifies to use the command line setup. If not specified the \
graphical\n\ interface will be launched.\n\
--H , --help\n Display this usage information.\n\n\
+-?, -H , --help\n Display this usage information.\n\n\
The following options will only be taken into account if the option --cli \n\
(command line) is specified\n\
-s, --silentInstall\n Perform a silent installation.\n\
@@ -68,7 +68,7 @@
Server.\n\Usage: {0} {options}\n where {options} include:\n\
--cli\n\ Specifies to use the command line setup. If not specified the \
graphical\n\ interface will be launched.\n\
--H, --help\n Display this usage information.\n\n\
+-?, -H, --help\n Display this usage information.\n\n\
The following options will only be taken into account if the option --cli \n\
(command line) is specified\n\
-s, -silentInstall\n Perform a silent installation.\n\
@@ -111,7 +111,7 @@
Usage: {0} {options}\n where {options} include:\n\
--cli\n\ Specifies to use the command line uninstall. If not specified the \
graphical\n\ interface will be launched.\n\
--H, --help\n Display this usage information.\n\n\
+-?, -H, --help\n Display this usage information.\n\n\
The following options will only be taken into account if the option --cli \n\
(command line) is specified\n\
-s, --silentUninstall\n Perform a silent uninstall.
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 86289e7..b51bb73 100644
--- a/opends/src/server/org/opends/server/util/args/ArgumentParser.java
+++ b/opends/src/server/org/opends/server/util/args/ArgumentParser.java
@@ -1025,6 +1025,11 @@
{
int currentLength = buffer.length();
+ if (usageArgument.getName().equals(a.getName()))
+ {
+ buffer.append("-?, ");
+ }
+
buffer.append("-");
buffer.append(shortID.charValue());
@@ -1065,6 +1070,10 @@
{
if (longID != null)
{
+ if (usageArgument.getName().equals(a.getName()))
+ {
+ buffer.append("-?, ");
+ }
buffer.append("--");
buffer.append(longID);
@@ -1133,6 +1142,12 @@
}
}
}
+ if (usageArgument == null)
+ {
+ buffer.append(EOL);
+ buffer.append("-?");
+ buffer.append(EOL);
+ }
}
diff --git a/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java b/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
index 0ee9279..8f3e675 100644
--- a/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
+++ b/opends/src/statuspanel/org/opends/statuspanel/StatusCli.java
@@ -30,6 +30,7 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
+import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator;
@@ -132,7 +133,8 @@
for (int i=0; i<args.length; i++)
{
if (args[i].equalsIgnoreCase("-H") ||
- args[i].equalsIgnoreCase("--help"))
+ args[i].equalsIgnoreCase("--help") ||
+ args[i].equalsIgnoreCase("-?"))
{
printUsage = true;
}
@@ -224,14 +226,14 @@
if (printUsage)
{
- printUsage();
+ printUsage(System.out);
}
else if (errors.size() > 0)
{
System.err.println(Utils.getStringFromCollection(errors,
LINE_SEPARATOR+LINE_SEPARATOR));
- System.out.println();
- printUsage();
+ System.err.println();
+ printUsage(System.err);
returnValue = USER_DATA_ERROR;
}
else
@@ -334,7 +336,7 @@
return ResourceProvider.getInstance();
}
- private void printUsage()
+ private void printUsage(PrintStream stream)
{
String arg;
if (Utils.isWindows())
@@ -350,7 +352,7 @@
*/
String msg = getMsg("status-cli-usage", true);
msg = msg.replace("{0}", arg);
- System.err.println(msg);
+ stream.println(msg);
}
private ServerStatusDescriptor createServerStatusDescriptor(String dn,
diff --git a/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java b/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
index d94456c..5da9c76 100644
--- a/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
+++ b/opends/src/statuspanel/org/opends/statuspanel/StatusPanelLauncher.java
@@ -51,9 +51,18 @@
{
printUsage = true;
}
+ for (int i=0; i<args.length; i++)
+ {
+ if (args[i].equalsIgnoreCase("-H") ||
+ args[i].equalsIgnoreCase("--help") ||
+ args[i].equalsIgnoreCase("-?"))
+ {
+ printUsage = true;
+ }
+ }
if (printUsage)
{
- printUsage();
+ printUsage(System.out);
System.exit(1);
} else
@@ -116,7 +125,7 @@
return returnValue[0];
}
- private static void printUsage()
+ private static void printUsage(PrintStream stream)
{
String arg;
if (Utils.isWindows())
@@ -132,7 +141,7 @@
*/
String msg = getMsg("status-panel-launcher-usage");
msg = msg.replace("{0}", arg);
- System.err.println(msg);
+ stream.println(msg);
}
/**
diff --git a/opends/src/statuspanel/org/opends/statuspanel/resources/Resources.properties b/opends/src/statuspanel/org/opends/statuspanel/resources/Resources.properties
index ef8ad05..25eccf5 100644
--- a/opends/src/statuspanel/org/opends/statuspanel/resources/Resources.properties
+++ b/opends/src/statuspanel/org/opends/statuspanel/resources/Resources.properties
@@ -35,7 +35,7 @@
which displays basic server information and will allow you to start, stop and \
restart the server.\n\
Usage: {0} {options}\n where {options} include:\n\
--H, --help\n Display this usage information.
+-?, -H, --help\n Display this usage information.
status-panel-launcher-gui-launch-failed=Could not launch Status Panel. Check \
that you have access to the display.
@@ -175,7 +175,7 @@
-w {bindPassword}, --bindPassword {bindPassword}\n Bind password\n\
-j {bindPasswordFile}, --bindPasswordFile {bindPasswordFile}\n Bind \
password file\n\
--H , --help\n Display this usage information.
+-?, -H , --help\n Display this usage information.
not-available-authentication-required-cli-label=<not available> (*)
not-available-authentication-required-cli-legend=* Information only available \
if you provide authentication information when launching the status \
--
Gitblit v1.10.0