commit c58c4b6e26ea1bc22466000456415d718275fc45 parent 7e850905d55511ad97343cbd94d6306519c251aa Author: Jacob R. Edwards <jacob@jacobedwards.org> Date: Sun, 22 Jun 2025 17:04:23 -0500 Add support for costs.awk trim variable Diffstat:
| M | costs | | | 15 | ++++++++++++--- | 
1 file changed, 12 insertions(+), 3 deletions(-)
diff --git a/costs b/costs @@ -6,10 +6,19 @@ filter=cat while test $# -gt 0 do case "$1" in - (-t) filter=./total.awk ;; + (-t) total=1 ;; (-p) filter=./percentage.awk ;; + (-d) + n="${2:?-d: requires argument}" + shift + if test "$n" -eq 0; then + total=1 + else + trim="$n" + fi + ;; (-*) - echo "usage: ${0##*/} [-tp] [args ...] + echo "usage: ${0##*/} [-tp] [-d depth] [args ...] error: $1: invalid option" 1>&2 exit 1 ;; (*) break ;; @@ -17,4 +26,4 @@ error: $1: invalid option" 1>&2 shift done -costs.awk "$@" | $filter +costs.awk ${trim:+-vtrim="$trim"} ${total:+-vtotal=1} "$@" | $filter
