Skip to content

Add cx completion <shell> subcommand#20

Open
shihyuho wants to merge 1 commit into
ind-igo:masterfrom
shihyuho:feature/shell-completion
Open

Add cx completion <shell> subcommand#20
shihyuho wants to merge 1 commit into
ind-igo:masterfrom
shihyuho:feature/shell-completion

Conversation

@shihyuho

Copy link
Copy Markdown

What

Adds cx completion <shell>, which prints a shell completion script to stdout — same UX as kubectl completion. Supported shells: bash, zsh, fish, powershell, elvish.

source <(cx completion bash)              # current bash shell
cx completion zsh > "${fpath[1]}/_cx"     # zsh
cx completion fish > ~/.config/fish/completions/cx.fish

How

  • Adds the clap_complete dependency.
  • New Completion { shell } subcommand that calls clap_complete::generate with the Cli command factory and writes to stdout.
  • Integration tests covering script generation for each shell plus the unknown-shell error path.
  • README "Shell completion" section and CHANGELOG entry.

Verification

  • cargo build
  • cargo clippy -- -D warnings
  • cargo test ✅ (unit 150 + integration 57; run with --test-threads=1 to avoid pre-existing flakiness in concurrent grammar-download tests, unrelated to this change)

🤖 Generated with Claude Code

Generate shell completion scripts via clap_complete, matching the
`kubectl completion` UX. Supports bash, zsh, fish, powershell, and elvish.

Adds the clap_complete dependency, a `Completion` subcommand that writes
the generated script to stdout, integration tests covering each shell and
the unknown-shell error path, plus README and CHANGELOG entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

1 participant