summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java23
-rw-r--r--validation/src/test/java/org/onap/cli/validation/OnapCliMainTest.java9
2 files changed, 19 insertions, 13 deletions
diff --git a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
index 2404a899..939c753a 100644
--- a/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
+++ b/framework/src/main/java/org/onap/cli/fw/utils/OnapCommandUtils.java
@@ -1101,15 +1101,15 @@ public class OnapCommandUtils {
if (param.getShortOption() != null || param.getLongOption() != null) {
optFirstCol = OnapCommandParameter.printShortOption(param.getShortOption()) + " | "
+ OnapCommandParameter.printLongOption(param.getLongOption());
- commandOptions += "[" + optFirstCol + "] ";
+ commandOptions += " [" + optFirstCol + "]";
} else {
optFirstCol = param.getName();
- commandOptions += "<" + optFirstCol + "> ";
+ commandOptions += " <" + optFirstCol + ">";
}
newLineOptions++;
- attrName.getValues().add(optFirstCol);
+ attrName.getValues().add(" " + optFirstCol);
// Second column description
String optSecondCol = param.getDescription().trim();
@@ -1142,7 +1142,7 @@ public class OnapCommandUtils {
}
try {
- help += "\n\nOptions:\n" + commandOptions + "\nwhere,\n" + paramTable.print();
+ help += "\n\nOptions::\n\n" + commandOptions + "\n\nwhere::\n\n" + paramTable.print();
} catch (OnapCommandException e) {
throw new OnapCommandHelpFailed(e);
}
@@ -1156,7 +1156,7 @@ public class OnapCommandUtils {
for (OnapCommandResultAttribute attr : cmd.getResult().getRecords()) {
OnapCommandResultAttribute attrHelp = new OnapCommandResultAttribute();
- attrHelp.setName(attr.getName());
+ attrHelp.setName(" " + attr.getName());
attrHelp.setDescription(attr.getDescription());
String msg = attr.getDescription() + " and is of type " + attr.getType().name() + ".";
if (attr.isSecured()) {
@@ -1166,14 +1166,17 @@ public class OnapCommandUtils {
attrHelp.setType(attr.getType());
resultTable.getRecords().add(attrHelp);
}
- try {
- help += "\n\nResults:\n" + resultTable.print();
- } catch (OnapCommandException e) {
- throw new OnapCommandHelpFailed(e);
+
+ if (cmd.getResult().getRecords().size() > 0) {
+ try {
+ help += "\n\nResults::\n\n" + resultTable.print();
+ } catch (OnapCommandException e) {
+ throw new OnapCommandHelpFailed(e);
+ }
}
// Error
- help += "\n\nError:\nOn error, it prints <HTTP STATUS CODE>::<ERROR CODE>::<ERROR MESSAGE>\n";
+ help += "\n\nError::\n\n On error, it prints <HTTP STATUS CODE>::<ERROR CODE>::<ERROR MESSAGE>\n";
return help;
}
diff --git a/validation/src/test/java/org/onap/cli/validation/OnapCliMainTest.java b/validation/src/test/java/org/onap/cli/validation/OnapCliMainTest.java
index f89e265d..836505d7 100644
--- a/validation/src/test/java/org/onap/cli/validation/OnapCliMainTest.java
+++ b/validation/src/test/java/org/onap/cli/validation/OnapCliMainTest.java
@@ -60,14 +60,17 @@ public class OnapCliMainTest {
}
@Test
- public void commandHelpTest() throws OnapCommandException {
+ public void usageReadTheDocsTest() throws OnapCommandException {
for (String version: OnapCommandRegistrar.getRegistrar().getAvailableProductVersions()) {
OnapCommandRegistrar.getRegistrar().setEnabledProductVersion(version);
+ System.out.println(version);
+ System.out.println("==========================\n\n");
for (ExternalSchema sch : OnapCommandRegistrar.getRegistrar().listCommandInfo()) {
if (sch.getCmdVersion().equals(version)) {
- System.out.println(
- "************************* help '" + sch.getCmdName() + "' *******************************");
+ System.out.println(sch.getCmdName());
+ System.out.println("-----------------------------------------------\n\n");
this.handle(new String[] { sch.getCmdName(), "-h"});
+ System.out.println("\n");
}
}
}