8157185: jshell tool: ambiguous format -- distinguished arguments should be options
authorrfield
Wed, 18 May 2016 11:35:10 -0700
changeset 38520 17e72b872ffd
parent 38519 d70d50ec27bb
child 38521 f2fe39ab9256
8157185: jshell tool: ambiguous format -- distinguished arguments should be options Reviewed-by: vromero
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java
langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties
langtools/test/jdk/jshell/CommandCompletionTest.java
langtools/test/jdk/jshell/ToolBasicTest.java
langtools/test/jdk/jshell/ToolFormatTest.java
langtools/test/jdk/jshell/ToolLocaleMessageTest.java
langtools/test/jdk/jshell/ToolReloadTest.java
langtools/test/jdk/jshell/ToolSimpleTest.java
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/Feedback.java	Wed May 18 11:35:10 2016 -0700
@@ -600,7 +600,7 @@
             return valid;
         }
 
-        // For /set newmode <new-mode> [command|quiet [<old-mode>]]
+        // For /set newmode <new-mode> [-command|-quiet [<old-mode>]]
         boolean setNewMode() {
             String umode = at.next();
             if (umode == null) {
@@ -611,8 +611,8 @@
                 errorat("jshell.err.feedback.expected.mode.name", umode);
                 valid = false;
             }
-            String[] fluffOpt = at.next("command", "quiet");
-            boolean fluff = fluffOpt == null || fluffOpt.length != 1 || "command".equals(fluffOpt[0]);
+            String[] fluffOpt = at.next("-command", "-quiet");
+            boolean fluff = fluffOpt == null || fluffOpt.length != 1 || "-command".equals(fluffOpt[0]);
             if (fluffOpt != null && fluffOpt.length != 1) {
                 errorat("jshell.err.feedback.command.quiet");
                 valid = false;
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/JShellTool.java	Wed May 18 11:35:10 2016 -0700
@@ -113,7 +113,7 @@
     private static final String LINE_SEP = System.getProperty("line.separator");
     private static final Pattern LINEBREAK = Pattern.compile("\\R");
     private static final Pattern HISTORY_ALL_START_FILENAME = Pattern.compile(
-            "((?<cmd>(all|history|start))(\\z|\\p{javaWhitespace}+))?(?<filename>.*)");
+            "((?<cmd>(-all|-history|-start))(\\z|\\p{javaWhitespace}+))?(?<filename>.*)");
     private static final String RECORD_SEPARATOR = "\u241E";
     private static final String RB_NAME_PREFIX  = "jdk.internal.jshell.tool.resources";
     private static final String VERSION_RB_NAME = RB_NAME_PREFIX + ".version";
@@ -879,8 +879,8 @@
     }
 
     private static final CompletionProvider EMPTY_COMPLETION_PROVIDER = new FixedCompletionProvider();
