hledger icon indicating copy to clipboard operation
hledger copied to clipboard

a non-lossy print mode preserving all journal data

Open simonmichael opened this issue 6 years ago • 3 comments

Currently the print command is good at preserving the format and internal comments of transactions (except for #931). But it does not print comments preceding transactions, or standalone file-level comments or directives. It would be nice to have a mode (or a separate command) that can do this, making it safe and easy to reformat/sort the whole journal without losing any data. (Use cases needed..)

Transaction has a tprecedingcomments field which could be used to store comments immediately preceding a transaction. Some way of storing and reproducing the other file-level comments and directives is needed. (A list of generic [JournalEntity] ?)

Sorting needs more thought. How should it work ? Note:

  • The order in which transactions are entered in a journal is not important to hledger.
  • It may be important to some users, if they like using some non-chronological ordering scheme.
  • The current print command always sorts transactions by date.
  • Directives (and top level comments) can be position-sensitive. Eg, some directives will affect the following transactions until the file end, or until a closing directive.

simonmichael avatar Nov 16 '19 19:11 simonmichael