* sudo rpm -e completion b0rken
@ 2009-11-21 17:35 Alexey I. Froloff
2009-11-21 18:33 ` Bart Schaefer
0 siblings, 1 reply; 4+ messages in thread
From: Alexey I. Froloff @ 2009-11-21 17:35 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 320 bytes --]
Completion for rpm -e is broken (completes local files, not
packages) when it's going to be executed under sudo. However,
rpm --erase works as expected.
$ rpm -e <Tab>
---- package ----
...
$ sudo rpm -e <Tab>
---- file ----
...
$ sudo rpm --erase <Tab>
---- package ----
...
--
Regards,
Sir Raorn.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: sudo rpm -e completion b0rken
2009-11-21 17:35 sudo rpm -e completion b0rken Alexey I. Froloff
@ 2009-11-21 18:33 ` Bart Schaefer
2010-03-12 15:12 ` [PATCH] Do not look into $words for options, use _arguments powers instead Alexey I. Froloff
0 siblings, 1 reply; 4+ messages in thread
From: Bart Schaefer @ 2009-11-21 18:33 UTC (permalink / raw)
To: Alexey I. Froloff, zsh-workers
On Nov 21, 8:35pm, Alexey I. Froloff wrote:
}
} Completion for rpm -e is broken (completes local files, not
} packages) when it's going to be executed under sudo.
It's not rpm completion that's broken, it's sudo completion, which
believes that the -e is an option of sudo itself.
-e The -e (edit) option indicates that, instead of running a
command, the user wishes to edit one or more files. In lieu of
a command, the string "sudoedit" is used when consulting the
sudoers file.
_sudo has:
if [[ $service = sudoedit || -n $words[(R)-e] ]]; then
args+=(
'*:file: _files'
)
else
...
fi
The file names don't have to directly follow the -e and there are a
bunch of other options that have their own arguments and that may be
used both with and withou -e, so it's not as trivial as this pretends
to determine where the command begins and the sudo options end.
It'd probably require using the _arguments state machine to get this
right; I'm not sure it's worth the effort for this one special case.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] Do not look into $words for options, use _arguments powers instead
2009-11-21 18:33 ` Bart Schaefer
@ 2010-03-12 15:12 ` Alexey I. Froloff
2010-03-12 15:24 ` Alexey I. Froloff
0 siblings, 1 reply; 4+ messages in thread
From: Alexey I. Froloff @ 2010-03-12 15:12 UTC (permalink / raw)
To: Zsh list; +Cc: Alexey I. Froloff
Signed-off-by: Alexey I. Froloff <raorn@altlinux.org>
---
Completion/Unix/Command/_sudo | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/Completion/Unix/Command/_sudo b/Completion/Unix/Command/_sudo
index 23afb40..384e935 100644
--- a/Completion/Unix/Command/_sudo
+++ b/Completion/Unix/Command/_sudo
@@ -25,21 +25,18 @@ args=(
'-S[read password from stdin]'
)
-if [[ $service = sudoedit || -n $words[(R)-e] ]]; then
- args+=(
+if [[ $service = sudoedit ]]; then
+ _arguments $args \
'*:file: _files'
- )
else
- args+=(
- '-b[run command in background]'
- '-E[preserve environment]'
- '-H[set HOME environment variable]'
- '-P[preserve group vector]'
- '(-i)-s[run SHELL]'
- '(-s)-i[simulate login]'
- '(-):command name: _command_names -e'
+ _arguments $args \
+ '(- :)-e[edit file]:*:file:_files' \
+ '(- :)-s[run SHELL]' \
+ '(- :)-i[simulate login]' \
+ '(-i -s -e)-b[run command in background]' \
+ '(-i -s -e)-E[preserve environment]' \
+ '(-i -s -e)-H[set HOME environment variable]' \
+ '(-i -s -e)-P[preserve group vector]' \
+ '(-):command: _command_names -e' \
'*::arguments: _normal'
- )
fi
-
-_arguments $args
--
1.6.6.2
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Do not look into $words for options, use _arguments powers instead
2010-03-12 15:12 ` [PATCH] Do not look into $words for options, use _arguments powers instead Alexey I. Froloff
@ 2010-03-12 15:24 ` Alexey I. Froloff
0 siblings, 0 replies; 4+ messages in thread
From: Alexey I. Froloff @ 2010-03-12 15:24 UTC (permalink / raw)
To: zsh-workers
[-- Attachment #1: Type: text/plain, Size: 338 bytes --]
On Fri, Mar 12, 2010 at 06:12:58PM +0300, Alexey I. Froloff wrote:
> Completion/Unix/Command/_sudo | 25 +++++++++++--------------
> 1 files changed, 11 insertions(+), 14 deletions(-)
This patch seems to work and doesn't break anything on first
sight.
--
Regards, --
Sir Raorn. --- http://thousandsofhate.blogspot.com/
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-03-12 15:24 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-21 17:35 sudo rpm -e completion b0rken Alexey I. Froloff
2009-11-21 18:33 ` Bart Schaefer
2010-03-12 15:12 ` [PATCH] Do not look into $words for options, use _arguments powers instead Alexey I. Froloff
2010-03-12 15:24 ` Alexey I. Froloff
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).