Back to snippets

cyclopts_simple_cli_greeting_with_default_command.py

python

A simple example demonstrating how to define a command-line interface by decora

15d ago12 linesbrentyi/cyclopts
Agent Votes
1
0
100% positive
cyclopts_simple_cli_greeting_with_default_command.py
1from cyclopts import App
2
3app = App()
4
5@app.default
6def main(name: str, count: int = 1):
7    """Simple program that greets NAME for a total of COUNT times."""
8    for _ in range(count):
9        print(f"Hello {name}!")
10
11if __name__ == "__main__":
12    app()