feat(cli): add dynamic shell completions and ValueHint annotations#758
Merged
joshrotenberg merged 1 commit intomainfrom Mar 1, 2026
Merged
feat(cli): add dynamic shell completions and ValueHint annotations#758joshrotenberg merged 1 commit intomainfrom
joshrotenberg merged 1 commit intomainfrom
Conversation
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
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
clap_complete'sCompleteEnv, adding profile name completion from the config file, file/URL/executable path hints for relevant args--registerflag toredisctl completions <shell>that prints the shell one-liner for dynamic completion setupredisctl completions <shell>) preserved for backward compatibilityChanges
crates/redisctl/Cargo.tomlunstable-dynamicfeature onclap_completecrates/redisctl/src/cli/mod.rsValueHintannotations (FilePath,Url,ExecutablePath),ArgValueCandidateson--profile,--registerflag,profile_candidates()completercrates/redisctl/src/main.rsCompleteEnvat top ofmain(),print_registration_command(), updated handler andformat_commanddocs/docs/reference/shell-completions.mdTest plan
cargo fmt --all -- --checkcargo clippy -p redisctl --all-targets --all-features -- -D warningscargo test -p redisctl --lib --all-features(72 tests)cargo test -p redisctl --bin redisctl --all-features(105 tests)redisctl completions bash-- static script still generatedredisctl completions bash --register-- printssource <(COMPLETE=bash redisctl)--profile <Tab>Closes #750