costs

Tool to help you see the impact of recurring costs
git clone git://jacobedwards.org/costs
Log | Files | Refs | README

costs (552B)


      1 #!/bin/sh
      2 # Copyright 2023 Jacob R. Edwards <jacob@jacobedwards.org>
      3 # Wrapper script for costs.awk, total.awk, percentage.awk, etc.
      4 
      5 filter=cat
      6 while test $# -gt 0
      7 do
      8 	case "$1" in
      9 	(-t) total=1 ;;
     10 	(-p) filter=./percentage.awk ;;
     11 	(-d)
     12 		n="${2:?-d: requires argument}"
     13 		shift
     14 		if test "$n" -eq 0; then
     15 			total=1
     16 		else
     17 			trim="$n"
     18 		fi
     19 		;;
     20 	(-*)
     21 		echo "usage: ${0##*/} [-tp] [-d depth] [args ...]
     22 error: $1: invalid option" 1>&2
     23 		exit 1 ;;
     24 	(*) break ;;
     25 	esac
     26 	shift
     27 done
     28 
     29 costs.awk ${trim:+-vtrim="$trim"} ${total:+-vtotal=1} "$@" | $filter