Zsh Mailing List Archive
Messages sorted by:
compadd option passing (Re: Completion function for bitkeeper?)
- X-seq: zsh-workers 19259
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: compadd option passing (Re: Completion function for bitkeeper?)
- Date: Wed, 19 Nov 2003 17:18:55 +0000
- In-reply-to: <29608.1069237406@xxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20031106153225.GA491@xxxxxxxxxxxxxxxxxx> <1281.1068232665@athlon> <20031110182013.GA20547@xxxxxxxxxxxxxxxxxx> <9219.1068538977@xxxxxxxxxxx> <20031111162338.GD23138@xxxxxxxxxxxxxxxxxx> <901.1068577572@athlon> <20031111212828.GA28125@xxxxxxxxxxxxxxxxxx> <29114.1068797096@xxxxxxxxxxx> <20031114154608.GA6959@xxxxxxxxxxxxxxxxxx> <15744.1069084060@xxxxxxxxxxx> <20031117175151.GA24060@xxxxxxxxxxxxxxxxxx> <29608.1069237406@xxxxxxxxxxx>
[redirected to zsh-workers]
On Nov 19, 11:23am, Oliver Kiddle wrote:
} I agree that it isn't ideal. The best alternative I can think of would
} be to pass compadd options to the various tag handling functions
} instead of the completion functions.
That makes it harder for people writing simple completion functions to
make use of the compadd options, though. Maybe that never comes up, but
it seems an unnecessary limitation.
I suggest instead that we choose a single option (or other syntactic
marker) that is documented as being passed to completion functions to
delimit the compadd options from the any options of the function itself.
E.g. soemthing like "everything between -o and a bare '-' is a compadd
completion_func ... -o compadd options here - ...
That specific suggestion probably won't work because a hyphen may appear
as an argument to -S or -P or -r etc., but you get the idea.
Alternately always pass the compadd options in an array parameter, and
use such a "reserved option" of completion_func to specify the name of
compaddopts=( ... )
completion_func ... -o compaddopts ...
In either of the above scenarios, completion functions can avoid name
clashes by extracting the -o option with zparseopts and storing the
resuting array in a local before declaring any other locals whose names
might conflict. The docs could include sample code for this that could
be cut'n'pasted into new completion functions.
Messages sorted by: