* PATCH: stylistic override to _deb_packages
@ 2000-01-29 22:37 Clint Adams
2000-01-30 1:20 ` Tanaka Akira
2000-02-01 11:08 ` Alexandre Duret-Lutz
0 siblings, 2 replies; 3+ messages in thread
From: Clint Adams @ 2000-01-29 22:37 UTC (permalink / raw)
To: zsh-workers
With this patch, 'packageset' can be used to override the
argument to _deb_packages.
Index: Completion/Debian/_deb_packages
===================================================================
RCS file: /cvs/zsh/zsh/Completion/Debian/_deb_packages,v
retrieving revision 1.1.1.5
diff -u -r1.1.1.5 _deb_packages
--- Completion/Debian/_deb_packages 1999/12/27 21:22:24 1.1.1.5
+++ Completion/Debian/_deb_packages 2000/01/29 22:31:49
@@ -32,16 +32,24 @@
}
_deb_packages () {
- local command="$argv[$#]" expl cachevar
+ local command="$argv[$#]" expl cachevar pkgset
[[ "$command" = (installed|uninstalled|avail) ]] || {
_message "_deb_packages:unknown command: $command"
return
}
+ zstyle -s ":completion${curcontext}" packageset pkgset
+
+ [[ "$pkgset" = (installed|uninstalled|avail|available) ]] || {
+ pkgset="$command"
+ }
+
+ [[ "$pkgset" = "available" ]] && pkgset="avail"
+
expl=("${(@)argv[1,-2]}")
- _deb_packages_updage_$command
+ _deb_packages_updage_$pkgset
_tags packages && compadd "$expl[@]" - "${(e):-"\${(@)$cachevar}"}"
}
Index: Completion/Debian/_dpkg
===================================================================
RCS file: /cvs/zsh/zsh/Completion/Debian/_dpkg,v
retrieving revision 1.1.1.4
diff -u -r1.1.1.4 _dpkg
--- Completion/Debian/_dpkg 1999/12/29 07:44:21 1.1.1.4
+++ Completion/Debian/_dpkg 2000/01/29 22:31:49
@@ -1,7 +1,5 @@
#compdef dpkg dpkg-deb
-local dds
-
_dpkg_deb_args=('(--build)-b[build archive]:directory:_files -/' \
'(-b)--build:directory:_files -/' \
'(--contents)-c[list contents]:Debian package:_files -g \*.deb' \
@@ -22,9 +20,6 @@
'--version[show version]' \
'--licence[show licensing]')
-zstyle -s ':completion${curcontext}:deb:dpkg' status dds
-[[ "$dds" == installed ]] || dds="avail"
-
case "$words[1]" in
dpkg)
_arguments -s '(--install)-i[install packages]:Debian package:_files -g \*.deb' \
@@ -43,8 +38,8 @@
'--merge-avail[merge available]:package file:_files' \
'--clear-avail[clear available]' \
'--forget-old-unavail[forget uninstalled unavailable]' \
- '(--status)-s[display package status]:packages:_deb_packages $dds' \
- '(-s)--status:packages:_deb_packages $dds' \
+ '(--status)-s[display package status]:packages:_deb_packages installed' \
+ '(-s)--status:packages:_deb_packages installed' \
'(--print-avail)-p[display available details]:packages:_deb_packages avail' \
'(-p)--print-avail:packages:_deb_packages avail' \
'(--listfiles)-L[list owned files]:packages:_deb_packages installed' \
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvs/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.1.1.116
diff -u -r1.1.1.116 compsys.yo
--- Doc/Zsh/compsys.yo 2000/01/21 16:33:54 1.1.1.116
+++ Doc/Zsh/compsys.yo 2000/01/29 22:31:50
@@ -546,7 +546,7 @@
used to look up the tt(users-hosts) style
)
item(tt(packages))(
-for packages (e.g. tt(rpm) packages)
+for packages (e.g. tt(rpm) or installed tt(Debian) packages)
)
item(tt(parameters))(
for names of parameters
@@ -1108,6 +1108,15 @@
it will first try to generate matches without inserting the `tt(*)'
and if that yields no matches, it will try again with the `tt(*)'
inserted.
+)
+item(tt(packageset))(
+A style containing an override for the default package set
+for that context. For example,
+
+example(zstyle :completion:complete::dpkg::--status-1 packageset avail)
+
+will cause available packages, rather than only installed packages,
+to be completed for `dpkg --status'.
)
item(tt(path))(
This is used together with the the tt(urls) tag by completion
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: stylistic override to _deb_packages
2000-01-29 22:37 PATCH: stylistic override to _deb_packages Clint Adams
@ 2000-01-30 1:20 ` Tanaka Akira
2000-02-01 11:08 ` Alexandre Duret-Lutz
1 sibling, 0 replies; 3+ messages in thread
From: Tanaka Akira @ 2000-01-30 1:20 UTC (permalink / raw)
To: zsh-workers
In article <20000129173722.A13963@scowler.net>,
Clint Adams <schizo@debian.org> writes:
> - _deb_packages_updage_$command
> + _deb_packages_updage_$pkgset
Oops. `updage' is my typo.
Index: Completion/Debian/_deb_packages
===================================================================
RCS file: /projects/zsh/zsh/Completion/Debian/_deb_packages,v
retrieving revision 1.1.1.6
diff -u -r1.1.1.6 _deb_packages
--- Completion/Debian/_deb_packages 2000/01/30 00:59:22 1.1.1.6
+++ Completion/Debian/_deb_packages 2000/01/30 01:17:37
@@ -2,7 +2,7 @@
# Usage: _deb_packages expl... avail|installed|uninstalled
-_deb_packages_updage_avail () {
+_deb_packages_update_avail () {
if (( ! $+_deb_packages_cache_uninstalled )); then
_deb_packages_cache_avail=(
${(f)"$(apt-cache dumpavail | awk '/^Package:/ { print $2 }')"}
@@ -11,7 +11,7 @@
cachevar=_deb_packages_cache_avail
}
-_deb_packages_updage_installed () {
+_deb_packages_update_installed () {
if (( ! $+_deb_packages_cache_installed )); then
_deb_packages_cache_installed=(
${${${(f)"$(dpkg --get-selections)"}:#*deinstall}%% *}
@@ -20,9 +20,9 @@
cachevar=_deb_packages_cache_installed
}
-_deb_packages_updage_uninstalled () {
- _deb_packages_updage_avail
- _deb_packages_updage_installed
+_deb_packages_update_uninstalled () {
+ _deb_packages_update_avail
+ _deb_packages_update_installed
if (( ! $+_deb_packages_cache_uninstalled )); then
_deb_packages_cache_uninstalled=(
${_deb_packages_cache_avail:#${(j:|:)~${_deb_packages_cache_installed:q}}}
@@ -49,9 +49,9 @@
expl=("${(@)argv[1,-2]}")
- _deb_packages_updage_$pkgset
+ _deb_packages_update_$pkgset
- _tags packages && compadd "$expl[@]" - "${(e):-"\${(@)$cachevar}"}"
+ _tags packages && compadd "$expl[@]" - "${(@P)cachevar}"
}
_deb_packages "$@"
--
Tanaka Akira
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: PATCH: stylistic override to _deb_packages
2000-01-29 22:37 PATCH: stylistic override to _deb_packages Clint Adams
2000-01-30 1:20 ` Tanaka Akira
@ 2000-02-01 11:08 ` Alexandre Duret-Lutz
1 sibling, 0 replies; 3+ messages in thread
From: Alexandre Duret-Lutz @ 2000-02-01 11:08 UTC (permalink / raw)
To: zsh-workers; +Cc: Clint Adams
>>> "Clint" == Clint Adams <schizo@debian.org> writes:
Clint> With this patch, 'packageset' can be used to override the
Clint> argument to _deb_packages.
[...]
This add the completion for this new style.
Index: Completion/Builtins/_zstyle
--- Completion/Builtins/_zstyle Mon, 24 Jan 2000 13:13:23 +0100 Alexandre
+++ Completion/Builtins/_zstyle Tue, 01 Feb 2000 11:58:49 +0100 Alexandre
@@ -42,6 +42,7 @@
menu c:boolauto
numbers c:bool
original c:bool
+ packageset c:packageset
path 'c:_path_files -/'
ports c:_ports
prefix-hidden c:bool
@@ -138,6 +139,11 @@
listwhen)
_wanted values expl 'when to list completions' &&
compadd "$expl[@]" always never sometimes
+ ;;
+
+ packageset)
+ _wanted values expl 'default package set' &&
+ compadd "$expl[@]" available installed uninstalled
;;
progress)
--
Alexandre Duret-Lutz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2000-02-01 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-01-29 22:37 PATCH: stylistic override to _deb_packages Clint Adams
2000-01-30 1:20 ` Tanaka Akira
2000-02-01 11:08 ` Alexandre Duret-Lutz
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).