diff options
author | fpi | 2021-05-15 14:46:57 +0200 |
---|---|---|
committer | fpi | 2021-05-15 14:47:41 +0200 |
commit | 53ca8cf510a123ed8b3eef3bbe847f9f1b40793b (patch) | |
tree | 4db7f10a3f04f0bef0deebea383321a18a43f410 | |
parent | Update symlinks (diff) |
Add ledger report script for plotting w/ gnuplot
-rw-r--r-- | ledgerrc.org | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/ledgerrc.org b/ledgerrc.org index ec44d5e..34bedd6 100644 --- a/ledgerrc.org +++ b/ledgerrc.org @@ -1,8 +1,32 @@ #+PROPERTY: header-args:conf :tangle tangle/.ledgerrc :results silent #+begin_src conf ---file ~/.personal/f/ledger/main.ledger +--file ~/git/projects/ledger/main.ledger #+end_src -#+begin_src shell :tangle tangle/symlink.sh :shebang "#!/bin/bash" +#+begin_src shell :tangle tangle/symlink.sh :shebang "#!/bin/bash" :results silent ln -siv $(pwd)/tangle/.ledgerrc ~/ +ln -siv $(pwd)/tangle/report ~/.local/bin/ +#+end_src + +The =report= script can be used for simple plotting of ledger output using gnuplot. This is taken directly from the ledger git repo. +#+begin_src shell :tangle tangle/report :shebang "#!/usr/bin/env sh" +# This script facilities plotting of a ledger register report. If you +# use OS/X, and have AquaTerm installed, you will probably want to set +# LEDGER_TERM to "aqua". +# +# Examples of use: +# +# report -j -M reg food # plot monthly food costs +# report -J reg checking # plot checking account balance + +if [ -z "$LEDGER_TERM" ]; then + LEDGER_TERM="wxt persist" +fi + +(cat <<EOF; ledger "$@") | gnuplot + set terminal $LEDGER_TERM + set xdata time + set timefmt "%Y-%m-%d" + plot "-" using 1:2 with linespoints +EOF #+end_src |