diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-04-13 01:11:25 -0400 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2018-04-13 01:11:25 -0400 |
commit | 26a5f4d8b8396a8792ece1b38a8c68c52247fa22 (patch) | |
tree | 87fdc56db1fcdb6cf393958188c14d7f4f2607af /cmd2.py | |
parent | ea5c242ae06b3f31644cc0c62db8157249c6ef6a (diff) | |
download | cmd2-git-26a5f4d8b8396a8792ece1b38a8c68c52247fa22.tar.gz |
Added better check for whether a path is a directory
Diffstat (limited to 'cmd2.py')
-rwxr-xr-x | cmd2.py | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -1600,10 +1600,11 @@ class Cmd(cmd.Cmd): :return: List[str] - a list of possible tab completions """ - # Used to complete ~ and ~user strings with a list of users that have existing home dirs + # Used to complete ~ and ~user strings def complete_users(): - # We are returning ~user strings that resolve to directories, so don't append a space or quote + # We are returning ~user strings that resolve to directories, + # so don't append a space or quote in the case of a single result. self.allow_appended_space = False self.allow_closing_quote = False @@ -1692,7 +1693,7 @@ class Cmd(cmd.Cmd): matches = [c for c in matches if os.path.isdir(c)] # Don't append a space or closing quote to directory - if len(matches) == 1 and not os.path.isfile(matches[0]): + if len(matches) == 1 and os.path.isdir(matches[0]): self.allow_appended_space = False self.allow_closing_quote = False |