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

Re: How to get all tagets for rake completion?



Oliver Kiddle schrieb am Mi 31. Mär, 02:10 (+0200):
> On 15 Dec, Jörg Sommer wrote:
> > > > I would like to get all targets for the completion of rake arguments. How
> > > > can I inject an argument to the targets query call or how to replace it? I
> > > > have to pass `-A` to *rake* to get the arguments for the completion.
> 
> Sorry that this patch didn't receive any attention earlier.

No problem. Don't worry.

> To try to understand this, what is the disadvantage of calling rake with
> -A? Does that make it much slower or is it that most users wouldn't want
> "uncommented" targets?

It gives a much huger list and might contain many entries someone will never
use. But I don't know what's common. From my point of view I prefer more
than less.

> Incidentally, _rake doesn't seem to complete the -A option so that must
> be newish.

I found this commit:
https://github.com/ruby/rake/commit/72ac1327d82d85daed68220700ea6873d5b76fe6
from Oct 16, 2012 included in tag rake-0.9.3. I think it's old enough the be
seen as commonly available.

> > What do you think about the attached commit? Is it fine or should I change
> > anything?
> 
> When looking up the style, you should include the tag in the context
> when one is applicable, so ":completion:${curcontext}:targets" in this
> case.

Ah, okay. I must admit, I've never used zsytle queries before. I would make
this change, right?

-    zstyle -t ":completion:${curcontext}" all-targets && all=-A
+    zstyle -t ":completion:${curcontext}:targets" all-targets && all=-A

> As a general principle, it is better to use a style name that has a
> generic meaning. I can't find any existing style along the lines of an
> extra-matches, more-matches, allow-slow-generation etc so unless I've
> missed one you'd need to invent a suitable one. "all-targets" is too
> specific to targets.

How about ‘verbose’?

-- 
Wer geliebt, kann nicht vergessen,
Wer vergisst, hat nie geliebt,
Wer geliebt und doch vergessen,
Hat vergessen, wie man liebt!

Attachment: signature.asc
Description: PGP signature



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