Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Flush previous completions only for optionals. Need to think more abo…

…ut when to do the same for positionals.
  • Loading branch information...
commit 32cead8f06cb29067a48f2ba74f9bbc8506e634a 1 parent 45ae8bf
@kislyuk authored
Showing with 6 additions and 4 deletions.
  1. +6 −4 argcomplete/__init__.py
View
10 argcomplete/__init__.py
@@ -225,10 +225,12 @@ def __call__(self, parser, namespace, values, option_string=None):
completer = completers.ChoicesCompleter(active_action.choices)
if completer:
- if not action_is_satisfied(active_action):
- # This means the current action will fail to parse if the word under the cursor is not given
- # to it, so give it exclusive control over completions (flush previous completions)
- completions = []
+ if len(active_action.option_strings) > 0: # only for optionals
+ if not action_is_satisfied(active_action):
+ # This means the current action will fail to parse if the word under the cursor is not given
+ # to it, so give it exclusive control over completions (flush previous completions)
+ debug("Resetting completions because", active_action, "is unsatisfied")
+ completions = []
try:
completions += [c for c in completer(prefix=cword_prefix,
parser=parser,
Please sign in to comment.
Something went wrong with that request. Please try again.