Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to invoke a subcommand with defaults #201

Closed
untitaker opened this issue Aug 13, 2014 · 3 comments
Closed

Ability to invoke a subcommand with defaults #201

untitaker opened this issue Aug 13, 2014 · 3 comments

Comments

@untitaker
Copy link
Contributor

I don't want to specify the default values of a subcommand i am invoking, because i don't know which parameters that command is taking.

def test_other_command_invoke_with_defaults(runner):
    @click.command()
    @click.pass_context
    def cli(ctx):
        return ctx.invoke(other_cmd)

    @click.command()
    @click.option('--foo', type=click.INT, default=42)
    def other_cmd(foo):
        click.echo(foo)

    result = runner.invoke(cli, [])
    assert not result.exception
    assert result.output == '42\n'
@mitsuhiko
Copy link
Contributor

This was always the intention and I fixed this in 3.2 now instead of 4.0 because of some internal changes I had to do for this. This is technically a backwards incompatible change but only for a case that was never documented (invoking other commands by passing arguments positionally) so I rather do this now than later when it's impossible.

@argv0
Copy link

argv0 commented Aug 14, 2014

What superb timing! I was trying to figure out what I was doing wrong when I saw the commit go through- works perfectly for me now. Any idea when you'll push 3.2 to pypi?

Click is great, btw- thank you !

  • Andy

Sent from my iPhone

On Aug 14, 2014, at 12:44 AM, Armin Ronacher [email protected] wrote:

This was always the intention and I fixed this in 3.2 now instead of 4.0 because of some internal changes I had to do for this. This is technically a backwards incompatible change but only for a case that was never documented (invoking other commands by passing arguments positionally) so I rather do this now than later when it's impossible.


Reply to this email directly or view it on GitHub.

@mitsuhiko
Copy link
Contributor

Will push it soon. Was hoping for more bugs though :)

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 13, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants