dev: Runs shellcheck on hledger-simplebal

Shellcheck handled the variable fixups. The pipefail flag avoids another
Shellcheck warning w.r.t. handling pipe failures. This script is so
minimal that it's safe to simply fail the pipe entirely if the hledger
command fails.
This commit is contained in:
Colin Dean 2024-01-22 23:17:20 -05:00 committed by Simon Michael
parent 4faa381ccd
commit 2ac0905c70

View File

@ -3,8 +3,10 @@
# total of `hledger balance`, optionally with arguments, as a single
# machine-readable number. Requires hledger 1.24 or newer.
set -o pipefail
VALUATION_COMMODITY="$"
hledger bal -0 -N -X "$VALUATION_COMMODITY" --infer-market-prices -c "$VALUATION_COMMODITY 1000" --layout=bare "$@" | awk '{print $1}'
hledger bal -0 -N -X "${VALUATION_COMMODITY}" --infer-market-prices -c "${VALUATION_COMMODITY} 1000" --layout=bare "$@" | awk '{print $1}'
# Tired of complex financial reports ? This is a silly but fun and
# occasionally useful script showing how to get "one number" semi-robustly