Skip to content

feat(cli): add dynamic shell completions and ValueHint annotations#758

Merged
joshrotenberg merged 1 commit intomainfrom
feat/shell-completion-improvements
Mar 1, 2026
Merged

feat(cli): add dynamic shell completions and ValueHint annotations#758
joshrotenberg merged 1 commit intomainfrom
feat/shell-completion-improvements

Conversation

@joshrotenberg
Copy link
Collaborator

Summary

  • Enable runtime-aware tab completions via clap_complete's CompleteEnv, adding profile name completion from the config file, file/URL/executable path hints for relevant args
  • Add --register flag to redisctl completions <shell> that prints the shell one-liner for dynamic completion setup
  • Static script generation (redisctl completions <shell>) preserved for backward compatibility

Changes

File What
crates/redisctl/Cargo.toml Enable unstable-dynamic feature on clap_complete
crates/redisctl/src/cli/mod.rs ValueHint annotations (FilePath, Url, ExecutablePath), ArgValueCandidates on --profile, --register flag, profile_candidates() completer
crates/redisctl/src/main.rs CompleteEnv at top of main(), print_registration_command(), updated handler and format_command
docs/docs/reference/shell-completions.md "Dynamic Completions (Recommended)" section, static completions moved to fallback

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p redisctl --all-targets --all-features -- -D warnings
  • cargo test -p redisctl --lib --all-features (72 tests)
  • cargo test -p redisctl --bin redisctl --all-features (105 tests)
  • redisctl completions bash -- static script still generated
  • redisctl completions bash --register -- prints source <(COMPLETE=bash redisctl)
  • Add registration line to shell rc, verify profile names complete with --profile <Tab>

Closes #750

Enable runtime-aware tab completions via clap_complete's CompleteEnv,
adding profile name completion from the config file, file path hints,
URL hints, and executable path hints. Add --register flag to print
the shell one-liner for dynamic completion setup. Static script
generation preserved for backward compatibility.

Closes #750
@joshrotenberg joshrotenberg merged commit 5ef037c into main Mar 1, 2026
25 checks passed
@joshrotenberg joshrotenberg deleted the feat/shell-completion-improvements branch March 1, 2026 18:16
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.

Shell completion improvements (context-aware completions)

1 participant