6
Kind of got it as I started thinking about it after posting... Would be better as a oneliner set to an alias so one can add flags on the fly, but this works:
#!/usr/bin/env bash
# Where to save temporary journal
PROGRESS_JOURNAL_PATH="/tmp/progress.journal"
# Current month as number
MONTH=$(date +%m)
# Need to increment the month with one for loop to work
((MONTH++))
# Clean out the temp journal in case it already exists
echo -e "; Temporary progress journal\n" > "$PROGRESS_JOURNAL_PATH"
for ((COUNTER = 1 ; COUNTER < $MONTH ; COUNTER++)); do
# Append each months transactions until current month within the same date range as today
hledger print -b "$(date +%Y)-$COUNTER-01" -e "$(date +%Y)-$COUNTER-$(date +%d)" >> "$PROGRESS_JOURNAL_PATH"
done
# Print out the command that should run to output
echo "$ hledger -f $PROGRESS_JOURNAL_PATH is -t -M -A"
# Get the result
hledger -f "$PROGRESS_JOURNAL_PATH" is -t -M -A -S