-    private static final CompletionProvider KEYWORD_COMPLETION_PROVIDER = new FixedCompletionProvider("all ", "start ", "history ");
-    private static final CompletionProvider RELOAD_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider("restore", "quiet");
+    private static final CompletionProvider KEYWORD_COMPLETION_PROVIDER = new FixedCompletionProvider("-all ", "-start ", "-history ");
+    private static final CompletionProvider RELOAD_OPTIONS_COMPLETION_PROVIDER = new FixedCompletionProvider("-restore", "-quiet");
     private static final CompletionProvider FILE_COMPLETION_PROVIDER = fileCompletions(p -> true);
     private final Map<String, Command> commands = new LinkedHashMap<>();
     private void registerCommand(Command cmd) {
@@ -1389,7 +1389,7 @@
      *
      * @param snippets the base list of possible snippets
      * @param arg the user's argument to the command, maybe be the empty string
-     * @param allowAll if true, allow the use of 'all' and 'start'
+     * @param allowAll if true, allow the use of '-all' and '-start'
      * @return a Stream of referenced snippets or null if no matches to specific arg
      */
     private <T extends Snippet> Stream<T> argToSnippets(List<T> snippets, String arg, boolean allowAll) {
@@ -1403,15 +1403,15 @@
      * @param snippets the base list of possible snippets
      * @param defFilter the filter to apply to the arguments if no argument
      * @param arg the user's argument to the command, maybe be the empty string
-     * @param allowAll if true, allow the use of 'all' and 'start'
+     * @param allowAll if true, allow the use of '-all' and '-start'
      * @return a Stream of referenced snippets or null if no matches to specific arg
      */
     private <T extends Snippet> Stream<T> argToSnippets(List<T> snippets,
             Predicate<Snippet> defFilter, String arg, boolean allowAll) {
-        if (allowAll && arg.equals("all")) {
+        if (allowAll && arg.equals("-all")) {
             // all snippets including start-up, failed, and overwritten
             return snippets.stream();
-        } else if (allowAll && arg.equals("start")) {
+        } else if (allowAll && arg.equals("-start")) {
             // start-up snippets
             return snippets.stream()
                     .filter(this::inStartUp);
@@ -1436,8 +1436,8 @@
 
     /**
      * Convert a user argument to a Stream of snippets referenced by that
-     * argument, printing an informative message if no matches. Allow 'all' and
-     * 'start'.
+     * argument, printing an informative message if no matches. Allow '-all' and
+     * '-start'.
      *
      * @param snippets the base list of possible snippets
      * @param defFilter the filter to apply to the arguments if no argument
@@ -1595,7 +1595,7 @@
     }
 
     private boolean cmdList(String arg) {
-        if (arg.equals("history")) {
+        if (arg.equals("-history")) {
             return cmdHistory();
         }
         Stream<Snippet> stream = argToSnippetsWithMessage(state.snippets(),
@@ -1672,13 +1672,13 @@
         Iterable<String> history = replayableHistory;
         boolean echo = true;
         if (arg.length() > 0) {
-            if ("restore".startsWith(arg)) {
+            if ("-restore".startsWith(arg)) {
                 if (replayableHistoryPrevious == null) {
                     errormsg("jshell.err.reload.no.previous");
                     return false;
                 }
                 history = replayableHistoryPrevious;
-            } else if ("quiet".startsWith(arg)) {
+            } else if ("-quiet".startsWith(arg)) {
                 echo = false;
             } else {
                 errormsg("jshell.err.arg", "/reload", arg);
@@ -1705,13 +1705,13 @@
         boolean saveStart = false;
         String cmd = mat.group("cmd");
         if (cmd != null) switch (cmd) {
-            case "all":
-                saveAll = "all";
+            case "-all":
+                saveAll = "-all";
                 break;
-            case "history":
+            case "-history":
                 useHistory = true;
                 break;
-            case "start":
+            case "-start":
                 saveStart = true;
                 break;
         }
--- a/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/resources/l10n.properties	Wed May 18 11:35:10 2016 -0700
@@ -34,7 +34,7 @@
 
 jshell.msg.terminated =\
 State engine terminated.\n\
-Restore definitions with: /reload restore
+Restore definitions with: /reload -restore
 
 jshell.msg.use.one.of = Use one of: {0}
 jshell.err.def.or.id.not.found = No applicable definition or id found named: {0}
@@ -102,7 +102,7 @@
 
 jshell.err.feedback.expected.new.feedback.mode = Expected new feedback mode -- {0}
 jshell.err.feedback.expected.mode.name = Expected a new feedback mode name. ''{0}'' is a known feedback mode -- {1}
-jshell.err.feedback.command.quiet = Specify either ''command'' or ''quiet'' -- {0}
+jshell.err.feedback.command.quiet = Specify either ''-command'' or ''-quiet'' -- {0}
 jshell.err.feedback.expected.field = Expected field name missing -- {0}
 jshell.err.feedback.expected.mode = Expected a feedback mode -- {0}
 jshell.err.feedback.does.not.match.mode = Does not match any current feedback mode: {0} -- {1}
@@ -151,15 +151,15 @@
 \    -version             Version information\n
 
 help.list.summary = list the source you have typed
-help.list.args = [<name or id>|all|start]
+help.list.args = [<name or id>|-all|-start]
 help.list =\
 Show the source of snippets, prefaced with the snippet id.\n\
 \n\
 /list\n\t\
     List the currently active snippets of code that you typed or read with /open\n\n\
-/list start\n\t\
+/list -start\n\t\
     List the automatically evaluated start-up snippets\n\n\
-/list all\n\t\
+/list -all\n\t\
     List all snippets including failed, overwritten, dropped, and start-up\n\n\
 /list <name>\n\t\
     List snippets with the specified name (preference for active snippets)\n\n\
@@ -191,18 +191,18 @@
     Drop the snippet with the specified snippet id
 
 help.save.summary = Save snippet source to a file.
-help.save.args = [all|history|start] <file>
+help.save.args = [-all|-history|-start] <file>
 help.save =\
 Save the specified snippets and/or commands to the specified file.\n\
 \n\
 /save <file>\n\t\
     Save the source of current active snippets to the file.\n\n\
-/save all <file>\n\t\
+/save -all <file>\n\t\
     Save the source of all snippets to the file.\n\t\
     Includes source including overwritten, failed, and start-up code.\n\n\
-/save history <file>\n\t\
+/save -history <file>\n\t\
     Save the sequential history of all commands and snippets entered since jshell was launched.\n\n\
-/save start <file>\n\t\
+/save -start <file>\n\t\
     Save the default start-up definitions to the file.
 
 help.open.summary = open a file as source input
@@ -214,7 +214,7 @@
     Read the specified file as jshell input.
 
 help.vars.summary = list the declared variables and their values
-help.vars.args = [<name or id>|all|start]
+help.vars.args = [<name or id>|-all|-start]
 help.vars =\
 List the type, name, and value of jshell variables.\n\
 \n\
@@ -224,13 +224,13 @@
     List jshell variables with the specified name (preference for active variables)\n\n\
 /vars <id>\n\t\
     List the jshell variable with the specified snippet id\n\n\
-/vars start\n\t\
+/vars -start\n\t\
     List the automatically added start-up jshell variables\n\n\
-/vars all\n\t\
+/vars -all\n\t\
     List all jshell variables including failed, overwritten, dropped, and start-up
 
 help.methods.summary = list the declared methods and their signatures
-help.methods.args = [<name or id>|all|start]
+help.methods.args = [<name or id>|-all|-start]
 help.methods =\
 List the name, parameter types, and return type of jshell methods.\n\
 \n\
@@ -240,13 +240,13 @@
     List jshell methods with the specified name (preference for active methods)\n\n\
 /methods <id>\n\t\
     List the jshell method with the specified snippet id\n\n\
-/methods start\n\t\
+/methods -start\n\t\
     List the automatically added start-up jshell methods\n\n\
-/methods all\n\t\
+/methods -all\n\t\
     List all snippets including failed, overwritten, dropped, and start-up
 
 help.types.summary = list the declared types
-help.types.args =[<name or id>|all|start]
+help.types.args =[<name or id>|-all|-start]
 help.types =\
 List jshell classes, interfaces, and enums.\n\
 \n\
@@ -256,9 +256,9 @@
     List jshell types with the specified name (preference for active types)\n\n\
 /types <id>\n\t\
     List the jshell type with the specified snippet id\n\n\
-/types start\n\t\
+/types -start\n\t\
     List the automatically added start-up jshell types\n\n\
-/types all\n\t\
+/types -all\n\t\
     List all jshell types including failed, overwritten, dropped, and start-up
 
 help.imports.summary = list the imported items
@@ -283,8 +283,8 @@
 Tool settings are maintained, as set with: /set ...\n\
 Save any work before using this command
 
-help.reload.summary = reset and replay relevant history -- current or previous (restore)
-help.reload.args = [restore] [quiet]
+help.reload.summary = reset and replay relevant history -- current or previous (-restore)
+help.reload.args = [-restore] [-quiet]
 help.reload =\
 Reset the jshell tool code and execution state then replay each\n\
 jshell valid command and valid snippet in the order they were entered.\n\
@@ -293,13 +293,13 @@
      Reset and replay the valid history since jshell was entered, or\n\t\
      a /reset, or /reload command was executed -- whichever is most\n\t\
      recent.\n\n\
-/reload restore\n\t\
+/reload -restore\n\t\
      Reset and replay the valid history between the previous and most\n\t\
      recent time that jshell was entered, or a /reset, or /reload\n\t\
      command was executed. This can thus be used to restore a previous\n\t\
      jshell tool sesson.\n\n\
-/reload [restore] quiet\n\t\
-     With the 'quiet' argument the replay is not shown.  Errors will display.
+/reload [-restore] -quiet\n\t\
+     With the '-quiet' argument the replay is not shown.  Errors will display.
 
 help.classpath.summary = add a path to the classpath
 help.classpath.args = <path>
@@ -350,7 +350,7 @@
      The contents of the specified <file> become the default start-up snippets and commands.\n\n\
 /set feedback <mode>\n\t\
      Set the feedback mode describing displayed feedback for entered snippets and commands.\n\n\
-/set newmode <new-mode> [command|quiet [<old-mode>]]\n\t\
+/set newmode <new-mode> [-command|-quiet [<old-mode>]]\n\t\
      Create a user-defined feedback mode, optionally copying from an existing mode.\n\n\
 /set prompt <mode> "<prompt>" "<continuation-prompt>"\n\t\
      Set the displayed prompts for a given feedback mode.\n\n\
@@ -544,12 +544,12 @@
 help.set.newmode = \
 Create a user-defined feedback mode, optionally copying from an existing mode.\n\
 \n\t\
-/set newmode <new-mode> [command|quiet [<old-mode>]]\n\
+/set newmode <new-mode> [-command|-quiet [<old-mode>]]\n\
 \n\
 Where <new-mode> is the name of a mode you wish to create.\n\
 Where <old-mode> is the name of a previously defined feedback mode.\n\
 If <old-mode> is present, its settings are copied to the new mode.\n\
-'command' vs 'quiet' determines if informative/verifying command feedback is displayed.\n\
+'-command' vs '-quiet' determines if informative/verifying command feedback is displayed.\n\
 \n\
 Once the new mode is created, use '/set format' and '/set prompt' to configure it.\n\
 Use '/set feedback' to use the new mode.\n\
@@ -583,7 +583,7 @@
 which are run when the jshell tool is started or reset.
 
 startup.feedback = \
-/set newmode verbose command    \n\
+/set newmode verbose -command    \n\
 \n\
 /set prompt verbose '\\njshell> '   '   ...> '    \n\
 \n\
@@ -650,11 +650,11 @@
 /set truncation verbose 80\n\
 /set truncation verbose 500                                                                  varvalue\n\
 \n\
-/set newmode normal command verbose    \n\
+/set newmode normal -command verbose    \n\
 /set format normal display ''                                                               added,modified,replaced,overwrote,dropped-update    \n\
 /set format normal display '{pre}{action} variable {name}, reset to null{post}'             replaced-vardecl,varinit-ok-update    \n\
 /set format normal display '{result}'                                                       added,modified,replaced-expression,varvalue,assignment,varinit,vardecl-ok-primary    \n\
-/set newmode concise quiet normal    \n\
+/set newmode concise -quiet normal    \n\
 \n\
 /set prompt concise 'jshell> '   '   ...> '    \n\
 \n\
@@ -662,7 +662,7 @@
 \n\
 /set feedback normal    \n\
 \n\
-/set newmode silent quiet    \n\
+/set newmode silent -quiet    \n\
 /set prompt silent '-> ' '>> '    \n\
 /set format silent pre '|  '    \n\
 /set format silent post '%n'    \n\
--- a/langtools/test/jdk/jshell/CommandCompletionTest.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/test/jdk/jshell/CommandCompletionTest.java	Wed May 18 11:35:10 2016 -0700
@@ -60,11 +60,11 @@
     public void testList() {
         test(false, new String[] {"-nostartup"},
                 a -> assertCompletion(a, "/l|", false, "/list "),
-                a -> assertCompletion(a, "/list |", false, "all ", "history ", "start "),
-                a -> assertCompletion(a, "/list h|", false, "history "),
+                a -> assertCompletion(a, "/list |", false, "-all ", "-history ", "-start "),
+                a -> assertCompletion(a, "/list -h|", false, "-history "),
                 a -> assertCompletion(a, "/list q|", false),
                 a -> assertVariable(a, "int", "xray"),
-                a -> assertCompletion(a, "/list |", false, "1", "all ", "history ", "start ", "xray"),
+                a -> assertCompletion(a, "/list |", false, "-all ", "-history ", "-start ", "1", "xray"),
                 a -> assertCompletion(a, "/list x|", false, "xray")
         );
     }
@@ -108,7 +108,7 @@
         Compiler compiler = new Compiler();
         assertCompletion("/s|", false, "/save ", "/set ");
         List<String> p1 = listFiles(Paths.get(""));
-        Collections.addAll(p1, "all ", "history ", "start ");
+        Collections.addAll(p1, "-all ", "-history ", "-start ");
         FileSystems.getDefault().getRootDirectories().forEach(s -> p1.add(s.toString()));
         Collections.sort(p1);
         assertCompletion("/save |", false, p1.toArray(new String[p1.size()]));
@@ -116,7 +116,7 @@
         List<String> p2 = listFiles(classDir);
         assertCompletion("/save " + classDir + "/|",
                 false, p2.toArray(new String[p2.size()]));
-        assertCompletion("/save all " + classDir + "/|",
+        assertCompletion("/save -all " + classDir + "/|",
                 false, p2.toArray(new String[p2.size()]));
     }
 
--- a/langtools/test/jdk/jshell/ToolBasicTest.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/test/jdk/jshell/ToolBasicTest.java	Wed May 18 11:35:10 2016 -0700
@@ -403,13 +403,13 @@
                     (a) -> assertCommand(a, "int a;", null),
                     (a) -> assertCommand(a, "()", null, null, null, "", ""),
                     (a) -> assertClass(a, "class A { public String toString() { return \"A\"; } }", "class", "A"),
-                    (a) -> assertCommandCheckOutput(a, "/list all", (out) ->
+                    (a) -> assertCommandCheckOutput(a, "/list -all", (out) ->
                             output.addAll(Stream.of(out.split("\n"))
                                     .filter(str -> !str.isEmpty())
                                     .map(str -> str.substring(str.indexOf(':') + 2))
                                     .filter(str -> !str.startsWith("/"))
                                     .collect(Collectors.toList()))),
-                    (a) -> assertCommand(a, "/save all " + path.toString(), "")
+                    (a) -> assertCommand(a, "/save -all " + path.toString(), "")
             );
             assertEquals(Files.readAllLines(path), output);
         }
@@ -472,7 +472,7 @@
     public void testStartSave() throws IOException {
         Compiler compiler = new Compiler();
         Path startSave = compiler.getPath("startSave.txt");
-        test(a -> assertCommand(a, "/save start " + startSave.toString(), null));
+        test(a -> assertCommand(a, "/save -start " + startSave.toString(), null));
         List<String> lines = Files.lines(startSave)
                 .filter(s -> !s.isEmpty())
                 .collect(Collectors.toList());
--- a/langtools/test/jdk/jshell/ToolFormatTest.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/test/jdk/jshell/ToolFormatTest.java	Wed May 18 11:35:10 2016 -0700
@@ -43,7 +43,7 @@
     public void testSetFormat() {
         try {
             test(
-                    (a) -> assertCommandOutputStartsWith(a, "/set newmode test command", "|  Created new feedback mode: test"),
+                    (a) -> assertCommandOutputStartsWith(a, "/set newmode test -command", "|  Created new feedback mode: test"),
                     (a) -> assertCommand(a, "/set format test pre '$ '", ""),
                     (a) -> assertCommand(a, "/set format test post ''", ""),
                     (a) -> assertCommand(a, "/set format test act 'ADD' added", ""),
@@ -82,7 +82,7 @@
 
     public void testSetFormatSelector() {
         List<ReplTest> tests = new ArrayList<>();
-        tests.add((a) -> assertCommandOutputStartsWith(a, "/set newmode ate quiet",
+        tests.add((a) -> assertCommandOutputStartsWith(a, "/set newmode ate -quiet",
                             "|  Created new feedback mode: ate"));
         tests.add((a) -> assertCommand(a, "/set feedback ate", ""));
         StringBuilder sb = new StringBuilder();
@@ -162,7 +162,7 @@
                     (a) -> assertCommand(a, "String s = java.util.stream.IntStream.range(65, 74)"+
                             ".mapToObj(i -> \"\"+(char)i).reduce((a,b) -> a + b + a).get()",
                             "s ==> \"ABACABADABACABAEABACABADABACABAFABACABADABACABAEABACABADABACABAGABACABADABA ..."),
-                    (a) -> assertCommandOutputStartsWith(a, "/set newmode test quiet", ""),
+                    (a) -> assertCommandOutputStartsWith(a, "/set newmode test -quiet", ""),
                     (a) -> assertCommandOutputStartsWith(a, "/set feedback test", ""),
                     (a) -> assertCommand(a, "/set format test display '{type}:{value}' primary", ""),
                     (a) -> assertCommand(a, "/set truncation test 20", ""),
@@ -187,11 +187,11 @@
     public void testSetNewModeQuiet() {
         try {
             test(
-                    (a) -> assertCommandOutputStartsWith(a, "/set newmode nmq quiet normal", "|  Created new feedback mode: nmq"),
+                    (a) -> assertCommandOutputStartsWith(a, "/set newmode nmq -quiet normal", "|  Created new feedback mode: nmq"),
                     (a) -> assertCommand(a, "/set feedback nmq", ""),
-                    (a) -> assertCommand(a, "/se ne nmq2 q nor", ""),
+                    (a) -> assertCommand(a, "/se ne nmq2 -q nor", ""),
                     (a) -> assertCommand(a, "/se fee nmq2", ""),
-                    (a) -> assertCommand(a, "/set newmode nmc command normal", ""),
+                    (a) -> assertCommand(a, "/set newmode nmc -command normal", ""),
                     (a) -> assertCommandOutputStartsWith(a, "/set feedback nmc", "|  Feedback mode: nmc"),
                     (a) -> assertCommandOutputStartsWith(a, "/set newmode nm", "|  Created new feedback mode: nm"),
                     (a) -> assertCommandOutputStartsWith(a, "/set feedback nm", "|  Feedback mode: nm"),
@@ -206,15 +206,15 @@
     public void testSetError() {
         try {
             test(
-                    (a) -> assertCommandOutputStartsWith(a, "/set newmode tee command foo",
+                    (a) -> assertCommandOutputStartsWith(a, "/set newmode tee -command foo",
                             "|  Does not match any current feedback mode: foo"),
                     (a) -> assertCommandOutputStartsWith(a, "/set newmode tee flurb",
-                            "|  Specify either 'command' or 'quiet'"),
+                            "|  Specify either '-command' or '-quiet'"),
                     (a) -> assertCommandOutputStartsWith(a, "/set newmode te2",
                             "|  Created new feedback mode: te2"),
-                    (a) -> assertCommandOutputStartsWith(a, "/set newmode te2 command",
+                    (a) -> assertCommandOutputStartsWith(a, "/set newmode te2 -command",
                             "|  Expected a new feedback mode name. 'te2' is a known feedback mode"),
-                    (a) -> assertCommandOutputStartsWith(a, "/set newmode te command normal",
+                    (a) -> assertCommandOutputStartsWith(a, "/set newmode te -command normal",
                             "|  Created new feedback mode: te"),
                     (a) -> assertCommand(a, "/set format te errorpre 'ERROR: '", ""),
                     (a) -> assertCommandOutputStartsWith(a, "/set feedback te",
@@ -260,8 +260,8 @@
                     (a) -> assertCommandOutputStartsWith(a, "/set newmode te",
                             "ERROR: Expected a new feedback mode name"),
                     (a) -> assertCommandOutputStartsWith(a, "/set newmode x xyz",
-                            "ERROR: Specify either 'command' or 'quiet'"),
-                    (a) -> assertCommandOutputStartsWith(a, "/set newmode x quiet y",
+                            "ERROR: Specify either '-command' or '-quiet'"),
+                    (a) -> assertCommandOutputStartsWith(a, "/set newmode x -quiet y",
                             "ERROR: Does not match any current feedback mode"),
                     (a) -> assertCommandOutputStartsWith(a, "/set prompt",
                             "ERROR: Expected a feedback mode"),
--- a/langtools/test/jdk/jshell/ToolLocaleMessageTest.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/test/jdk/jshell/ToolLocaleMessageTest.java	Wed May 18 11:35:10 2016 -0700
@@ -76,7 +76,7 @@
     public void testSample() {
         try {
             testLocale(
-                    (a) -> assertCommandOK(a, "/set newmode test command normal", "test"),
+                    (a) -> assertCommandOK(a, "/set newmode test -command normal", "test"),
                     (a) -> assertCommandOK(a, "/set format test errorpre 'ERROR: '"),
                     (a) -> assertCommandOK(a, "/set feedback test", "test"),
 
@@ -101,7 +101,7 @@
     public void testCommand() {
         try {
             testLocale(
-                    (a) -> assertCommandOK(a, "/set newmode test command normal", "test"),
+                    (a) -> assertCommandOK(a, "/set newmode test -command normal", "test"),
                     (a) -> assertCommandOK(a, "/set format test errorpre 'ERROR: '"),
                     (a) -> assertCommandOK(a, "/set feedback test", "test"),
 
@@ -134,13 +134,13 @@
 
     public void testHelp() {
         testLocale(
-                (a) -> assertCommandOK(a, "/help", "/list", "/save", "/set", "[restore]"),
-                (a) -> assertCommandOK(a, "/help /list", "start", "all"),
+                (a) -> assertCommandOK(a, "/help", "/list", "/save", "/set", "[-restore]"),
+                (a) -> assertCommandOK(a, "/help /list", "-start", "-all"),
                 (a) -> assertCommandOK(a, "/help /edit", "/set editor"),
                 (a) -> assertCommandOK(a, "/help /drop", "/drop"),
-                (a) -> assertCommandOK(a, "/help /save", "all", "start"),
+                (a) -> assertCommandOK(a, "/help /save", "-all", "-start"),
                 (a) -> assertCommandOK(a, "/help /open", "/open"),
-                (a) -> assertCommandOK(a, "/help /reload", "restore"),
+                (a) -> assertCommandOK(a, "/help /reload", "-restore"),
                 (a) -> assertCommandOK(a, "/help /help", "intro"),
                 (a) -> assertCommandOK(a, "/help /set", "newmode"),
                 (a) -> assertCommandOK(a, "/help /?", "intro"),
@@ -156,11 +156,11 @@
     public void testFeedbackError() {
         try {
             testLocale(
-                    (a) -> assertCommandOK(a, "/set newmode tee command foo", "foo"),
-                    (a) -> assertCommandOK(a, "/set newmode tee flurb", "command", "quiet"),
+                    (a) -> assertCommandOK(a, "/set newmode tee -command foo", "foo"),
+                    (a) -> assertCommandOK(a, "/set newmode tee flurb", "-command", "-quiet"),
                     (a) -> assertCommandOK(a, "/set newmode te2", "te2"),
-                    (a) -> assertCommandOK(a, "/set newmode te2 command", "te2"),
-                    (a) -> assertCommandOK(a, "/set newmode te command normal", "te"),
+                    (a) -> assertCommandOK(a, "/set newmode te2 -command", "te2"),
+                    (a) -> assertCommandOK(a, "/set newmode te -command normal", "te"),
                     (a) -> assertCommandOK(a, "/set format te errorpre 'ERROR: '"),
                     (a) -> assertCommandOK(a, "/set feedback te"),
 
@@ -182,7 +182,7 @@
                     (a) -> assertCommandFail(a, "/set newmode"),
                     (a) -> assertCommandFail(a, "/set newmode te"),
                     (a) -> assertCommandFail(a, "/set newmode x xyz"),
-                    (a) -> assertCommandFail(a, "/set newmode x quiet y"),
+                    (a) -> assertCommandFail(a, "/set newmode x -quiet y"),
                     (a) -> assertCommandFail(a, "/set prompt"),
                     (a) -> assertCommandFail(a, "/set prompt te"),
                     (a) -> assertCommandFail(a, "/set prompt te aaa xyz", "aaa"),
--- a/langtools/test/jdk/jshell/ToolReloadTest.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/test/jdk/jshell/ToolReloadTest.java	Wed May 18 11:35:10 2016 -0700
@@ -120,7 +120,7 @@
                 a -> dropMethod(a, "/drop b", "b ()I", "|  dropped method b()"),
                 a -> assertClass(a, "class A {}", "class", "A"),
                 a -> dropClass(a, "/dr A", "class A", "|  dropped class A"),
-                a -> assertCommand(a, "/reload quiet",
+                a -> assertCommand(a, "/reload -quiet",
                         "|  Restarting and restoring state."),
                 a -> assertCommandCheckOutput(a, "/vars", assertVariables()),
                 a -> assertCommandCheckOutput(a, "/methods", assertMethods()),
@@ -169,7 +169,7 @@
                         "(int)int", "m"),
                 (a) -> evaluateExpression(a, "int", "m(x)", "25"),
                 (a) -> assertCommand(a, "/reset", "|  Resetting state."),
-                (a) -> assertCommand(a, "/reload restore",
+                (a) -> assertCommand(a, "/reload -restore",
                         "|  Restarting and restoring from previous state.\n" +
                         "-: int x = 5;\n" +
                         "-: int m(int z) { return z * z; }\n" +
@@ -188,8 +188,8 @@
                 (a) -> evaluateExpression(a, "int", "m(x)", "25"),
                 (a) -> assertCommand(a, "System.exit(1);",
                         "|  State engine terminated.\n" +
-                        "|  Restore definitions with: /reload restore"),
-                (a) -> assertCommand(a, "/reload restore",
+                        "|  Restore definitions with: /reload -restore"),
+                (a) -> assertCommand(a, "/reload -restore",
                         "|  Restarting and restoring from previous state.\n" +
                         "-: int x = 5;\n" +
                         "-: int m(int z) { return z * z; }\n" +
@@ -208,7 +208,7 @@
                 (a) -> evaluateExpression(a, "int", "m(x)", "25")
         );
         test(false, new String[]{"-nostartup"},
-                (a) -> assertCommand(a, "/reload restore",
+                (a) -> assertCommand(a, "/reload -restore",
                         "|  Restarting and restoring from previous state.\n" +
                         "-: int x = 5;\n" +
                         "-: int m(int z) { return z * z; }\n" +
--- a/langtools/test/jdk/jshell/ToolSimpleTest.java	Wed May 18 11:38:20 2016 +0530
+++ b/langtools/test/jdk/jshell/ToolSimpleTest.java	Wed May 18 11:35:10 2016 -0700
@@ -284,7 +284,7 @@
                 (a) -> assertHelp(a, "/?", "/list", "/help", "/exit", "intro"),
                 (a) -> assertHelp(a, "/help", "/list", "/help", "/exit", "intro"),
                 (a) -> assertHelp(a, "/help short", "shortcuts", "<tab>"),
-                (a) -> assertHelp(a, "/? /li", "/list all", "snippets"),
+                (a) -> assertHelp(a, "/? /li", "/list -all", "snippets"),
                 (a) -> assertHelp(a, "/help /help", "/help <command>")
         );
     }
@@ -314,15 +314,15 @@
         List<String> startVarList = new ArrayList<>(START_UP);
         startVarList.add("int aardvark");
         test(
-                a -> assertCommandCheckOutput(a, "/list all",
+                a -> assertCommandCheckOutput(a, "/list -all",
                         s -> checkLineToList(s, START_UP)),
                 a -> assertCommandOutputStartsWith(a, "/list " + arg,
                         "|  No applicable definition or id found named: " + arg),
                 a -> assertVariable(a, "int", "aardvark"),
                 a -> assertCommandOutputContains(a, "/list aardvark", "aardvark"),
-                a -> assertCommandCheckOutput(a, "/list start",
+                a -> assertCommandCheckOutput(a, "/list -start",
                         s -> checkLineToList(s, START_UP)),
-                a -> assertCommandCheckOutput(a, "/list all",
+                a -> assertCommandCheckOutput(a, "/list -all",
                         s -> checkLineToList(s, startVarList)),
                 a -> assertCommandCheckOutput(a, "/list printf",
                         s -> assertTrue(s.contains("void printf"))),
@@ -335,7 +335,7 @@
         String arg = "qqqq";
         List<String> startVarList = new ArrayList<>();
         test(
-                a -> assertCommandCheckOutput(a, "/vars all",
+                a -> assertCommandCheckOutput(a, "/vars -all",
                         s -> checkLineToList(s, startVarList)),
                 a -> assertCommandOutputStartsWith(a, "/vars " + arg,
                         "|  No applicable definition or id found named: " + arg),
@@ -344,9 +344,9 @@
                 a -> assertVariable(a, "int", "a"),
                 a -> assertVariable(a, "double", "a", "1", "1.0"),
                 a -> assertCommandOutputStartsWith(a, "/vars aardvark", "|    int aardvark = 0"),
-                a -> assertCommandCheckOutput(a, "/vars start",
+                a -> assertCommandCheckOutput(a, "/vars -start",
                         s -> checkLineToList(s, startVarList)),
-                a -> assertCommandOutputStartsWith(a, "/vars all",
+                a -> assertCommandOutputStartsWith(a, "/vars -all",
                         "|    int aardvark = 0\n|    int a = "),
                 a -> assertCommandOutputStartsWith(a, "/vars printf",
                         "|  No applicable definition or id found named: printf"),
@@ -359,9 +359,9 @@
         String arg = "qqqq";
         List<String> startMethodList = new ArrayList<>(START_UP_CMD_METHOD);
         test(
-                a -> assertCommandCheckOutput(a, "/methods all",
+                a -> assertCommandCheckOutput(a, "/methods -all",
                         s -> checkLineToList(s, startMethodList)),
-                a -> assertCommandCheckOutput(a, "/methods start",
+                a -> assertCommandCheckOutput(a, "/methods -start",
                         s -> checkLineToList(s, startMethodList)),
                 a -> assertCommandCheckOutput(a, "/methods printf",
                         s -> checkLineToList(s, startMethodList)),
@@ -377,7 +377,7 @@
                         "|  No applicable definition or id found named: " + arg),
                 a -> assertCommandOutputStartsWith(a, "/methods aardvark",
                         "|  No applicable definition or id found named: aardvark"),
-                a -> assertCommandCheckOutput(a, "/methods start",
+                a -> assertCommandCheckOutput(a, "/methods -start",
                         s -> checkLineToList(s, startMethodList)),
                 a -> assertCommandCheckOutput(a, "/methods printf",
                         s -> checkLineToList(s, startMethodList)),
@@ -393,16 +393,16 @@
         String arg = "qqqq";
         List<String> startTypeList = new ArrayList<>();
         test(
-                a -> assertCommandCheckOutput(a, "/types all",
+                a -> assertCommandCheckOutput(a, "/types -all",
                         s -> checkLineToList(s, startTypeList)),
-                a -> assertCommandCheckOutput(a, "/types start",
+                a -> assertCommandCheckOutput(a, "/types -start",
                         s -> checkLineToList(s, startTypeList)),
                 a -> assertCommandOutputStartsWith(a, "/types " + arg,
                         "|  No applicable definition or id found named: " + arg),
                 a -> assertVariable(a, "int", "aardvark"),
                 (a) -> assertClass(a, "class A { }", "class", "A"),
                 (a) -> assertClass(a, "interface A { }", "interface", "A"),
-                a -> assertCommandOutputStartsWith(a, "/types all",
+                a -> assertCommandOutputStartsWith(a, "/types -all",
                         "|    class A\n" +
                         "|    interface A"),
                 (a) -> assertClass(a, "enum E { }", "enum", "E"),
@@ -417,7 +417,7 @@
                         "|    @interface B"),
                 a -> assertCommandOutputStartsWith(a, "/types " + arg,
                         "|  No applicable definition or id found named: " + arg),
-                a -> assertCommandCheckOutput(a, "/types start",
+                a -> assertCommandCheckOutput(a, "/types -start",
                         s -> checkLineToList(s, startTypeList))
         );
     }