The following journal works just fine:
alias b=bank
alias cc=credit-card
01/01 Opening balances
(bank) 100
(credit-card) -10
01/02
expenses 5
cc
01/03
expenses 5
b
01/04 Credit card charge
cc = 0
b
01/05
expenses 5
b = 75
> hledger --file=aliases.txt balance
75 bank
0 credit-card
15 expenses
--------------------
90
However, if the aliases in the file are moved to the command line, hledger cannot balance the last posting:
hledger --file=no-aliases.txt --alias=cc=credit-card --alias=b=bank balance
hledger: could not balance this transaction (real postings are off by 90)
2018/01/05
expenses 5
b 85 = 75
Is there a fundamental difference that I'm missing? Or is this an erroneous behaviour?
Looks erroneous to me. Possibly similar to https://github.com/simonmichael/hledger/issues/729#issuecomment-381259336 . Thanks!
Yes, this is definitely similar. Aliases are applied only after the journal is finalized (and all missing amounts inferred). If my fix for 729 looks good (see #732), this issue could be easily on top of it
Most helpful comment
Yes, this is definitely similar. Aliases are applied only after the journal is finalized (and all missing amounts inferred). If my fix for 729 looks good (see #732), this issue could be easily on top of it