Author: ecn
Date: Mon Apr 29 17:52:05 2013
New Revision: 1477233

URL: http://svn.apache.org/r1477233
Log:
ACCUMULO-1347 applying patch from Tim Reardon for comments in the shell

Modified:
    
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
    
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java

Modified: 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java?rev=1477233&r1=1477232&r2=1477233&view=diff
==============================================================================
--- 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
 (original)
+++ 
accumulo/trunk/core/src/main/java/org/apache/accumulo/core/util/shell/Shell.java
 Mon Apr 29 17:52:05 2013
@@ -162,6 +162,7 @@ public class Shell extends ShellOptions 
   
   public static final String CHARSET = "ISO-8859-1";
   public static final int NO_FIXED_ARG_LENGTH_CHECK = -1;
+  public static final String COMMENT_PREFIX = "#";
   public static final String HISTORY_DIR_NAME = ".accumulo";
   public static final String HISTORY_FILE_NAME = "shell_history.txt";
   private static final String SHELL_DESCRIPTION = "Shell - Apache Accumulo 
Interactive Shell";
@@ -528,6 +529,10 @@ public class Shell extends ShellOptions 
       reader.printNewline();
     }
     
+    if (input.startsWith(COMMENT_PREFIX)) {
+      return;
+    }
+    
     String fields[];
     try {
       fields = new QuotedStringTokenizer(input).getTokens();

Modified: 
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
URL: 
http://svn.apache.org/viewvc/accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java?rev=1477233&r1=1477232&r2=1477233&view=diff
==============================================================================
--- 
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
 (original)
+++ 
accumulo/trunk/core/src/test/java/org/apache/accumulo/core/util/shell/ShellTest.java
 Mon Apr 29 17:52:05 2013
@@ -206,4 +206,12 @@ public class ShellTest {
     exec("scan -fm org.apache.accumulo.core.util.format.DateStringFormatter 
-st", true, expected);
     exec("deletetable t -f", true, "Table: [t] has been deleted");
   }
+  
+  @Test
+  public void commentTest() throws IOException {
+    Shell.log.debug("Starting comment test --------------------------");
+    exec("#", true, "Unknown command", false);
+    exec("# foo", true, "Unknown command", false);
+    exec("- foo", true, "Unknown command", true);
+  }
 }


Reply via email to