From: Greg Klanderman <gak@klanderman.net>
To: Zsh list <zsh-workers@zsh.org>
Subject: minor tweak to _subversion remote path completion
Date: Wed, 18 Nov 2009 16:18:34 -0500 [thread overview]
Message-ID: <19204.25770.645957.937135@gargle.gargle.HOWL> (raw)
This follows on to my previous patch:
Add a typeset -A that the _arguments documentation says is required:
| A function calling _arguments with at least one action containing a
| '->string' therefore must declare appropriate local parameters:
| local context state line
| typeset -A opt_args
| to avoid _arguments from altering the global environment.
Add support for the special '^/path/..' style repository paths which
I didn't even know about until making the claim that remote path
completion was now complete to a friend.
thanks,
Greg
Index: Completion/Unix/Command/_subversion
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_subversion,v
retrieving revision 1.29
diff -u -r1.29 _subversion
--- Completion/Unix/Command/_subversion 15 Nov 2009 17:52:02 -0000 1.29
+++ Completion/Unix/Command/_subversion 18 Nov 2009 21:16:57 -0000
@@ -2,6 +2,7 @@
_svn () {
local curcontext="$curcontext" state line expl ret=1
+ typeset -A opt_args
_arguments -C \
'(-)--help[print help information]' \
@@ -207,12 +208,20 @@
(( $+functions[_svn_remote_paths] )) ||
_svn_remote_paths() {
- local expl remfiles remdispf remdispd suf ret=1
+ local expl remfiles remdispf remdispd suf ret=1 pfx='\^/' sub='^/'
- [[ -prefix *://*/ ]] || return 1
+ # prefix must match a valid repository path format, either standard style
+ # schema://host/path/.. or ^/path/.. specifying a path relative to the
+ # root of the working directory repository. In the second form, allow the
+ # leading '^' be escaped in case the user has the extendedglob option set.
+ [[ -prefix *://*/ ]] ||
+ [[ -f .svn/entries && ( -prefix '^/' || -prefix '\^/' ) ]] ||
+ return 1
+
+ # return if remote access is not permitted
zstyle -T ":completion:${curcontext}:" remote-access || return 1
- remfiles=( ${(f)"$(svn list $IPREFIX${PREFIX%%[^./][^/]#} 2>/dev/null)"} )
+ remfiles=( ${(f)"$(svn list $IPREFIX${${PREFIX%%[^/]#}/#$pfx/$sub} 2>/dev/null)"} )
(( $? == 0 )) || return 1
# you might consider trying to return early if $#remfiles is zero,
reply other threads:[~2009-11-18 21:18 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=19204.25770.645957.937135@gargle.gargle.HOWL \
--to=gak@klanderman.net \
--cc=zsh-workers@zsh.org \
/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).