parallel: Improve zsh shell completion.

This commit is contained in:
Ole Tange 2023-01-14 00:54:00 +01:00
parent f7074ae561
commit fbe533c3d4

View file

@ -1647,7 +1647,6 @@ sub zsh_competion() {
my @zsh_completion = my @zsh_completion =
("compdef _comp_parallel parallel; ", ("compdef _comp_parallel parallel; ",
"setopt localoptions extended_glob; ", "setopt localoptions extended_glob; ",
"local -a _comp_priv_prefix; ",
"_comp_parallel() { ", "_comp_parallel() { ",
"_arguments "); "_arguments ");
my @och = options_completion_hash(); my @och = options_completion_hash();
@ -1680,8 +1679,8 @@ sub zsh_competion() {
shift @och; shift @och;
} }
push @zsh_completion, push @zsh_completion,
q{'(-)1:command: _command_names -e' }, q{'(-)1:command:{_command_names -e}' },
q{'*::arguments:{ _comp_priv_prefix=( '$words[1]' -n ${(kv)opt_args[(I)(-[ugHEP]|--(user|group|set-home|preserve-env|preserve-groups))]} ) ; _normal }'}, q{'*::arguments:_normal'},
"};\n"; "};\n";
print @zsh_completion; print @zsh_completion;
} }
@ -2102,7 +2101,7 @@ sub options_completion_hash() {
=> \@opt::filter), => \@opt::filter),
"_parset=s[Generate shell code for parset]" => \$opt::_parset, "_parset=s[Generate shell code for parset]" => \$opt::_parset,
("shell-completion|shellcompletion=s". ("shell-completion|shellcompletion=s".
"[Generate shell code for shell completion]" "[Generate shell code for shell completion]:shell:(bash zsh)"
=> \$opt::shellcompletion), => \$opt::shellcompletion),
# Parameter for testing optimal values # Parameter for testing optimal values
"_test=s" => \$opt::_test, "_test=s" => \$opt::_test,