summary refs log tree commit diff
path: root/Completion
diff options
context:
space:
mode:
authorDaniel Shahaf <d.s@daniel.shahaf.name>2016-07-29 17:03:03 +0000
committerDaniel Shahaf <d.s@daniel.shahaf.name>2016-07-31 16:21:29 +0000
commiteaaac9c89f2d71626e6be1a29a3e01b1c42aa5cb (patch)
tree07dffd1e02b548bbd5995df63bd237f00d6f3e36 /Completion
parent774f654e364ad19573cefe9f9d4e4919cdaacfd1 (diff)
downloadzsh-eaaac9c89f2d71626e6be1a29a3e01b1c42aa5cb.tar.gz
zsh-eaaac9c89f2d71626e6be1a29a3e01b1c42aa5cb.tar.xz
zsh-eaaac9c89f2d71626e6be1a29a3e01b1c42aa5cb.zip
38965: _svnadmin: Complete 'freeze' as a precommand.
Diffstat (limited to 'Completion')
-rw-r--r--Completion/Unix/Command/_subversion30
1 files changed, 29 insertions, 1 deletions
diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 08ba0e846..2c21aa740 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -183,6 +183,9 @@ _svn () {
 
 _svnadmin () {
   local curcontext="$curcontext" state line ret=1
+  integer NORMARG
+  local context state_descr
+  typeset -A opt_args
 
   _arguments -C \
     '(-)--help[print help information]' \
@@ -214,11 +217,36 @@ _svnadmin () {
         )
         if [[ $usage == *REPOS_PATH* ]]; then
           args+=( ":repository path:_files -/" )
+          case $cmd in
+            (freeze)
+              args+=( "*:arguments:->normal" )
+              ;;
+          esac
         elif [[ $cmd = help ]]; then
           args+=( "*:subcommand:_svnadmin_commands" )
         fi
 
-        _arguments "$args[@]" && ret=0
+        _arguments -n -s -S : "$args[@]" && ret=0
+
+        case $state in
+          # Test cases:
+          #   svnadmin freeze . rsync --<TAB> offers --file
+          #   svnadmin freeze -- . rsync -<TAB> offers rsync's options
+          #
+          # Note: the NORMARG calculations here include one positional argument
+          # (the '.') before the command.
+          (normal)
+            if (( ${words[(i)--]} < CURRENT )); then
+              words[1,NORMARG]=()
+              (( CURRENT -= NORMARG ))
+              _normal && ret=0
+            elif (( NORMARG+1 == CURRENT )); then
+              # ### don't allow --options in this case
+              # TODO: this should just use '_normal -F "(-*)"', but _normal ignores its arguments.
+              _command_names -e && ret=0
+            fi
+            ;;
+        esac
       else
         _message "unknown svnadmin command: $words[1]"
       fi