Skip to content

feat: migrate CLI from argparse to click with dynamic shell completion#1

Merged
dacrystal merged 9 commits intomainfrom
feat/click-migration
Apr 7, 2026
Merged

feat: migrate CLI from argparse to click with dynamic shell completion#1
dacrystal merged 9 commits intomainfrom
feat/click-migration

Conversation

@dacrystal
Copy link
Copy Markdown
Owner

Summary

  • Replace argparse with click>=8.0 as the CLI framework
  • Add dynamic shell completion for template names on open and edit commands — completions stay in sync automatically as templates change, no manual maintenance needed
  • Remove the hand-rolled completion subcommand entirely
  • Extract _do_open() helper and inline all cmd_* logic into click command functions
  • Update entry point: devcode:maindevcode:cli

Activation

# bash
eval "$(_DEVCODE_COMPLETE=bash_source devcode)"

# zsh
eval "$(_DEVCODE_COMPLETE=zsh_source devcode)"

Test Plan

  • 184 tests passing (uv run pytest)
  • devcode --help shows banner and all subcommands
  • devcode --version prints version
  • devcode open <TAB> completes template names
  • devcode list works as before

…tpath error

- devcode open now takes <projectpath> [template] (template optional)
- Auto-detects template from container history (running → stopped → default)
- Adds settings.json (~/.config/dev-code/settings.json) replacing DEVCODE_TEMPLATE_PATH
- settings.json auto-created with defaults on first run (default_template: dev-code)
- DEVCODE_CONF_DIR env var overrides config directory
- Errors on non-existent projectpath (bug fix)
- Updates shell completion: template completes at position 3 (not 2)
- Replace argparse with click>=8.0 throughout src/devcode.py
- Add dynamic shell completion for template names (open, edit commands)
- Extract _do_open() helper; inline cmd_* logic into click commands
- Remove hand-rolled completion subcommand (_BASH_COMPLETION, _ZSH_COMPLETION)
- Update entry point: devcode:main → devcode:cli
- Update tests: CliRunner for CLI tests, .callback() for unit tests
- Add _complete_templates tests; 184 tests passing
…l env

_get_version() falls back to "(dev)" when the package is not installed,
preventing PackageNotFoundError when tox runs with skip_install = true.
@codecov-commenter
Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

Thanks for integrating Codecov - We've got you covered ☂️

…groups

- Remove skip_install=true and manual deps list from tox.ini; use
  dependency_groups = test so tox installs the package (and its deps)
  from pyproject.toml properly
- Split dependency-groups into test (pytest, pytest-cov) and dev (tox,
  pyyaml, git-cliff); drop unused pyfiglet
- Add pythonpath = ["src"] to pytest config as safety net for direct runs
…ility

Path separator is \ on Windows; hardcoded forward-slash assertions failed
on windows-latest CI runner.
@dacrystal dacrystal merged commit dbfc60c into main Apr 7, 2026
3 checks passed
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