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 Do 08. Apr, 23:51 (+0200):
> On 4 Apr, Jörg Sommer wrote:
> > > The existing `verbose` style is usually used to conditionally add
> > > descriptions to matches, especially where generating those descriptions
> > > is slow or where they're of questionable value.
> >
> > And how about ‘expanded’ or ‘extended’?
> 
> Either of those are fine. Though you've not commented on the approach of
> inverting the sense of the style and using ignore-<something> which I
> think I prefer but I don't know rake so well.

I think rake is like make and I guess they show the uncommended tasks only
with `-A` for the same reason as make can have many internal targets they
aren't of any external use. I would choose the approach of enabling the
additional output which matches the behaviour of rake.

> Just pick whatever you think is best and update the patch with that and
> it should then be good to commit.

So here it is.

Regards Jörg

-- 
„Gesundheit ist dasjenige Maß an Krankheit, das es mir noch erlaubt,
meinen wesentlichen Beschäftigungen nachzugehen.“ (Friedrich Nietzsche)
From 6ba3068957f3ba555f6290f31abd07ada36cd237 Mon Sep 17 00:00:00 2001
Message-Id: <6ba3068957f3ba555f6290f31abd07ada36cd237.1618214528.git.joerg@xxxxxxxx>
From: =?UTF-8?q?J=C3=B6rg=20Sommer?= <joerg@xxxxxxxx>
Date: Tue, 15 Dec 2020 22:32:46 +0100
Subject: [PATCH] Completion/_rake: add zsytle for targets without description

`rake -T` shows only these targets having a description. But it might be
useful to see all. Allow this with the zsytle setting:

zstyle :completion::complete:rake:argument-rest:targets extended true
---
 Completion/Unix/Command/_rake | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Completion/Unix/Command/_rake b/Completion/Unix/Command/_rake
index 8814edaa5..10d621991 100644
--- a/Completion/Unix/Command/_rake
+++ b/Completion/Unix/Command/_rake
@@ -37,7 +37,9 @@ case "$state" in
   ;;
   target)
     local -a targets
-    targets=( ${${(f)"$(_call_program targets $words[1] -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} )
+    local all
+    zstyle -t ":completion:${curcontext}:targets" extended && all=-A
+    targets=( ${${(f)"$(_call_program targets $words[1] $all -sT $opt_args[(I)(-N|--nosearch)] ${(kv)opt_args[(I)(-f|--rakefile)]} 2>/dev/null)"}/(#b)rake ([^ ]##) ##\# (*)/${${match[1]}//:/\\:}:${match[2]:l}} )
     if (( ! ${targets[(I)rake aborted!]} )) then
       _describe -t targets 'rake target' targets && ret=0
     else
-- 
2.31.0

Attachment: signature.asc
Description: PGP signature



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