Created
September 19, 2021 15:30
-
-
Save dnicolodi/1d34c0cac02a86d909eaaaca6239cae0 to your computer and use it in GitHub Desktop.
This file contains 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.command() | |
@click.option('--verbose', '-v', type=int, count=True) | |
def main(verbose): | |
print(verbose) | |
# add an option | |
click.option('--times', '-n', type=int)(main) | |
# overwrite the callback | |
callback = main.callback | |
def foo(**kwargs): | |
print(kwargs) | |
kwargs.pop('times') | |
callback(**kwargs) | |
main.callback = foo | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment