;bin:ledgereval
This commit is contained in:
parent
c3ea87ca20
commit
a55455e19d
@ -38,6 +38,12 @@ Here are some scripts which don't use hledger directly, but might be useful to h
|
|||||||
(For more, see also: [plaintextaccounting.org > Software](https://plaintextaccounting.org#software)).
|
(For more, see also: [plaintextaccounting.org > Software](https://plaintextaccounting.org#software)).
|
||||||
|
|
||||||
|
|
||||||
|
### ledgereval
|
||||||
|
|
||||||
|
[`ledgereval`](https://github.com/simonmichael/hledger/blob/master/bin/ledgereval
|
||||||
|
is a helper for evaluating Ledger value expressions.
|
||||||
|
It's useful eg when converting amount expressions like `(1 USD + 2 USD)` to simple amounts.
|
||||||
|
|
||||||
### pricehist
|
### pricehist
|
||||||
|
|
||||||
[pricehist](https://pypi.org/project/pricehist) is useful for downloading market prices / conversion rates; recommended.
|
[pricehist](https://pypi.org/project/pricehist) is useful for downloading market prices / conversion rates; recommended.
|
||||||
|
|||||||
8
bin/ledgereval
Executable file
8
bin/ledgereval
Executable file
@ -0,0 +1,8 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# ledgereval [EXPR] - evaluate a Ledger value expression
|
||||||
|
# This runs `ledger eval`, but also accepts standard input, and does not add a newline.
|
||||||
|
# It's useful eg when converting Ledger's amount expressions to simple amounts.
|
||||||
|
# Decimal places can be important, eg ledgereval '0.01 USD / 2' vs ledgereval '0.010 USD / 2'.
|
||||||
|
|
||||||
|
expr="${*:-$(cat)}"
|
||||||
|
printf '%s' "$(ledger eval "$expr")"
|
||||||
Loading…
Reference in New Issue
Block a user