geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jinmeil...@apache.org
Subject [15/26] incubator-geode git commit: GEODE-1598: avoid deletion of options during GFSH autocomplete
Date Thu, 30 Jun 2016 19:23:20 GMT
GEODE-1598: avoid deletion of options during GFSH autocomplete

* This closes #175


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

Branch: refs/heads/feature/GEODE-1571
Commit: b5a50fe782231cc3521260b52952bc1bb146fa66
Parents: e43ef76
Author: gmeilen <gracemeilen@gmail.com>
Authored: Tue Jun 28 12:20:52 2016 -0700
Committer: Kirk Lund <klund@apache.org>
Committed: Tue Jun 28 14:31:12 2016 -0700

----------------------------------------------------------------------
 .../gemfire/management/internal/cli/GfshParser.java    | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/b5a50fe7/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 4d2564f..7fc7295 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,8 +336,19 @@ public class GfshParser implements Parser {
       boolean warningValueRequired = false;
       Option warningOption = null;
 
+      boolean updatedDesiredCursorPosition = false;
+      if (!userOptionSet.areOptionsPresent()) {
+        int walkBackwards = remainingBuffer.length() - 1;
+        while (remainingBuffer.charAt(walkBackwards) != '-') {
+          walkBackwards--;
+        }
+        walkBackwards -= 2;
+        desiredCursorPosition += walkBackwards;
+        updatedDesiredCursorPosition = true;
+      }
+
       for (Option option : commandTarget.getOptionParser().getOptions()) {
-        if (userOptionSet.hasOption(option)) {
+        if (!updatedDesiredCursorPosition && userOptionSet.hasOption(option)) {
           // We are supporting option synonyms,
           // so we need to check that here
           for (String string : userOptionSet.getSplit()) {


Mime
View raw message