Add state info in help message 75/38875/1
authorKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 27 Mar 2018 06:10:22 +0000 (11:40 +0530)
committerKanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
Tue, 27 Mar 2018 06:10:22 +0000 (11:40 +0530)
Issue-ID: CLI-78

Change-Id: Ie79342fc3fc5322ca9b1a6517b03c8d7bf03dd81
Signed-off-by: Kanagaraj Manickam k00365106 <kanagaraj.manickam@huawei.com>
framework/src/main/java/org/onap/cli/fw/registrar/OnapCommandRegistrar.java

index bd7977b..34dc6b6 100644 (file)
@@ -366,13 +366,22 @@ public class OnapCommandRegistrar {
         attrSrv.setScope(OnapCommandResultAttributeScope.SHORT);
         help.getRecords().add(attrSrv);
 
+        OnapCommandResultAttribute attrState = new OnapCommandResultAttribute();
+        attrState.setName(OnapCommandConstants.INFO_STATE.toUpperCase());
+        attrState.setDescription(OnapCommandConstants.INFO_STATE);
+        attrState.setScope(OnapCommandResultAttributeScope.SHORT);
+        help.getRecords().add(attrState);
+
+
         OnapCommandResultAttribute attrDesc = new OnapCommandResultAttribute();
         attrDesc.setName(OnapCommandConstants.DESCRIPTION.toUpperCase());
         attrDesc.setDescription(OnapCommandConstants.DESCRIPTION);
         attrDesc.setScope(OnapCommandResultAttributeScope.SHORT);
         help.getRecords().add(attrDesc);
 
-        for (String cmdName : isEnabledProductVersionOnly ? OnapCommandUtils.sort(this.listCommandsForEnabledProductVersion()) : OnapCommandUtils.sort(this.listCommands())) {
+        for (String cmdName : isEnabledProductVersionOnly ?
+                OnapCommandUtils.sort(this.listCommandsForEnabledProductVersion()) :
+                    OnapCommandUtils.sort(this.listCommands())) {
             OnapCommand cmd;
             try {
                 if (!isEnabledProductVersionOnly) {
@@ -387,6 +396,7 @@ public class OnapCommandRegistrar {
 
                 attrSrv.getValues().add(cmd.getInfo().getService());
                 attrDesc.getValues().add(cmd.getDescription());
+                attrState.getValues().add(cmd.getInfo().getState().name());
             } catch (OnapCommandException e) {
                 throw new OnapCommandHelpFailed(e);
             }