geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [10/32] incubator-geode git commit: GEODE-1598: fix autocomplete for first option and repeat tabs
Date Tue, 05 Jul 2016 23:15:33 GMT
GEODE-1598: fix autocomplete for first option and repeat tabs

This closes #187


Project: http://git-wip-us.apache.org/repos/asf/incubator-geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-geode/commit/9c156369
Tree: http://git-wip-us.apache.org/repos/asf/incubator-geode/tree/9c156369
Diff: http://git-wip-us.apache.org/repos/asf/incubator-geode/diff/9c156369

Branch: refs/heads/feature/GEODE-1571
Commit: 9c156369fba49f459587fa7dc4b8bdca9e2c29d5
Parents: 1a3c38a
Author: gmeilen <gracemeilen@gmail.com>
Authored: Fri Jul 1 15:00:04 2016 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Fri Jul 1 15:26:49 2016 -0700

----------------------------------------------------------------------
 .../management/internal/cli/GfshParser.java     | 23 ++------------------
 .../cli/parser/jopt/JoptOptionParser.java       |  1 +
 .../internal/cli/JoptOptionParserTest.java      |  3 ++-
 3 files changed, 5 insertions(+), 22 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9c156369/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
index 6e91b64..29a6aee 100755
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/GfshParser.java
@@ -336,29 +336,10 @@ public class GfshParser implements Parser {
       boolean warningValueRequired = false;
       Option warningOption = null;
 
-      boolean updatedDesiredCursorPosition = false;
-      if (!userOptionSet.areOptionsPresent()) {
-        if (remainingBuffer.contains("-")) {
-          int walkBackwards = remainingBuffer.length() - 1;
-          while (remainingBuffer.charAt(walkBackwards) != '-' && walkBackwards >
0) {
-            walkBackwards--;
-          }
-          while (remainingBuffer.charAt(walkBackwards) == '-' && walkBackwards >
0) {
-            walkBackwards--;
-          }
-          while (remainingBuffer.charAt(walkBackwards) == ' ' && walkBackwards >
0) {
-            walkBackwards--;
-          }
-          if (walkBackwards > 0) {
-            walkBackwards += 2;
-            desiredCursorPosition += walkBackwards;
-          }
-          updatedDesiredCursorPosition = true;
-        }
-      } // gfsh>start server --name=server1 --lo
+
 
       for (Option option : commandTarget.getOptionParser().getOptions()) {
-        if (!updatedDesiredCursorPosition && userOptionSet.hasOption(option)) {
+        if (userOptionSet.hasOption(option)) {
           // We are supporting option synonyms,
           // so we need to check that here
           for (String string : userOptionSet.getSplit()) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9c156369/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
----------------------------------------------------------------------
diff --git a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
index de47ce6..18ea581 100644
--- a/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
+++ b/geode-core/src/main/java/com/gemstone/gemfire/management/internal/cli/parser/jopt/JoptOptionParser.java
@@ -61,6 +61,7 @@ public class JoptOptionParser implements GfshOptionParser {
    */
   public JoptOptionParser() {
     parser = new OptionParser(true);
+    parser.allowsUnrecognizedOptions();
   }
 
   public void setArguments(LinkedList<Argument> arguments) {

http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/9c156369/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
----------------------------------------------------------------------
diff --git a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
index 01a2b74..587cfc2 100644
--- a/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
+++ b/geode-core/src/test/java/com/gemstone/gemfire/management/internal/cli/JoptOptionParserTest.java
@@ -30,6 +30,7 @@ import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
+import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionException;
 import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionMissingException;
 import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionNotApplicableException;
 import com.gemstone.gemfire.management.internal.cli.parser.Argument;
@@ -239,7 +240,7 @@ public class JoptOptionParserTest {
 
   @Test
   public void parseInputWithUndefinedOptionShouldThrow() throws Exception {
-    assertThatThrownBy(() -> this.simpleOptionParser.parse("command1 argument1_value argument2_value
--undefinedOption")).isExactlyInstanceOf(CliCommandOptionNotApplicableException.class);
+    assertThatThrownBy(() -> this.simpleOptionParser.parse("command1 argument1_value argument2_value
--undefinedOption")).isExactlyInstanceOf(CliCommandOptionException.class);
   }
 
   @Test


Mime
View raw message