From fad2c8b5dc5d173cb06a71c6269c4c1a18438963 Mon Sep 17 00:00:00 2001 From: Sebastian Lenzlinger Date: Wed, 18 Jun 2025 00:41:35 +0200 Subject: [PATCH] Fix awk error in tasklib.sh by renaming 'func' variable The variable name 'func' is a reserved builtin in gawk, causing errors when running `./task help`. Renamed to 'funcname' to avoid the conflict. --- shellib/dot-local/lib/shellib/tasklib.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/shellib/dot-local/lib/shellib/tasklib.sh b/shellib/dot-local/lib/shellib/tasklib.sh index 5c90317..db7913c 100644 --- a/shellib/dot-local/lib/shellib/tasklib.sh +++ b/shellib/dot-local/lib/shellib/tasklib.sh @@ -13,7 +13,7 @@ get_function_usage() { local file="${2:-$0}" # Get the function definition and extract Usage: comments - awk -v func="$func_name" ' + awk -v funcname="$func_name" ' /^[[:space:]]*'"$func_name"'[[:space:]]*\(\)/ { in_func = 1 next @@ -37,14 +37,14 @@ show_task_help() { echo "================" echo - for func in $func_list; do + for funcname in $func_list; do # Skip internal functions and the help function itself - if [[ ! "$func" =~ ^(_|show_task_help|list_functions|get_function_usage) ]]; then - local usage=$(get_function_usage "$func" "$file") + if [[ ! "$funcname" =~ ^(_|show_task_help|list_functions|get_function_usage) ]]; then + local usage=$(get_function_usage "$funcname" "$file") if [[ -n "$usage" ]]; then - printf "%-30s %s\n" "$func" "- $usage" + printf "%-30s %s\n" "$funcname" "- $usage" else - printf "%-30s\n" "$func" + printf "%-30s\n" "$funcname" fi fi done