zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: zsh-users@sunsite.dk
Subject: Re: autocompletion of file url's
Date: Wed, 2 Aug 2006 22:34:21 +0100	[thread overview]
Message-ID: <20060802223421.a65ccae4.p.w.stephenson@ntlworld.com> (raw)
In-Reply-To: <44D11FDF.5060000@sheffield.ac.uk>

On Wed, 02 Aug 2006 22:57:51 +0100
Nathan Haigh <n.haigh@sheffield.ac.uk> wrote:
> I've started using subversion a bit recently and it annoys the hell out
> of me when you have to specify repositories etc with file urls since
> autocompletion doesn't work. e.g.
> 
> svn import tmp/myproject file:///path/to/my/svn/repo

It looks like the completion function is still not all that
sophisticated, so presumably no subversion user up to now has got to
grips with the nitty gritty.  Here's your chance to become a zsh
completion wizard...

The despatcher for subversion commands doesn't have an explicit entry
for "import", so it tries to synthesize it from the help text and
doesn't get it right.  This adds an explicit entry.  I'm guessing the
first argument will usually be a directory, but that can be changed if
not.  The URL completion for the second argument is standard across the
completion system and should be good enough for your purposes.

Say if you come across any more problems; I only use subversion very
occasionally (and the Perforce completion is a good deal more complete
:-)) but it's an important thing to get right.

I've added matching parentheses to the case statement because they
looked nicer.

Index: Completion/Unix/Command/_subversion
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_subversion,v
retrieving revision 1.19
diff -u -r1.19 _subversion
--- Completion/Unix/Command/_subversion	12 Jul 2006 02:40:54 -0000	1.19
+++ Completion/Unix/Command/_subversion	2 Aug 2006 21:33:21 -0000
@@ -34,32 +34,38 @@
         )
 
         case $cmd in;
-          add)
+          (add)
             args+=(
               '*:file:_files -g "*(^e:_svn_controlled:)"'
             )
           ;;
-          commit)
+          (commit)
             args+=(
               '*:file:_files -g "*(e:_svn_status:)"'
             )
           ;;
-          delete)
+          (delete)
             args+=(
               '*:file:_files -g ".svn(/e:_svn_deletedfiles:)"'
             )
           ;;
-          diff)
+          (diff)
             args+=(
 	      '*: : _alternative "files:file:_files -g \*\(e:_svn_status:\)" "urls:URL:_svn_urls"'
 	    )
           ;;
-          help)
+          (help)
             args+=(
               '*::sub command:_svn_commands'
             )
+	  ;;
+	  (import)
+	    args+=(
+		'1:project directory:_files -/'
+		'2:import location: _alternative "files:file:_files" "urls:URL:_svn_urls"'
+	    )
           ;;
-          log)
+          (log)
             args+=(
               '1: : _alternative "files:file:_files -g \*\(e:_svn_controlled:\)" "urls:URL:_svn_urls"'
 	      '*:file:_files -g "*(e:_svn_controlled:)"'
@@ -72,17 +78,17 @@
 	    '*:path or url: _alternative "files:file:_files" "urls:URL:_svn_urls"'
 	    )
 	  ;;
-          resolved)
+          (resolved)
             args+=(
               '*:file:_files -g "*(e:_svn_conflicts:)"'
             )
           ;;
-          revert)
+          (revert)
             args+=(
               '*:file:_files -g "(.svn|*)(/e:_svn_deletedfiles:,e:_svn_status:)"'
             )
           ;;
-          *)
+          (*)
             case $usage in
               *(SRC|DST|TARGET|URL*PATH)*)
                 args+=(

-- 
Peter Stephenson <p.w.stephenson@ntlworld.com>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/


  reply	other threads:[~2006-08-02 21:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-02 21:57 Nathan Haigh
2006-08-02 21:34 ` Peter Stephenson [this message]
2006-08-03  9:29   ` Nathan Haigh
2006-08-03  9:16     ` Peter Stephenson
2006-08-03 10:09     ` Nathan Haigh
2006-08-03  9:21       ` Peter Stephenson
2006-08-06  3:21       ` Thor Andreassen
2006-08-03 12:34     ` Clint Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060802223421.a65ccae4.p.w.stephenson@ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).