hledger/bin
2022-06-10 12:52:02 +01:00
..
_hledger-chart.hs dev: hlint: Avoid use of reverse. 2021-08-27 06:13:56 -10:00
.gitignore prices: new addon (#486) 2017-01-25 11:50:54 -08:00
bashrc scripts: bin: exclude non-executable files 2022-04-05 10:05:04 -10:00
compile.sh ;bin: linux/pr CI uses ghc 8.2, make functest uses default ghc (#1453) 2021-01-12 12:11:56 -08:00
csv.mk doc: move last addon docs out of hledger manual; add hledger-iadd 2017-01-24 15:39:38 -08:00
hledger-balance-as-budget.hs fix!: Revert "fix!: utf-8: Use with-utf8 to ensure all files are read and written with utf8 encoding. (#1619)" 2022-06-01 09:35:18 +10:00
hledger-check-fancyassertions.hs fix!: Revert "fix!: utf-8: Use with-utf8 to ensure all files are read and written with utf8 encoding. (#1619)" 2022-06-01 09:35:18 +10:00
hledger-check-tagfiles.cabal.hs cln: hlint: Remove unless and $> warnings. 2021-08-27 06:13:56 -10:00
hledger-check-tagfiles.hs cln: hlint: Remove unless and $> warnings. 2021-08-27 06:13:56 -10:00
hledger-combine-balances.hs fix!: Revert "fix!: utf-8: Use with-utf8 to ensure all files are read and written with utf8 encoding. (#1619)" 2022-06-01 09:35:18 +10:00
hledger-git bin: hledger-git, hledger-pijul 2022-04-20 23:23:36 -10:00
hledger-pijul bin: hledger-git, hledger-pijul 2022-04-20 23:23:36 -10:00
hledger-print-location.hs fix: bin: Remove old function in hledger-print-location. 2022-03-26 15:35:19 -10:00
hledger-simplebal bin: hledger-simplebal.sh -> hledger-simplebal 2022-04-20 23:36:43 -10:00
hledger-smooth.hs fix: bin: Get scripts compiling with current hledger-lib. 2021-09-08 13:19:31 -10:00
hledger-swap-dates.hs fix!: Revert "fix!: utf-8: Use with-utf8 to ensure all files are read and written with utf8 encoding. (#1619)" 2022-06-01 09:35:18 +10:00
paypaljson bin: paypaljson, paypaljson2csv - download txns from paypal API 2022-06-10 12:52:02 +01:00
paypaljson2csv bin: paypaljson, paypaljson2csv - download txns from paypal API 2022-06-10 12:52:02 +01:00
README.md bin: readme: cleanup 2022-04-20 23:36:58 -10:00
scripts.test ;bin: ignore stderr in func tests, check only exit code 2021-01-29 12:09:58 -08:00

Miscellaneous hledger add-ons, bash scripts, example make rules, etc. Things in this directory can be unfinished or out of date.

See https://hledger.org/addons.html and https://hledger.org/scripting.html for more about these scripts and scripting generally.

About the hledger-*.hs scripts

The hledger-*.hs add-on commands are mostly implemented as stack runghc scripts. See the comments in hledger-check-fancyassertions.hs for more about how to run or compile them. Short version: run bin/compile.sh to compile all scripts, and add this directory to your $PATH so they show up in hledger's command list.

How to:

Install all scripts as add-on commands

$ git clone https://github.com/simonmichael/hledger
$ hledger/bin/compile.sh
$ export PATH=$PATH:$PWD/hledger/bin

$ hledger                           # scripts now appear in commands list
$ hledger-print-location --help     # run a script directly
$ hledger print-location -- --help  # or run it via hledger. -- is needed before script options

Create a new script

The example scripts follow a template that implements hledger's standard command line options and help, so it's a good idea to use one as your starting point. The hledger- naming is not required, but it causes scripts to show up in the hledger commands list. On unix, your new script should be marked executable. This should do it:

$ cd hledger
$ cp bin/hledger-swap-dates.hs bin/hledger-foo.hs  # and edit, at least the command name and help
$ stack install string-qq     # ensure any extra script deps are installed
$ bin/hledger-cmd.hs --help
foo [OPTIONS]
  My new foo command.
  ...
$ stack ghc bin/hledger-cmd.hs
$ hledger foo -- --help
foo [OPTIONS]
  My new foo command.
  ...

Run ghcid on a script

$ stack install string-qq     # ensure any extra script deps are installed
$ stack exec -- ghcid bin/hledger-foo.hs 
...
Ok, one module loaded.
All good (1 module, at 10:50:48)

Run ghci on a script

$ stack install string-qq     # ensure any extra script deps are installed
$ stack ghci bin/hledger-foo.hs 
...
Ok, one module loaded.
...
ghci>