readline support for ingenish
Hi,
maybe readline support is a good idea for ingenish:
diff --git a/scripts/ingenish b/scripts/ingenish index 4fac6307..734b6b40 100755 --- a/scripts/ingenish +++ b/scripts/ingenish @@ -17,6 +17,9 @@ import ingen import shlex import sys +import readline +import os +import atexit # Python 2 compatibility try: @@ -66,6 +69,8 @@ Example: def run(cmd): + if len(cmd) == 0: + return False if cmd[0] == 'help': print_usage() elif cmd[0] == 'exit': @@ -86,6 +91,15 @@ def run(cmd): return ingen.delete(cmd[1]) return False +histfile = os.path.join(os.path.expanduser("~"), ".ingenish_history") +try: + readline.read_history_file(histfile) + # default history len is -1 (infinite), which may grow unruly + readline.set_history_length(100000) +except FileNotFoundError: + pass + +atexit.register(readline.write_history_file, histfile) a = 1 server = 'unix:///tmp/ingen.sock'