Skip to content

cli

CLI of fair-python-cookiecutter-demo.

calc

calc(op: CalcOperation, x: int, y: int)

Compute the result of applying an operation on x and y.

Source code in src/fair_python_cookiecutter_demo/cli.py
17
18
19
20
21
@app.command()
def calc(op: CalcOperation, x: int, y: int):
    """Compute the result of applying an operation on x and y."""
    result: int = calculate(op, x, y)
    typer.echo(f"Result: {result}")

hello

hello(name: str)

Greet a person.

Source code in src/fair_python_cookiecutter_demo/cli.py
27
28
29
30
@say.command()
def hello(name: str):
    """Greet a person."""
    print(f"Hello {name}")

goodbye

goodbye(name: str, formal: bool = False)

Say goodbye to a person.

Source code in src/fair_python_cookiecutter_demo/cli.py
33
34
35
36
37
38
39
@say.command()
def goodbye(name: str, formal: bool = False):
    """Say goodbye to a person."""
    if formal:
        print(f"Goodbye {name}. Have a good day.")
    else:
        print(f"Bye {name}!")