Merge pull request #2750 from evanunderscore/fix-filescompleter

Fix crash in FastFilesCompleter with no prefix
This commit is contained in:
Bruno Oliveira
2017-09-14 20:11:43 -03:00
committed by GitHub
3 changed files with 5 additions and 3 deletions

View File

@@ -78,7 +78,8 @@ class FastFilesCompleter:
completion = []
globbed = []
if '*' not in prefix and '?' not in prefix:
if prefix[-1] == os.path.sep: # we are on unix, otherwise no bash
# we are on unix, otherwise no bash
if not prefix or prefix[-1] == os.path.sep:
globbed.extend(glob(prefix + '.*'))
prefix += '*'
globbed.extend(glob(prefix))
@@ -98,7 +99,7 @@ if os.environ.get('_ARGCOMPLETE'):
filescompleter = FastFilesCompleter()
def try_argcomplete(parser):
argcomplete.autocomplete(parser)
argcomplete.autocomplete(parser, always_complete_options=False)
else:
def try_argcomplete(parser):
pass