From b147c7e5d705f3e884156d3e68c12f604014d915 Mon Sep 17 00:00:00 2001 From: Patrick Mulligan Date: Sun, 10 May 2026 07:05:14 -0400 Subject: [PATCH] feat: add --csv flag to atm-transactions helper --- deploy/nixos/atm-transactions.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deploy/nixos/atm-transactions.sh b/deploy/nixos/atm-transactions.sh index 045baec..4ff0a47 100644 --- a/deploy/nixos/atm-transactions.sh +++ b/deploy/nixos/atm-transactions.sh @@ -10,6 +10,7 @@ # atm-transactions --since 2026-02-28 # Since a date # atm-transactions --summary # Summary totals only # atm-transactions --inventory # Current cassette & cashbox state +# atm-transactions --csv # Output as CSV (pipe to file) set -euo pipefail @@ -20,8 +21,10 @@ if [ ! -f "$DB" ]; then exit 1 fi +FORMAT="-column -header" + sql() { - sqlite3 -column -header "$DB" "$1" + sqlite3 $FORMAT "$DB" "$1" } # Parse arguments @@ -31,6 +34,7 @@ SINCE="" SUMMARY=false INVENTORY=false TODAY=false +CSV=false while [[ $# -gt 0 ]]; do case "$1" in @@ -46,6 +50,8 @@ while [[ $# -gt 0 ]]; do SUMMARY=true; shift ;; --inventory) INVENTORY=true; shift ;; + --csv) + CSV=true; FORMAT="-csv -header"; shift ;; -h|--help) echo "Usage: atm-transactions [OPTIONS]" echo "" @@ -56,6 +62,7 @@ while [[ $# -gt 0 ]]; do echo " --today Show today's transactions" echo " --summary Show summary totals" echo " --inventory Show cassette & cashbox state" + echo " --csv Output as CSV (pipe to file)" echo " -h, --help Show this help" exit 0 ;; *)