Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: completion as if.



On 30 Oct, Matthew Martin wrote:
> On Wed, Oct 30, 2024 at 04:21:12PM -0400, Eric Cook wrote:
> > For years now people have come to irc and asked a question along the lines of
> > `how can i get my command to complete like this other command?' and over time

> Haven't gotten around to finding a way to check the yodl, but this is
> the diff I had (with an addition of local). $service is set and local'd
> by _dispatch which _normal calls, so I don't think _as_if needs to mess
> with it. I'm also curious if there are any issues with this.

I don't see any obvious issue with this and I can believe that users
have a need for an easy way to do this.

I would be inclined to call _dispatch directly. The first two big blocks
of _normal aren't needed but would be harmless other than wasting time
on redundant checks. The use of _set_command possibly is needed, however.
As far as I'm concerned, feel free to commit it in either form.

The nearest thing we have already is.

  compdef command=context

But that does take a context which could be a -value- or -redirect-
or something. And that can't be used as a helper function.

Oliver




Messages sorted by: Reverse Date, Date, Thread, Author