From: Bruno Bonfils <asyd@debian-fr.org>
To: <zsh-workers@sunsite.dk>
Subject: _auto-apt
Date: Tue, 21 May 2002 17:34:23 +0200 [thread overview]
Message-ID: <878z6d1pmo.fsf@jazzland.hash-group.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 446 bytes --]
Hi all,
i attach the _auto-apt completion function that just i finish to
write. But i still have one problem :
_wanted distribution expl 'distribution' compadd -q -S, $distribs
as you can see, user can use one or many distrubitions, comma
separated, thats why i add the -S, So, when i a do
auto-apt -a <tab>
i have the completion for main,contrib,non-free,etc..., but :
auto-apt -a main,<tab> do nothing
I hope you can help me. Regards
[-- Attachment #2: auto-apt completion fonction --]
[-- Type: application/octet-stream, Size: 1715 bytes --]
#compdef auto-apt
#
# Bruno Bonfils, <asyd@zshfr.or>
#
local expl prev ret
prev="$words[CURRENT-1]"
# if there is a command in arguments ?
if [[ -n $words[(r)(run|update|update-local|merge|del|check|list|search|debuilt|status)] ]] ; then
# yes, add completion for command arguments and command options
if [[ -n $words[(r)(update|update-local|merge)] && "$words[CURRENT]" = -* ]] ; then
_wanted option expl 'option' compadd - "-a" && return 0;
fi
if [[ -n $words[(r)(check|list|search)] && "$words[CURRENT]" = -* ]] ; then
_wanted option expl 'option' compadd - "-v" "-f" && return 0;
fi
case $prev in
"run")
_wanted command expl 'command' _files -g '*(/,*)' && return 0 ;;
"del")
_wanted package expl 'package' _deb_packages avail && return 0 ;;
esac
else
# no, add completion for commands or options (and options arguments)
case $prev in
"-a")
local distribs
distribs=("main" "contrib" "non-free" "non-US" "none")
_wanted distribution expl 'distribution' compadd -q -S, $distribs ;;
"-p")
local hooks
hooks=("exec" "open" "access" "stat" "none")
_wanted hook expl 'hook' compadd -q -S, $hooks ;;
"-D")
_wanted file expl 'dbfile' _files ;;
"-F")
_wanted file expl 'filedb' _files ;;
*)
local commands options
commands=("run" "update" "update-local" "merge" "del" "check" "list" "search" "debuild" "status")
options=("-h" "-s" "-y" "-q" "-i" "-X" "-x" "-a" "-p" "-D" "-F" "-L")
if [[ "$words[CURRENT]" = -* ]] ; then
_wanted option expl 'option' compadd - $options
else
_wanted command expl 'command' compadd $commands
fi
;;
esac
return 0
fi
[-- Attachment #3: Type: text/plain, Size: 148 bytes --]
--
Bruno Bonfils KeyID F39DCCF5
Sys Admin GNU/Linux http://www.debian-fr.org
next reply other threads:[~2002-05-21 15:34 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-05-21 15:34 Bruno Bonfils [this message]
2002-05-21 16:03 ` _auto-apt Oliver Kiddle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878z6d1pmo.fsf@jazzland.hash-group.net \
--to=asyd@debian-fr.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).