examples/suppress.py
raw| 1 | try: |
| 2 | import click |
| 3 | except ImportError: |
| 4 | print("Please install click for this example") |
| 5 | print(" pip install click") |
| 6 | exit() |
| 7 | |
| 8 | from rich.traceback import install |
| 9 | |
| 10 | install(suppress=[click]) |
| 11 | |
| 12 | |
| 13 | @click.command() |
| 14 | @click.option("--count", default=1, help="Number of greetings.") |
| 15 | def hello(count): |
| 16 | """Simple program that greets NAME for a total of COUNT times.""" |
| 17 | 1 / 0 |
| 18 | for x in range(count): |
| 19 | click.echo(f"Hello {name}!") |
| 20 | |
| 21 | |
| 22 | if __name__ == "__main__": |
| 23 | hello() |