From b204803274126602952cb167a6c33864922836eb Mon Sep 17 00:00:00 2001 From: Jonathan Ellis Date: Mon, 24 Aug 2015 19:51:23 -0500 Subject: [PATCH] add CLEAR cqlsh command patch by Paul O'Fallon; reviewed by Stefania for CASSANDRA-10086 --- CHANGES.txt | 1 + bin/cqlsh.py | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/CHANGES.txt b/CHANGES.txt index fc56d72f8ba9..30f7d309fff8 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) diff --git a/bin/cqlsh.py b/bin/cqlsh.py index 9a348bc70606..bfb3a24a5f10 100644 --- a/bin/cqlsh.py +++ b/bin/cqlsh.py @@ -242,7 +242,9 @@ def find_zip(libprefix): 'expand', 'paging', 'exit', - 'quit' + 'quit', + 'clear', + 'cls' ) @@ -275,6 +277,7 @@ def registrator(f): | | | + | ; ::= ( "DESCRIBE" | "DESC" ) @@ -362,6 +365,9 @@ def registrator(f): ::= "exit" | "quit" ; + ::= "CLEAR" | "CLS" + ; + ::= "?" ; ''' @@ -2170,6 +2176,16 @@ def do_exit(self, parsed=None): 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()