summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2018-08-01 02:59:29 -0400
committerKevin Van Brunt <kmvanbrunt@gmail.com>2018-08-01 02:59:29 -0400
commit65ac68cb8c3da52f48d9e9334eff8b1392464aad (patch)
treec7617c8b208410c121ae2413d4098206f7049569
parent3ec6cea21a97ac7adc4db4cbb809626a3fdeee7d (diff)
downloadcmd2-git-65ac68cb8c3da52f48d9e9334eff8b1392464aad.tar.gz
Fixed case where extra slash was printing when tab completing users on Windows
-rw-r--r--CHANGELOG.md6
-rwxr-xr-xcmd2.py7
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 83e444b4..a62eacd2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,8 @@
-## 0.8.8 (TBD, 2018)
+## 0.8.9 (TBD 2018)
+* Bug Fixes
+ * Fixed extra slash that could print when tab completing users on Windows
+
+## 0.8.8 (June 28, 2018)
* Bug Fixes
* Prevent crashes that could occur attempting to open a file in non-existent directory or with very long filename
* Enhancements
diff --git a/cmd2.py b/cmd2.py
index b804211a..3d11f6ea 100755
--- a/cmd2.py
+++ b/cmd2.py
@@ -1694,12 +1694,15 @@ class Cmd(cmd.Cmd):
users = []
# Windows lacks the pwd module so we can't get a list of users.
- # Instead we will add a slash once the user enters text that
+ # Instead we will return a result once the user enters text that
# resolves to an existing home directory.
if sys.platform.startswith('win'):
expanded_path = os.path.expanduser(text)
if os.path.isdir(expanded_path):
- users.append(text + os.path.sep)
+ user = text
+ if add_trailing_sep_if_dir:
+ user += os.path.sep
+ users.append(user)
else:
import pwd