Skip to content

Commit

Permalink
move add-ons and scripts to bin/
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichael committed Jan 8, 2017
1 parent e7f6bfa commit 34ec740
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 23 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
.*
_*
bin/*
cabal-dev*
cabal.sandbox.config
*/dist/
Expand Down
20 changes: 12 additions & 8 deletions bin/README
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
Interesting/historical binaries are kept here, such as:
hledger add-on commands, hledger-related scripts, developer builds.

- Optimised cabal builds, copied here from cabal's bin directory.
- Old versions, with the -X.Y suffix. Used for performance benchmarking.
- Builds for other platforms, with a -PLATFORM-ARCH suffix, maybe compressed for download.
- Non-optimised developer builds compiled with make (*dev).
Used during development for quicker, multi-package, and on-change compilation.
- cabal and/or make builds with profiling enabled (*-prof).
Used for investigating time and space usage.
Scripts named hledger-* are hledger add-on commands. You can run them directly,
or via "hledger [HLEDGEROPTS] ADDONCMD [-- ADDONOPTS]". You should:
1. add this directory to your $PATH
2. ensure the scripts have executable permission (they should already, at least on unix)
3. optionally, compile them for quicker startup
See also: http://hledger.org/hledger.html#add-on-commands

Other hledger-related scripts include bash aliases, makefile examples, etc.

hledger development-related binaries also are stored here, such as
old versions for benchmarking, and platform-specific binaries.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 3 additions & 2 deletions extra/hledger-rewrite.hs → bin/hledger-rewrite.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
--package text
-}
-- To run or compile this script, it's easiest to be in the hledger source tree. Then:
-- To run it directly: extra/hledger-rewrite.hs ARGS
-- To compile it: stack build hledger --only-dependencies && stack ghc extra/hledger-rewrite.hs
-- To run it directly: bin/hledger-rewrite.hs ARGS
-- To compile it: stack build hledger --only-dependencies && stack ghc bin/hledger-rewrite.hs

