* supress suffix (blank) in completion menu (selection)
@ 2001-11-03 20:16 Borsenkow Andrej
2001-11-03 20:27 ` Bart Schaefer
0 siblings, 1 reply; 7+ messages in thread
From: Borsenkow Andrej @ 2001-11-03 20:16 UTC (permalink / raw)
To: ZSH Workers Mailing List
I want to complete prefix of more long word that is known to be
incomplete. I do not want any suffix added (because you have to enter
some data after this prefix anyway). Still menu selection adds blank
when I accept current choice.
To illustrate:
elif compset -P removable_; then
compadd -- cdrom_ floppy_ && return 0
that is part of
removable_cdrom_0://...
i.e. after I completed to removable_cdrom_ I have to enter number.
-andrej
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: supress suffix (blank) in completion menu (selection)
2001-11-03 20:16 supress suffix (blank) in completion menu (selection) Borsenkow Andrej
@ 2001-11-03 20:27 ` Bart Schaefer
2001-11-03 21:59 ` Mandrake urpmi suite completion Borsenkow Andrej
0 siblings, 1 reply; 7+ messages in thread
From: Bart Schaefer @ 2001-11-03 20:27 UTC (permalink / raw)
To: Borsenkow Andrej, ZSH Workers Mailing List
On Nov 3, 11:16pm, Borsenkow Andrej wrote:
}
} I want to complete prefix of more long word that is known to be
} incomplete. I do not want any suffix added
}
} elif compset -P removable_; then
} compadd -- cdrom_ floppy_ && return 0
Unless I'm missing something:
elif compset -P removable_; then
compadd -S '' -- cdrom_ floppy_ && return 0
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 7+ messages in thread
* Mandrake urpmi suite completion
2001-11-03 20:27 ` Bart Schaefer
@ 2001-11-03 21:59 ` Borsenkow Andrej
2001-11-03 22:35 ` Bart Schaefer
2001-11-05 11:25 ` Oliver Kiddle
0 siblings, 2 replies; 7+ messages in thread
From: Borsenkow Andrej @ 2001-11-03 21:59 UTC (permalink / raw)
To: ZSH Workers Mailing List
[-- Attachment #1: Type: text/plain, Size: 705 bytes --]
Bart Schaefer wrote:
> Unless I'm missing something:
>
> elif compset -P removable_; then
> compadd -S '' -- cdrom_ floppy_ && return 0
>
>
Really :)
O.K. attached is completion for (part of) urpmi programs on Mandrake.
urpmi is similar to apt on Debian - you can define install media
(local/removable/ftp/http) and have a list of all available packages
with automatic dependency resolution. It does not include completion for
urpmf or urpmq because I do not quite understand what they are doing
besides teh simplest usage.
Should it go into Completion/Mandrake?
Suggestions for it are welcome. Chmouel, what about adding it to Zsh
RPM? We need update for 4.0.4 anyway.
-andrej
[-- Attachment #2: _urpmi --]
[-- Type: text/plain, Size: 2857 bytes --]
#compdef urpmi urpmi.addmedia urpmi.removemedia urpmi.update
local state context line
typeset -A opt_args
_urpmi_cache_policy() {
[[ -e "$1" && -e /var/lib/urpmi/depslist.ordered && \
"$1" -nt /var/lib/urpmi/depslist.ordered ]] && return 1
return 0
}
case "$service" in
urpmi.addmedia )
_arguments -A '-*' \
"-update[mark as update media]" \
":name of media: " \
":media URL:->media_url" \
": :(with)" \
":relative path to hdlist file: " \
&& return 0
;;
urpmi.removemedia )
_arguments -A '-*' \
"(:)-a[select all media]" \
"(-a)"{,\*}": :->urpmi_media" \
&& return 0
;;
urpmi.update )
_arguments -A '-*' \
"(:)-a[select all non-removable media]" \
"-c[clean /var/cache/urpmi/headers on exit]" \
"*-f[force rebuild of hdlist or base files (if repeated)]" \
"(-a)"{,\*}": :->urpmi_media" \
&& return 0
;;
urpmi )
_arguments -A '-*' \
"(: -)--help[print usage information]" \
"(--help)--update[use only update media]" \
"(--help)--auto[do not ask any questions]" \
"(--help)--auto-select[select the pakages to update]" \
"(--help)--force[preceed even when some packages do not exist]" \
"(--help)--best-output[automatically select text or X interface]" \
"(--help)-a[select all packages matching command line]" \
"(--help -m -M)-m[choose minimum closure of requires (default)]" \
"(--help -m -M)-M[choose maximum closure of requires]" \
"(--help)-c[choose complete method for resolving requires]" \
"(--help)-p[allow search in provides]" \
"(--help -q -v)-q[be quiet]" \
"(--help -q -v)-v[verbose mode]" \
"(--help)"{,\*}": :->urpmi_rpms" \
&& return 0
;;
esac
case "$state" in
media_url )
if compset -P file://; then
_files -W / -/ && return 0
elif compset -P removable_cdrom_\?://; then
_files -/ && return 0
elif compset -P removable_; then
compadd -S "" -- cdrom_ floppy_ && return 0
elif [[ -prefix '(ftp|http):' ]]; then
_url && return 0
else
compadd -- file:// http:// ftp:// removable_
fi
;;
urpmi_media )
local source media brace ret=1
while read source media brace; do
[[ "$brace" != "{" ]] && continue
_wanted urpmi_media expl 'available media' \
compadd -- "$source"
ret=0
done < /etc/urpmi/urpmi.cfg
return "$ret"
;;
urpmi_rpms )
local pkg foo expl
local -a pkgs
if [[ -r /var/lib/urpmi/depslist.ordered ]]; then
if _cache_invalid _urpmi_rpms || ! _retrieve_cache _urpmi_rpms; then
while read pkg foo; do
[[ "$pkg" == (#b)(*)-[^-]##-[^-]## ]] && {
pkgs[$#pkgs+1]=("$match[1]")
}
done < /var/lib/urpmi/depslist.ordered
_store_cache _urpmi_rpms pkgs
fi
_wanted urpmi_rpms expl 'RPM to install' \
compadd -a pkgs && return 0
fi
;;
esac
return 1
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mandrake urpmi suite completion
2001-11-03 21:59 ` Mandrake urpmi suite completion Borsenkow Andrej
@ 2001-11-03 22:35 ` Bart Schaefer
2001-11-05 11:25 ` Oliver Kiddle
1 sibling, 0 replies; 7+ messages in thread
From: Bart Schaefer @ 2001-11-03 22:35 UTC (permalink / raw)
To: Borsenkow Andrej, ZSH Workers Mailing List
On Nov 4, 12:59am, Borsenkow Andrej wrote:
}
} O.K. attached is completion for (part of) urpmi programs on Mandrake.
}
} Should it go into Completion/Mandrake?
I imagine so.
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mandrake urpmi suite completion
2001-11-03 21:59 ` Mandrake urpmi suite completion Borsenkow Andrej
2001-11-03 22:35 ` Bart Schaefer
@ 2001-11-05 11:25 ` Oliver Kiddle
2001-11-10 12:50 ` Chmouel Boudjnah
2001-11-14 14:32 ` PATCH: " Borsenkow Andrej
1 sibling, 2 replies; 7+ messages in thread
From: Oliver Kiddle @ 2001-11-05 11:25 UTC (permalink / raw)
To: Borsenkow Andrej; +Cc: ZSH Workers Mailing List
Borsenkow Andrej wrote:
>
> O.K. attached is completion for (part of) urpmi programs on Mandrake.
> Should it go into Completion/Mandrake?
Sounds like as good a place as any.
> Suggestions for it are welcome.
Okay, here's a few suggestions then:
> urpmi )
> "(--help)--auto-select[select the pakages to update]" \
You've got a typo here: ^^^
> case "$state" in
> media_url )
> if compset -P file://; then
> _files -W / -/ && return 0
Is that right? If so, uprmi is using a dodgy file url format. After
file:// it would normally be a hostname with file names occurring after
file:/. You're also losing the _urls feature of completing the current
directory after `file:' which I find really useful.
If it would be useful here, it would be easy to modify _urls to take -/
in addition to -g (which it already takes and passes to _files).
> elif compset -P removable_cdrom_\?://; then
> _files -/ && return 0
> elif compset -P removable_; then
> compadd -S "" -- cdrom_ floppy_ && return 0
> elif [[ -prefix '(ftp|http):' ]]; then
> _url && return 0
Do you mean _urls there?
> else
> compadd -- file:// http:// ftp:// removable_
An _wanted with description would be nice here (and similarly further
above).
Oliver
_____________________________________________________________________
This message has been checked for all known viruses by the
MessageLabs Virus Scanning Service. For further information visit
http://www.messagelabs.com/stats.asp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Mandrake urpmi suite completion
2001-11-05 11:25 ` Oliver Kiddle
@ 2001-11-10 12:50 ` Chmouel Boudjnah
2001-11-14 14:32 ` PATCH: " Borsenkow Andrej
1 sibling, 0 replies; 7+ messages in thread
From: Chmouel Boudjnah @ 2001-11-10 12:50 UTC (permalink / raw)
To: Oliver Kiddle; +Cc: Borsenkow Andrej, ZSH Workers Mailing List
Oliver Kiddle <okiddle@yahoo.co.uk> writes:
> Is that right? If so, uprmi is using a dodgy file url format. After
> file:// it would normally be a hostname with file names occurring after
yes this is the format of the format.
^ permalink raw reply [flat|nested] 7+ messages in thread
* PATCH: RE: Mandrake urpmi suite completion
2001-11-05 11:25 ` Oliver Kiddle
2001-11-10 12:50 ` Chmouel Boudjnah
@ 2001-11-14 14:32 ` Borsenkow Andrej
1 sibling, 0 replies; 7+ messages in thread
From: Borsenkow Andrej @ 2001-11-14 14:32 UTC (permalink / raw)
To: 'Oliver Kiddle'; +Cc: 'ZSH Workers Mailing List'
[-- Attachment #1: Type: text/plain, Size: 489 bytes --]
> > "(--help)--auto-select[select the pakages to update]" \
>
> You've got a typo here: ^^^
>
fixed.
>
> Do you mean _urls there?
>
Yes, fixed.
> > else
> > compadd -- file:// http:// ftp:// removable_
>
> An _wanted with description would be nice here (and similarly further
> above).
>
Added. Also modified to handle new urpmi-2.0+ removable format.
-andrej
Patch attached, I commit when I get article number back.
[-- Attachment #2: zsh-urpmi.diff --]
[-- Type: application/octet-stream, Size: 3836 bytes --]
Index: Completion/Mandrake/Command/_urpmi
===================================================================
RCS file: _urpmi
diff -N _urpmi
--- /dev/null Thu May 24 22:33:05 2001
+++ _urpmi Wed Nov 14 06:26:42 2001
@@ -0,0 +1,111 @@
+#compdef urpmi urpmi.addmedia urpmi.removemedia urpmi.update
+local state context line
+typeset -A opt_args
+
+_urpmi_cache_policy() {
+ [[ -e "$1" && -e /var/lib/urpmi/depslist.ordered && \
+ "$1" -nt /var/lib/urpmi/depslist.ordered ]] && return 1
+ return 0
+}
+
+case "$service" in
+ urpmi.addmedia )
+ _arguments -A '-*' \
+ "-update[mark as update media]" \
+ ":name of media: " \
+ ":media URL:->media_url" \
+ ": :(with)" \
+ ":relative path to hdlist file: " \
+ && return 0
+ ;;
+ urpmi.removemedia )
+ _arguments -A '-*' \
+ "(:)-a[select all media]" \
+ "(-a)"{,\*}": :->urpmi_media" \
+ && return 0
+ ;;
+ urpmi.update )
+ _arguments -A '-*' \
+ "(:)-a[select all non-removable media]" \
+ "-c[clean /var/cache/urpmi/headers on exit]" \
+ "*-f[force rebuild of hdlist or base files (if repeated)]" \
+ "(-a)"{,\*}": :->urpmi_media" \
+ && return 0
+ ;;
+ urpmi )
+ _arguments -A '-*' \
+ "(: -)--help[print usage information]" \
+ "(--help)--update[use only update media]" \
+ "(--help)--allow-medium-change[allow change of removable media]" \
+ "(--help)--auto[do not ask any questions]" \
+ "(--help)--auto-select[select the packages to update]" \
+ "(--help)--force[preceed even when some packages do not exist]" \
+ "(--help)--best-output[automatically select text or X interface]" \
+ "(--help)-a[select all packages matching command line]" \
+ "(--help -m -M)-m[choose minimum closure of requires (default)]" \
+ "(--help -m -M)-M[choose maximum closure of requires]" \
+ "(--help)-c[choose complete method for resolving requires]" \
+ "(--help)-p[allow search in provides]" \
+ "(--help -q -v)-q[be quiet]" \
+ "(--help -q -v)-v[verbose mode]" \
+ "(--help)"{,\*}": :->urpmi_rpms" \
+ && return 0
+ ;;
+esac
+
+case "$state" in
+ media_url )
+ if compset -P file://; then
+ _files -W / -/ && return 0
+ elif compset -P 'removable_cdrom(|_?)://'; then
+ _files -/ && return 0
+ elif compset -P removable_; then
+ local -a devices
+ locale dev foo
+ while read dev foo; do
+ [[ "$dev" != none ]] && devices=($devices ${dev#/dev/})
+ done < /etc/fstab
+ if [[ "$(rpm -q urpmi)" == urpmi-1.* ]]; then
+ _wanted urpmi_device expl 'device for removable media' \
+ compadd -s _ -S "" -a devices && return 0
+ else
+ _wanted urpmi_device expl 'device for removable media' \
+ compadd -s :// -S "" -a devices && return 0
+ fi
+ elif [[ -prefix '(ftp|http)://' ]]; then
+ _urls && return 0
+ else
+ _wanted urpmi_media_type expl 'type of media' \
+ compadd -- file:// http:// ftp:// removable_
+ fi
+ ;;
+ urpmi_media )
+ local source media brace ret=1
+ while read source media brace; do
+ [[ "$brace" != "{" ]] && continue
+ _wanted urpmi_media expl 'available media' \
+ compadd -- "$source"
+ ret=0
+ done < /etc/urpmi/urpmi.cfg
+ return "$ret"
+ ;;
+ urpmi_rpms )
+ local pkg foo expl
+ local -a pkgs
+ if [[ -r /var/lib/urpmi/depslist.ordered ]]; then
+ if _cache_invalid _urpmi_rpms || ! _retrieve_cache _urpmi_rpms; then
+ while read pkg foo; do
+ [[ "$pkg" == (#b)(*)-[^-]##-[^-]## ]] && {
+ pkgs[$#pkgs+1]=("$match[1]")
+ }
+ done < /var/lib/urpmi/depslist.ordered
+ _store_cache _urpmi_rpms pkgs
+ fi
+ _wanted urpmi_rpms expl 'RPM to install' \
+ compadd -a pkgs && return 0
+ fi
+ ;;
+esac
+
+return 1
+
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2001-11-14 14:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-11-03 20:16 supress suffix (blank) in completion menu (selection) Borsenkow Andrej
2001-11-03 20:27 ` Bart Schaefer
2001-11-03 21:59 ` Mandrake urpmi suite completion Borsenkow Andrej
2001-11-03 22:35 ` Bart Schaefer
2001-11-05 11:25 ` Oliver Kiddle
2001-11-10 12:50 ` Chmouel Boudjnah
2001-11-14 14:32 ` PATCH: " Borsenkow Andrej
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).