1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-26 05:51:08 +02:00

unposted: _postfix: Correct quoting in _call_program invocations.

Fixes completion when the command name ('postconf') or the argument to
the -c option ('/etc/postfix') are quoted on the command line, as in

    % postconf -c '/etc/postfix' ... <TAB>
This commit is contained in:
Daniel Shahaf 2016-09-16 04:02:08 +00:00
parent 6914fb298d
commit d523ddaba2
2 changed files with 6 additions and 3 deletions

View file

@ -1,5 +1,8 @@
2016-09-16 Daniel Shahaf <d.s@daniel.shahaf.name>
* unposted: Completion/Unix/Command/_postfix: Correct quoting
in _call_program invocations.
* 39312 (tweaked): Completion/Unix/Command/_postfix: _postfix
(postconf): Complete only applicable parameters for -X and -#.

View file

@ -30,11 +30,11 @@ _postfix_main_cf_parameter() {
#
# don't bother to add -c in this case: the defaults don't depend on the config dir.
_wanted parameters expl 'main.cf parameter' compadd "$@" -- \
${${(f)"$(_call_program postconf_-d "${(q)words[1]} -$kind")"}%% =*}
${${(f)"$(_call_program postconf_-d "${words[1]} -$kind")"}%% =*}
;;
(n)
# Show the values too.
local -a kv=( ${${(f)"$(_call_program postconf_-n "${(q)words[1]} ${opt_args[-c]+"-c ${(q)opt_args[-c]}"} -$kind")"}/ = /:} )
local -a kv=( ${${(f)"$(_call_program postconf_-n "${words[1]} ${opt_args[-c]+"-c ${opt_args[-c]}"} -$kind")"}/ = /:} )
_describe -t parameters 'main.cf parameter' kv
;;
(*)
@ -50,7 +50,7 @@ _postfix_main_cf_parameter_and_value() {
# completing «postconf foo=bar=<TAB>» would change main.cf. So, don't remove
# it.
if compset -P 1 '*='; then
local value="`_call_program postconf-get-value-at-dir "${(q)words[1]} ${opt_args[-c]+"-c ${(q)opt_args[-c]}"} -h -- ${(q)IPREFIX%=}"`"
local value="`_call_program postconf-get-value-at-dir "${words[1]} ${opt_args[-c]+"-c ${opt_args[-c]}"} -h -- ${(q)IPREFIX%=}"`"
[[ -n $value ]] && compadd "$@" -- $value
else
_postfix_main_cf_parameter d -S=