From: Shohei YOSHIDA <syohex@gmail.com>
To: zsh-workers@zsh.org
Cc: Shohei YOSHIDA <syohex@gmail.com>
Subject: [PATCH] Fix gradlew completion
Date: Fri, 22 Sep 2023 11:50:03 +0900 [thread overview]
Message-ID: <20230922025003.33716-1-syohex@gmail.com> (raw)
gradlew is not usually in the PATH so the command to retrieve tasks would fail
due to 'command not found'. So it should execute './gradlew' instead of 'gradle'
if service is gradlew and there is an executable file './gradlew' in current
directory
---
Completion/Unix/Command/_gradle | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/Completion/Unix/Command/_gradle b/Completion/Unix/Command/_gradle
index c1f7c05ee..734429288 100644
--- a/Completion/Unix/Command/_gradle
+++ b/Completion/Unix/Command/_gradle
@@ -91,8 +91,13 @@ if [[ $state == task && ! -prefix - ]]; then
if _cache_invalid $cache_name || ! _retrieve_cache $cache_name; then
zle -R "Generating cache from $gradle_buildfile"
+ local gradle_command=$service
+ if [[ $service == gradlew && -x ./gradlew ]]; then
+ gradle_command='./gradlew'
+ fi
+
# Run gradle/gradlew and retrieve possible tasks.
- for outputline in ${(f)"$($service --build-file $gradle_buildfile -q tasks --all)"}; do
+ for outputline in ${(f)"$($gradle_command --build-file $gradle_buildfile -q tasks --all)"}; do
# Tasks and subprojects each start with a lowercase letter, but whereas tasks are in camelCase, each
# subproject consists of one or more sections of kebab-case, with each section ending in a ':'.
--
2.39.2
next reply other threads:[~2023-09-22 2:50 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 2:50 Shohei YOSHIDA [this message]
2023-09-22 23:36 ` Oliver Kiddle
2023-09-23 3:13 ` Shohei Yoshida
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230922025003.33716-1-syohex@gmail.com \
--to=syohex@gmail.com \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).