summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--main/src/main/java/org/onap/cli/main/OnapCli.java14
-rw-r--r--main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java3
2 files changed, 16 insertions, 1 deletions
diff --git a/main/src/main/java/org/onap/cli/main/OnapCli.java b/main/src/main/java/org/onap/cli/main/OnapCli.java
index 71d9cf77..8a4ebeb1 100644
--- a/main/src/main/java/org/onap/cli/main/OnapCli.java
+++ b/main/src/main/java/org/onap/cli/main/OnapCli.java
@@ -175,6 +175,8 @@ public class OnapCli {
attr.getValues().add(OnapCliConstants.PARAM_INTERACTIVE_HELP);
attrDesc.getValues().add(OnapCliConstants.PARAM_INTERACTIVE_HELP_MSG);
+ attr.getValues().add(OnapCliConstants.PARAM_INTERACTIVE_PROFILE);
+ attrDesc.getValues().add(OnapCliConstants.PARAM_INTERACTIVE_PROFILE_MSG);
try {
return "\n\nDirectives:\n" + help.print();
} catch (OnapCommandException e) {
@@ -224,6 +226,15 @@ public class OnapCli {
} else if (!args.isEmpty() && this.args.get(0).equals(OnapCliConstants.PARAM_INTERACTIVE_VERSION)) {
this.args = Arrays.asList(new String [] {this.getLongOption(OnapCliConstants.PARAM_VERSION_LONG)});
handleVersion();
+ } else if (!args.isEmpty() && this.args.get(0).equals(OnapCliConstants.PARAM_INTERACTIVE_PROFILE)) {
+ if (args.size() == 1) {
+ this.print("Please use it in the form of 'profile <profile-name>'");
+ } else {
+ this.args = Arrays.asList(new String [] {
+ this.getLongOption(OnapCliConstants.PARAM_PROFILE_LONG),
+ this.args.get(1)});
+ handleProfile();
+ }
} else if (!args.isEmpty() && this.args.get(0).equals(OnapCliConstants.PARAM_INTERACTIVE_SET)) {
if (args.size() > 1) {
String [] paramEntry = args.get(1).trim().split("=");
@@ -285,7 +296,8 @@ public class OnapCli {
OnapCliConstants.PARAM_INTERACTIVE_HELP,
OnapCliConstants.PARAM_INTERACTIVE_VERSION,
OnapCliConstants.PARAM_INTERACTIVE_SET,
- OnapCliConstants.PARAM_INTERACTIVE_UNSET);
+ OnapCliConstants.PARAM_INTERACTIVE_UNSET,
+ OnapCliConstants.PARAM_INTERACTIVE_PROFILE);
console.addCompleter(strCompleter);
console.setPrompt(OnapCliConstants.PARAM_INTERACTIVE_PROMPT);
} catch (OnapCommandException e) { // NOSONAR
diff --git a/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java b/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java
index 337cd41c..d28b9849 100644
--- a/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java
+++ b/main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java
@@ -45,6 +45,9 @@ public final class OnapCliConstants {
public static final String PARAM_INTERACTIVE_SET_MSG = "To set the parameter values. Once its set, will be available for all commands in current session.";
public static final String PARAM_INTERACTIVE_UNSET = "unset";
public static final String PARAM_INTERACTIVE_UNSET_MSG = "To unset the parameter value in current session.";
+ public static final String PARAM_INTERACTIVE_PROFILE = "profile";
+ public static final String PARAM_INTERACTIVE_PROFILE_MSG = "Start profiling current settings made of use, set.";
+
public static final String PARAM_INTERACTIVE_ARG_SPLIT_PATTERN = "\\s+";
private OnapCliConstants(){}