Skip to content

Instantly share code, notes, and snippets.

@drorata
Created September 28, 2018 15:01
Show Gist options
  • Select an option

  • Save drorata/04f9be16e6d3b4fa011ba4e3404d027b to your computer and use it in GitHub Desktop.

Select an option

Save drorata/04f9be16e6d3b4fa011ba4e3404d027b to your computer and use it in GitHub Desktop.
Nested groups using click
import click
@click.group()
def app():
pass
@app.command()
@click.option('-x')
def func1(x):
print("func1 x = %s" % str(x))
@app.command()
@click.option('-y')
def func2(y):
print("func2 y = %s" % str(y))
@app.group()
def subapp():
pass
@subapp.command()
@click.option('-z')
def func3(z):
print("func3 z = %s" % str(z))
if __name__ == "__main__":
app()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment