Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR migrates the CLI from argparse to typer, providing better type hints and modern CLI patterns. The change simplifies the command registration process by replacing manual argument parsing with typer's decorator-based approach.
Key changes:
- Replaced argparse with typer for CLI implementation
- Updated dependencies to include typer and remove argcomplete
- Simplified command registration using typer decorators
Reviewed Changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| pyproject.toml | Updated dependencies to include typer, removed argcomplete, and changed CLI entry point |
| cli.py | Complete rewrite using typer instead of argparse with decorator-based command registration |
| .devcontainer/post-create.sh | Updated shell completion setup to use typer's built-in completion |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| from adit_radis_shared.cli import commands | ||
| from adit_radis_shared.cli import helper as cli_helper | ||
| from adit_radis_shared.cli import parsers | ||
| from adit_radis_shared.cli.setup import setup_root_parser | ||
|
|
||
| app = typer.Typer( | ||
| context_settings={"help_option_names": ["-h", "--help"]}, | ||
| no_args_is_help=True, | ||
| ) | ||
|
|
||
| app.command()(commands.init_workspace) | ||
| app.command()(commands.randomize_env_secrets) | ||
| app.command()(commands.compose_build) | ||
| app.command()(commands.compose_pull) | ||
| app.command()(commands.compose_up) | ||
| app.command()(commands.compose_down) | ||
| app.command()(commands.stack_deploy) | ||
| app.command()(commands.stack_rm) | ||
| app.command()(commands.lint) | ||
| app.command()(commands.format_code) | ||
| app.command()(commands.test) | ||
| app.command()(commands.shell) | ||
| app.command()(commands.show_outdated) | ||
| app.command()(commands.db_backup) | ||
| app.command()(commands.db_restore) | ||
| app.command()(commands.generate_auth_token) | ||
| app.command()(commands.generate_secure_password) | ||
| app.command()(commands.generate_django_secret_key) | ||
| app.command()(commands.generate_certificate_chain) | ||
| app.command()(commands.generate_certificate_files) | ||
| app.command()(commands.upgrade_postgres_volume) | ||
| app.command()(commands.try_github_actions) | ||
|
|
||
|
|
There was a problem hiding this comment.
The import assumes that all commands in the shared library are compatible with typer. Verify that the imported commands module provides typer-compatible functions, as the previous argparse-based implementation may have different function signatures.
No description provided.