From 5762d5ef8e93429c045d1660b260d4d2d9dcc455 Mon Sep 17 00:00:00 2001 From: Valentin Maerten Date: Tue, 16 Sep 2025 19:34:57 +0200 Subject: [PATCH] fix: autocomplete from subfolder works as expected in zsh shell (#2425) --- completion/zsh/_task | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/completion/zsh/_task b/completion/zsh/_task index ddb888d7..7fe50aed 100755 --- a/completion/zsh/_task +++ b/completion/zsh/_task @@ -16,21 +16,18 @@ function __task_list() { if [[ -n "$taskfile" && -f "$taskfile" ]]; then - enabled=1 cmd+=(--taskfile "$taskfile") - else - for taskfile in {T,t}askfile{,.dist}.{yaml,yml}; do - if [[ -f "$taskfile" ]]; then - enabled=1 - break - fi - done + fi + + + if output=$("${cmd[@]}" $_GO_TASK_COMPLETION_LIST_OPTION 2>/dev/null); then + enabled=1 fi (( enabled )) || return 0 scripts=() - for item in "${(@)${(f)$("${cmd[@]}" $_GO_TASK_COMPLETION_LIST_OPTION)}[2,-1]#\* }"; do + for item in "${(@)${(f)output}[2,-1]#\* }"; do task="${item%%:[[:space:]]*}" desc="${item##[^[:space:]]##[[:space:]]##}" scripts+=( "${task//:/\\:}:$desc" )