From 95fc26d4ada850ec58789f5a1aa88dae308c342f Mon Sep 17 00:00:00 2001 From: budimanjojo Date: Sat, 7 May 2022 23:20:08 +0700 Subject: [PATCH] Fix broken completion when no taskfile is found --- completion/fish/task.fish | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/completion/fish/task.fish b/completion/fish/task.fish index 92a7478e..8e5b5fc2 100644 --- a/completion/fish/task.fish +++ b/completion/fish/task.fish @@ -1,5 +1,8 @@ function __task_get_tasks --description "Prints all available tasks with their description" - task -l | sed '1d' | awk '{ $1=""; print $0 }' | sed 's/:\ /\t/g' | string trim + set -l output (task -l 2>&1 < /dev/null | sed '1d' | awk '{ $1=""; print $0 }' | sed 's/:\ /\t/g' | string trim | string split0) + if test $output + echo $output + end end complete -c task -d 'Runs the specified task(s). Falls back to the "default" task if no task name was specified, or lists all tasks if an unknown task name was