simonmichael / hledger

Robust, fast, intuitive plain text accounting tool with CLI, TUI and web interfaces.
https://hledger.org
GNU General Public License v3.0
2.97k stars 317 forks source link

directives from included files have are ignored #2191

Closed redneb closed 6 months ago

redneb commented 6 months ago

This is a relatively minor issue, but hledger seems to ignore some (all?) directives that are included from some other file.

Here's a minimal example. Create the following 2 files:

; file1.journal
D 1,000.00 USD

and

; file2.journal
include file1.journal
2024-03-31 Test
    expense:test              1234.5
    asset:bank

If you do an hledger print on this file you'll get the following output:

$ hledger -f file2.journal print
2024-03-31 Test
    expense:test          1234.5
    asset:bank

I would have expected the output to look like this:

2024-03-31 Test
    expense:test    1,234.50 USD
    asset:bank

I am trying this with:

$ hledger --version
hledger 1.32.3, linux-x86_64
simonmichael commented 6 months ago

Does https://hledger.org/1.32/hledger.html#directives-and-multiple-files and the following section explain it ?

simonmichael commented 6 months ago

To be precise: at https://hledger.org/1.32/hledger.html#directive-effects, D's "Sets a default commodity" effect has "Y" for "ends at file end?". But at https://hledger.org/1.32/hledger.html#d-directive, "This effect lasts until ... end of the journal" seems ambiguous, I'll change it to "end of the file".

redneb commented 6 months ago

Ah, it seems my meticulous document-reading skills took a day off just when I needed them the most! Apologies for the spam!

To be precise: at https://hledger.org/1.32/hledger.html#directive-effects, D's "Sets a default commodity" effect has "Y" for "ends at file end?". But at https://hledger.org/1.32/hledger.html#d-directive, "This effect lasts until ... end of the journal" seems ambiguous, I'll change it to "end of the file".

I concur with the suggested change, thanks!

simonmichael commented 6 months ago

No problem.. there are are a lot of docs. Thanks for the report.