Created
January 1, 2019 18:15
-
-
Save DahlitzFlorian/42114b4d762fcf492c788025e878da48 to your computer and use it in GitHub Desktop.
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 | |
| from tool import __version__ | |
| from tool.custom_decorators import add_version | |
| @click.group() | |
| @click.version_option( | |
| __version__, "-V", "--version", message="%(prog)s, version %(version)s" | |
| ) | |
| @click.pass_context | |
| @add_version | |
| def cli(ctx): | |
| """ | |
| Welcome to the Help Page of tool. | |
| $ tool ... | |
| """ | |
| pass | |
| @cli.command() | |
| @click.option( | |
| "-t", | |
| "--text", | |
| default="Hello World", | |
| help="Text to print" | |
| ) | |
| @click.pass_context | |
| def do(ctx, text): | |
| """Print text.""" | |
| print(text) | |
| if __name__ == "__main__": | |
| cli() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment