From 591561f65721f3ae4c349ccd49718e0af2ede04c Mon Sep 17 00:00:00 2001 From: Carl Smedstad Date: Sun, 22 May 2022 16:15:15 +0200 Subject: [PATCH] Address shellcheck warnings in task.bash --- completion/bash/task.bash | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/completion/bash/task.bash b/completion/bash/task.bash index 7c9ae4b5..f70a5758 100644 --- a/completion/bash/task.bash +++ b/completion/bash/task.bash @@ -1,4 +1,4 @@ -# /bin/bash +#!/bin/bash _task_completion() { @@ -7,12 +7,14 @@ _task_completion() case "$cur" in --*) - local options="$(_parse_help task)" - COMPREPLY=( $(compgen -W "$options" -- "$cur") ) + local options + options="$(_parse_help task)" + mapfile -t COMPREPLY < <(compgen -W "$options" -- "$cur") ;; *) - local tasks="$(task --list-all | awk 'NR>1 { sub(/:$/,"",$2); print $2 }')" - COMPREPLY=( $(compgen -W "$tasks" -- "$cur") ) + local tasks + tasks="$(task --list-all | awk 'NR>1 { sub(/:$/,"",$2); print $2 }')" + mapfile -t COMPREPLY < <(compgen -W "$tasks" -- "$cur") ;; esac