{-|
hledger-rewrite [PATTERNS] --add-posting "ACCT AMTEXPR" ...
Expand All @@ -31,6 +31,7 @@ Related: https://github.com/simonmichael/hledger/issues/99
TODO:
- should allow regex matching and interpolating matched name in replacement
- should apply all matching rules to a transaction, not just one
- should apply the rule for each matched posting within a transaction, if there's more than one
- should be possible to use this on unbalanced entries, eg while editing one
Expand Down
2 changes: 1 addition & 1 deletion extra/README
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Extra stuff: less-maintained add-ons, custom report scripts, shell aliases, make rules...
"Extra" stuff, such as the old hledger-chart package.
2 changes: 1 addition & 1 deletion hledger/doc/commands.m4.md
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ $ LEDGER_FILE=unique.journal hledger print-unique
## rewrite
Prints all journal entries, adding specified custom postings to matched entries.
[hledger-rewrite.hs](https://github.com/simonmichael/hledger/blob/master/extra/hledger-rewrite.hs),
[hledger-rewrite.hs](https://github.com/simonmichael/hledger/blob/master/bin/hledger-rewrite.hs),
in hledger's extra directory (compilation optional), adds postings to existing transactions,
optionally with an amount based on the existing transaction's first amount. See the script for more details.
Expand Down
2 changes: 1 addition & 1 deletion site/developer-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ $ make test -n
&& echo pkgtest PASSED) || echo pkgtest FAILED
(stack exec hledger test \
&& echo builtintest PASSED) || echo builtintest FAILED
(COLUMNS=80 PATH=`pwd`/bin:/home/simon/src/hledger/bin:/home/simon/src/hledger/extra:/home/simon/.local/bin:/home/simon/.cabal/bin:/opt/ghc/7.10.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/var/lib/gems/1.9.1/bin stack exec -- shelltest --execdir -- -j16 --hide-successes tests \
(COLUMNS=80 PATH=`pwd`/bin:/home/simon/src/hledger/bin:/home/simon/.local/bin:/home/simon/.cabal/bin:/opt/ghc/7.10.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/var/lib/gems/1.9.1/bin stack exec -- shelltest --execdir -- -j16 --hide-successes tests \
&& echo functest PASSED) || echo functest FAILED
```

Expand Down
4 changes: 2 additions & 2 deletions site/more-docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,13 @@ See also the two Twitter feeds:
- [ledger-autosync](https://bitbucket.org/egh/ledger-autosync) downloads/converts/deduplicates OFX data
- [hledger-chart](http://hackage.haskell.org/package/hledger-chart) generates simple pie charts (unmaintained)
- [hledger-vty](http://hackage.haskell.org/package/hledger-vty) a simple curses-style UI (unmaintained)
- More in [extra/](https://github.com/simonmichael/hledger/tree/master/extra/)
- More in [bin/](https://github.com/simonmichael/hledger/tree/master/bin/)

## Scripting examples

- <https://gist.github.com/4172604> printing average expenses by month
- <https://gist.github.com/4210558> calculating historical account balances
- More in [extra/](https://github.com/simonmichael/hledger/tree/master/extra/)
- More in [bin/](https://github.com/simonmichael/hledger/tree/master/bin/)

## Similar projects

Expand Down
2 changes: 1 addition & 1 deletion site/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ Simon Michael, Johannes Gerer, Nikolay Orlyuk, Shubham Lagwankar.

- fix non-existent "oldtime" dependency ([#431](http://bugs.hledger.org/431))

- [hledger-equity.hs](https://github.com/simonmichael/hledger/blob/master/extra/hledger-equity.hs) now generates valid journal format when there are multiple commodities
- [hledger-equity.hs](https://github.com/simonmichael/hledger/blob/master/bin/hledger-equity.hs) now generates valid journal format when there are multiple commodities

### hledger-ui 1.1

Expand Down
6 changes: 3 additions & 3 deletions tests/extra/equity.test → tests/bin/equity.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tests for equity addon

# Simple case
runghc ../../extra/hledger-equity.hs -f- -p 2016 assets liabilities
runghc ../../bin/hledger-equity.hs -f- -p 2016 assets liabilities
<<<
2016/1/1 open
assets:bank $100
Expand Down Expand Up @@ -35,7 +35,7 @@ runghc ../../extra/hledger-equity.hs -f- -p 2016 assets liabilities
>>>=0

# Verify effect of period
runghc ../../extra/hledger-equity.hs -f- -p 2016 assets liabilities
runghc ../../bin/hledger-equity.hs -f- -p 2016 assets liabilities
<<<
2015/12/31 open
assets:bank $100
Expand Down Expand Up @@ -68,7 +68,7 @@ runghc ../../extra/hledger-equity.hs -f- -p 2016 assets liabilities

# # Tear transaction across periods
# # TODO: clarify what should we see for this case
# runghc ../../extra/hledger-equity.hs -f- -p 2016 assets liabilities
# runghc ../../bin/hledger-equity.hs -f- -p 2016 assets liabilities
# <<<
# 2016/1/1 open
# assets:bank $100
Expand Down
6 changes: 3 additions & 3 deletions tests/extra/rewrite.test → tests/bin/rewrite.test
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Tests for rewrite addon

# Add proportional income tax (from documentation)
runghc ../../extra/hledger-rewrite.hs -f- ^income --add-posting '(liabilities:tax) *.33'
runghc ../../bin/hledger-rewrite.hs -f- ^income --add-posting '(liabilities:tax) *.33'
<<<
2016/1/1 paycheck
income:remuneration $-100
Expand All @@ -23,7 +23,7 @@ runghc ../../extra/hledger-rewrite.hs -f- ^income --add-posting '(liabilities:ta
>>>=0

# Duplicate posting for budgeting (from documentation)
runghc ../../extra/hledger-rewrite.hs -f- expenses:gifts --add-posting '(budget:gifts) *-1'
runghc ../../bin/hledger-rewrite.hs -f- expenses:gifts --add-posting '(budget:gifts) *-1'
<<<
2016/1/1 withdraw
assets:cash $20
Expand All @@ -45,7 +45,7 @@ runghc ../../extra/hledger-rewrite.hs -f- expenses:gifts --add-posting '(budget:
>>>=0

# Add absolute bank processing fee
runghc ../../extra/hledger-rewrite.hs -f- assets:bank and 'amt:<0' --add-posting 'expenses:fee $5' --add-posting 'assets:bank $-5'
runghc ../../bin/hledger-rewrite.hs -f- assets:bank and 'amt:<0' --add-posting 'expenses:fee $5' --add-posting 'assets:bank $-5'
<<<
2016/1/1 withdraw
assets:cash $20
Expand Down

0 comments on commit 34ec740

Please sign in to comment.