Add CLI command
Steps
- Find the CLI entry point. Look for
if __name__ == "__main__":, or amain()function, or a Typer/Click/argparse setup. Don't grep blindly —[project.scripts]inpyproject.tomlnames it. - Match the existing CLI library. If the project uses argparse, stay with argparse — don't introduce Typer mid-project.
- Add the command with a docstring matching surrounding style.
- Wire
--help— every command needs a one-line help string. - Write a test in the project's test file. Use the same test framework already in use.
- Run tests + lint before declaring done.
Failure modes to avoid
- Adding a new CLI library (Typer/Click) when the project already uses argparse.
- Adding a
--verboseflag when the project already has one called--log-level. - Breaking
--helpfor existing commands by changing shared argparse defaults. - Shipping without a test.