Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Completion function for bitkeeper?
- X-seq: zsh-users 6749
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Danek Duvall <duvall@xxxxxxxxxxx>
- Subject: Re: Completion function for bitkeeper?
- Date: Fri, 07 Nov 2003 20:17:45 +0100
- Cc: Jonas Juselius <jonas@xxxxxx>, zsh-users@xxxxxxxxxx
- In-reply-to: <20031106153225.GA491@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20030523160020.GA9026@xxxxxxxxx> <20030523160155.GA14388@xxxxxxxxxxxxxxxxxx> <20031106153225.GA491@xxxxxxxxxxxxxxxxxx>
Danek Duvall wrote:
>
> If someone can explain me out of my confusion in the first big comment,
> that'd be really nice, but what I have appears to work.
> # If _sccsfiles is called from one of the _sccs_* functions, then
> # it'll have some compadd options added after the first word, so
> # the positional parameters are not all "ours".
> #
> # One option is to precede the call to _sccsfiles in the optspec's
> # action with a space, which prevents these extra parameters from
> # being passed in. Ugh. See the documentation for _arguments in
> # zshcompsys(1), where it talks about action starting with a space.
> #
> # Instead, remove the first few arguments if they match $expl. Why
> # they're passed in both places I don't know (and this may be a
> # bug).
>
> while [[ -n "$1" && "$1" == "$expl[i]" ]]; do
> shift
> ((++i))
> done
>
> [[ "$1" == "-e" ]] && sfile="SCCS/p."
Try using zparseopts to find and remove that -e option instead:
zparseopts -D -E e=eopt
[[ -n $eopt ]] && sfile="SCCS/p."
Looking inside expl is not a good idea as the array name expl is purely
a convention.
The other thing you can do is use a `-' in the _sccs_* functions from
which you call _sccsfiles. e.g:
_wanted files expl 'sccs file' _sccsfiles -e -
It will then put compadd options after the `-e'. The main use of that
however is when you have "$@" among the arguments and want any
description in it to take precedence over the new one.
Oliver
Messages sorted by:
Reverse Date,
Date,
Thread,
Author