Skip to content

Instantly share code, notes, and snippets.

@DahlitzFlorian
Created December 30, 2018 12:27
Show Gist options
  • Select an option

  • Save DahlitzFlorian/45707f23b3a18f63ac07f2f9072d6053 to your computer and use it in GitHub Desktop.

Select an option

Save DahlitzFlorian/45707f23b3a18f63ac07f2f9072d6053 to your computer and use it in GitHub Desktop.
import click
from tool import __version__
@click.group()
@click.version_option(
__version__, "-V", "--version", message="%(prog)s, version %(version)s"
)
@click.pass_context
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