zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH 1/2] Complete 'svnadmin freeze' as a precommand.
@ 2016-07-29 17:03 Daniel Shahaf
  2016-07-29 17:03 ` [PATCH 2/2] _svnadmin: Complete positional arguments for 'hotcopy', 'setlog', 'setrevprop', 'delrevprop' Daniel Shahaf
  0 siblings, 1 reply; 2+ messages in thread
From: Daniel Shahaf @ 2016-07-29 17:03 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_subversion | 30 +++++++++++++++++++++++++++++-
 1 file changed, 29 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 08ba0e8..5bbc033 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH 2/2] _svnadmin: Complete positional arguments for 'hotcopy', 'setlog', 'setrevprop', 'delrevprop'.
  2016-07-29 17:03 [PATCH 1/2] Complete 'svnadmin freeze' as a precommand Daniel Shahaf
@ 2016-07-29 17:03 ` Daniel Shahaf
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Shahaf @ 2016-07-29 17:03 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Command/_subversion | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/Completion/Unix/Command/_subversion b/Completion/Unix/Command/_subversion
index 5bbc033..945b9d6 100644
--- a/Completion/Unix/Command/_subversion
+++ b/Completion/Unix/Command/_subversion
@@ -221,6 +221,18 @@ _svnadmin () {
             (freeze)
               args+=( "*:arguments:->normal" )
               ;;
+            (hotcopy)
+              args+=( ":new repository:_files -/" )
+              ;;
+            (setlog)
+              args+=( ": :_files" )
+              ;;
+            (setrevprop)
+              args+=( ":property name" ":property value file:_files" )
+              ;;
+            (delrevprop)
+              args+=( ":property name" )
+              ;;
           esac
         elif [[ $cmd = help ]]; then
           args+=( "*:subcommand:_svnadmin_commands" )


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-29 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-29 17:03 [PATCH 1/2] Complete 'svnadmin freeze' as a precommand Daniel Shahaf
2016-07-29 17:03 ` [PATCH 2/2] _svnadmin: Complete positional arguments for 'hotcopy', 'setlog', 'setrevprop', 'delrevprop' Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).