You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "bschoening (via GitHub)" <gi...@apache.org> on 2023/05/19 21:43:15 UTC
[GitHub] [cassandra] bschoening commented on a diff in pull request #2354: CASSANDRA-15046 Added CQLSH history command
bschoening commented on code in PR #2354:
URL: https://github.com/apache/cassandra/pull/2354#discussion_r1199431252
##########
pylib/cqlshlib/cqlshmain.py:
##########
@@ -1835,6 +1835,31 @@ def do_help(self, parsed):
self.printerr("*** No browser to display CQL help. URL for help topic %s : %s" % (t, url))
else:
self.printerr("*** No help on %s" % (t,))
+ def do_history(self,parsed):
+ """
+ HISTORY [cqlsh only]
+
+ Displays the most recent commands executed in cqlsh
+
+ HISTORY (<n>)
+
+ If n is specified, the history display length is set to n for this session
+ """
+
+ recent_history = ""
+ history_length = readline.get_current_history_length()
+
+ n = parsed.get_binding('n')
+ if (n is not None):
+ val = int(n)
+ self.max_history_length_shown = val
+
+ for index in range(history_length, history_length-self.max_history_length_shown, -1):
+ history_item = readline.get_history_item(index)
+ if history_item:
+ recent_history += history_item +"\n"
+ print("Recent Commands:\n\n" + recent_history)
Review Comment:
I agree, I'll remove it
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org