From 0d7977dad87156b63b15006c75dd76a508b6d788 Mon Sep 17 00:00:00 2001 From: q Date: Fri, 28 Nov 2025 18:17:16 +0200 Subject: [PATCH] add type target --- bake | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/bake b/bake index 4ab301f..1d4f88e 100755 --- a/bake +++ b/bake @@ -1,5 +1,5 @@ #!/bin/bash -## VERSION 23.8.23 +## VERSION 25.11.28 ## BASH-MAKE ========================================================== ## Utility to mimick some of GNU Make behavior, but run in a single ## bash shell. This executable can be used as the Bakefile, too, @@ -51,6 +51,26 @@ _menu() { _flines | while read line; do "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" fi done; } +_type() { if [ -z "$1" ]; then echo Give target name; exit 1; fi; + OLDIFS="$IFS" + IFS='' + while read line; do + if [[ "$line" =~ ([a-zA-Z0-9_\.\-]+)\(\).\{[\ #]*(.*) ]]; then + if [ "${BASH_REMATCH[1]}" = "$1" ]; then + infunction=true + printf "\e[33m%s\e[0m() {\e[36m # %-50s ]\e[0m\n" \ + "${BASH_REMATCH[1]}" "${BASH_REMATCH[2]}" + continue + else + infunction=false + fi + fi + if [ "$infunction" = "true" ]; then + if [ -z "$line" ]; then continue; fi + echo "$line" + fi + done < "$BAKEFILE" + IFS="$OLDIFS"; } _help() { cat <