Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Bug#246305: zsh: completion for sudo doesn't add commands under root's path
- X-seq: zsh-workers 19861
- From: Clint Adams <clint@xxxxxxx>
- To: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- Subject: Re: Bug#246305: zsh: completion for sudo doesn't add commands under root's path
- Date: Sat, 1 May 2004 01:02:29 -0400
- Cc: 246305-submitter@xxxxxxxxxxxxxxx, zsh-workers@xxxxxxxxxx
- In-reply-to: <1040430162512.ZM1310@xxxxxxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <877jw0gzp3.wl@xxxxxxxxxxxxxxxxxxxxxxxxxx> <20040428130449.GA3198@xxxxxxxxxxx> <1040428160206.ZM29342@xxxxxxxxxxxxxxxxxxxxxxx> <20040430122712.GA2985@xxxxxxxxxxx> <17443.1083331282@xxxxxxxxxxxxxxxxxxxxx> <20040430153937.GA4644@xxxxxxxxxxx> <1040430162512.ZM1310@xxxxxxxxxxxxxxxxxxxxxxx>
This is how to achieve the equivalent effects with the patch at the
bottom, which could probably use some deuglification/optimization.
Should I commit?
> zstyle ':completion:*:sudo:*' command-path delete . .. '../*'
zstyle -e ':completion:*:sudo:*' command-path 'reply=(${path:#(.|..|../*})'
> zstyle ':completion:*:sudo:*' command-path append /usr/local/bin /opt/bin
zstyle -e ':completion:*:sudo:*' command-path 'reply=($path /usr/local/bin /opt/bin)'
> zstyle ':completion:*:sudo:*' command-path prepend ~/bin /usr/local/bin
zstyle -e ':completion:*:sudo:*' command-path 'reply=(~/bin /usr/local/bin $path)'
> zstyle ':completion:*:sudo:*' command-path assign /bin /usr/bin /usr/sbin
zstyle ':completion:*:sudo:*' command-path /bin /usr/bin /usr/sbin
> (This begs the question of what to do if you want to add things at both
> the end and the beginning.)
zstyle -e ':completion:*:sudo:*' command-path 'reply=(~/bin $path /usr/local/bin /opt/bin)'
Though I don't see the significance of path order.
Index: Completion/Zsh/Type/_command_names
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Type/_command_names,v
retrieving revision 1.6
diff -u -r1.6 _command_names
--- Completion/Zsh/Type/_command_names 3 Sep 2003 10:15:35 -0000 1.6
+++ Completion/Zsh/Type/_command_names 1 May 2004 04:57:49 -0000
@@ -33,4 +33,13 @@
args=( "$@" )
+{
+local -a oldpath
+oldpath=( $path )
+local -A +h commands
+local -a cmdpath
+zstyle -a ":completion:${curcontext}" command-path cmdpath
+local -a +h path
+[[ $#cmdpath -gt 0 ]] && path=( $cmdpath ) || path=( $oldpath )
_alternative -O args "$defs[@]"
+}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author