2023-07-07 04:52:41 +03:00
|
|
|
|
#!/usr/bin/env just -f
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# * financial reports/scripts, managed with https://github.com/casey/just
|
|
|
|
|
# ** PUBLIC: the scripts below can be shared in hledger's bin/justfile.
|
|
|
|
|
|
|
|
|
|
# *** PREAMBLE ------------------------------------------------------------
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-07-07 21:16:15 +03:00
|
|
|
|
just := "just -f " + justfile()
|
2023-10-14 07:57:57 +03:00
|
|
|
|
TODAY := `date +%Y-%m-%d`
|
2023-07-07 23:38:43 +03:00
|
|
|
|
|
|
|
|
|
# list the commands available
|
|
|
|
|
@help:
|
2023-10-14 07:57:57 +03:00
|
|
|
|
{{ just }} -lu --list-heading=$'{{ file_name(justfile()) }} commands:\n\
|
|
|
|
|
ARGS can be added to customise reports.\n\
|
2023-07-07 23:38:43 +03:00
|
|
|
|
'
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# XXX we don't quote ARGS properly, so each one must be free of spaces
|
2023-07-07 23:38:43 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# XXX broken
|
|
|
|
|
# # interactively pick a command with the default chooser. Eg: just pick -
|
|
|
|
|
# pick:
|
|
|
|
|
# {{ just }} --choose
|
2023-07-07 23:38:43 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# XXX be careful, runs each selected command immediately. Use mouse to select.
|
2023-07-07 23:38:43 +03:00
|
|
|
|
# interactively view command outputs with fzf and bkt. Eg: just view - --black
|
2023-10-14 07:57:57 +03:00
|
|
|
|
view *ARGS:
|
|
|
|
|
{{ just }} --choose --chooser="fzf --reverse --preview='bkt --ttl=15m --stale=15s -- just {}' {{ ARGS }}"
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# rerun the given command with watchexec whenever local files change
|
|
|
|
|
watch CMD:
|
2023-10-14 07:57:57 +03:00
|
|
|
|
watchexec -- {{ just }} {{ CMD }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# *** IMPORT ------------------------------------------------------------
|
2023-07-07 23:38:43 +03:00
|
|
|
|
|
2023-07-07 04:52:41 +03:00
|
|
|
|
# where to import most hledger transactions from
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# import sources:
|
|
|
|
|
# 1. cash wallets
|
|
|
|
|
# 2. wells fargo bank
|
|
|
|
|
# 3. bank of ireland
|
|
|
|
|
# 4. fidelity
|
|
|
|
|
# 5. paypal
|
2023-07-07 04:52:41 +03:00
|
|
|
|
IMPORTFILES := '\
|
|
|
|
|
wf-bchecking.csv.rules \
|
|
|
|
|
wf-pchecking.csv.rules \
|
|
|
|
|
wf-bsavings.csv.rules \
|
|
|
|
|
wf-psavings.csv.rules \
|
|
|
|
|
bofi-ichecking.csv.rules \
|
2023-10-14 07:57:57 +03:00
|
|
|
|
fidelity.csv.rules \
|
|
|
|
|
paypal.csv \
|
2023-07-07 04:52:41 +03:00
|
|
|
|
'
|
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# get auto-downloadable CSVs, and clean manually-downloaded CSVs
|
|
|
|
|
csv:
|
|
|
|
|
#!/usr/bin/env bash
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# latestcsv PARTIALFILEPATH - list latest non-cleaned CSV with this path
|
|
|
|
|
latestcsv() { ls -t "$1"*.csv | grep -v ".clean" | head -1; }
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
echo "cleaning fidelity csv"
|
|
|
|
|
# remove leading space
|
|
|
|
|
for f in $(latestcsv ~/Downloads/History_for_Account_); do
|
|
|
|
|
g=~/Downloads/$(basename $f csv)clean.csv
|
|
|
|
|
sed -e 's/^ //' $f >$g
|
|
|
|
|
# ls -l $g
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
echo "getting paypal csv..."
|
|
|
|
|
paypaljson | paypaljson2csv > paypal.csv
|
|
|
|
|
# ls -l paypal.csv
|
|
|
|
|
|
|
|
|
|
# get CSVs, then import any new transactions from them to the journal, logging but not printing errors; add --dry to preview
|
|
|
|
|
@csv-import *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
date >>import.log
|
2023-10-14 07:57:57 +03:00
|
|
|
|
{{ just }} csv 2>>import.log || echo "Failed, check import.log"
|
|
|
|
|
hledger import {{ IMPORTFILES }} {{ ARGS }} 2>>import.log || echo "Failed, check import.log"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HOUSEHOLDEKRECENT := "household-recent.journal"
|
|
|
|
|
|
|
|
|
|
# get a household adjustment transaction for last month
|
|
|
|
|
household:
|
|
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
echo "getting household google sheet..."
|
|
|
|
|
date=$(if [ "$(builtin type -p gdate)" ]; then echo gdate; else echo date; fi)
|
|
|
|
|
env household $($date --date -1month +%b) >{{ HOUSEHOLDEKRECENT }}
|
|
|
|
|
|
|
|
|
|
# get a household adjustment transaction for last month, then import it if new; add --dry to preview
|
|
|
|
|
@household-import *ARGS:
|
|
|
|
|
{{ just }} household 2>>import.log || echo "Failed, check import.log"
|
|
|
|
|
hledger import {{ HOUSEHOLDEKRECENT }} -I {{ ARGS }} 2>>import.log || echo "Failed, check import.log"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# show the forecast transactions predicted recently and soon
|
|
|
|
|
@forecast *ARGS:
|
|
|
|
|
hledger print --forecast=15daysago..15days tag:_generated --auto -I {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# import any new forecast transactions; add --dry to preview
|
|
|
|
|
@forecast-import *ARGS:
|
|
|
|
|
echo "forecasting transactions"
|
|
|
|
|
hledger import future.journal --forecast=15daysago..15days --auto -I {{ ARGS }} 2>>import.log || echo "Failed, check import.log"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# get and import all the above; add --dry to preview
|
|
|
|
|
@import *ARGS:
|
|
|
|
|
{{ just }} csv-import {{ ARGS }}
|
|
|
|
|
{{ just }} household-import {{ ARGS }}
|
|
|
|
|
{{ just }} forecast-import {{ ARGS }}
|
|
|
|
|
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show prices for main commodities (default: today's)
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@get-prices *PHFETCHARGS:
|
|
|
|
|
(pricehist fetch -o ledger -s {{ TODAY }} alphavantage EUR/USD {{ PHFETCHARGS }} | sed -E 's/EUR/€/') &
|
|
|
|
|
(pricehist fetch -o ledger -s {{ TODAY }} alphavantage GBP/USD {{ PHFETCHARGS }} | sed -E 's/GBP/£/') &
|
|
|
|
|
(pricehist fetch -o ledger -s {{ TODAY }} alphavantage JPY/USD {{ PHFETCHARGS }} | sed -E 's/JPY/¥/')
|
2023-07-07 04:52:41 +03:00
|
|
|
|
# Parallelised for speed; do slowest last.
|
|
|
|
|
# Output order varies, can be sorted with LC_COLLATE=C.UTF-8 sort or hledger -f- prices.
|
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# *** REPORTS ------------------------------------------------------------
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-07-07 23:38:43 +03:00
|
|
|
|
PERIOD := "1/1..tomorrow"
|
|
|
|
|
|
2023-07-07 04:52:41 +03:00
|
|
|
|
# show balance sheet
|
2023-10-14 07:57:57 +03:00
|
|
|
|
bs *ARGS:
|
|
|
|
|
hledger bs --layout bare --pretty --drop 1 -p {{ PERIOD }} -E -5 {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show income statement
|
2023-10-14 07:57:57 +03:00
|
|
|
|
is *ARGS:
|
|
|
|
|
hledger is --layout bare --pretty --drop 1 -p {{ PERIOD }} -S {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show assets
|
2023-10-14 07:57:57 +03:00
|
|
|
|
a *ARGS:
|
|
|
|
|
hledger bal type:al -H --layout bare --pretty --drop 1 -p {{ PERIOD }} -E {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show revenues
|
2023-10-14 07:57:57 +03:00
|
|
|
|
r *ARGS:
|
|
|
|
|
hledger bal type:r --layout bare --pretty --drop 1 -p {{ PERIOD }} -S --invert {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show expenses
|
2023-10-14 07:57:57 +03:00
|
|
|
|
x *ARGS:
|
|
|
|
|
hledger bal type:x --layout bare --pretty --drop 1 -p {{ PERIOD }} -S --invert {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show assets bar chart
|
2023-10-14 07:57:57 +03:00
|
|
|
|
ab *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
echo "Quarterly net worth:"
|
2023-10-14 07:57:57 +03:00
|
|
|
|
hledger-bar -v 200 -Q type:al -H {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show revenues bar chart
|
2023-10-14 07:57:57 +03:00
|
|
|
|
rb *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
echo "Quarterly revenues:"
|
2023-10-14 07:57:57 +03:00
|
|
|
|
hledger-bar -v 40 -Q type:r --invert {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show expenses bar chart
|
2023-10-14 07:57:57 +03:00
|
|
|
|
xb *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
echo "Quarterly expenses:"
|
2023-10-14 07:57:57 +03:00
|
|
|
|
hledger-bar -v 40 -Q type:x --invert {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# XXX with partial workaround for https://github.com/gooofy/drawilleplot/issues/4
|
2023-10-14 07:57:57 +03:00
|
|
|
|
|
2023-07-07 04:52:41 +03:00
|
|
|
|
# show assets line chart
|
2023-10-14 07:57:57 +03:00
|
|
|
|
al *ARGS:
|
|
|
|
|
hledger plot -- bal --depth=1 type:a --historical --terminal --rcParams '{"figure.figsize":[8,3]}' --no-today -q --title "hledger assets" {{ ARGS }} | sed 's/⠀/ /g'
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show revenues line chart
|
2023-10-14 07:57:57 +03:00
|
|
|
|
rl *ARGS:
|
|
|
|
|
hledger plot -- bal --depth=1 type:r --monthly --invert --terminal --rcParams '{"figure.figsize":[8,3]}' --drawstyle 'steps-mid' --no-today -q --title "hledger monthly revenues" {{ ARGS }} | sed 's/⠀/ /g'
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show expenses line chart
|
2023-10-14 07:57:57 +03:00
|
|
|
|
xl *ARGS:
|
|
|
|
|
hledger plot -- bal --depth=1 type:x --monthly --terminal --rcParams '{"figure.figsize":[8,3]}' --drawstyle 'steps-mid' --no-today -q --title "hledger monthly expenses" {{ ARGS }} | sed 's/⠀/ /g'
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show consulting revenue
|
2023-10-14 07:57:57 +03:00
|
|
|
|
consulting *ARGS:
|
|
|
|
|
hledger reg --invert 'revenues:(cw|ah)' -p {{ PERIOD }} {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# estimated-tax *ARGS :
|
2023-07-07 23:38:43 +03:00
|
|
|
|
# @echo "Federal estimated tax due for this year"
|
|
|
|
|
# $(HLEDGER) register liabilities:personal:tax:federal:$(YEAR) --width=130
|
|
|
|
|
# @echo State estimated tax due for this year:
|
|
|
|
|
# @$(HLEDGER) register liabilities:personal:tax:state:$(YEAR) --width=130
|
|
|
|
|
# @echo
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# *** TIME REPORTS ------------------------------------------------------------
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
set export := true
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# The file where actual time data is logged, for dashboard's stats.
|
|
|
|
|
# This might or might not be the top-level $TIMELOG file.
|
|
|
|
|
#TIMELOGDATA=$TIMELOG
|
2023-10-14 07:57:57 +03:00
|
|
|
|
|
2023-07-07 04:52:41 +03:00
|
|
|
|
YEAR := `date +%Y`
|
|
|
|
|
TIMELOGDATA := 'time-' + YEAR + '.timedot'
|
2023-10-14 07:57:57 +03:00
|
|
|
|
TIMELOGALL := `dirname "$TIMELOG"` + '/time-all.journal'
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# This redisplays only when a file listed by `hledger -f $TIMELOG files` is modified.
|
|
|
|
|
# To force a per minute display as well, have $TIMELOG include a dummy file (.update)
|
|
|
|
|
# and configure a cron job to touch that every minute.
|
|
|
|
|
# (This is better than touching the timelog file itself, which confuses editors.)
|
|
|
|
|
#
|
2023-10-14 07:57:57 +03:00
|
|
|
|
|
2023-07-07 04:52:41 +03:00
|
|
|
|
# show time dashboard, redisplaying when timelog files change
|
2023-10-14 07:57:57 +03:00
|
|
|
|
tdash *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
#!/usr/bin/env bash
|
2023-07-07 21:16:15 +03:00
|
|
|
|
set -euo pipefail
|
2023-07-07 04:52:41 +03:00
|
|
|
|
dir=$(dirname "$TIMELOG")
|
|
|
|
|
cd "$dir"
|
2023-07-07 23:38:43 +03:00
|
|
|
|
opts= #--poll=10 # <- uncomment to fix symlinked files being ignored
|
|
|
|
|
watchexec $opts --no-vcs-ignore \
|
|
|
|
|
--filter-file=<(hledger -f "$TIMELOG" files | sed -E "s|$dir/||g") \
|
2023-10-14 07:57:57 +03:00
|
|
|
|
-c -r {{ just }} tstatus {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show time dashboard, redisplaying every minute with watch
|
2023-10-14 07:57:57 +03:00
|
|
|
|
# dash-1m *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
# watch -n60 -c tt status
|
|
|
|
|
# }
|
|
|
|
|
|
|
|
|
|
# show current time status
|
2023-10-14 07:57:57 +03:00
|
|
|
|
tstatus *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
#!/usr/bin/env bash
|
2023-07-07 21:16:15 +03:00
|
|
|
|
set -euo pipefail
|
2023-07-07 04:52:41 +03:00
|
|
|
|
date=$(if [ "$(builtin type -p gdate)" ]; then echo gdate; else echo date; fi)
|
|
|
|
|
stat=$(if [ "$(builtin type -p gstat)" ]; then echo gstat; else echo stat; fi)
|
|
|
|
|
curtime=$($date +'%H:%M %Z, %a %b %-e %Y')
|
|
|
|
|
modtime=$($date +'%H:%M %Z' -r "$TIMELOGDATA")
|
|
|
|
|
modsecs=$($stat -c %Y "$TIMELOGDATA")
|
|
|
|
|
nowsecs=$($date +%s)
|
|
|
|
|
agesecs=$((nowsecs - modsecs))
|
|
|
|
|
agemins=$(python3 -c "print($agesecs/60)")
|
|
|
|
|
agehrs=$(python3 -c "print($agesecs/3600.0)")
|
|
|
|
|
ageqtrhrs=$(python3 -c "print(round($agesecs/900.0))")
|
2023-10-14 07:57:57 +03:00
|
|
|
|
agedots=$({{ just }} tdots "$ageqtrhrs")
|
2023-07-07 04:52:41 +03:00
|
|
|
|
printf "Current time: %s\n" "$curtime"
|
|
|
|
|
# old, for osh: use env here to run the system printf, which supports floating point
|
|
|
|
|
env printf "Timelog saved: %s, %.0fm / %.1fh / %s ago\n" "$modtime" "$agemins" "$agehrs" "$agedots"
|
|
|
|
|
# Show the current day/week/month budget status.
|
|
|
|
|
printf "Time plans:\n"
|
|
|
|
|
# calculate each period's budget from daily budget
|
2023-10-14 07:57:57 +03:00
|
|
|
|
hledger -f "$TIMELOG" bal -1 -p 'daily today' --budget=Daily {{ ARGS }} | tail +2
|
|
|
|
|
hledger -f "$TIMELOG" bal -1 -p 'weekly this week' --budget=Daily {{ ARGS }} | tail +2
|
|
|
|
|
hledger -f "$TIMELOG" bal -1 -p 'monthly this month' --budget=Daily {{ ARGS }} | tail +2
|
2023-07-07 04:52:41 +03:00
|
|
|
|
# or use each period's specific budget
|
|
|
|
|
# hledger -f "$TIMELOG" bal -p 'daily today' --budget=Daily -1 | tail +2
|
|
|
|
|
# hledger -f "$TIMELOG" bal -p 'weekly this week' --budget=Weekly -1 | tail +2
|
|
|
|
|
# hledger -f "$TIMELOG" bal -p 'monthly this month' --budget=Monthly -1 | tail +2
|
|
|
|
|
echo
|
|
|
|
|
hledger -f "$TIMELOG" check -s tags ordereddates || true
|
|
|
|
|
# this comes last because it's slow and variable length
|
|
|
|
|
echo
|
|
|
|
|
printf "Display activity:\n"
|
|
|
|
|
wakelog today | tail -n 6
|
|
|
|
|
|
|
|
|
|
# what happened ? Show largest time balances first, today and depth 1 by default
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@twhat *ARGS:
|
|
|
|
|
hledger -f "$TIMELOG" bal -S -1 -p today {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# print line of N dots, grouped in 4s (suitable for timedot)
|
|
|
|
|
tdots N:
|
|
|
|
|
#!/usr/bin/env bash
|
2023-07-07 21:16:15 +03:00
|
|
|
|
set -euo pipefail
|
2023-10-14 07:57:57 +03:00
|
|
|
|
n={{ N }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
ndiv4=$((n/4))
|
|
|
|
|
nmod4=$((n-n/4*4))
|
|
|
|
|
sep=''
|
|
|
|
|
while [[ $ndiv4 -gt 0 ]]; do ndiv4=$((ndiv4-1)); echo -n "$sep...."; sep=' '; done
|
|
|
|
|
while [[ $nmod4 -gt 0 ]]; do nmod4=$((nmod4-1)); echo -n "$sep."; sep=''; done
|
|
|
|
|
echo
|
|
|
|
|
|
2023-10-14 07:57:57 +03:00
|
|
|
|
RFLAGS := '-tM'
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# horizontal time summary this year, monthly by default
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@tx *ARGS:
|
|
|
|
|
hledger -f "$TIMELOG" bal -1 "$RFLAGS" {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# vertical time summary this year, monthly by default
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@ty *ARGS:
|
|
|
|
|
hledger -f "$TIMELOG" bal -1 "$RFLAGS" --transpose {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# horizontal time summary since 2007, yearly by default. Gaps in 2010-2015.
|
|
|
|
|
@txall *ARGS:
|
|
|
|
|
hledger -f "$TIMELOGALL" bal -1 "$RFLAGS" -Y {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# vertical time summary since 2007, yearly by default. Gaps in 2010-2015.
|
|
|
|
|
@tyall *ARGS:
|
|
|
|
|
hledger -f "$TIMELOGALL" bal -1 "$RFLAGS" -Y --transpose {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# horizontal hledger time summary, yearly by default. Gaps in 2010-2015.
|
|
|
|
|
@txallhledger *ARGS:
|
|
|
|
|
{{ just }} txall hledger not:^ser.ek -AT {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# show a bar chart of this year's time in hours, weekly by default. Bar resolution is 1h.
|
|
|
|
|
@tbar *ARGS:
|
|
|
|
|
hledger-bar -v 1 -f "$TIMELOG" -W {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# show a bar chart of time since 2007, monthly by default, with 10h bar resolution. Gaps in 2010-2015.
|
|
|
|
|
@tbarall *ARGS:
|
|
|
|
|
hledger-bar -v 10 -f "$TIMELOGALL" -M not:cur: {{ ARGS }}
|
|
|
|
|
# not:cur: because --layout=bare will add a row for no-symbol commodity if any periods are zero.
|
|
|
|
|
|
|
|
|
|
# show a bar chart of time since 2007, yearly by default, with 100h bar resolution. Gaps in 2010-2015.
|
|
|
|
|
@tbarally *ARGS:
|
|
|
|
|
hledger-bar -v 100 -f "$TIMELOGALL" -Y not:cur:'' {{ ARGS }}
|
|
|
|
|
# not:cur: because --layout=bare will add a row for no-symbol commodity if any periods are zero.
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# this and last week's time budgets
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@tweekbudgets *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
printf "\nLast week, this week:\n"
|
|
|
|
|
timeweekly run
|
|
|
|
|
|
|
|
|
|
# recent past weeks' time budgets
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@tweekbudgetspast *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
printf "\nPast weeks:\n"
|
|
|
|
|
timeweekly past
|
|
|
|
|
|
|
|
|
|
# show unused / undeclared time accounts
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@taccunused *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
echo "Unused: (but declared)"
|
2023-10-14 07:57:57 +03:00
|
|
|
|
hledger -f "$TIMELOG" acc --unused {{ ARGS }} --directives | gsed -E 's/:(.)/.\1/g'
|
2023-07-07 04:52:41 +03:00
|
|
|
|
echo
|
|
|
|
|
echo "Undeclared: (but used)"
|
2023-10-14 07:57:57 +03:00
|
|
|
|
hledger -f "$TIMELOG" acc --undeclared {{ ARGS }} --directives | gsed -E 's/:(.)/.\1/g'
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show unused / undeclared time accounts by category
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@taccunusedcat *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
for a in $(tt acc -1); do line; echo "$a":; tt unused "^$a"; echo; done; line
|
|
|
|
|
|
|
|
|
|
# add declarations for all undeclared time accounts
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@taccadd *ARGS:
|
2023-07-07 04:52:41 +03:00
|
|
|
|
hledger -f "$TIMELOG" accounts --undeclared --directives | sed 's/:/./g' >>"$TIMELOG"
|
|
|
|
|
|
|
|
|
|
# show monthly time budget performance this year
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@tbudgets *ARGS:
|
|
|
|
|
{{ just }} tx --budget=daily -M -p jan..tomorrow {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show monthly time budget performance this year, vertically
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@tbudgetsy *ARGS:
|
|
|
|
|
{{ just }} ty --budget=daily -M -p jan..tomorrow {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# dedicated weekly reports, needed to set proper week start date, to ensure simple headings:
|
|
|
|
|
|
|
|
|
|
# show weekly time budget performance this year
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@tbudgetsw *ARGS:
|
|
|
|
|
{{ just }} ty --budget=daily -W -p 3/27..tomorrow {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|
|
|
|
|
# show weekly time budget performance this year, horizontally
|
2023-10-14 07:57:57 +03:00
|
|
|
|
@tbudgetswx *ARGS:
|
|
|
|
|
{{ just }} tx --budget=daily -W -p 3/27..tomorrow {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# show monthly time percentages
|
|
|
|
|
@txpc *ARGS:
|
|
|
|
|
{{ just }} tx -% {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# show monthly time tagged by activity type
|
|
|
|
|
@txt *ARGS:
|
|
|
|
|
hledger -f "$TIMELOG" bal -b2023/5 -M tag:t -1 {{ ARGS }}
|
|
|
|
|
|
|
|
|
|
# show monthly time tagged by activity type as percentages
|
|
|
|
|
@txtpc *ARGS:
|
|
|
|
|
{{ just }} txt -% {{ ARGS }}
|
2023-07-07 04:52:41 +03:00
|
|
|
|
|