Skip to content
Myr

avoid creating empty list in bash completion if not needed

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Nicholas Wiles · committed by Nicholas Wiles · parent 73a8f11 · Browse files · 1 file+6 added−7 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+6 added−7 removed

  • other:+6 added−7 removed

1 file+6 added−7 removed

modified:click/_bashcomplete.py+6 added-7 removed
102 unmodified lines
103 :param incomplete: the incomplete text to autocomplete104 :param cmd_param: command definition105 :return: all the possible user-specified completions for the param106 """107 choices = []107 if isinstance(cmd_param.type, Choice):109 choices = cmd_param.type.choices108 return cmd_param.type.choices109 elif cmd_param.autocompletion is not None:111 choices = cmd_param.autocompletion(ctx=ctx,112 args=args,113 incomplete=incomplete)114 for c in choices:115 yield c110 return cmd_param.autocompletion(ctx=ctx,111 args=args,112 incomplete=incomplete)113 else:114 return []115116def get_choices(cli, prog_name, args, incomplete):117 """118 :param cli: command definition
75 unmodified lines