On Mon, Jun 2, 2014 at 8:55 PM, Martin Blais <[email protected]> wrote:
> Why don't you build a tool for printing out the result of these rule-based > modifications? Do you think that would be useful? Is it possible? I see a > lot of questions like: "Why doesn't my rule such and such work? I see > unexpected results in the register." If Ledger had a command to "expand > everything, and print the expanded results," all of these questions would > be easily answered by inspecting what it's doing, no? Is that easy to > implement? > > Just an idea. I'm building something exactly like that for Beancount, to > help in debugging plugins, which are essentially functions that transform a > list of entries in arbitrary ways, into a new, modified list of entries. > One should be able to diff the files and round-trip between data-structure > to text and back. > Actually, I just completed support for round-trips tonight (I had been writing comparison code lately in order to make it easier to write tests by writing a list of expected transactions in the input syntax itself, so it was a-propos). This means that Beancount can now read a complete ledger file, spit it back out in text, and re-reading that output generates the same data structures in memory. Writing that re-read structure out again to a second file also shows no file diff against the first output to text, it's identical. I tested this on my gigantic personal ledger of 8 years, and it passes clean. I'll add a new report type called "print" shortly, which will just spit out the data structure it read in memory back to text, after running all the transformations (e.g. automatically setting the amounts on postings, processing the tag directives, adding price entries for postings at a price, and whatever else the plugins do). This should be a nice debugging tool in the future, as it reflects what it does, e.g., what was automatically generated by the syntax shortcuts. -- --- You received this message because you are subscribed to the Google Groups "Ledger" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
