Skip to content

Commit

Permalink
fix(complete): Have consistent order across machines
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Sep 4, 2024
1 parent 64e3790 commit 0436e2a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions clap_complete/src/env/shells.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ function _clap_dynamic_completer() {
COMPLETER -- ${words} 2>/dev/null \
)}")
zstyle ":completion:${curcontext}:*" group-name ''
if [[ -n $completions ]]; then
compadd -a completions
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ function _clap_dynamic_completer() {
exhaustive -- ${words} 2>/dev/null \
)}")

zstyle ":completion:${curcontext}:*" group-name ''
if [[ -n $completions ]]; then
compadd -a completions
fi
Expand Down
12 changes: 6 additions & 6 deletions clap_complete/tests/testsuite/zsh.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ fn complete_dynamic_env_toplevel() {
let input = "exhaustive \t\t";
let expected = snapbox::str![[r#"
% exhaustive
--generate --help -V action help last quote
--global --version -h alias hint pacman value
action --generate -h help last quote value
alias --global --help hint pacman -V --version
"#]];
let actual = runtime.complete(input, &term).unwrap();
assert_data_eq!(actual, expected);
Expand All @@ -205,10 +205,10 @@ fn complete_dynamic_env_quoted_help() {
let input = "exhaustive quote \t\t";
let expected = snapbox::str![[r#"
% exhaustive quote
--backslash --double-quotes --single-quotes cmd-backslash cmd-expansions
--backticks --expansions --version cmd-backticks cmd-single-quotes
--brackets --global -V cmd-brackets escape-help
--choice --help -h cmd-double-quotes help
--backslash cmd-backslash cmd-expansions --expansions help
--backticks cmd-backticks cmd-single-quotes --global --single-quotes
--brackets cmd-brackets --double-quotes -h -V
--choice cmd-double-quotes escape-help --help --version
"#]];
let actual = runtime.complete(input, &term).unwrap();
assert_data_eq!(actual, expected);
Expand Down

0 comments on commit 0436e2a

Please sign in to comment.