From d303dfa7f59aef999c43e2a7a56aac7099e40454 Mon Sep 17 00:00:00 2001 From: Jun-ichi Takimoto Date: Thu, 28 Dec 2017 11:35:34 +0900 Subject: 42175 + 42177 + 42178: avoid localized output from external commands _call_program and '_arguments --' will call _comp_locale before calling external command for easier analysis of the output. This is disabled by passing an option '-l'. --- Completion/Unix/Command/_subversion | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index b4ccccfae..6a35e9947 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -34,7 +34,7 @@ _svn () { typeset -gHA _svn_cmds if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then _svn_cmds=( - ${=${(f)${${"$(_comp_locale; _call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) if (( $? == 0 )); then _store_cache svn-cmds _svn_cmds @@ -60,14 +60,14 @@ _svn () { if _cache_invalid svn-${cmd}-usage || \ ! _retrieve_cache svn-${cmd}-usage; then - usage=${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] } + usage=${${(M)${(f)"$(_call_program options svn help $cmd)"}:#usage:*}#usage:*$cmd] } _store_cache svn-${cmd}-usage usage fi if _cache_invalid svn-${cmd}-usage || \ ! _retrieve_cache svn-${cmd}-args; then args=( - ${=${${${(M)${(f)"$(_comp_locale; _call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} + ${=${${${(M)${(f)"$(_call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} ) while (( idx=$args[(I)*--accept:arg:] )); do args[(I)*--accept:arg:]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' ) @@ -227,7 +227,7 @@ _svnadmin () { if [[ -n $state ]] && (( ! $+_svnadmin_cmds )); then typeset -gHA _svnadmin_cmds _svnadmin_cmds=( - ${=${(f)${${"$(_comp_locale; _call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([-a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) fi @@ -242,9 +242,9 @@ _svnadmin () { if (( $#cmd )); then curcontext="${curcontext%:*:*}:svnadmin-${cmd}:" - usage=${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd } + usage=${${(M)${(f)"$(_call_program options svnadmin help $cmd)"}:#$cmd: usage:*}#$cmd: usage: svnadmin $cmd } args=( - ${=${${${(M)${(f)"$(_comp_locale; _call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} + ${=${${${(M)${(f)"$(_call_program options svnadmin help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]} ) # All options get {-x+,--long-x=} args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} ) @@ -429,7 +429,7 @@ _svn_props() { _svn_changelists() { local cls - cls=( ${${${(M)${(f)"$(_comp_locale; _call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} ) + cls=( ${${${(M)${(f)"$(_call_program changelists svn status 2>/dev/null)"}:#--- Changelist*}%??}##*\'} ) compadd "$@" -a cls && return 0 } -- cgit v1.2.3 From ffacc9576683aa16a5f48f5b99a7a3c282c6159f Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 7 Feb 2018 20:47:30 +0100 Subject: 42343: complete --config-option to svn more than once --- ChangeLog | 5 +++++ Completion/Unix/Command/_subversion | 44 ++++++++++++++++++++++++++++--------- 2 files changed, 39 insertions(+), 10 deletions(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index 52a2d229a..7fc34cdb9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2018-02-07 Oliver Kiddle + + * 42343: Completion/Unix/Command/_subversion: complete + --config-option more than once + 2018-01-31 Peter Stephenson * 42332: Src/builtin.c, Src/utils.c: special case printf for diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index 6a35e9947..be1f42f85 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -1,4 +1,4 @@ -#compdef svn svnadmin svnadmin-static=svnadmin +#compdef svn svnlite=svn svnadmin svnadmin-static=svnadmin _svn () { local curcontext="$curcontext" state line expl ret=1 @@ -24,7 +24,7 @@ _svn () { zstyle ":completion:*:*:$service:*" cache-policy _svn_caching_policy fi - _arguments -C \ + _arguments -C -A "-*" \ '(-)--help[print help information]' \ '(- *)--version[print client version information]' \ '1: :->cmds' \ @@ -70,29 +70,32 @@ _svn () { ${=${${${(M)${(f)"$(_call_program options svn help $cmd)"#(*Valid options:|(#e))}:#* :*}%% #:*}/ (arg|ARG)/:arg:}/(#b)(-##)([[:alpha:]]##) \[--([a-z-]##)\](:arg:)#/(--$match[3])$match[1]$match[2]$match[4] ($match[1]$match[2])--$match[3]$match[4]} ) while (( idx=$args[(I)*--accept:arg:] )); do - args[(I)*--accept:arg:]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' ) + args[idx]=( --accept'=:automatic conflict resolution action:((working\:working base\:base '"`for i j in p postpone mc mine-conflict tc theirs-conflict mf mine-full tf theirs-full e edit l launch; do print -rn $i\\\\:$j $j\\\\:$j ""; done `"'))' ) done while (( idx=$args[(I)*--c(l|hangelist):arg:] )); do - args[(I)*--c(l|hangelist):arg:]=( \*{--cl,--changelist}'=:change list:_svn_changelists' ) + args[idx]=( \*{--cl,--changelist}'=:change list:_svn_changelists' ) done while (( idx=$args[(I)*--config-dir:arg:] )); do - args[(I)*--config-dir:arg:]=( --config-dir'=:config dir:_directories' ) + args[idx]=( --config-dir'=:config dir:_directories' ) done + while (( idx=$args[(I)*--config-option:arg:] )); do + args[idx]=( '*--config-option=: :_svn_config_options' ) + done while (( idx=$args[(I)*--depth:arg:] )); do - args[(I)*--depth:arg:]=( --depth'=:operation depth (how far to recurse):(empty files immediates infinity)' ) + args[idx]=( --depth'=:operation depth (how far to recurse):(empty files immediates infinity)' ) done while (( idx=$args[(I)*(-F|--file):arg:] )); do - args[(I)*(-F|--file):arg:]=( '(-F --file)'{-F+,--file=}':log message file:_files' ) + args[idx]=( '(-F --file)'{-F+,--file=}':log message file:_files' ) done while (( idx=$args[(I)*--set-depth:arg:] )); do - args[(I)*--set-depth:arg:]=( --set-depth'=[make working copy deeper or shallower]:new depth:(exclude empty files immediates infinity)' ) + args[idx]=( --set-depth'=[make working copy deeper or shallower]:new depth:(exclude empty files immediates infinity)' ) done while (( idx=$args[(I)*--trust-server-cert-failures:arg:] )); do - args[(I)*--trust-server-cert-failures:arg:]=( --trust-server-cert-failures'=:failures:_values -s , "certificate failures to ignore" "unknown-ca[unknown authority]" "cn-mismatch[hostname mismatch]" "expired[certificate expired]" "not-yet-valid[certificate not yet valid]" "other[all other failures]"' ) + args[idx]=( --trust-server-cert-failures'=:failures:_values -s , "certificate failures to ignore" "unknown-ca[unknown authority]" "cn-mismatch[hostname mismatch]" "expired[certificate expired]" "not-yet-valid[certificate not yet valid]" "other[all other failures]"' ) done while (( idx=$args[(I)*--show-item:arg:] )); do # (q) to quote the parentheses in the value - args[(I)*--show-item:arg:]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' ) + args[idx]=( --show-item'=:item key:(('"`for i j in ${(kv)show_item_keys}; do print -rn - $i\\\\:"${(q)j}" ""; done`"'))' ) done # All other options get {-x+,--long-x=} args=( ${args/(#b)(--[A-Za-z0-9-]##):arg:/$match[1]=:arg:} ) @@ -417,6 +420,27 @@ _svnadmin_commands() { compadd "$@" -k _svnadmin_cmds || compadd "$@" ${(s.:.)_svnadmin_cmds} } +(( $+functions[_svn_config_options] )) || +_svn_config_options() { + local -a expl suf + local cfgfile + compset -S ':*' || suf=( -qS : ) + if compset -P 2 '*:'; then + if compset -P '*='; then + _message -e values 'value' + else + _message -e options 'option' + fi + elif compset -P 1 '*:'; then + cfgfile=( ~/.subversion/${(M)${IPREFIX%:}%(config|servers)}(N) /dev/null ) + _description sections expl 'section' + compadd $suf "$expl[@]" ${${${(M)${(f)"$(<${cfgfile[1]})"}:#\[*\]}#\[}%\]} + else + _description config-files expl 'configuration file' + compadd $suf "$expl[@]" config servers + fi +} + (( $+functions[_svn_props] )) || _svn_props() { local properties -- cgit v1.2.3 From 567733906210feaebce94675985eb1e77602bfd8 Mon Sep 17 00:00:00 2001 From: Daniel Shahaf Date: Thu, 8 Feb 2018 15:12:39 +0000 Subject: unposted: _subversion: Support subcommands with hyphens in their names, such as 'shelf-list (shelves)' from upstream 1.10 development versions. --- ChangeLog | 6 ++++++ Completion/Unix/Command/_subversion | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) (limited to 'Completion/Unix/Command/_subversion') diff --git a/ChangeLog b/ChangeLog index 01f0733cb..741fcad60 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2018-02-08 Daniel Shahaf + + * unposted: Completion/Unix/Command/_subversion: Support + subcommands with hyphens in their names, such as 'shelf-list + (shelves)' from upstream 1.10 development versions. + 2018-02-07 Oliver Kiddle * Christian Hesse: 42333: Completion/Unix/Command/_git: Starting diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion index be1f42f85..b7e10c06b 100644 --- a/Completion/Unix/Command/_subversion +++ b/Completion/Unix/Command/_subversion @@ -34,7 +34,7 @@ _svn () { typeset -gHA _svn_cmds if _cache_invalid svn-cmds || ! _retrieve_cache svn-cmds; then _svn_cmds=( - ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ${=${(f)${${"$(_call_program commands svn help)"#l#*Available subcommands:}%%Subversion is a tool*}}/(#s)[[:space:]]#(#b)([a-z-]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} ) if (( $? == 0 )); then _store_cache svn-cmds _svn_cmds -- cgit v1.2.3