multiple -f arguments fails if the files are of different format #320

anarcat opened this Issue Jan 29, 2016 · 5 comments


None yet

2 participants

anarcat commented Jan 29, 2016 edited

while investigating timelog support in hledger and ledgercli, i stumbled upon this weird bug where some of the multiple -f arguments are ignored if they are in a different format.

in other words, this prints time entries:

hledger -f timelog p

while this doesn't:

hledger -f timelog -f hledger.lgr p

The sample files are in the repo, which also demonstrates a compatibility problem when applying accounts before includes, which i believe was fixed in a2b989d.

@simonmichael simonmichael added this to the 1.0 milestone Jan 29, 2016
anarcat commented Jan 31, 2016

oh, and of course include fails similarly (or worse, actually):

$ hledger -f hledger.lgr bal
using conversion rules file /home/anarcat/src/ledger-timetracking/hledger.lgr.rules
hledger: "/home/anarcat/src/ledger-timetracking/hledger.lgr" (line 2, column 1) in included file "timelog":
"/home/anarcat/src/ledger-timetracking/timelog" (line 1, column 1):
unexpected 'i'
expecting journal transaction or directive or end of input

should that be filed as a separate bug?


No, this is explicitly disallowed by the docs. But, with luck one fix will resolve both.

@simonmichael simonmichael added a commit that referenced this issue May 18, 2016
@simonmichael journal: can now include timeclock/timedot files (#320)
journal files can now include journal, timeclock or timedot files (but
not yet CSV files). Also timeclock/timedot files no longer support
default year directives.

The Hledger.Read.* modules have been reorganised for better reuse.
Hledger.Read.Utils has been renamed Hledger.Read.Common and holds
low-level parsers & utilities; high-level read utilities have moved to

Partly fixed.. "The include directive can only be used in journal files. It can include journal, timeclock or timedot files, but not CSV files."

Eventually, we should be able to include any supported format. I'll leave this open as a reminder.

@simonmichael simonmichael added WISH and removed BUG labels May 18, 2016
@simonmichael simonmichael removed this from the 1.0 milestone May 18, 2016
@simonmichael simonmichael added the BUG label May 18, 2016

Ah shoot! I forgot the original -f case. That's still open.

@simonmichael simonmichael reopened this May 18, 2016
@simonmichael simonmichael added a commit that referenced this issue May 18, 2016
@simonmichael lib: allow multiple files of different format (#320)
When multiple files are specified with multiple -f options, we now
parse each one individually, rather than just concatenating them, so
they can have different formats.

Directives (like default year or account aliases) no longer carry over
from one file to the next. Limitation or feature ?

Multiple FILES specified on the command line are now parsed individually, so they can have different formats. Directives in one file no longer affect subsequent files. I think this is ok.

@simonmichael simonmichael removed the WISH label Jul 16, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment