Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanimir Agovic2017-11-28 20:58:17 +0000
committerSanimir Agovic2017-11-28 21:08:17 +0000
commita61b2f18cddca3507bf164c5dadda627c5a9b35a (patch)
treea46f0ead98864bac495d4442af1d69999a959412
parent852c46cceed94018b7daa5eedd26014e68f74619 (diff)
downloadorg.eclipse.tcf-a61b2f18cddca3507bf164c5dadda627c5a9b35a.tar.gz
org.eclipse.tcf-a61b2f18cddca3507bf164c5dadda627c5a9b35a.tar.xz
org.eclipse.tcf-a61b2f18cddca3507bf164c5dadda627c5a9b35a.zip
shell: enable commandline editing and auto completion
Enables commandline editing and binds tab-key to auto complete valid python identifies and keywords. Change-Id: I8490b10747be1d701fe61b0b3ae600e2de4c32aa Signed-off-by: Sanimir Agovic <sanimir@subpath.org>
-rw-r--r--python/src/tcf/shell.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/python/src/tcf/shell.py b/python/src/tcf/shell.py
index cd1459121..4073463ab 100644
--- a/python/src/tcf/shell.py
+++ b/python/src/tcf/shell.py
@@ -104,12 +104,16 @@ class Shell(code.InteractiveConsole, protocol.ChannelOpenListener,
def interact():
+ shell = Shell()
try:
# enable commandline editing if available
- import readline # @UnusedImport
+ import readline
except ImportError:
pass
- shell = Shell()
+ else:
+ import rlcompleter
+ readline.set_completer(rlcompleter.Completer(shell.locals).complete)
+ readline.parse_and_bind("tab: complete")
shell.interact("TCF Shell")
if __name__ == "__main__":

Back to the top