You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by jb...@apache.org on 2015/08/25 02:52:17 UTC

[3/6] cassandra git commit: add CLEAR cqlsh command patch by Paul O'Fallon; reviewed by Stefania for CASSANDRA-10086

add CLEAR cqlsh command
patch by Paul O'Fallon; reviewed by Stefania for CASSANDRA-10086


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

Branch: refs/heads/trunk
Commit: b204803274126602952cb167a6c33864922836eb
Parents: 06a053d
Author: Jonathan Ellis <jb...@apache.org>
Authored: Mon Aug 24 19:51:23 2015 -0500
Committer: Jonathan Ellis <jb...@apache.org>
Committed: Mon Aug 24 19:51:23 2015 -0500

----------------------------------------------------------------------
 CHANGES.txt  |  1 +
 bin/cqlsh.py | 18 +++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/b2048032/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index fc56d72..30f7d30 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -1,4 +1,5 @@
 2.2.1
+ * add CLEAR cqlsh command (CASSANDRA-10086)
  * Support string literals as Role names for compatibility (CASSANDRA-10135)
  * Allow count(*) and count(1) to be use as normal aggregation (CASSANDRA-10114)
  * An NPE is thrown if the column name is unknown for an IN relation (CASSANDRA-10043)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/b2048032/bin/cqlsh.py
----------------------------------------------------------------------
diff --git a/bin/cqlsh.py b/bin/cqlsh.py
index 9a348bc..bfb3a24 100644
--- a/bin/cqlsh.py
+++ b/bin/cqlsh.py
@@ -242,7 +242,9 @@ my_commands_ending_with_newline = (
     'expand',
     'paging',
     'exit',
-    'quit'
+    'quit',
+    'clear',
+    'cls'
 )
 
 
@@ -275,6 +277,7 @@ cqlsh_extra_syntax_rules = r'''
                    | <expandCommand>
                    | <exitCommand>
                    | <pagingCommand>
+                   | <clearCommand>
                    ;
 
 <describeCommand> ::= ( "DESCRIBE" | "DESC" )
@@ -362,6 +365,9 @@ cqlsh_extra_syntax_rules = r'''
 <exitCommand> ::= "exit" | "quit"
                 ;
 
+<clearCommand> ::= "CLEAR" | "CLS"
+                 ;
+
 <qmark> ::= "?" ;
 '''
 
@@ -2170,6 +2176,16 @@ class Shell(cmd.Cmd):
             self.conn.shutdown()
     do_quit = do_exit
 
+    def do_clear(self, parsed):
+        """
+        CLEAR/CLS [cqlsh only]
+
+        Clears the console.
+        """
+        import subprocess
+        subprocess.call(['clear','cls'][myplatform == 'Windows'], shell=True)
+    do_cls = do_clear
+
     def do_debug(self, parsed):
         import pdb
         pdb.set_trace()