Skip to content

Commit

Permalink
add CLEAR cqlsh command
Browse files Browse the repository at this point in the history
patch by Paul O'Fallon; reviewed by Stefania for CASSANDRA-10086
  • Loading branch information
jbellis committed Aug 25, 2015
1 parent 06a053d commit b204803
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
1 change: 1 addition & 0 deletions 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)
Expand Down
18 changes: 17 additions & 1 deletion bin/cqlsh.py
Expand Up @@ -242,7 +242,9 @@ def find_zip(libprefix):
'expand',
'paging',
'exit',
'quit'
'quit',
'clear',
'cls'
)


Expand Down Expand Up @@ -275,6 +277,7 @@ def registrator(f):
| <expandCommand>
| <exitCommand>
| <pagingCommand>
| <clearCommand>
;
<describeCommand> ::= ( "DESCRIBE" | "DESC" )
Expand Down Expand Up @@ -362,6 +365,9 @@ def registrator(f):
<exitCommand> ::= "exit" | "quit"
;
<clearCommand> ::= "CLEAR" | "CLS"
;
<qmark> ::= "?" ;
'''

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit b204803

Please sign in to comment.