summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
authorTodd Leonhardt <tleonhardt@gmail.com>2017-06-09 15:37:41 -0400
committerTodd Leonhardt <tleonhardt@gmail.com>2017-06-09 15:37:41 -0400
commitc9854771a2f280a23cb9176f820efabb69c49398 (patch)
treec2bf0ae9fad1b4d111ffbc0a0c982caf75731c84 /cmd2.py
parenteb3d29538e3f898cb69e1f2964a7f84a3c0391d4 (diff)
downloadcmd2-git-c9854771a2f280a23cb9176f820efabb69c49398.tar.gz
Manually set readline delimiters to not include a dash ("-")
This is because file paths which had a "-" in them were not being completed with tab completion of local paths.
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/cmd2.py b/cmd2.py
index 13169a17..7965ea3b 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1090,7 +1090,10 @@ class Cmd(cmd.Cmd):
if self.use_rawinput and self.completekey:
try:
self.old_completer = readline.get_completer()
+ self.old_delims = readline.get_completer_delims()
readline.set_completer(self.complete)
+ # Don't treat "-" as a readline delimiter since it is commonly used in filesystem paths
+ readline.set_completer_delims(self.old_delims.replace('-', ''))
readline.parse_and_bind(self.completekey + ": complete")
except NameError:
pass
@@ -1109,6 +1112,7 @@ class Cmd(cmd.Cmd):
if self.use_rawinput and self.completekey:
try:
readline.set_completer(self.old_completer)
+ readline.set_completer_delims(self.old_delims)
except NameError:
pass
return stop