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

Adding extra option to click.CommandCollection ? #341

Open
yspanchal opened this issue May 12, 2015 · 6 comments
Open

Adding extra option to click.CommandCollection ? #341

yspanchal opened this issue May 12, 2015 · 6 comments
Labels

Comments

@yspanchal
Copy link

Hi,

I want to add extra option to click.CommandCollection.

cli = click.CommandCollection(sources=[account, user], context_settings=CONTEXT_SETTINGS)

if __name__ == __main__:
        cli()

i want to add --xyz option to cli command

cli --xyz

@untitaker
Copy link
Contributor

import click

@click.group()
def cli1():
    pass

@cli1.command()
def cmd1():
    """Command on cli1"""

@click.group()
def cli2(foo):
    pass

@cli2.command()
def cmd2():
    """Command on cli2"""

@click.command(cls=click.CommandCollection, sources=[cli1, cli2])
@click.option('--foo')
def cli(foo):
    pass

if __name__ == '__main__':
    cli()

I think this should be added to the docs, not sure if it works completely as expected though.

@untitaker untitaker added the docs label May 13, 2015
@yspanchal
Copy link
Author

@untitaker thank you... its done...!!! :)

@untitaker
Copy link
Contributor

I'll leave this open because the docs should explain this.

@untitaker untitaker reopened this May 14, 2015
@lordnynex
Copy link

👍

@mindw
Copy link

mindw commented Feb 28, 2017

Does it make sense to document it given #347 ?

@jcrotts
Copy link
Contributor

jcrotts commented May 15, 2018

This should be documented after a fix is implemented in #347.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants