diff options
Diffstat (limited to 'main')
-rw-r--r-- | main/src/main/java/org/onap/cli/main/OnapCli.java | 10 | ||||
-rw-r--r-- | main/src/main/java/org/onap/cli/main/conf/OnapCliConstants.java | 1 |
2 files changed, 10 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 ac63fdfa..b52d89d7 100644 --- a/main/src/main/java/org/onap/cli/main/OnapCli.java +++ b/main/src/main/java/org/onap/cli/main/OnapCli.java @@ -151,7 +151,14 @@ public class OnapCli { } catch (OnapCommandException e) { this.print(e); } + } 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.size() == 1 && args.get(0).trim().isEmpty()) { + //Ignore blanks // NOSONAR + continue; + } handleCommand(); } } @@ -187,7 +194,8 @@ public class OnapCli { strCompleter.add(OnapCliConstants.PARAM_INTERACTIVE_EXIT, OnapCliConstants.PARAM_INTERACTIVE_CLEAR, OnapCliConstants.PARAM_INTERACTIVE_USE, - OnapCliConstants.PARAM_INTERACTIVE_HELP); + OnapCliConstants.PARAM_INTERACTIVE_HELP, + OnapCliConstants.PARAM_INTERACTIVE_VERSION); 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 d01aa1e5..dfb20c96 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 @@ -33,6 +33,7 @@ public final class OnapCliConstants { public static final String PARAM_INTERACTIVE_CLEAR = "clear"; public static final String PARAM_INTERACTIVE_USE = "use"; public static final String PARAM_INTERACTIVE_HELP = "help"; + public static final String PARAM_INTERACTIVE_VERSION = "version"; public static final String PARAM_INTERACTIVE_ARG_SPLIT_PATTERN = "\\s+"; private OnapCliConstants(){} |