Skip to content
Myr

Fix bug preventing completion on subcommands

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

authored by Nic Wiles · committed by Nic Wiles · parent 3363233 · Browse files · 2 files+12 added−1 removed
This commit

State

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

Diff stats

2 files+12 added−1 removed

  • other:+12 added−1 removed

2 files+12 added−1 removed

modified:click/_bashcomplete.py+1 added-1 removed
28 unmodified lines
2930def resolve_ctx(cli, prog_name, args):31 ctx = cli.make_context(prog_name, args, resilient_parsing=True)32 while ctx.args + ctx.protected_args and isinstance(ctx.command, MultiCommand):33 a = ctx.args + ctx.protected_args33 a = ctx.protected_args + ctx.args34 cmd = ctx.command.get_command(ctx, a[0])35 if cmd is None:36 return None37 ctx = cmd.make_context(a[0], a[1:], parent=ctx, resilient_parsing=True)
61 unmodified lines
modified:examples/bashcompletion/bashcompletion.py+11 added
3 unmodified lines
4@click.group()5def cli():6 pass789@cli.command()10@click.option('-c', '--count', type=click.INT, default=1)11@click.argument("first", type=click.STRING, autocompletion=["John", "Bob", "Fred"])12@click.argument("last", type=click.STRING, autocompletion=["Smith", "Simon", "Doe"])
13 unmodified lines
26@cli.command()27def cmd3():28 pass2930@click.group()31def group():32 pass3334@group.command()35@click.argument("color", type=click.STRING, autocompletion=['red', 'green', 'blue'])36def subcmd(color):37 click.echo('Color is: %s' % color)3839cli.add_command(group)