mirror of
https://github.com/daylinmorgan/viv.git
synced 2024-11-09 19:13:14 -06:00
28 lines
543 B
Python
Executable file
28 lines
543 B
Python
Executable file
#!/usr/bin/env python3
|
|
"""
|
|
It can be convenient to quickly generate a cli for a short script.
|
|
Or to add simple visualization of data using the wonderful rich library.
|
|
"""
|
|
|
|
__import__("viv").activate("typer", "rich-click") # noqa
|
|
|
|
import typer
|
|
|
|
app = typer.Typer()
|
|
|
|
|
|
@app.command()
|
|
def hello(name: str):
|
|
print(f"Hello {name}")
|
|
|
|
|
|
@app.command()
|
|
def goodbye(name: str, formal: bool = False):
|
|
if formal:
|
|
print(f"Goodbye Ms. {name}. Have a good day.")
|
|
else:
|
|
print(f"Bye {name}!")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
app()
|