Created
September 28, 2018 15:01
-
-
Save drorata/04f9be16e6d3b4fa011ba4e3404d027b to your computer and use it in GitHub Desktop.
Nested groups using click
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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