-
-
Notifications
You must be signed in to change notification settings - Fork 341
Description
I use hledger
itself to process and normalize all my ledgers whether imported from other sources or manually composed. The print
command makes sure the values for every posting in a transaction are aligned.
2016/01/01 Example transaction
Expense:Foo $6
Expense:Foo:Baz $3
Cash
Becomes the much nicer:
2016/01/01 Example transaction
Expense:Foo $6
Expense:Foo:Baz $3
Cash $-9
However the column at which this alignment happens varies from transaction to transaction. Consider this case:
2016/01/01 Example transaction
Expense:Foo $6
Cash
2016/01/01 Another transaction
Expense:Bar:Baz $6
Cash
Normalizing this using print -x
will return each transaction aligned at a a different place:
2016/01/01 Example transaction
Expense:Foo $6
Cash $-6
2016/01/01 Another transaction
Expense:Bar:Baz $6
Cash $-6
In this case ledger print
is superior in that all transactions are aligned together:
2016/01/01 Example transaction
Expense:Foo $6
Cash
2016/01/01 Another transaction
Expense:Bar:Baz $6
Cash
I considered normalizing through ledger
, but there are many other ways in which hledger print
is preferable, such as alignment of postings with commodity costs:
# Source
2016/01/01 Unit prices
Expense:Foo 56 @ $6.00
Cash $-336
# Output of hledger print
2016/01/01 Unit prices
Expense:Foo 56 @ $6.00
Cash $-336
# Output of ledger print
2016/01/01 Unit prices
Expense:Foo 56 @ $6
Cash $-336
Personally I really like having the final cost of the posting right aligned as in the hledger
output.
What I would like is some kind of format option that specifies the right edge to align to (if possible without truncation of course).
The reason this would be preferable to a fully automatic width guesser that spans multiple transactions is that I could standardize on a width such that future changes such as renaming an account or moving transactions from one ledger to another would not cause churn in my Git commit history just because the length of an account string changed. Right now running git blame
on a Ledger file shows quite a bit of useless results as every posting in a transaction can change when just one posting is edited (because the column amounts are aligned to changes).