File: 02_declarative.py

package info (click to toggle)
python-rich-click 1.6.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 520 kB
  • sloc: python: 1,017; sh: 25; makefile: 9
file content (28 lines) | stat: -rw-r--r-- 616 bytes parent folder | download | duplicates (2)
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
import click

from rich_click import RichCommand, RichGroup


@click.group(cls=RichGroup)
@click.option("--debug/--no-debug", default=False)
def cli(debug):
    """
    My amazing tool does all the things.

    This is a minimal example based on documentation
    from the 'click' package.

    You can try using --help at the top level and also for
    specific group subcommands.
    """
    click.echo(f"Debug mode is {'on' if debug else 'off'}")


@cli.command(cls=RichCommand)
def sync():
    """Synchronise all your files between two places."""
    click.echo("Syncing")


if __name__ == "__main__":
    cli()