-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Closed
Milestone
Description
Expected Behavior
Three commands. The first takes a subset of the options that the last two take. Each prints the arguments they were called with. All but the first call the one before it via context.forward.
import click
from pprint import pprint
@click.group()
def main():
pass
@main.command()
@click.option('-a')
def first(**kwargs):
print('first')
pprint(kwargs)
@main.command()
@click.option('-a')
@click.option('-b')
@click.pass_context
def second(context, **kwargs):
print('second')
pprint(kwargs)
context.forward(first)
@main.command()
@click.option('-a')
@click.option('-b')
@click.pass_context
def third(context, **kwargs):
print('third')
pprint(kwargs)
context.forward(second)
main()Here's the behavior I expect from each command. Notably, first is called with the same arguments, its declared options, each time.
$ python main.py first
first
{'a': None}
$ python main.py second
second
{'a': None, 'b': None}
first
{'a': None}
$ python main.py third
third
{'a': None, 'b': None}
second
{'a': None, 'b': None}
first
{'a': None}
Actual Behavior
$ python main.py first
first
{'a': None}
$ python main.py second
second
{'a': None, 'b': None}
first
{'a': None, 'b': None} # 'first' is called with 'b' here
$ python main.py third
third
{'a': None, 'b': None}
second
{'a': None, 'b': None}
first
{'a': None} # but not here
Environment
- Python version: 3.7.5
- Click version: 7.1.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels