Skip to content

Commit

Permalink
hlfi: better help
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed May 24, 2023
1 parent a32c390 commit 2cdedc3
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions hlfi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# hlfi - see help below
# hlfi - reporting tool for hledger project finances
# shellcheck shell=bash disable=SC2317

set -e
Expand All @@ -10,64 +10,64 @@ PERIOD="quarterly from 1/1 to tomorrow"

line() { echo "--------------------------------------------------------------------------------"; }

help() { # - show this help
help() { # show this help
line
cat <<EOF
hlfi - reporting tool for hledger project finances
Usage: hlfi [COMMAND]
Commands:
$(grep -E '^\w.*\(\) *{ *#' "$SCRIPT" | sed -e 's/() *{//' -e 's/# /\t/')
CMD - run other hledger commands on the hledger project's journal
$(grep -E '^\w.*\(\) *{ *#' "$SCRIPT" | sed -e 's/() *{//' | column -t -s'#')
CMD run other hledger commands on the hledger project's journal
Add hledger options to customise reports.
EOF
}

bs() { # - show balance sheet
bs() { # show balance sheet
hledger -f "$JOURNAL" bs --layout bare --pretty --drop 1 -p "$PERIOD" -E "$@"
}

is() { # - show income statement
is() { # show income statement
hledger -f "$JOURNAL" is --layout bare --pretty --drop 1 -p "$PERIOD" -S "$@"
}

a() { # - show assets
a() { # show assets
hledger -f "$JOURNAL" bal type:al -H --layout bare --pretty --drop 1 -p "$PERIOD" -E "$@"
}

r() { # - show revenues
r() { # show revenues
hledger -f "$JOURNAL" bal type:r --layout bare --pretty --drop 1 -p "$PERIOD" -S --invert "$@"
}

x() { # - show expenses
x() { # show expenses
hledger -f "$JOURNAL" bal type:x --layout bare --pretty --drop 1 -p "$PERIOD" -S --invert "$@"
}

b-a() { # - show assets bar chart
b-a() { # show assets bar chart
echo "Quarterly net worth:"
hledger-bar -v 200 -f "$JOURNAL" -Q type:al -H "$@"
}

b-r() { # - show revenues bar chart
b-r() { # show revenues bar chart
echo "Quarterly revenues:"
hledger-bar -v 40 -f "$JOURNAL" -Q type:r --invert "$@"
}

b-x() { # - show expenses bar chart
b-x() { # show expenses bar chart
echo "Quarterly expenses:"
hledger-bar -v 40 -f "$JOURNAL" -Q type:x --invert "$@"
}

# XXX with partial workaround for https://github.com/gooofy/drawilleplot/issues/4
l-a() { # - show assets line chart
l-a() { # show assets line chart
hledger -f "$JOURNAL" plot -- bal --depth=1 ^assets --historical --terminal --rcParams '{"figure.figsize":[8,3]}' --no-today -q --title "hledger assets" "$@" | sed 's/⠀/ /g'
}

l-r() { # - show revenues line chart
l-r() { # show revenues line chart
hledger -f "$JOURNAL" plot -- bal --depth=1 ^revenues --monthly --invert --terminal --rcParams '{"figure.figsize":[8,3]}' --drawstyle 'steps-mid' --no-today -q --title "hledger monthly revenues" "$@" | sed 's/⠀/ /g'
}

l-x() { # - show expenses line chart
l-x() { # show expenses line chart
hledger -f "$JOURNAL" plot -- bal --depth=1 ^expenses --monthly --terminal --rcParams '{"figure.figsize":[8,3]}' --drawstyle 'steps-mid' --no-today -q --title "hledger monthly expenses" "$@" | sed 's/⠀/ /g'
}

Expand Down

0 comments on commit 2cdedc3

Please sign in to comment.