Hledger: Discrepancy between in-file and command-line aliases in hledger 1.5

Created on 14 Apr 2018  路  2Comments  路  Source: simonmichael/hledger

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?

A BUG cli journal code debugging

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

All 2 comments

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

adityag81 picture adityag81  路  5Comments

lucianf picture lucianf  路  8Comments

varac picture varac  路  9Comments

Timonsc picture Timonsc  路  4Comments

simonmichael picture simonmichael  路  8Comments