How-to: Add a Command¶
Goal¶
Add a new command with typed options and help text.
Steps¶
- Define command on your app.
from sayer import Sayer, Option
app = Sayer()
@app.command()
def sync_users(limit: int = Option(100, help="Maximum users to sync")):
print(f"Syncing {limit} users")
- Run it.
- Verify help.
Notes¶
- Command names default to kebab-case from function names.
- Prefer explicit
help=for every user-facing parameter.