Skip to content

Instantly share code, notes, and snippets.

@jkw552403
Created March 25, 2019 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jkw552403/3507e34c261a58a94156c416366e52b6 to your computer and use it in GitHub Desktop.
Save jkw552403/3507e34c261a58a94156c416366e52b6 to your computer and use it in GitHub Desktop.
click share options #python #click
def common_params(func):
@click.option('--foo')
@click.option('--bar')
@functools.wraps(func)
def wrapper(*args, **kwargs):
return func(*args, **kwargs)
return wrapper
@click.command()
@common_params
@click.option('--baz')
def cli(foo, bar, baz):
print(foo, bar, baz)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment