From 26a5f4d8b8396a8792ece1b38a8c68c52247fa22 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Fri, 13 Apr 2018 01:11:25 -0400 Subject: Added better check for whether a path is a directory --- cmd2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'cmd2.py') diff --git a/cmd2.py b/cmd2.py index a4072250..da26fce3 100755 --- a/cmd2.py +++ b/cmd2.py @@ -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 -- cgit v1.2.1