* Re: a couple of completion questions
@ 2000-06-07 8:50 Sven Wischnowsky
2000-06-07 15:06 ` "antecedents" [was Re: a couple of completion questions] Clint Adams
2000-06-07 15:38 ` _argument sets " Clint Adams
0 siblings, 2 replies; 4+ messages in thread
From: Sven Wischnowsky @ 2000-06-07 8:50 UTC (permalink / raw)
To: zsh-workers
Clint Adams wrote:
> Included at the bottom of this message is my current working copy of _dpkg.
>
> Firstly, is there a simple way to change the _arguments for
> remove|purge|status|listfiles in the state switch to use -A
> without factoring out each case and adding the appropriate
> options?
Sorry, I don't understand... what do you want to do?
> My second question has now been invalidated, so I'll substitute
> these two thoughts: it would be nice if -iR engaged the state engine
> in the same way -i -R or -R -i does;
If I understand you correctly here, than that's what we are discussing
currently in that rpm-thread. I hope to be able to work on this soon.
> and also, the call to _arguments
> used in the state switch for install/record_avail does not behave
> as described in zshcompsys(1), though I'm taking advantage of that.
I know nothing about dpkg and friends. In which way does it behave
differently from what's documented and how do you make use of it
(i.e.: is there something wrong? or only documented in the wrong way?
or should have both what it's doing and what's documented?)?
Bye
Sven
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
^ permalink raw reply [flat|nested] 4+ messages in thread
* "antecedents" [was Re: a couple of completion questions]
2000-06-07 8:50 a couple of completion questions Sven Wischnowsky
@ 2000-06-07 15:06 ` Clint Adams
2000-06-07 15:38 ` _argument sets " Clint Adams
1 sibling, 0 replies; 4+ messages in thread
From: Clint Adams @ 2000-06-07 15:06 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers
> Sorry, I don't understand... what do you want to do?
Okay. I want to use _arguments -A in the state switch at the bottom.
Originally, install and record_avail were the same case, but when I
added -A, they wouldn't complete, so I had to insert the options
that had gotten the user to that state, which is why install and
record_avail are two separate cases now.
I want to avoid making remove, purge, status, and listfiles
four separate cases, yet still retain the -A to _arguments.
My last resort would probably be to define four new arrays with
the short and long options and then use something like
${(P)${:-_dpkg_actions_${state}}}, but I was hoping that there
was a better way.
^ permalink raw reply [flat|nested] 4+ messages in thread
* _argument sets [was Re: a couple of completion questions]
2000-06-07 8:50 a couple of completion questions Sven Wischnowsky
2000-06-07 15:06 ` "antecedents" [was Re: a couple of completion questions] Clint Adams
@ 2000-06-07 15:38 ` Clint Adams
1 sibling, 0 replies; 4+ messages in thread
From: Clint Adams @ 2000-06-07 15:38 UTC (permalink / raw)
To: Sven Wischnowsky; +Cc: zsh-workers
> I know nothing about dpkg and friends. In which way does it behave
> differently from what's documented and how do you make use of it
> (i.e.: is there something wrong? or only documented in the wrong way?
> or should have both what it's doing and what's documented?)?
Okay, first off, this is what I want. <arg> is meant to be
-i, -A, or the long-option equivalents.
dpkg <arg> <TAB> right now completes _files -g \*.deb by default.
If I remove the -A to _arguments, it will complete $_dpkg_options.
Ideally, it should complete _files -g \*.deb, $_dpkg_options,
and $_dpkg_options_recursive, unless one of $_dpkg_options_recursive
is present, in which case it should complete directories instead of
\*.deb. BTW, I swapped the positions of -C and -A to _arguments.
It does this, except for completing $_dpkg_options or
$_dpkg_options_recursive. Or rather, it will for
dpkg --install --<TAB>
dpkg --install -<TAB>
dpkg --install -O<TAB>
but it won't complete for
dpkg --install --a<TAB>
So if I type dpkg --install --<TAB> I get --abort-after,
but if I type --a<TAB>, I get corrections.
^ permalink raw reply [flat|nested] 4+ messages in thread
* a couple of completion questions
@ 2000-06-06 16:25 Clint Adams
0 siblings, 0 replies; 4+ messages in thread
From: Clint Adams @ 2000-06-06 16:25 UTC (permalink / raw)
To: zsh-workers
Included at the bottom of this message is my current working copy of _dpkg.
Firstly, is there a simple way to change the _arguments for
remove|purge|status|listfiles in the state switch to use -A
without factoring out each case and adding the appropriate
options?
My second question has now been invalidated, so I'll substitute
these two thoughts: it would be nice if -iR engaged the state engine
in the same way -i -R or -R -i does; and also, the call to _arguments
used in the state switch for install/record_avail does not behave
as described in zshcompsys(1), though I'm taking advantage of that.
#compdef dpkg dpkg-deb
local _dpkg_deb_actions _dpkg_common_actions _dpkg_actions _dpkg_options
local _dpkg_options_recursive
local curcontext="$curcontext" context state line expl ret
_dpkg_deb_actions=('(--build)-b[build archive]:directory:_files -/' \
'(-b)--build:directory:_files -/' \
'(--contents)-c[list contents]:Debian package:_files -g \*.deb' \
'(-c)--contents:Debian package:_files -g \*.deb' \
'(--info)-I[show info]:Debian package:_files -g \*.deb' \
'(-I)--info:Debian package:_files -g \*.deb' \
'(--field)-f[show fields]:Debian package:_files -g \*.deb' \
'(-f)--field:Debian package:_files -g \*.deb' \
'(--control)-e[extract control]:Debian package:_files -g \*.deb' \
'(-e)--control:Debian package:_files -g \*.deb' \
'(--extract)-x[extract files]:Debian package:_files -g \*.deb' \
'(-x)--extract:Debian package:_files -g \*.deb' \
'(--vextract)-X[extract and list files]:Debian package:_files -g \*.deb' \
'(-X)--vextract[extract and list]:Debian package:_files -g \*.deb' \
'--fsys-tarfile[output fs tarfile]:Debian package:_files -g \*.deb')
_dpkg_common_actions=('--help[show help]' \
'--version[show version]' \
'(--license)--licence[show licencing]' \
'(--licence)--license[show licensing]')
_dpkg_actions=('(--install)-i[install packages]:*:Debian packages:->install' \
'(-i)--install:*:Debian packages:->install' \
'--unpack[unpack package]:Debian package:_files -g \*.deb' \
'--configure:*:package:->configure' \
'(--remove)-r[remove package]:*:package:->remove' \
'(-r)--remove:*:package:->remove' \
'(--purge)-P[purge package]:*:package:->purge' \
'(-P)--purge:*:package:->purge' \
'(--print-avail)-p[display available details]:packages:_deb_packages avail' \
'(-p)--print-avail:packages:_deb_packages avail' \
'--update-avail[update available]:package file:_files' \
'--merge-avail[merge available]:package file:_files' \
'(--record-avail)-A[record available]:*:package files:->record_avail' \
'(-A)--record-avail:*:package files:->record_avail' \
'--forget-old-unavail[forget uninstalled unavailable]' \
'--clear-avail[clear available]' \
'(--list)-l[list packages]:*:packages:->list' \
'(-l)--list:*:packages:->list' \
'(--status)-s[display package status]:*:packages:->status' \
'(-s)--status:*:packages:->status' \
'(--audit)-C[check for broken pkgs]' \
'(-C)--audit' \
'--get-selections[get selections]:pattern:' \
'--set-selections[set selections]' \
'--yet-to-unpack[list uninstalled]' \
'(--listfiles)-L[list owned files]:*:packages:->listfiles' \
'(-L)--listfiles:*:packages:->listfiles' \
'(--search)-S[search for file owner]:*:pattern:->search' \
'(-S)--search:*:pattern:->search' \
'--print-architecture[print target architecture]' \
'--print-gnu-build-architecture[print GNU version of target architecture]' \
'--print-installation-architecture[print host architecture]' \
'--compare-versions[compare version numbers]:*:expression:->compare_versions')
_dpkg_options=('--abort-after[abort after errors]:number of errors:' \
'--admindir=[data directory]:directory:_files -/' \
'--root=[alternative root]:root:_files -/' \
'--instdir=[change inst root but not data dir]:_files -/' \
'(--selected-only)-O[skip unselected packages]' \
'(-O)--selected-only' \
'(--skip-same-version)-E[skip packages with same version as installed]' \
'(-E)--skip-same-version' \
'(--refuse-downgrade)-G[skip packages with earlier version than installed]' \
'(-G)--refuse-downgrade' \
'(--auto-deconfigure)-B[install can break other packages]' \
'(-B)--auto-deconfigure' \
'--largemem[optimize for >4Mb RAM]' \
'--smallmem[optimize for <4Mb RAM]' \
'--no-act[show potential actions but do not follow through]' \
'-D+[debug options]:debug options:(h 1 2 3)' \
'--debug=[debug options]:debug options:(help 1 2 3)' \
'--ignore-depends=[ignore depends involving package]:package:_deb_packages avail' \
--{force,refuse,no-force}'--[forcing options]:what:(auto-select downgrade configure-any hold bad-path not-root overwrite overwrite-diverted depends-version depends confnew confold confdef confmiss conflicts architecture overwrite-dir remove-reinstreq remove-essential)')
_dpkg_options_recursive=('(--recursive)-R[recursive]' '(-R)--recursive')
case "${words[1]:t}" in
dpkg)
_arguments -C -s "$_dpkg_actions[@]" \
"$_dpkg_deb_actions[@]" \
"$_dpkg_common_actions[@]" \
"$_dpkg_options[@]" \
"$_dpkg_options_recursive[@]"
;;
dpkg-deb)
_arguments "$_dpkg_deb_actions[@]" \
"$_dpkg_common_actions[@]"
;;
esac
case "$state" in
install)
_funcall ret _dpkg_$state && return ret
_arguments -A -C -s '(--install)-i[install packages]' \
'(-i)--install' \
"$_dpkg_options[@]" \
- recur \
'(--recursive)-R[recursive]' \
'(-R)--recursive' \
':directory:_files -/' \
- nonrecur \
':Debian package:_files -g \*.deb' \
;;
record_avail)
_funcall ret _dpkg_$state && return ret
_arguments -A -C -s '(--record-avail)-A[record available]' \
'(-A)--record-avail' \
"$_dpkg_options[@]" \
- recur \
'(--recursive)-R[recursive]' \
'(-R)--recursive' \
':directory:_files -/' \
- nonrecur \
':Debian package:_files -g \*.deb' \
;;
remove|purge|status|listfiles)
_funcall ret _dpkg_$state && return ret
_arguments -A -C -s "$_dpkg_options[@]" \
'*:package:_deb_packages installed'
;;
list)
_funcall ret _dpkg_$state && return ret
_arguments -A -C -s "$_dpkg_options[@]" \
'*:packages:_deb_packages avail' \
;;
compare_versions)
_funcall ret _dpkg_$state && return ret
_arguments -A -C -s "$_dpkg_options[@]" \
'2:version A:' \
'3:operator:(lt le eq ne ge gt lt-nl le-nl ge-nl gt-nl)' \
'4:version B:'
;;
configure)
_funcall ret _dpkg_$state && return ret
_arguments -A -C -s '--configure' \
"$_dpkg_options[@]" \
'(--pending)-a[pending packages]' \
'(-a)--pending' \
'*:package:_deb_packages installed' \
;;
esac
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2000-06-07 15:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-06-07 8:50 a couple of completion questions Sven Wischnowsky
2000-06-07 15:06 ` "antecedents" [was Re: a couple of completion questions] Clint Adams
2000-06-07 15:38 ` _argument sets " Clint Adams
-- strict thread matches above, loose matches on Subject: below --
2000-06-06 16:25 a couple of completion questions Clint Adams
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).