You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cassandra.apache.org by mi...@apache.org on 2014/05/04 08:32:32 UTC
[2/6] git commit: Issue a warning after 3 empty lines in statement
Issue a warning after 3 empty lines in statement
patch by Mikhail Stepura; reviewed by Brandon Williams for CASSANDRA-7142
Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/e9bdb6a9
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/e9bdb6a9
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/e9bdb6a9
Branch: refs/heads/cassandra-2.1
Commit: e9bdb6a95c45dc4fc328a5c3a036bb1622857049
Parents: 2e955d4
Author: Mikhail Stepura <mi...@apache.org>
Authored: Fri May 2 15:57:57 2014 -0700
Committer: Mikhail Stepura <mi...@apache.org>
Committed: Sat May 3 23:26:40 2014 -0700
----------------------------------------------------------------------
CHANGES.txt | 1 +
bin/cqlsh | 7 +++++++
2 files changed, 8 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e9bdb6a9/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index 8570784..f4e14d8 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -12,6 +12,7 @@
* Plug holes in resource release when wiring up StreamSession (CASSANDRA-7073)
* Re-add parameter columns to tracing session (CASSANDRA-6942)
* Fix writetime/ttl functions for static columns (CASSANDRA-7081)
+ * Suggest CTRL-C or semicolon after three blank lines in cqlsh (CASSANDRA-7142)
Merged from 1.2:
* Add Cloudstack snitch (CASSANDRA-7147)
* Update system.peers correctly when relocating tokens (CASSANDRA-7126)
http://git-wip-us.apache.org/repos/asf/cassandra/blob/e9bdb6a9/bin/cqlsh
----------------------------------------------------------------------
diff --git a/bin/cqlsh b/bin/cqlsh
index 6fa3afe..020bd2a 100755
--- a/bin/cqlsh
+++ b/bin/cqlsh
@@ -519,6 +519,7 @@ class Shell(cmd.Cmd):
self.show_line_nums = True
self.stdin = stdin
self.query_out = sys.stdout
+ self.empty_lines = 0
def set_expanded_cql_version(self, ver):
ver, vertuple = full_cql_version(ver)
@@ -703,6 +704,7 @@ class Shell(cmd.Cmd):
def reset_statement(self):
self.reset_prompt()
self.statement.truncate(0)
+ self.empty_lines = 0;
def reset_prompt(self):
if self.current_keyspace is None:
@@ -711,11 +713,16 @@ class Shell(cmd.Cmd):
self.set_prompt(self.keyspace_prompt % self.current_keyspace)
def set_continue_prompt(self):
+ if self.empty_lines >=3:
+ self.set_prompt("Statements are terminated with a ';'. You can press CTRL-C to cancel an imcomplete statement.")
+ self.empty_lines = 0
+ return
if self.current_keyspace is None:
self.set_prompt(self.continue_prompt)
else:
spaces = ' ' * len(str(self.current_keyspace))
self.set_prompt(self.keyspace_continue_prompt % spaces)
+ self.empty_lines += 1
@contextmanager
def prepare_loop(self):