summaryrefslogtreecommitdiff
path: root/cmd2.py
diff options
context:
space:
mode:
Diffstat (limited to 'cmd2.py')
-rwxr-xr-xcmd2.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/cmd2.py b/cmd2.py
index 64ba5747..feb6c69b 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -382,10 +382,13 @@ def path_complete(text, line, begidx, endidx, dir_exe_only=False, dir_only=False
# Used if we need to prepend a directory to the search string
dirname = ''
- # Handle ~ in search text
- if token_being_completed.startswith('~'):
+ # If the user only entered a '~', then complete it with a slash
+ if token_being_completed == '~':
+ return [os.path.sep]
- # Tilde without separator is invalid
+ elif token_being_completed.startswith('~'):
+
+ # Tilde without separator between path is invalid
if not token_being_completed.startswith('~' + os.path.sep):
return []