Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: dynamic reset of completion widget
- X-seq: zsh-users 8174
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: Zsh User <zsh-users@xxxxxxxxxx>
- Subject: Re: dynamic reset of completion widget
- Date: Thu, 4 Nov 2004 10:39:29 -0800 (PST)
- In-reply-to: <20041104124224.GA9979@xxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <20041104124224.GA9979@xxxxxxxxxx>
- Reply-to: zsh-users@xxxxxxxxxx
On Thu, 4 Nov 2004, Francisco Borges wrote:
> I want to automatically create zsh widgets for python programs using
> python's standard option parser framework (optparse) and I want also to
> be able to make and set this widget on-the-fly.
Seems to me the right way to do this would be to define _first to spot
previously-unknown python scripts and hook them up. Calling _first is
already supported in the completion system, but the default implementation
is a no-op.
E.g.
_first() {
local command=$words[1]
if (( CURRENT > 1 )) && [[ -z $_comps[$command] ]]; then
if [[ $command = *.py ]]; then
eval "$($command --make-zsh-widget)"
compdef _$command $command
fi
fi
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author