mirror of
https://github.com/xcat2/confluent.git
synced 2024-11-22 09:32:21 +00:00
Add history to the dbg cli helper
As long as we are adding readline, history persistence is also really handy.
This commit is contained in:
parent
6a39a3f9a2
commit
d5efa87288
@ -19,12 +19,28 @@
|
||||
# Note that this script has a high chance of breaking confluent, so
|
||||
# do not be surprised if confluent crashes as you exit...
|
||||
|
||||
import atexit
|
||||
import os
|
||||
import select
|
||||
import socket
|
||||
import readline
|
||||
import sys
|
||||
import threading
|
||||
|
||||
historypath = os.path.expanduser("~/.confluentdbghistory")
|
||||
|
||||
def save_history():
|
||||
import readline
|
||||
try:
|
||||
readline.write_history_file(historypath)
|
||||
except:
|
||||
pass
|
||||
|
||||
if os.path.exists(historypath):
|
||||
readline.set_history_length(1000)
|
||||
readline.read_history_file(historypath)
|
||||
|
||||
atexit.register(save_history)
|
||||
readline.parse_and_bind('tab: complete')
|
||||
conn = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
conn.connect('/var/run/confluent/dbg.sock')
|
||||
|
Loading…
Reference in New Issue
Block a user