From 7d7590eeec89384877a3074092b49b16f60fccb8 Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 20 Apr 2015 14:22:45 +0000
Subject: [PATCH] OPENDJ-1955 dsconfig --displayCommand does not display the complete equivalent command
---
opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
index ce62c6c..21c48c8 100644
--- a/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
+++ b/opendj-config/src/main/java/org/forgerock/opendj/config/dsconfig/DSConfig.java
@@ -1311,29 +1311,32 @@
* Updates the command builder with the global options: script friendly, verbose, etc. for a given sub command. It
* also adds systematically the no-prompt option.
*
- * @param <T>
- * SubCommand type.
* @param subCommand
* The sub command handler or common.
* @return <T> The builded command.
*/
- <T> CommandBuilder getCommandBuilder(final T subCommand) {
+ CommandBuilder getCommandBuilder(final Object subCommand) {
final String commandName = getScriptName();
+ final SubCommandHandler handler;
final String subCommandName;
if (subCommand instanceof SubCommandHandler) {
- subCommandName = ((SubCommandHandler) subCommand).getSubCommand().getName();
+ handler = (SubCommandHandler) subCommand;
+ subCommandName = handler.getSubCommand().getName();
} else {
+ handler = null;
subCommandName = (String) subCommand;
}
+
final CommandBuilder commandBuilder = new CommandBuilder(commandName, subCommandName);
+ if (handler != null) {
+ commandBuilder.append(handler.getCommandBuilder());
+ }
if (factory != null && factory.getContextCommandBuilder() != null) {
commandBuilder.append(factory.getContextCommandBuilder());
}
-
if (verboseArgument.isPresent()) {
commandBuilder.addArgument(verboseArgument);
}
-
if (scriptFriendlyArgument.isPresent()) {
commandBuilder.addArgument(scriptFriendlyArgument);
}
@@ -1343,7 +1346,6 @@
if (propertiesFileArgument.isPresent()) {
commandBuilder.addArgument(propertiesFileArgument);
}
-
if (noPropertiesFileArgument.isPresent()) {
commandBuilder.addArgument(noPropertiesFileArgument);
}
--
Gitblit v1.10.0