forked from ewels/rich-click
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05_markdown.py
41 lines (33 loc) · 967 Bytes
/
05_markdown.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import rich_click as click
# Use Markdown (bit of a ridiculous example!)
click.rich_click.USE_MARKDOWN = True
@click.command()
@click.option(
"--input",
type=click.Path(),
help="Input **file**. _[default: a custom default]_",
)
@click.option(
"--type",
default="files",
show_default=True,
help="Type of file to sync",
)
@click.option("--all", is_flag=True, help="Sync\n 1. all\n 2. the\n 3. things?")
@click.option(
"--debug/--no-debug",
"-d/-n",
default=False,
help="# Enable `debug mode`",
)
def cli(input, type, all, debug):
"""
My amazing tool does _**all the things**_.
This is a `minimal example` based on documentation from the [_click_ package](https://click.palletsprojects.com/).
> Remember:
> - You can try using --help at the top level
> - Also for specific group subcommands.
"""
print(f"Debug mode is {'on' if debug else 'off'}")
if __name__ == "__main__":
cli()