From c25a63a02f081bcf0adc47ba527f624fc411d5cf Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Fri, 22 Aug 2003 14:39:49 +0000 Subject: merge changes back from 4.1 --- ChangeLog | 12 ++++ Completion/Debian/Command/.distfiles | 3 +- Completion/Debian/Command/_debsign | 15 +++++ Completion/Unix/Command/.distfiles | 1 + Completion/Unix/Command/_subversion | 116 +++++++++++++++++++++++++++++++++++ 5 files changed, 146 insertions(+), 1 deletion(-) create mode 100644 Completion/Debian/Command/_debsign create mode 100644 Completion/Unix/Command/_subversion diff --git a/ChangeLog b/ChangeLog index 0aead301e..f1f34ccc8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -61,6 +61,11 @@ * 18872: Completion/Unix/Command/_java: update javac completion for SDK 1.4.x and rename serialvar to serialver +2003-07-20 Clint Adams + + * 18874: Completion/Unix/Command/_subversion: PATH can mean + files too. + 2003-07-17 Oliver Kiddle * 18866: Etc/completion-style-guide: document conventions used @@ -88,6 +93,13 @@ * 18822: Completion/Base/Completer/_expand fix accept-exact style not not bail out when it shouldn't +2003-07-07 Clint Adams + + * 18831: Completion/Unix/Command/_subversion: completion for + svn and svnadmin. + * 18832: Completion/Debian/Command/_debsign: completion for + debsign, by Matt Zimmerman. + 2003-07-04 Oliver Kiddle * 18811: Completion/Unix/Type/_files: needed to quote % in diff --git a/Completion/Debian/Command/.distfiles b/Completion/Debian/Command/.distfiles index c0c1577c3..d0406bfc7 100644 --- a/Completion/Debian/Command/.distfiles +++ b/Completion/Debian/Command/.distfiles @@ -1,7 +1,8 @@ DISTFILES_SRC=' .distfiles -_apt _apt-show-versions _auto-apt +_apt _apt-show-versions _bts _bug _debchange _dpkg _dpkg_source _dput _dupload _update-alternatives _make-kpkg _debfoster +_auto-apt _debsign ' diff --git a/Completion/Debian/Command/_debsign b/Completion/Debian/Command/_debsign new file mode 100644 index 000000000..cd8c96dad --- /dev/null +++ b/Completion/Debian/Command/_debsign @@ -0,0 +1,15 @@ +#compdef debsign + +_arguments \ + '-r[copy .changes file from remote host]: :_user_at_host' \ + '-p[program with which to sign]:program name' \ + '-m[maintainer]:maintainer name and email address' \ + '-e[maintainer]:maintainer name and email address' \ + '-k[key ID to use for signing]:keyid' \ + '-s[argument style for signing program]:gpg or pgp' \ + '-S[look for source-only .changes file]' \ + '-a[architecture]:Debian architecture' \ + '-t[GNU system type]:GNU system type' \ + '--help[display help information]' \ + '--version[display version information]' \ + '*:changes or dsc file:_files -g "*.(changes|dsc)"' diff --git a/Completion/Unix/Command/.distfiles b/Completion/Unix/Command/.distfiles index 6a4d0e929..854fdd4c1 100644 --- a/Completion/Unix/Command/.distfiles +++ b/Completion/Unix/Command/.distfiles @@ -20,4 +20,5 @@ _chkconfig _cdcd _irssi _sccs _texinfo _ant _global _global_tags _figlet _ifconfig _last _larch _lsof _mt _xmlsoft _elinks _tidy _python _antiword _renice _sablotron _cdrecord _aap _du +_subversion ' diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion new file mode 100644 index 000000000..4fea4f72e --- /dev/null +++ b/Completion/Unix/Command/_subversion @@ -0,0 +1,116 @@ +#compdef svn svnadmin svnadmin-static=svnadmin + +_svn () { + + _arguments -s \ + '*::svn command:_svn_command' +} + +_svnadmin () { + + _arguments -s \ + '*::svnadmin command:_svnadmin_command' +} + +(( $+functions[_svn_command] )) || +_svn_command () { + local cmd + + if (( ! $+_svn_cmds )); then + typeset -gA _svn_cmds + _svn_cmds=( + ${=${(f)${${"$(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]//[(),]}// /:}}:} + ) + fi + + if (( CURRENT == 1 )); then + _tags commands && { compadd "$@" -k _svn_cmds || compadd "$@" ${_svn_cmds} } + else + local curcontext="$curcontext" + + cmd="${${(k)_svn_cmds[(R)*:$words[1]:*]}:-${(k)_svn_cmds[(i):$words[1]:]}}" + if (( $#cmd )); then + curcontext="${curcontext%:*:*}:svn-${cmd}:" + _svn_subcommand $cmd + else + _message "unknown svn command: $words[1]" + fi + fi +} + +(( $+functions[_svn_subcommand] )) || +_svn_subcommand () { + local subcmd _svn_subcmds _svn_subcmd_usage + + _svn_subcmd_usage=${${(M)${(f)"$(svn help $1)"}:#usage:*}#usage: $1 } + + _svn_subcmds=( + ${${=${${${(M)${(f)"$(svn help $1)"##*Valid options:}:#*:*}%% #:*}/ arg/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}[2,-1]} + ) + + [[ "$_svn_subcmd_usage" == *URL* ]] && _svn_subcmds=($_svn_subcmds ":url:_urls") + [[ "$_svn_subcmd_usage" == *PATH* ]] && _svn_subcmds=($_svn_subcmds "*:path:_files") + + _arguments \ + "$_svn_subcmds[@]" && ret=0 + + return ret + +} + + +(( $+functions[_svn_admincommand] )) || +_svnadmin_command () { + local cmd + + if (( ! $+_svnadmin_cmds )); then + typeset -gA _svnadmin_cmds + _svnadmin_cmds=( + ${=${(f)${${"$(svnadmin help)"#l#*Available subcommands:}}}/(#s)[[:space:]]#(#b)([a-z]##)[[:space:]]#(\([a-z, ?]##\))#/$match[1] :$match[1]${match[2]:+:${${match[2]//[(),]}// /:}}:} + ) + fi + + if (( CURRENT == 1 )); then + _tags commands && { compadd "$@" -k _svnadmin_cmds || compadd "$@" ${(kv)=_svnadmin_cmds} } + else + local curcontext="$curcontext" + + cmd="${${(k)_svnadmin_cmds[(R)*:$words[1]:*]}:-${(k)_svnadmin_cmds[(i):$words[1]:]}}" + if (( $#cmd )); then + curcontext="${curcontext%:*:*}:svnadmin-${cmd}:" + _svnadmin_subcommand $cmd + else + _message "unknown svnadmin command: $words[1]" + fi + fi +} + +(( $+functions[_svnadmin_subcommand] )) || +_svnadmin_subcommand () { + local subcmd _svnadmin_subcmds _svnadmin_subcmd_usage + + _svnadmin_subcmd_usage=${${(M)${(f)"$(svnadmin help $1)"}:#$1: usage:*}#$1: usage: svnadmin $1 } + + _svnadmin_subcmds=( + ${${=${${${(M)${(f)"$(svnadmin help $1)"##*Valid options:}:#*:*}%% #:*}/ arg/:arg:}/(#b)-([[:alpha:]]) \[--([a-z-]##)\](:arg:)#/(--$match[2])-$match[1]$match[3] (-$match[1])--$match[2]$match[3]}[2,-1]} + ) + + [[ "$_svnadmin_subcmd_usage" == *REPOS_PATH* ]] && + _svnadmin_subcmds=($_svnadmin_subcmds ":path:_files -/") + + _arguments \ + "$_svnadmin_subcmds[@]" && ret=0 + + return ret + +} + + +_subversion () { + case $service in + (svn) _svn "$@" ;; + (svnadmin) _svnadmin "$@" ;; + esac +} + +_subversion "$@" -- cgit 1.4.1