feat: migrate CLI from argparse to click with dynamic shell completion#1
Merged
feat: migrate CLI from argparse to click with dynamic shell completion#1
Conversation
…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.
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 ☂️ |
…p_install env" This reverts commit 99aed26.
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
click>=8.0as the CLI frameworkopenandeditcommands — completions stay in sync automatically as templates change, no manual maintenance neededcompletionsubcommand entirely_do_open()helper and inline allcmd_*logic into click command functionsdevcode:main→devcode:cliActivation
Test Plan
uv run pytest)devcode --helpshows banner and all subcommandsdevcode --versionprints versiondevcode open <TAB>completes template namesdevcode listworks as before