mirror of
https://github.com/simonmichael/hledger.git
synced 2024-11-08 07:09:28 +03:00
bc9375e4e5
It's amazing how you can build, document, support and fix a thing for years and not know what exactly it does. Directives are tricky. Here is a pretty accurate description of their current behaviour, determined by testing.
4.7 KiB
4.7 KiB
Summary of directives
hledger's directives are based on Ledger's, but there are many differences (and also some between hledger versions). Directives' behaviour and interactions can get a little bit complex, especially with multiple files, so here is a table summarising them and their effects.
directive | end directive | subdirectives | purpose | can affect (as of 2018/06) |
---|---|---|---|---|
account |
any text | declare an account name & optional account code | account code: balance reports (except balance single-column mode) |
|
alias |
end aliases |
rewrite account names | following inline/included entries until end of current file or end directive | |
apply account |
end apply account |
prepend a common parent to account names | following inline/included entries until end of current file or end directive | |
comment |
end comment |
ignore part of journal | following inline/included entries until end of current file or end directive | |
commodity |
format |
declare a commodity and its number notation & display style | number notation: following entries in that commodity in all files; display style: amounts of that commodity in reports |
|
D |
declare a commodity, number notation & display style for commodityless amounts | commodity: all commodityless entries in all files; number notation: following commodityless entries and entries in that commodity in all files; display style: amounts of that commodity in reports |
||
include |
include entries/directives from another file | what the included directives affect | ||
P |
declare a market price for a commodity | amounts of that commodity in reports, when -V is used | ||
Y |
declare a year for yearless dates | following inline/included entries until end of current file |
Definitions:
subdirective | optional indented directive or unparsed text lines immediately following a parent directive |
account code | numeric code influencing account display order in most balance reports |
number notation | how to interpret numbers when parsing journal entries (the identity of the decimal separator character). Currently each commodity can have its own notation, even in the same file. |
display style | how to display amounts of a commodity in reports (symbol side and spacing, digit groups, decimal separator, decimal places) |
directive scope | which entries and (when there are multiple files) which files are affected by a directive |