Skip to content

For cli use typer instead of argparse#238

Merged
medihack merged 1 commit intomainfrom
cli-typer
Oct 7, 2025
Merged

For cli use typer instead of argparse#238
medihack merged 1 commit intomainfrom
cli-typer

Conversation

@medihack
Copy link
Member

@medihack medihack commented Oct 7, 2025

No description provided.

Copilot AI review requested due to automatic review settings October 7, 2025 15:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +5 to +36
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)


Copy link

Copilot AI Oct 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
@medihack medihack merged commit 455d7c4 into main Oct 7, 2025
1 check passed
@medihack medihack deleted the cli-typer branch October 7, 2025 15:24
samuelvkwong pushed a commit to samuelvkwong/adit that referenced this pull request Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants