diff --git a/hledger-lib/defs.m4 b/hledger-lib/defs.m4 index ce8828c81..f94c5a0bc 100644 --- a/hledger-lib/defs.m4 +++ b/hledger-lib/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.19.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{October 2020}})m4_dnl +m4_define({{_monthyear_}}, {{November 2020}})m4_dnl diff --git a/hledger-lib/hledger_csv.5 b/hledger-lib/hledger_csv.5 index f0164326e..cb606f5f1 100644 --- a/hledger-lib/hledger_csv.5 +++ b/hledger-lib/hledger_csv.5 @@ -1,6 +1,6 @@ .\"t -.TH "hledger_csv" "5" "October 2020" "hledger 1.19.99" "hledger User Manuals" +.TH "hledger_csv" "5" "November 2020" "hledger 1.19.99" "hledger User Manuals" diff --git a/hledger-lib/hledger_csv.txt b/hledger-lib/hledger_csv.txt index 19f630b8a..68750efbd 100644 --- a/hledger-lib/hledger_csv.txt +++ b/hledger-lib/hledger_csv.txt @@ -959,4 +959,4 @@ SEE ALSO -hledger 1.19.99 October 2020 hledger_csv(5) +hledger 1.19.99 November 2020 hledger_csv(5) diff --git a/hledger-lib/hledger_journal.5 b/hledger-lib/hledger_journal.5 index 1b4a795ce..090b0e974 100644 --- a/hledger-lib/hledger_journal.5 +++ b/hledger-lib/hledger_journal.5 @@ -1,6 +1,6 @@ .\"t -.TH "hledger_journal" "5" "October 2020" "hledger 1.19.99" "hledger User Manuals" +.TH "hledger_journal" "5" "November 2020" "hledger 1.19.99" "hledger User Manuals" @@ -587,33 +587,52 @@ commodity 1 000 000.9455 .PP .SS Commodity display style .PP -For each commodity, hledger chooses a consistent format to use when +For each commodity, hledger chooses a consistent style to use when displaying amounts. (Except price amounts, which are always displayed as written). The display style is chosen as follows: .IP \[bu] 2 If there is a commodity directive (or default commodity directive) for -the commodity, that format is used (see examples above). +the commodity, its style is used (see examples above). .IP \[bu] 2 -Otherwise the format of the first posting amount in that commodity seen -in the journal is used. -But the number of decimal places (\[dq]precision\[dq]) will be the -maximum from all posting amounts in that commodity. +Otherwise the style is inferred from the amounts in that commodity seen +in the journal. .IP \[bu] 2 -Or if there are no such amounts in the journal, a default format is used +Or if there are no such amounts in the journal, a default style is used (like \f[C]$1000.00\f[R]). .PP -Transaction prices don\[aq]t affect the amount display style directly, -but occasionally they can do so indirectly (eg when an posting\[aq]s -amount is inferred using a transaction price). +A style is inferred from the journal amounts in a commodity as follows: +.IP \[bu] 2 +Use the general style (decimal mark, symbol placement) of the first +amount +.IP \[bu] 2 +Use the first-seen digit group style (digit group mark, digit group +sizes), if any +.IP \[bu] 2 +Use the maximum number of decimal places of all. +.PP +Transaction price amounts don\[aq]t affect the commodity display style +directly, but occasionally they can do so indirectly (eg when a +posting\[aq]s amount is inferred using a transaction price). If you find this causing problems, use a commodity directive to fix the display style. .PP -In summary: amounts will be displayed much as they appear in your -journal, with the max observed number of decimal places. -If you want to see fewer decimal places in reports, use a commodity -directive to override that. +In summary, each commodity\[aq]s amounts will be normalised to +.IP \[bu] 2 +the style declared by a \f[C]commodity\f[R] directive +.IP \[bu] 2 +or, the style of the first posting amount in the journal, with the +first-seen digit group style and the maximum-seen number of decimal +places. .PP +If reports are showing amounts in a way you don\[aq]t like (eg, with too +many decimal places), use a commodity directive to set your preferred +style. +.SS Rounding +.PP +Amounts are stored internally as decimal numbers with up to 255 decimal +places, and displayed with the number of decimal places specified by the +commodity display style. Note, hledger uses banker\[aq]s rounding: it rounds to the nearest even number, eg 0.5 displayed with zero decimal places is \[dq]0\[dq]). (Guaranteed since hledger 1.17.1; in older versions this could vary if diff --git a/hledger-lib/hledger_journal.info b/hledger-lib/hledger_journal.info index cd7481dc2..190653f05 100644 --- a/hledger-lib/hledger_journal.info +++ b/hledger-lib/hledger_journal.info @@ -488,6 +488,7 @@ EUR 1E3 * Digit group marks:: * Commodity display style:: +* Rounding::  File: hledger_journal.info, Node: Digit group marks, Next: Commodity display style, Up: Amounts @@ -523,40 +524,62 @@ commodity INR 9,99,99,999.00 commodity 1 000 000.9455  -File: hledger_journal.info, Node: Commodity display style, Prev: Digit group marks, Up: Amounts +File: hledger_journal.info, Node: Commodity display style, Next: Rounding, Prev: Digit group marks, Up: Amounts 1.8.2 Commodity display style ----------------------------- -For each commodity, hledger chooses a consistent format to use when +For each commodity, hledger chooses a consistent style to use when displaying amounts. (Except price amounts, which are always displayed as written). The display style is chosen as follows: * If there is a commodity directive (or default commodity directive) - for the commodity, that format is used (see examples above). + for the commodity, its style is used (see examples above). - * Otherwise the format of the first posting amount in that commodity - seen in the journal is used. But the number of decimal places - ("precision") will be the maximum from all posting amounts in that - commodity. + * Otherwise the style is inferred from the amounts in that commodity + seen in the journal. - * Or if there are no such amounts in the journal, a default format is + * Or if there are no such amounts in the journal, a default style is used (like '$1000.00'). - Transaction prices don't affect the amount display style directly, -but occasionally they can do so indirectly (eg when an posting's amount -is inferred using a transaction price). If you find this causing -problems, use a commodity directive to fix the display style. + A style is inferred from the journal amounts in a commodity as +follows: - In summary: amounts will be displayed much as they appear in your -journal, with the max observed number of decimal places. If you want to -see fewer decimal places in reports, use a commodity directive to -override that. + * Use the general style (decimal mark, symbol placement) of the first + amount + * Use the first-seen digit group style (digit group mark, digit group + sizes), if any + * Use the maximum number of decimal places of all. - Note, hledger uses banker's rounding: it rounds to the nearest even -number, eg 0.5 displayed with zero decimal places is "0"). (Guaranteed -since hledger 1.17.1; in older versions this could vary if hledger was -built with Decimal < 0.5.1.) + Transaction price amounts don't affect the commodity display style +directly, but occasionally they can do so indirectly (eg when a +posting's amount is inferred using a transaction price). If you find +this causing problems, use a commodity directive to fix the display +style. + + In summary, each commodity's amounts will be normalised to + + * the style declared by a 'commodity' directive + * or, the style of the first posting amount in the journal, with the + first-seen digit group style and the maximum-seen number of decimal + places. + + If reports are showing amounts in a way you don't like (eg, with too +many decimal places), use a commodity directive to set your preferred +style. + + +File: hledger_journal.info, Node: Rounding, Prev: Commodity display style, Up: Amounts + +1.8.3 Rounding +-------------- + +Amounts are stored internally as decimal numbers with up to 255 decimal +places, and displayed with the number of decimal places specified by the +commodity display style. Note, hledger uses banker's rounding: it +rounds to the nearest even number, eg 0.5 displayed with zero decimal +places is "0"). (Guaranteed since hledger 1.17.1; in older versions +this could vary if hledger was built with Decimal < 0.5.1.)  File: hledger_journal.info, Node: Transaction prices, Next: Lot prices and lot dates, Prev: Amounts, Up: Transactions @@ -1889,96 +1912,98 @@ Node: Account names15177 Ref: #account-names15318 Node: Amounts15805 Ref: #amounts15944 -Node: Digit group marks17055 -Ref: #digit-group-marks17206 -Node: Commodity display style18144 -Ref: #commodity-display-style18307 -Node: Transaction prices19711 -Ref: #transaction-prices19883 -Node: Lot prices and lot dates22314 -Ref: #lot-prices-and-lot-dates22511 -Node: Balance assertions22999 -Ref: #balance-assertions23185 -Node: Assertions and ordering24218 -Ref: #assertions-and-ordering24406 -Node: Assertions and included files25106 -Ref: #assertions-and-included-files25349 -Node: Assertions and multiple -f options25682 -Ref: #assertions-and-multiple--f-options25938 -Node: Assertions and commodities26070 -Ref: #assertions-and-commodities26302 -Node: Assertions and prices27459 -Ref: #assertions-and-prices27673 -Node: Assertions and subaccounts28113 -Ref: #assertions-and-subaccounts28342 -Node: Assertions and virtual postings28666 -Ref: #assertions-and-virtual-postings28908 -Node: Assertions and precision29050 -Ref: #assertions-and-precision29243 -Node: Balance assignments29510 -Ref: #balance-assignments29684 -Node: Balance assignments and prices30848 -Ref: #balance-assignments-and-prices31020 -Node: Directives31244 -Ref: #directives31403 -Node: Directives and multiple files36901 -Ref: #directives-and-multiple-files37084 -Node: Comment blocks37748 -Ref: #comment-blocks37931 -Node: Including other files38107 -Ref: #including-other-files38287 -Node: Default year39211 -Ref: #default-year39380 -Node: Declaring commodities39787 -Ref: #declaring-commodities39970 -Node: Default commodity41775 -Ref: #default-commodity41961 -Node: Declaring market prices42850 -Ref: #declaring-market-prices43045 -Node: Declaring accounts43902 -Ref: #declaring-accounts44088 -Node: Account comments45013 -Ref: #account-comments45176 -Node: Account subdirectives45600 -Ref: #account-subdirectives45795 -Node: Account types46108 -Ref: #account-types46292 -Node: Account display order49338 -Ref: #account-display-order49508 -Node: Rewriting accounts50659 -Ref: #rewriting-accounts50844 -Node: Basic aliases51601 -Ref: #basic-aliases51747 -Node: Regex aliases52451 -Ref: #regex-aliases52623 -Node: Combining aliases53342 -Ref: #combining-aliases53535 -Node: Aliases and multiple files54811 -Ref: #aliases-and-multiple-files55020 -Node: end aliases55599 -Ref: #end-aliases55756 -Node: Default parent account55857 -Ref: #default-parent-account56025 -Node: Periodic transactions56909 -Ref: #periodic-transactions57084 -Node: Periodic rule syntax58956 -Ref: #periodic-rule-syntax59162 -Node: Two spaces between period expression and description!59866 -Ref: #two-spaces-between-period-expression-and-description60185 -Node: Forecasting with periodic transactions60869 -Ref: #forecasting-with-periodic-transactions61174 -Node: Budgeting with periodic transactions63229 -Ref: #budgeting-with-periodic-transactions63468 -Node: Auto postings63877 -Ref: #auto-postings64017 -Node: Auto postings and multiple files66196 -Ref: #auto-postings-and-multiple-files66400 -Node: Auto postings and dates66609 -Ref: #auto-postings-and-dates66883 -Node: Auto postings and transaction balancing / inferred amounts / balance assertions67058 -Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions67409 -Node: Auto posting tags67751 -Ref: #auto-posting-tags67966 +Node: Digit group marks17068 +Ref: #digit-group-marks17219 +Node: Commodity display style18157 +Ref: #commodity-display-style18337 +Node: Rounding19880 +Ref: #rounding20004 +Node: Transaction prices20416 +Ref: #transaction-prices20588 +Node: Lot prices and lot dates23019 +Ref: #lot-prices-and-lot-dates23216 +Node: Balance assertions23704 +Ref: #balance-assertions23890 +Node: Assertions and ordering24923 +Ref: #assertions-and-ordering25111 +Node: Assertions and included files25811 +Ref: #assertions-and-included-files26054 +Node: Assertions and multiple -f options26387 +Ref: #assertions-and-multiple--f-options26643 +Node: Assertions and commodities26775 +Ref: #assertions-and-commodities27007 +Node: Assertions and prices28164 +Ref: #assertions-and-prices28378 +Node: Assertions and subaccounts28818 +Ref: #assertions-and-subaccounts29047 +Node: Assertions and virtual postings29371 +Ref: #assertions-and-virtual-postings29613 +Node: Assertions and precision29755 +Ref: #assertions-and-precision29948 +Node: Balance assignments30215 +Ref: #balance-assignments30389 +Node: Balance assignments and prices31553 +Ref: #balance-assignments-and-prices31725 +Node: Directives31949 +Ref: #directives32108 +Node: Directives and multiple files37606 +Ref: #directives-and-multiple-files37789 +Node: Comment blocks38453 +Ref: #comment-blocks38636 +Node: Including other files38812 +Ref: #including-other-files38992 +Node: Default year39916 +Ref: #default-year40085 +Node: Declaring commodities40492 +Ref: #declaring-commodities40675 +Node: Default commodity42480 +Ref: #default-commodity42666 +Node: Declaring market prices43555 +Ref: #declaring-market-prices43750 +Node: Declaring accounts44607 +Ref: #declaring-accounts44793 +Node: Account comments45718 +Ref: #account-comments45881 +Node: Account subdirectives46305 +Ref: #account-subdirectives46500 +Node: Account types46813 +Ref: #account-types46997 +Node: Account display order50043 +Ref: #account-display-order50213 +Node: Rewriting accounts51364 +Ref: #rewriting-accounts51549 +Node: Basic aliases52306 +Ref: #basic-aliases52452 +Node: Regex aliases53156 +Ref: #regex-aliases53328 +Node: Combining aliases54047 +Ref: #combining-aliases54240 +Node: Aliases and multiple files55516 +Ref: #aliases-and-multiple-files55725 +Node: end aliases56304 +Ref: #end-aliases56461 +Node: Default parent account56562 +Ref: #default-parent-account56730 +Node: Periodic transactions57614 +Ref: #periodic-transactions57789 +Node: Periodic rule syntax59661 +Ref: #periodic-rule-syntax59867 +Node: Two spaces between period expression and description!60571 +Ref: #two-spaces-between-period-expression-and-description60890 +Node: Forecasting with periodic transactions61574 +Ref: #forecasting-with-periodic-transactions61879 +Node: Budgeting with periodic transactions63934 +Ref: #budgeting-with-periodic-transactions64173 +Node: Auto postings64582 +Ref: #auto-postings64722 +Node: Auto postings and multiple files66901 +Ref: #auto-postings-and-multiple-files67105 +Node: Auto postings and dates67314 +Ref: #auto-postings-and-dates67588 +Node: Auto postings and transaction balancing / inferred amounts / balance assertions67763 +Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions68114 +Node: Auto posting tags68456 +Ref: #auto-posting-tags68671  End Tag Table diff --git a/hledger-lib/hledger_journal.txt b/hledger-lib/hledger_journal.txt index 4648b77b6..9ed1cb723 100644 --- a/hledger-lib/hledger_journal.txt +++ b/hledger-lib/hledger_journal.txt @@ -412,41 +412,59 @@ FILE FORMAT commodity 1 000 000.9455 Commodity display style - For each commodity, hledger chooses a consistent format to use when - displaying amounts. (Except price amounts, which are always displayed - as written). The display style is chosen as follows: + For each commodity, hledger chooses a consistent style to use when dis- + playing amounts. (Except price amounts, which are always displayed as + written). The display style is chosen as follows: o If there is a commodity directive (or default commodity directive) - for the commodity, that format is used (see examples above). + for the commodity, its style is used (see examples above). - o Otherwise the format of the first posting amount in that commodity - seen in the journal is used. But the number of decimal places ("pre- - cision") will be the maximum from all posting amounts in that commod- - ity. + o Otherwise the style is inferred from the amounts in that commodity + seen in the journal. - o Or if there are no such amounts in the journal, a default format is + o Or if there are no such amounts in the journal, a default style is used (like $1000.00). - Transaction prices don't affect the amount display style directly, but - occasionally they can do so indirectly (eg when an posting's amount is - inferred using a transaction price). If you find this causing prob- - lems, use a commodity directive to fix the display style. + A style is inferred from the journal amounts in a commodity as follows: - In summary: amounts will be displayed much as they appear in your jour- - nal, with the max observed number of decimal places. If you want to - see fewer decimal places in reports, use a commodity directive to over- - ride that. + o Use the general style (decimal mark, symbol placement) of the first + amount - Note, hledger uses banker's rounding: it rounds to the nearest even - number, eg 0.5 displayed with zero decimal places is "0"). (Guaranteed - since hledger 1.17.1; in older versions this could vary if hledger was - built with Decimal < 0.5.1.) + o Use the first-seen digit group style (digit group mark, digit group + sizes), if any + + o Use the maximum number of decimal places of all. + + Transaction price amounts don't affect the commodity display style di- + rectly, but occasionally they can do so indirectly (eg when a posting's + amount is inferred using a transaction price). If you find this caus- + ing problems, use a commodity directive to fix the display style. + + In summary, each commodity's amounts will be normalised to + + o the style declared by a commodity directive + + o or, the style of the first posting amount in the journal, with the + first-seen digit group style and the maximum-seen number of decimal + places. + + If reports are showing amounts in a way you don't like (eg, with too + many decimal places), use a commodity directive to set your preferred + style. + + Rounding + Amounts are stored internally as decimal numbers with up to 255 decimal + places, and displayed with the number of decimal places specified by + the commodity display style. Note, hledger uses banker's rounding: it + rounds to the nearest even number, eg 0.5 displayed with zero decimal + places is "0"). (Guaranteed since hledger 1.17.1; in older versions + this could vary if hledger was built with Decimal < 0.5.1.) Transaction prices Within a transaction, you can note an amount's price in another commod- - ity. This can be used to document the cost (in a purchase) or selling - price (in a sale). For example, transaction prices are useful to - record purchases of a foreign currency. Note transaction prices are + ity. This can be used to document the cost (in a purchase) or selling + price (in a sale). For example, transaction prices are useful to + record purchases of a foreign currency. Note transaction prices are fixed at the time of the transaction, and do not change over time. See also market prices, which represent prevailing exchange rates on a cer- tain date. @@ -472,14 +490,14 @@ FILE FORMAT assets:euros EUR100 ; one hundred euros purchased assets:dollars $-135 ; for $135 - 4. Like 1, but the @ is parenthesised, i.e. (@); this is for compati- - bility with Ledger journals (Virtual posting costs), and is equiva- + 4. Like 1, but the @ is parenthesised, i.e. (@); this is for compati- + bility with Ledger journals (Virtual posting costs), and is equiva- lent to 1 in hledger. 5. Like 2, but as in 4 the @@ is parenthesised, i.e. (@@); in hledger, this is equivalent to 2. - Use the -B/--cost flag to convert amounts to their transaction price's + Use the -B/--cost flag to convert amounts to their transaction price's commodity, if any. (mnemonic: "B" is from "cost Basis", as in Ledger). Eg here is how -B affects the balance report for the example above: @@ -490,8 +508,8 @@ FILE FORMAT $-135 assets:dollars $135 assets:euros # <- the euros' cost - Note -B is sensitive to the order of postings when a transaction price - is inferred: the inferred price will be in the commodity of the last + Note -B is sensitive to the order of postings when a transaction price + is inferred: the inferred price will be in the commodity of the last amount. So if example 3's postings are reversed, while the transaction is equivalent, -B shows something different: @@ -504,18 +522,18 @@ FILE FORMAT EUR100 assets:euros Lot prices and lot dates - Ledger allows another kind of price, lot price (four variants: {UNIT- + Ledger allows another kind of price, lot price (four variants: {UNIT- PRICE}, {{TOTALPRICE}}, {=FIXEDUNITPRICE}, {{=FIXEDTOTALPRICE}}), and/or a lot date ([DATE]) to be specified. These are normally used to - select a lot when selling investments. hledger will parse these, for - compatibility with Ledger journals, but currently ignores them. A - transaction price, lot price and/or lot date may appear in any order, + select a lot when selling investments. hledger will parse these, for + compatibility with Ledger journals, but currently ignores them. A + transaction price, lot price and/or lot date may appear in any order, after the posting amount and before the balance assertion if any. Balance assertions - hledger supports Ledger-style balance assertions in journal files. - These look like, for example, = EXPECTEDBALANCE following a posting's - amount. Eg here we assert the expected dollar balance in accounts a + hledger supports Ledger-style balance assertions in journal files. + These look like, for example, = EXPECTEDBALANCE following a posting's + amount. Eg here we assert the expected dollar balance in accounts a and b after each posting: 2013/1/1 @@ -527,32 +545,32 @@ FILE FORMAT b $-1 =$-2 After reading a journal file, hledger will check all balance assertions - and report an error if any of them fail. Balance assertions can pro- - tect you from, eg, inadvertently disrupting reconciled balances while - cleaning up old entries. You can disable them temporarily with the + and report an error if any of them fail. Balance assertions can pro- + tect you from, eg, inadvertently disrupting reconciled balances while + cleaning up old entries. You can disable them temporarily with the -I/--ignore-assertions flag, which can be useful for troubleshooting or - for reading Ledger files. (Note: this flag currently does not disable + for reading Ledger files. (Note: this flag currently does not disable balance assignments, below). Assertions and ordering - hledger sorts an account's postings and assertions first by date and - then (for postings on the same day) by parse order. Note this is dif- + hledger sorts an account's postings and assertions first by date and + then (for postings on the same day) by parse order. Note this is dif- ferent from Ledger, which sorts assertions only by parse order. (Also, - Ledger assertions do not see the accumulated effect of repeated post- + Ledger assertions do not see the accumulated effect of repeated post- ings to the same account within a transaction.) So, hledger balance assertions keep working if you reorder differently- - dated transactions within the journal. But if you reorder same-dated - transactions or postings, assertions might break and require updating. + dated transactions within the journal. But if you reorder same-dated + transactions or postings, assertions might break and require updating. This order dependence does bring an advantage: precise control over the order of postings and assertions within a day, so you can assert intra- day balances. Assertions and included files - With included files, things are a little more complicated. Including - preserves the ordering of postings and assertions. If you have multi- - ple postings to an account on the same day, split across different - files, and you also want to assert the account's balance on the same + With included files, things are a little more complicated. Including + preserves the ordering of postings and assertions. If you have multi- + ple postings to an account on the same day, split across different + files, and you also want to assert the account's balance on the same day, you'll have to put the assertion in the right file. Assertions and multiple -f options @@ -560,15 +578,15 @@ FILE FORMAT -f options. Use include or concatenate the files instead. Assertions and commodities - The asserted balance must be a simple single-commodity amount, and in - fact the assertion checks only this commodity's balance within the - (possibly multi-commodity) account balance. This is how assertions + The asserted balance must be a simple single-commodity amount, and in + fact the assertion checks only this commodity's balance within the + (possibly multi-commodity) account balance. This is how assertions work in Ledger also. We could call this a "partial" balance assertion. To assert the balance of more than one commodity in an account, you can write multiple postings, each asserting one commodity's balance. - You can make a stronger "total" balance assertion by writing a double + You can make a stronger "total" balance assertion by writing a double equals sign (== EXPECTEDBALANCE). This asserts that there are no other unasserted commodities in the account (or, that their balance is 0). @@ -588,7 +606,7 @@ FILE FORMAT a 0 == $1 It's not yet possible to make a complete assertion about a balance that - has multiple commodities. One workaround is to isolate each commodity + has multiple commodities. One workaround is to isolate each commodity into its own subaccount: 2013/1/1 @@ -602,21 +620,21 @@ FILE FORMAT a:euro 0 == 1EUR Assertions and prices - Balance assertions ignore transaction prices, and should normally be + Balance assertions ignore transaction prices, and should normally be written without one: 2019/1/1 (a) $1 @ EUR1 = $1 - We do allow prices to be written there, however, and print shows them, - even though they don't affect whether the assertion passes or fails. - This is for backward compatibility (hledger's close command used to - generate balance assertions with prices), and because balance assign- + We do allow prices to be written there, however, and print shows them, + even though they don't affect whether the assertion passes or fails. + This is for backward compatibility (hledger's close command used to + generate balance assertions with prices), and because balance assign- ments do use them (see below). Assertions and subaccounts - The balance assertions above (= and ==) do not count the balance from - subaccounts; they check the account's exclusive balance only. You can + The balance assertions above (= and ==) do not count the balance from + subaccounts; they check the account's exclusive balance only. You can assert the balance including subaccounts by writing =* or ==*, eg: 2019/1/1 @@ -630,16 +648,16 @@ FILE FORMAT tual. They are not affected by the --real/-R flag or real: query. Assertions and precision - Balance assertions compare the exactly calculated amounts, which are - not always what is shown by reports. Eg a commodity directive may - limit the display precision, but this will not affect balance asser- + Balance assertions compare the exactly calculated amounts, which are + not always what is shown by reports. Eg a commodity directive may + limit the display precision, but this will not affect balance asser- tions. Balance assertion failure messages show exact amounts. Balance assignments - Ledger-style balance assignments are also supported. These are like - balance assertions, but with no posting amount on the left side of the - equals sign; instead it is calculated automatically so as to satisfy - the assertion. This can be a convenience during data entry, eg when + Ledger-style balance assignments are also supported. These are like + balance assertions, but with no posting amount on the left side of the + equals sign; instead it is calculated automatically so as to satisfy + the assertion. This can be a convenience during data entry, eg when setting opening balances: ; starting a new journal, set asset account balances @@ -657,14 +675,14 @@ FILE FORMAT expenses:misc The calculated amount depends on the account's balance in the commodity - at that point (which depends on the previously-dated postings of the - commodity to that account since the last balance assertion or assign- + at that point (which depends on the previously-dated postings of the + commodity to that account since the last balance assertion or assign- ment). Note that using balance assignments makes your journal a little less explicit; to know the exact amount posted, you have to run hledger or do the calculations yourself, instead of just reading it. Balance assignments and prices - A transaction price in a balance assignment will cause the calculated + A transaction price in a balance assignment will cause the calculated amount to have that price attached: 2019/1/1 @@ -675,84 +693,83 @@ FILE FORMAT (a) $1 @ EUR2 = $1 @ EUR2 Directives - A directive is a line in the journal beginning with a special keyword, + A directive is a line in the journal beginning with a special keyword, that influences how the journal is processed. hledger's directives are based on a subset of Ledger's, but there are many differences (and also some differences between hledger versions). Directives' behaviour and interactions can get a little bit complex, so - here is a table summarising the directives and their effects, with - links to more detailed docs. Note part of this table is hidden when + here is a table summarising the directives and their effects, with + links to more detailed docs. Note part of this table is hidden when viewed in a web browser - scroll it sideways to see more. - direc- end di- subdi- purpose can affect (as of + direc- end di- subdi- purpose can affect (as of tive rective rec- 2018/06) tives ------------------------------------------------------------------------------------ - account any document account names, de- all entries in all - text clare account types & dis- files, before or + account any document account names, de- all entries in all + text clare account types & dis- files, before or play order after alias end rewrite account names following entries - aliases until end of cur- + aliases until end of cur- rent file or end directive - apply end apply prepend a common parent to following entries - account account account names until end of cur- + apply end apply prepend a common parent to following entries + account account account names until end of cur- rent file or end directive comment end com- ignore part of journal following entries - ment until end of cur- + ment until end of cur- rent file or end directive - commod- format declare a commodity and its number notation: + commod- format declare a commodity and its number notation: ity number notation & display following entries style in that commodity in all files ; dis- play style: amounts of that commodity in reports - D declare a commodity to be default commodity: + + + D declare a commodity to be default commodity: used for commodityless following commod- - amounts, and its number no- ityless entries un- - tation & display style til end of current - file; number nota- + amounts, and its number no- ityless entries un- + tation & display style til end of current + file; number nota- tion: following en- - tries in that com- + tries in that com- modity until end of - current file; dis- + current file; dis- play style: amounts of that commodity in reports include include entries/directives what the included from another file directives affect P declare a market price for a amounts of that - commodity commodity in re- - ports, when -V is + commodity commodity in re- + ports, when -V is used - Y declare a year for yearless following entries - dates until end of cur- + Y declare a year for yearless following entries + dates until end of cur- rent file - - - - = declare an auto posting all entries in par- - rule, adding postings to ent/current/child + = declare an auto posting all entries in par- + rule, adding postings to ent/current/child other transactions files (but not sib- ling files, see #1212) And some definitions: - subdi- optional indented directive line immediately following a parent + subdi- optional indented directive line immediately following a parent rec- directive tive number how to interpret numbers when parsing journal entries (the iden- - nota- tity of the decimal separator character). (Currently each com- + nota- tity of the decimal separator character). (Currently each com- tion modity can have its own notation, even in the same file.) - dis- how to display amounts of a commodity in reports (symbol side + dis- how to display amounts of a commodity in reports (symbol side play and spacing, digit groups, decimal separator, decimal places) style - direc- which entries and (when there are multiple files) which files + direc- which entries and (when there are multiple files) which files tive are affected by a directive scope @@ -761,35 +778,35 @@ FILE FORMAT ports). Some directives have multiple effects. Directives and multiple files - If you use multiple -f/--file options, or the include directive, - hledger will process multiple input files. But note that directives + If you use multiple -f/--file options, or the include directive, + hledger will process multiple input files. But note that directives which affect input (see above) typically last only until the end of the file in which they occur. This may seem inconvenient, but it's intentional; it makes reports sta- - ble and deterministic, independent of the order of input. Otherwise - you could see different numbers if you happened to write -f options in - a different order, or if you moved includes around while cleaning up + ble and deterministic, independent of the order of input. Otherwise + you could see different numbers if you happened to write -f options in + a different order, or if you moved includes around while cleaning up your files. - It can be surprising though; for example, it means that alias direc- + It can be surprising though; for example, it means that alias direc- tives do not affect parent or sibling files (see below). Comment blocks - A line containing just comment starts a commented region of the file, + A line containing just comment starts a commented region of the file, and a line containing just end comment (or the end of the current file) ends it. See also comments. Including other files - You can pull in the content of additional files by writing an include + You can pull in the content of additional files by writing an include directive, like this: include FILEPATH - Only journal files can include, and only journal, timeclock or timedot + Only journal files can include, and only journal, timeclock or timedot files can be included (not CSV files, currently). - If the file path does not begin with a slash, it is relative to the + If the file path does not begin with a slash, it is relative to the current file's folder. A tilde means home directory, eg: include ~/main.journal. @@ -798,17 +815,17 @@ FILE FORMAT *.journal. There is limited support for recursive wildcards: **/ (the slash is re- - quired) matches 0 or more subdirectories. It's not super convenient - since you have to avoid include cycles and including directories, but + quired) matches 0 or more subdirectories. It's not super convenient + since you have to avoid include cycles and including directories, but this can be done, eg: include */**/*.journal. The path may also be prefixed to force a specific file format, overrid- - ing the file extension (as described in hledger.1 -> Input files): in- + ing the file extension (as described in hledger.1 -> Input files): in- clude timedot:~/notes/2020*.md. Default year - You can set a default year to be used for subsequent dates which don't - specify a year. This is a line beginning with Y followed by the year. + You can set a default year to be used for subsequent dates which don't + specify a year. This is a line beginning with Y followed by the year. Eg: Y2009 ; set default year to 2009 @@ -830,19 +847,19 @@ FILE FORMAT Declaring commodities The commodity directive has several functions: - 1. It declares commodities which may be used in the journal. This is + 1. It declares commodities which may be used in the journal. This is currently not enforced, but can serve as documentation. - 2. It declares what decimal mark character (period or comma) to expect - when parsing input - useful to disambiguate international number - formats in your data. (Without this, hledger will parse both 1,000 + 2. It declares what decimal mark character (period or comma) to expect + when parsing input - useful to disambiguate international number + formats in your data. (Without this, hledger will parse both 1,000 and 1.000 as 1). - 3. It declares a commodity's display style in output - decimal and + 3. It declares a commodity's display style in output - decimal and digit group marks, number of decimal places, symbol placement etc. - You are likely to run into one of the problems solved by commodity di- - rectives, sooner or later, so it's a good idea to just always use them + You are likely to run into one of the problems solved by commodity di- + rectives, sooner or later, so it's a good idea to just always use them to declare your commodities. A commodity directive is just the word commodity followed by an amount. @@ -855,8 +872,8 @@ FILE FORMAT ; separating thousands with comma. commodity 1,000.0000 AAAA - or on multiple lines, using the "format" subdirective. (In this case - the commodity symbol appears twice and should be the same in both + or on multiple lines, using the "format" subdirective. (In this case + the commodity symbol appears twice and should be the same in both places.): ; commodity SYMBOL @@ -869,22 +886,22 @@ FILE FORMAT format INR 1,00,00,000.00 The quantity of the amount does not matter; only the format is signifi- - cant. The number must include a decimal mark: either a period or a + cant. The number must include a decimal mark: either a period or a comma, followed by 0 or more decimal digits. - Note hledger normally uses banker's rounding, so 0.5 displayed with + Note hledger normally uses banker's rounding, so 0.5 displayed with zero decimal digits is "0". (More at Commodity display style.) Default commodity - The D directive sets a default commodity, to be used for amounts with- + The D directive sets a default commodity, to be used for amounts with- out a commodity symbol (ie, plain numbers). This commodity will be ap- plied to all subsequent commodity-less amounts, or until the next D di- rective. (Note, this is different from Ledger's D.) - For compatibility/historical reasons, D also acts like a commodity di- + For compatibility/historical reasons, D also acts like a commodity di- rective, setting the commodity's display style (for output) and decimal mark (for parsing input). As with commodity, the amount must always be - written with a decimal mark (period or comma). If both directives are + written with a decimal mark (period or comma). If both directives are used, commodity's style takes precedence. The syntax is D AMOUNT. Eg: @@ -898,9 +915,9 @@ FILE FORMAT b Declaring market prices - The P directive declares a market price, which is an exchange rate be- - tween two commodities on a certain date. (In Ledger, they are called - "historical prices".) These are often obtained from a stock exchange, + The P directive declares a market price, which is an exchange rate be- + tween two commodities on a certain date. (In Ledger, they are called + "historical prices".) These are often obtained from a stock exchange, cryptocurrency exchange, or the foreign exchange market. Here is the format: @@ -911,16 +928,16 @@ FILE FORMAT o COMMODITYA is the symbol of the commodity being priced - o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com- + o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com- modity, giving the price in commodity B of one unit of commodity A. - These two market price directives say that one euro was worth 1.35 US + These two market price directives say that one euro was worth 1.35 US dollars during 2009, and $1.40 from 2010 onward: P 2009/1/1 EUR $1.35 P 2010/1/1 EUR $1.40 - The -V, -X and --value flags use these market prices to show amount + The -V, -X and --value flags use these market prices to show amount values in another commodity. See Valuation. Declaring accounts @@ -930,20 +947,20 @@ FILE FORMAT o They can document your intended chart of accounts, providing a refer- ence. - o They can store extra information about accounts (account numbers, + o They can store extra information about accounts (account numbers, notes, etc.) - o They can help hledger know your accounts' types (asset, liability, - equity, revenue, expense), useful for reports like balancesheet and + o They can help hledger know your accounts' types (asset, liability, + equity, revenue, expense), useful for reports like balancesheet and incomestatement. - o They control account display order in reports, allowing non-alpha- + o They control account display order in reports, allowing non-alpha- betic sorting (eg Revenues to appear above Expenses). - o They help with account name completion in the add command, hledger- + o They help with account name completion in the add command, hledger- iadd, hledger-web, ledger-mode etc. - The simplest form is just the word account followed by a hledger-style + The simplest form is just the word account followed by a hledger-style account name, eg: account assets:bank:checking @@ -951,7 +968,7 @@ FILE FORMAT Account comments Comments, beginning with a semicolon, can be added: - o on the same line, after two or more spaces (because ; is allowed in + o on the same line, after two or more spaces (because ; is allowed in account names) o on the next lines, indented @@ -965,7 +982,7 @@ FILE FORMAT Same-line comments are not supported by Ledger, or hledger <1.13. Account subdirectives - We also allow (and ignore) Ledger-style indented subdirectives, just + We also allow (and ignore) Ledger-style indented subdirectives, just for compatibility.: account assets:bank:checking @@ -984,21 +1001,21 @@ FILE FORMAT Asset, Liability, Equity, Revenue, Expense. These account types are important for controlling which accounts appear - in the balancesheet, balancesheetequity, incomestatement reports (and + in the balancesheet, balancesheetequity, incomestatement reports (and probably for other things in future). - Additionally, we recognise the Cash type, which is also an Asset, and - which causes accounts to appear in the cashflow report. ("Cash" here - means liquid assets, eg bank balances but typically not investments or + Additionally, we recognise the Cash type, which is also an Asset, and + which causes accounts to appear in the cashflow report. ("Cash" here + means liquid assets, eg bank balances but typically not investments or receivables.) Declaring account types Generally, to make these reports work you should declare your top-level accounts and their types, using account directives with type: tags. - The tag's value should be one of: Asset, Liability, Equity, Revenue, - Expense, Cash, A, L, E, R, X, C (all case insensitive). The type is - inherited by all subaccounts except where they override it. Here's a + The tag's value should be one of: Asset, Liability, Equity, Revenue, + Expense, Cash, A, L, E, R, X, C (all case insensitive). The type is + inherited by all subaccounts except where they override it. Here's a complete example: account assets ; type: Asset @@ -1010,8 +1027,8 @@ FILE FORMAT account expenses ; type: Expense Auto-detected account types - If you happen to use common english top-level account names, you may - not need to declare account types, as they will be detected automati- + If you happen to use common english top-level account names, you may + not need to declare account types, as they will be detected automati- cally using the following rules: If name matches regular account type is: @@ -1024,7 +1041,7 @@ FILE FORMAT ^(income|revenue)s?(:|$) Revenue ^expenses?(:|$) Expense - If account type is Asset and name does not contain regu- account type + If account type is Asset and name does not contain regu- account type lar expression: is: -------------------------------------------------------------------------- (investment|receivable|:A/R|:fixed) Cash @@ -1034,9 +1051,9 @@ FILE FORMAT Interference from auto-detected account types If you assign any account type, it's a good idea to assign all of them, - to prevent any confusion from mixing declared and auto-detected types. - Although it's unlikely to happen in real life, here's an example: with - the following journal, balancesheetequity shows "liabilities" in both + to prevent any confusion from mixing declared and auto-detected types. + Although it's unlikely to happen in real life, here's an example: with + the following journal, balancesheetequity shows "liabilities" in both Liabilities and Equity sections. Declaring another account as type:Li- ability would fix it: @@ -1048,8 +1065,8 @@ FILE FORMAT equity -2 Old account type syntax - In some hledger journals you might instead see this old syntax (the - letters ALERX, separated from the account name by two or more spaces); + In some hledger journals you might instead see this old syntax (the + letters ALERX, separated from the account name by two or more spaces); this is deprecated and may be removed soon: account assets A @@ -1059,8 +1076,8 @@ FILE FORMAT account expenses X Account display order - Account directives also set the order in which accounts are displayed, - eg in reports, the hledger-ui accounts screen, and the hledger-web + Account directives also set the order in which accounts are displayed, + eg in reports, the hledger-ui accounts screen, and the hledger-web sidebar. By default accounts are listed in alphabetical order. But if you have these account directives in the journal: @@ -1082,20 +1099,20 @@ FILE FORMAT Undeclared accounts, if any, are displayed last, in alphabetical order. - Note that sorting is done at each level of the account tree (within - each group of sibling accounts under the same parent). And currently, + Note that sorting is done at each level of the account tree (within + each group of sibling accounts under the same parent). And currently, this directive: account other:zoo - would influence the position of zoo among other's subaccounts, but not + would influence the position of zoo among other's subaccounts, but not the position of other among the top-level accounts. This means: - o you will sometimes declare parent accounts (eg account other above) + o you will sometimes declare parent accounts (eg account other above) that you don't intend to post to, just to customize their display or- der - o sibling accounts stay together (you couldn't display x:y in between + o sibling accounts stay together (you couldn't display x:y in between a:b and a:c). Rewriting accounts @@ -1113,14 +1130,14 @@ FILE FORMAT o customising reports Account aliases also rewrite account names in account directives. They - do not affect account names being entered via hledger add or hledger- + do not affect account names being entered via hledger add or hledger- web. See also Rewrite account names. Basic aliases - To set an account alias, use the alias directive in your journal file. - This affects all subsequent journal entries in the current file or its + To set an account alias, use the alias directive in your journal file. + This affects all subsequent journal entries in the current file or its included files. The spaces around the = are optional: alias OLD = NEW @@ -1128,49 +1145,49 @@ FILE FORMAT Or, you can use the --alias 'OLD=NEW' option on the command line. This affects all entries. It's useful for trying out aliases interactively. - OLD and NEW are case sensitive full account names. hledger will re- - place any occurrence of the old account name with the new one. Subac- + OLD and NEW are case sensitive full account names. hledger will re- + place any occurrence of the old account name with the new one. Subac- counts are also affected. Eg: alias checking = assets:bank:wells fargo:checking ; rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a" Regex aliases - There is also a more powerful variant that uses a regular expression, + There is also a more powerful variant that uses a regular expression, indicated by the forward slashes: alias /REGEX/ = REPLACEMENT or --alias '/REGEX/=REPLACEMENT'. - REGEX is a case-insensitive regular expression. Anywhere it matches - inside an account name, the matched part will be replaced by REPLACE- - MENT. If REGEX contains parenthesised match groups, these can be ref- + REGEX is a case-insensitive regular expression. Anywhere it matches + inside an account name, the matched part will be replaced by REPLACE- + MENT. If REGEX contains parenthesised match groups, these can be ref- erenced by the usual numeric backreferences in REPLACEMENT. Eg: alias /^(.+):bank:([^:]+):(.*)/ = \1:\2 \3 ; rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking" - Also note that REPLACEMENT continues to the end of line (or on command - line, to end of option argument), so it can contain trailing white- + Also note that REPLACEMENT continues to the end of line (or on command + line, to end of option argument), so it can contain trailing white- space. Combining aliases - You can define as many aliases as you like, using journal directives + You can define as many aliases as you like, using journal directives and/or command line options. - Recursive aliases - where an account name is rewritten by one alias, - then by another alias, and so on - are allowed. Each alias sees the + Recursive aliases - where an account name is rewritten by one alias, + then by another alias, and so on - are allowed. Each alias sees the effect of previously applied aliases. - In such cases it can be important to understand which aliases will be - applied and in which order. For (each account name in) each journal + In such cases it can be important to understand which aliases will be + applied and in which order. For (each account name in) each journal entry, we apply: - 1. alias directives preceding the journal entry, most recently parsed + 1. alias directives preceding the journal entry, most recently parsed first (ie, reading upward from the journal entry, bottom to top) - 2. --alias options, in the order they appeared on the command line + 2. --alias options, in the order they appeared on the command line (left to right). In other words, for (an account name in) a given journal entry: @@ -1181,20 +1198,20 @@ FILE FORMAT o aliases defined after/below the entry do not affect it. - This gives nearby aliases precedence over distant ones, and helps pro- - vide semantic stability - aliases will keep working the same way inde- + This gives nearby aliases precedence over distant ones, and helps pro- + vide semantic stability - aliases will keep working the same way inde- pendent of which files are being read and in which order. - In case of trouble, adding --debug=6 to the command line will show + In case of trouble, adding --debug=6 to the command line will show which aliases are being applied when. Aliases and multiple files - As explained at Directives and multiple files, alias directives do not + As explained at Directives and multiple files, alias directives do not affect parent or sibling files. Eg in this command, hledger -f a.aliases -f b.journal - account aliases defined in a.aliases will not affect b.journal. In- + account aliases defined in a.aliases will not affect b.journal. In- cluding the aliases doesn't work either: include a.aliases @@ -1216,14 +1233,14 @@ FILE FORMAT include c.journal ; also affected end aliases - You can clear (forget) all currently defined aliases with the end + You can clear (forget) all currently defined aliases with the end aliases directive: end aliases Default parent account - You can specify a parent account which will be prepended to all ac- - counts within a section of the journal. Use the apply account and end + You can specify a parent account which will be prepended to all ac- + counts within a section of the journal. Use the apply account and end apply account directives like so: apply account home @@ -1240,7 +1257,7 @@ FILE FORMAT home:food $10 home:cash $-10 - If end apply account is omitted, the effect lasts to the end of the + If end apply account is omitted, the effect lasts to the end of the file. Included files are also affected, eg: apply account business @@ -1249,50 +1266,50 @@ FILE FORMAT apply account personal include personal.journal - Prior to hledger 1.0, legacy account and end spellings were also sup- + Prior to hledger 1.0, legacy account and end spellings were also sup- ported. - A default parent account also affects account directives. It does not - affect account names being entered via hledger add or hledger-web. If - account aliases are present, they are applied after the default parent + A default parent account also affects account directives. It does not + affect account names being entered via hledger add or hledger-web. If + account aliases are present, they are applied after the default parent account. Periodic transactions - Periodic transaction rules describe transactions that recur. They al- - low hledger to generate temporary future transactions to help with - forecasting, so you don't have to write out each one in the journal, - and it's easy to try out different forecasts. Secondly, they are also + Periodic transaction rules describe transactions that recur. They al- + low hledger to generate temporary future transactions to help with + forecasting, so you don't have to write out each one in the journal, + and it's easy to try out different forecasts. Secondly, they are also used to define the budgets shown in budget reports. - Periodic transactions can be a little tricky, so before you use them, + Periodic transactions can be a little tricky, so before you use them, read this whole section - or at least these tips: - 1. Two spaces accidentally added or omitted will cause you trouble - + 1. Two spaces accidentally added or omitted will cause you trouble - read about this below. - 2. For troubleshooting, show the generated transactions with hledger - print --forecast tag:generated or hledger register --forecast + 2. For troubleshooting, show the generated transactions with hledger + print --forecast tag:generated or hledger register --forecast tag:generated. - 3. Forecasted transactions will begin only after the last non-fore- + 3. Forecasted transactions will begin only after the last non-fore- casted transaction's date. - 4. Forecasted transactions will end 6 months from today, by default. + 4. Forecasted transactions will end 6 months from today, by default. See below for the exact start/end rules. - 5. period expressions can be tricky. Their documentation needs im- + 5. period expressions can be tricky. Their documentation needs im- provement, but is worth studying. - 6. Some period expressions with a repeating interval must begin on a - natural boundary of that interval. Eg in weekly from DATE, DATE - must be a monday. ~ weekly from 2019/10/1 (a tuesday) will give an + 6. Some period expressions with a repeating interval must begin on a + natural boundary of that interval. Eg in weekly from DATE, DATE + must be a monday. ~ weekly from 2019/10/1 (a tuesday) will give an error. 7. Other period expressions with an interval are automatically expanded - to cover a whole number of that interval. (This is done to improve + to cover a whole number of that interval. (This is done to improve reports, but it also affects periodic transactions. Yes, it's a bit - inconsistent with the above.) Eg: ~ every 10th day of month from - 2020/01, which is equivalent to ~ every 10th day of month from + inconsistent with the above.) Eg: ~ every 10th day of month from + 2020/01, which is equivalent to ~ every 10th day of month from 2020/01/01, will be adjusted to start on 2019/12/10. Periodic rule syntax @@ -1304,17 +1321,17 @@ FILE FORMAT expenses:rent $2000 assets:bank:checking - There is an additional constraint on the period expression: the start - date must fall on a natural boundary of the interval. Eg monthly from + There is an additional constraint on the period expression: the start + date must fall on a natural boundary of the interval. Eg monthly from 2018/1/1 is valid, but monthly from 2018/1/15 is not. - Partial or relative dates (M/D, D, tomorrow, last week) in the period - expression can work (useful or not). They will be relative to today's - date, unless a Y default year directive is in effect, in which case + Partial or relative dates (M/D, D, tomorrow, last week) in the period + expression can work (useful or not). They will be relative to today's + date, unless a Y default year directive is in effect, in which case they will be relative to Y/1/1. Two spaces between period expression and description! - If the period expression is followed by a transaction description, + If the period expression is followed by a transaction description, these must be separated by two or more spaces. This helps hledger know where the period expression ends, so that descriptions can not acciden- tally alter their meaning, as in this example: @@ -1328,67 +1345,67 @@ FILE FORMAT So, - o Do write two spaces between your period expression and your transac- + o Do write two spaces between your period expression and your transac- tion description, if any. - o Don't accidentally write two spaces in the middle of your period ex- + o Don't accidentally write two spaces in the middle of your period ex- pression. Forecasting with periodic transactions - The --forecast flag activates any periodic transaction rules in the - journal. They will generate temporary recurring transactions, which - are not saved in the journal, but will appear in all reports (eg + The --forecast flag activates any periodic transaction rules in the + journal. They will generate temporary recurring transactions, which + are not saved in the journal, but will appear in all reports (eg print). This can be useful for estimating balances into the future, or - experimenting with different scenarios. Or, it can be used as a data + experimenting with different scenarios. Or, it can be used as a data entry aid: describe recurring transactions, and every so often copy the output of print --forecast into the journal. - These transactions will have an extra tag indicating which periodic + These transactions will have an extra tag indicating which periodic rule generated them: generated-transaction:~ PERIODICEXPR. And a simi- - lar, hidden tag (beginning with an underscore) which, because it's - never displayed by print, can be used to match transactions generated + lar, hidden tag (beginning with an underscore) which, because it's + never displayed by print, can be used to match transactions generated "just now": _generated-transaction:~ PERIODICEXPR. - Periodic transactions are generated within some forecast period. By + Periodic transactions are generated within some forecast period. By default, this o begins on the later of o the report start date if specified with -b/-p/date: - o the day after the latest normal (non-periodic) transaction in the + o the day after the latest normal (non-periodic) transaction in the journal, or today if there are no normal transactions. - o ends on the report end date if specified with -e/-p/date:, or 6 + o ends on the report end date if specified with -e/-p/date:, or 6 months (180 days) from today. - This means that periodic transactions will begin only after the latest - recorded transaction. And a recorded transaction dated in the future - can prevent generation of periodic transactions. (You can avoid that + This means that periodic transactions will begin only after the latest + recorded transaction. And a recorded transaction dated in the future + can prevent generation of periodic transactions. (You can avoid that by writing the future transaction as a one-time periodic rule instead - put tilde before the date, eg ~ YYYY-MM-DD ...). Or, you can set your own arbitrary "forecast period", which can overlap - recorded transactions, and need not be in the future, by providing an - option argument, like --forecast=PERIODEXPR. Note the equals sign is + recorded transactions, and need not be in the future, by providing an + option argument, like --forecast=PERIODEXPR. Note the equals sign is required, a space won't work. PERIODEXPR is a period expression, which - can specify the start date, end date, or both, like in a date: query. - (See also hledger.1 -> Report start & end date). Some examples: + can specify the start date, end date, or both, like in a date: query. + (See also hledger.1 -> Report start & end date). Some examples: --forecast=202001-202004, --forecast=jan-, --forecast=2020. Budgeting with periodic transactions - With the --budget flag, currently supported by the balance command, - each periodic transaction rule declares recurring budget goals for the - specified accounts. Eg the first example above declares a goal of - spending $2000 on rent (and also, a goal of depositing $2000 into - checking) every month. Goals and actual performance can then be com- + With the --budget flag, currently supported by the balance command, + each periodic transaction rule declares recurring budget goals for the + specified accounts. Eg the first example above declares a goal of + spending $2000 on rent (and also, a goal of depositing $2000 into + checking) every month. Goals and actual performance can then be com- pared in budget reports. See also: Budgeting and Forecasting. Auto postings - "Automated postings" or "auto postings" are extra postings which get - added automatically to transactions which match certain queries, de- + "Automated postings" or "auto postings" are extra postings which get + added automatically to transactions which match certain queries, de- fined by "auto posting rules", when you use the --auto flag. An auto posting rule looks a bit like a transaction: @@ -1398,27 +1415,27 @@ FILE FORMAT ... ACCOUNT [AMOUNT] - except the first line is an equals sign (mnemonic: = suggests match- - ing), followed by a query (which matches existing postings), and each - "posting" line describes a posting to be generated, and the posting + except the first line is an equals sign (mnemonic: = suggests match- + ing), followed by a query (which matches existing postings), and each + "posting" line describes a posting to be generated, and the posting amounts can be: - o a normal amount with a commodity symbol, eg $2. This will be used + o a normal amount with a commodity symbol, eg $2. This will be used as-is. o a number, eg 2. The commodity symbol (if any) from the matched post- ing will be added to this. - o a numeric multiplier, eg *2 (a star followed by a number N). The + o a numeric multiplier, eg *2 (a star followed by a number N). The matched posting's amount (and total price, if any) will be multiplied by N. - o a multiplier with a commodity symbol, eg *$2 (a star, number N, and + o a multiplier with a commodity symbol, eg *$2 (a star, number N, and symbol S). The matched posting's amount will be multiplied by N, and its commodity symbol will be replaced with S. - Any query term containing spaces must be enclosed in single or double - quotes, as on the command line. Eg, note the quotes around the second + Any query term containing spaces must be enclosed in single or double + quotes, as on the command line. Eg, note the quotes around the second query term below: = expenses:groceries 'expenses:dining out' @@ -1457,24 +1474,24 @@ FILE FORMAT Auto postings and multiple files An auto posting rule can affect any transaction in the current file, or - in any parent file or child file. Note, currently it will not affect + in any parent file or child file. Note, currently it will not affect sibling files (when multiple -f/--file are used - see #1212). Auto postings and dates - A posting date (or secondary date) in the matched posting, or (taking - precedence) a posting date in the auto posting rule itself, will also + A posting date (or secondary date) in the matched posting, or (taking + precedence) a posting date in the auto posting rule itself, will also be used in the generated posting. Auto postings and transaction balancing / inferred amounts / balance asser- tions Currently, auto postings are added: - o after missing amounts are inferred, and transactions are checked for + o after missing amounts are inferred, and transactions are checked for balancedness, o but before balance assertions are checked. - Note this means that journal entries must be balanced both before and + Note this means that journal entries must be balanced both before and after auto postings are added. This changed in hledger 1.12+; see #893 for background. @@ -1484,11 +1501,11 @@ FILE FORMAT o generated-posting:= QUERY - shows this was generated by an auto post- ing rule, and the query - o _generated-posting:= QUERY - a hidden tag, which does not appear in + o _generated-posting:= QUERY - a hidden tag, which does not appear in hledger's output. This can be used to match postings generated "just now", rather than generated in the past and saved to the journal. - Also, any transaction that has been changed by auto posting rules will + Also, any transaction that has been changed by auto posting rules will have these tags added: o modified: - this transaction was modified @@ -1499,7 +1516,7 @@ FILE FORMAT REPORTING BUGS - Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel + Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list) @@ -1513,7 +1530,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1) @@ -1521,4 +1538,4 @@ SEE ALSO -hledger 1.19.99 October 2020 hledger_journal(5) +hledger 1.19.99 November 2020 hledger_journal(5) diff --git a/hledger-lib/hledger_timeclock.5 b/hledger-lib/hledger_timeclock.5 index df21d06db..7d934d9e0 100644 --- a/hledger-lib/hledger_timeclock.5 +++ b/hledger-lib/hledger_timeclock.5 @@ -1,5 +1,5 @@ -.TH "hledger_timeclock" "5" "October 2020" "hledger 1.19.99" "hledger User Manuals" +.TH "hledger_timeclock" "5" "November 2020" "hledger 1.19.99" "hledger User Manuals" diff --git a/hledger-lib/hledger_timeclock.txt b/hledger-lib/hledger_timeclock.txt index ee440c6e0..e157fe0a2 100644 --- a/hledger-lib/hledger_timeclock.txt +++ b/hledger-lib/hledger_timeclock.txt @@ -78,4 +78,4 @@ SEE ALSO -hledger 1.19.99 October 2020 hledger_timeclock(5) +hledger 1.19.99 November 2020 hledger_timeclock(5) diff --git a/hledger-lib/hledger_timedot.5 b/hledger-lib/hledger_timedot.5 index 33bf011d8..4d2ad1326 100644 --- a/hledger-lib/hledger_timedot.5 +++ b/hledger-lib/hledger_timedot.5 @@ -1,5 +1,5 @@ -.TH "hledger_timedot" "5" "October 2020" "hledger 1.19.99" "hledger User Manuals" +.TH "hledger_timedot" "5" "November 2020" "hledger 1.19.99" "hledger User Manuals" diff --git a/hledger-lib/hledger_timedot.txt b/hledger-lib/hledger_timedot.txt index c82216696..5c5d68414 100644 --- a/hledger-lib/hledger_timedot.txt +++ b/hledger-lib/hledger_timedot.txt @@ -161,4 +161,4 @@ SEE ALSO -hledger 1.19.99 October 2020 hledger_timedot(5) +hledger 1.19.99 November 2020 hledger_timedot(5) diff --git a/hledger-ui/defs.m4 b/hledger-ui/defs.m4 index ce8828c81..f94c5a0bc 100644 --- a/hledger-ui/defs.m4 +++ b/hledger-ui/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.19.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{October 2020}})m4_dnl +m4_define({{_monthyear_}}, {{November 2020}})m4_dnl diff --git a/hledger-ui/hledger-ui.1 b/hledger-ui/hledger-ui.1 index 5ad356459..08e4bd4e6 100644 --- a/hledger-ui/hledger-ui.1 +++ b/hledger-ui/hledger-ui.1 @@ -1,5 +1,5 @@ -.TH "hledger-ui" "1" "October 2020" "hledger-ui 1.19.99" "hledger User Manuals" +.TH "hledger-ui" "1" "November 2020" "hledger-ui 1.19.99" "hledger User Manuals" diff --git a/hledger-ui/hledger-ui.txt b/hledger-ui/hledger-ui.txt index 95102d031..be2a3b40a 100644 --- a/hledger-ui/hledger-ui.txt +++ b/hledger-ui/hledger-ui.txt @@ -456,4 +456,4 @@ SEE ALSO -hledger-ui 1.19.99 October 2020 hledger-ui(1) +hledger-ui 1.19.99 November 2020 hledger-ui(1) diff --git a/hledger-web/defs.m4 b/hledger-web/defs.m4 index ce8828c81..f94c5a0bc 100644 --- a/hledger-web/defs.m4 +++ b/hledger-web/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.19.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{October 2020}})m4_dnl +m4_define({{_monthyear_}}, {{November 2020}})m4_dnl diff --git a/hledger-web/hledger-web.1 b/hledger-web/hledger-web.1 index a45819d76..91b162ca2 100644 --- a/hledger-web/hledger-web.1 +++ b/hledger-web/hledger-web.1 @@ -1,5 +1,5 @@ -.TH "hledger-web" "1" "October 2020" "hledger-web 1.19.99" "hledger User Manuals" +.TH "hledger-web" "1" "November 2020" "hledger-web 1.19.99" "hledger User Manuals" @@ -88,6 +88,10 @@ enable the view, add, and/or manage capabilities (default: view,add) \f[B]\f[CB]--capabilities-header=HTTPHEADER\f[B]\f[R] read capabilities to enable from a HTTP header, like X-Sandstorm-Permissions (default: disabled) +.TP +\f[B]\f[CB]--test\f[B]\f[R] +run hledger-web\[aq]s tests and exit. +hspec test runner args may follow a --, eg: hledger-web --test -- --help .PP hledger input options: .TP diff --git a/hledger-web/hledger-web.info b/hledger-web/hledger-web.info index 8ba0e947a..c4e771c0a 100644 --- a/hledger-web/hledger-web.info +++ b/hledger-web/hledger-web.info @@ -97,6 +97,10 @@ before options, as shown in the synopsis above. read capabilities to enable from a HTTP header, like X-Sandstorm-Permissions (default: disabled) +'--test' + + run hledger-web's tests and exit. hspec test runner args may + follow a -, eg: hledger-web -test - -help hledger input options: @@ -583,20 +587,20 @@ Tag Table: Node: Top72 Node: OPTIONS1752 Ref: #options1857 -Node: PERMISSIONS8737 -Ref: #permissions8876 -Node: EDITING UPLOADING DOWNLOADING10088 -Ref: #editing-uploading-downloading10269 -Node: RELOADING11103 -Ref: #reloading11237 -Node: JSON API11670 -Ref: #json-api11784 -Node: ENVIRONMENT17274 -Ref: #environment17390 -Node: FILES18123 -Ref: #files18223 -Node: BUGS18436 -Ref: #bugs18514 +Node: PERMISSIONS8861 +Ref: #permissions9000 +Node: EDITING UPLOADING DOWNLOADING10212 +Ref: #editing-uploading-downloading10393 +Node: RELOADING11227 +Ref: #reloading11361 +Node: JSON API11794 +Ref: #json-api11908 +Node: ENVIRONMENT17398 +Ref: #environment17514 +Node: FILES18247 +Ref: #files18347 +Node: BUGS18560 +Ref: #bugs18638  End Tag Table diff --git a/hledger-web/hledger-web.txt b/hledger-web/hledger-web.txt index 7f646873d..ee7af5239 100644 --- a/hledger-web/hledger-web.txt +++ b/hledger-web/hledger-web.txt @@ -80,6 +80,9 @@ OPTIONS read capabilities to enable from a HTTP header, like X-Sand- storm-Permissions (default: disabled) + --test run hledger-web's tests and exit. hspec test runner args may + follow a --, eg: hledger-web --test -- --help + hledger input options: -f FILE --file=FILE @@ -87,7 +90,7 @@ OPTIONS $LEDGER_FILE or $HOME/.hledger.journal) --rules-file=RULESFILE - Conversion rules file to use when reading CSV (default: + Conversion rules file to use when reading CSV (default: FILE.rules) --separator=CHAR @@ -129,7 +132,7 @@ OPTIONS multiperiod/multicolumn report by year -p --period=PERIODEXP - set start date, end date, and/or reporting interval all at once + set start date, end date, and/or reporting interval all at once using period expressions syntax --date2 @@ -152,21 +155,21 @@ OPTIONS hide/aggregate accounts or postings more than NUM levels deep -E --empty - show items with zero amount, normally hidden (and vice-versa in + show items with zero amount, normally hidden (and vice-versa in hledger-ui/hledger-web) -B --cost convert amounts to their cost/selling amount at transaction time -V --market - convert amounts to their market value in default valuation com- + convert amounts to their market value in default valuation com- modities -X --exchange=COMM convert amounts to their market value in commodity COMM --value - convert amounts to cost or market value, more flexibly than + convert amounts to cost or market value, more flexibly than -B/-V/-X --infer-value @@ -175,15 +178,15 @@ OPTIONS --auto apply automated posting rules to modify transactions. --forecast - generate future transactions from periodic transaction rules, - for the next 6 months or till report end date. In hledger-ui, + generate future transactions from periodic transaction rules, + for the next 6 months or till report end date. In hledger-ui, also make ordinary future transactions visible. --color=WHEN (or --colour=WHEN) - Should color-supporting commands use ANSI color codes in text - output. 'auto' (default): whenever stdout seems to be a color- - supporting terminal. 'always' or 'yes': always, useful eg when - piping output into 'less -R'. 'never' or 'no': never. A + Should color-supporting commands use ANSI color codes in text + output. 'auto' (default): whenever stdout seems to be a color- + supporting terminal. 'always' or 'yes': always, useful eg when + piping output into 'less -R'. 'never' or 'no': never. A NO_COLOR environment variable overrides this. When a reporting option appears more than once in the command line, the @@ -203,54 +206,54 @@ OPTIONS show debug output (levels 1-9, default: 1) A @FILE argument will be expanded to the contents of FILE, which should - contain one command line option/argument per line. (To prevent this, + contain one command line option/argument per line. (To prevent this, insert a -- argument before.) By default, hledger-web starts the web app in "transient mode" and also opens it in your default web browser if possible. In this mode the web app will keep running for as long as you have it open in a browser win- - dow, and will exit after two minutes of inactivity (no requests and no - browser windows viewing it). With --serve, it just runs the web app - without exiting, and logs requests to the console. With --serve-api, - only the JSON web api (see below) is served, with the usual HTML + dow, and will exit after two minutes of inactivity (no requests and no + browser windows viewing it). With --serve, it just runs the web app + without exiting, and logs requests to the console. With --serve-api, + only the JSON web api (see below) is served, with the usual HTML server-side web UI disabled. - By default the server listens on IP address 127.0.0.1, accessible only - to local requests. You can use --host to change this, eg --host + By default the server listens on IP address 127.0.0.1, accessible only + to local requests. You can use --host to change this, eg --host 0.0.0.0 to listen on all configured addresses. - Similarly, use --port to set a TCP port other than 5000, eg if you are + Similarly, use --port to set a TCP port other than 5000, eg if you are running multiple hledger-web instances. Both of these options are ignored when --socket is used. In this case, - it creates an AF_UNIX socket file at the supplied path and uses that - for communication. This is an alternative way of running multiple - hledger-web instances behind a reverse proxy that handles authentica- - tion for different users. The path can be derived in a predictable + it creates an AF_UNIX socket file at the supplied path and uses that + for communication. This is an alternative way of running multiple + hledger-web instances behind a reverse proxy that handles authentica- + tion for different users. The path can be derived in a predictable way, eg by using the username within the path. As an example, nginx as - reverse proxy can use the variable $remote_user to derive a path from - the username used in a HTTP basic authentication. The following - proxy_pass directive allows access to all hledger-web instances that + reverse proxy can use the variable $remote_user to derive a path from + the username used in a HTTP basic authentication. The following + proxy_pass directive allows access to all hledger-web instances that created a socket in /tmp/hledger/: proxy_pass http://unix:/tmp/hledger/${remote_user}.socket; - You can use --base-url to change the protocol, hostname, port and path + You can use --base-url to change the protocol, hostname, port and path that appear in hyperlinks, useful eg for integrating hledger-web within - a larger website. The default is http://HOST:PORT/ using the server's + a larger website. The default is http://HOST:PORT/ using the server's configured host address and TCP port (or http://HOST if PORT is 80). - With --file-url you can set a different base url for static files, eg + With --file-url you can set a different base url for static files, eg for better caching or cookie-less serving on high performance websites. PERMISSIONS - By default, hledger-web allows anyone who can reach it to view the + By default, hledger-web allows anyone who can reach it to view the journal and to add new transactions, but not to change existing data. You can restrict who can reach it by - o setting the IP address it listens on (see --host above). By default - it listens on 127.0.0.1, accessible to all users on the local ma- + o setting the IP address it listens on (see --host above). By default + it listens on 127.0.0.1, accessible to all users on the local ma- chine. o putting it behind an authenticating proxy, using eg apache or nginx @@ -260,44 +263,44 @@ PERMISSIONS You can restrict what the users who reach it can do, by o using the --capabilities=CAP[,CAP..] flag when you start it, enabling - one or more of the following capabilities. The default value is + one or more of the following capabilities. The default value is view,add: o view - allows viewing the journal file and all included files o add - allows adding new transactions to the main journal file - o manage - allows editing, uploading or downloading the main or in- + o manage - allows editing, uploading or downloading the main or in- cluded files - o using the --capabilities-header=HTTPHEADER flag to specify a HTTP - header from which it will read capabilities to enable. hledger-web - on Sandstorm uses the X-Sandstorm-Permissions header to integrate + o using the --capabilities-header=HTTPHEADER flag to specify a HTTP + header from which it will read capabilities to enable. hledger-web + on Sandstorm uses the X-Sandstorm-Permissions header to integrate with Sandstorm's permissions. This is disabled by default. EDITING, UPLOADING, DOWNLOADING - If you enable the manage capability mentioned above, you'll see a new - "spanner" button to the right of the search form. Clicking this will - let you edit, upload, or download the journal file or any files it in- + If you enable the manage capability mentioned above, you'll see a new + "spanner" button to the right of the search form. Clicking this will + let you edit, upload, or download the journal file or any files it in- cludes. - Note, unlike any other hledger command, in this mode you (or any visi- + Note, unlike any other hledger command, in this mode you (or any visi- tor) can alter or wipe the data files. - Normally whenever a file is changed in this way, hledger-web saves a - numbered backup (assuming file permissions allow it, the disk is not - full, etc.) hledger-web is not aware of version control systems, cur- - rently; if you use one, you'll have to arrange to commit the changes + Normally whenever a file is changed in this way, hledger-web saves a + numbered backup (assuming file permissions allow it, the disk is not + full, etc.) hledger-web is not aware of version control systems, cur- + rently; if you use one, you'll have to arrange to commit the changes yourself (eg with a cron job or a file watcher like entr). - Changes which would leave the journal file(s) unparseable or non-valid - (eg with failing balance assertions) are prevented. (Probably. This + Changes which would leave the journal file(s) unparseable or non-valid + (eg with failing balance assertions) are prevented. (Probably. This needs re-testing.) RELOADING hledger-web detects changes made to the files by other means (eg if you - edit it directly, outside of hledger-web), and it will show the new - data when you reload the page or navigate to a new page. If a change + edit it directly, outside of hledger-web), and it will show the new + data when you reload the page or navigate to a new page. If a change makes a file unparseable, hledger-web will display an error message un- til the file has been fixed. @@ -305,8 +308,8 @@ RELOADING that both machine clocks are roughly in step.) JSON API - In addition to the web UI, hledger-web also serves a JSON API that can - be used to get data or add new transactions. If you want the JSON API + In addition to the web UI, hledger-web also serves a JSON API that can + be used to get data or add new transactions. If you want the JSON API only, you can use the --serve-api flag. Eg: $ hledger-web -f examples/sample.journal --serve-api @@ -323,7 +326,7 @@ JSON API /accounttransactions/ACCOUNTNAME Eg, all account names in the journal (similar to the accounts command). - (hledger-web's JSON does not include newlines, here we use python to + (hledger-web's JSON does not include newlines, here we use python to prettify it): $ curl -s http://127.0.0.1:5000/accountnames | python -m json.tool @@ -364,25 +367,25 @@ JSON API "aprice": null, ... - Most of the JSON corresponds to hledger's data types; for details of - what the fields mean, see the Hledger.Data.Json haddock docs and click - on the various data types, eg Transaction. And for a higher level un- + Most of the JSON corresponds to hledger's data types; for details of + what the fields mean, see the Hledger.Data.Json haddock docs and click + on the various data types, eg Transaction. And for a higher level un- derstanding, see the journal manual. In some cases there is outer JSON corresponding to a "Report" type. To - understand that, go to the Hledger.Web.Handler.MiscR haddock and look - at the source for the appropriate handler to see what it returns. Eg + understand that, go to the Hledger.Web.Handler.MiscR haddock and look + at the source for the appropriate handler to see what it returns. Eg for /accounttransactions it's getAccounttransactionsR, returning a "ac- - countTransactionsReport ...". Looking up the haddock for that we can - see that /accounttransactions returns an AccountTransactionsReport, - which consists of a report title and a list of AccountTransactionsRe- + countTransactionsReport ...". Looking up the haddock for that we can + see that /accounttransactions returns an AccountTransactionsReport, + which consists of a report title and a list of AccountTransactionsRe- portItem (etc). - You can add a new transaction to the journal with a PUT request to - /add, if hledger-web was started with the add capability (enabled by + You can add a new transaction to the journal with a PUT request to + /add, if hledger-web was started with the add capability (enabled by default). The payload must be the full, exact JSON representation of a - hledger transaction (partial data won't do). You can get sample JSON - from hledger-web's /transactions or /accounttransactions, or you can + hledger transaction (partial data won't do). You can get sample JSON + from hledger-web's /transactions or /accounttransactions, or you can export it with hledger-lib, eg like so: .../hledger$ stack ghci hledger-lib @@ -478,22 +481,22 @@ JSON API "tstatus": "Unmarked" } - And here's how to test adding it with curl. This should add a new en- + And here's how to test adding it with curl. This should add a new en- try to your journal: $ curl http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.json ENVIRONMENT LEDGER_FILE The journal file path when not specified with -f. Default: - ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- + ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- nal). - A typical value is ~/DIR/YYYY.journal, where DIR is a version-con- - trolled finance directory and YYYY is the current year. Or ~/DIR/cur- + A typical value is ~/DIR/YYYY.journal, where DIR is a version-con- + trolled finance directory and YYYY is the current year. Or ~/DIR/cur- rent.journal, where current.journal is a symbolic link to YYYY.journal. On Mac computers, you can set this and other environment variables in a - more thorough way that also affects applications started from the GUI + more thorough way that also affects applications started from the GUI (say, an Emacs dock icon). Eg on MacOS Catalina I have a ~/.MacOSX/en- vironment.plist file containing @@ -504,13 +507,13 @@ ENVIRONMENT To see the effect you may need to killall Dock, or reboot. FILES - Reads data from one or more files in hledger journal, timeclock, time- - dot, or CSV format specified with -f, or $LEDGER_FILE, or - $HOME/.hledger.journal (on windows, perhaps + Reads data from one or more files in hledger journal, timeclock, time- + dot, or CSV format specified with -f, or $LEDGER_FILE, or + $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). BUGS - The need to precede options with -- when invoked from hledger is awk- + The need to precede options with -- when invoked from hledger is awk- ward. -f- doesn't work (hledger-web can't read from stdin). @@ -524,7 +527,7 @@ BUGS REPORTING BUGS - Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel + Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list) @@ -538,7 +541,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1) @@ -546,4 +549,4 @@ SEE ALSO -hledger-web 1.19.99 October 2020 hledger-web(1) +hledger-web 1.19.99 November 2020 hledger-web(1) diff --git a/hledger/defs.m4 b/hledger/defs.m4 index ce8828c81..f94c5a0bc 100644 --- a/hledger/defs.m4 +++ b/hledger/defs.m4 @@ -4,4 +4,4 @@ m4_dnl Program version. Updated by make setversion. m4_define({{_version_}}, {{1.19.99}})m4_dnl m4_dnl m4_dnl Date to show in man pages. Updated by make setdate. -m4_define({{_monthyear_}}, {{October 2020}})m4_dnl +m4_define({{_monthyear_}}, {{November 2020}})m4_dnl diff --git a/hledger/hledger.1 b/hledger/hledger.1 index 9a3d83549..bc94b5ff9 100644 --- a/hledger/hledger.1 +++ b/hledger/hledger.1 @@ -1,6 +1,6 @@ .\"t -.TH "hledger" "1" "October 2020" "hledger 1.19.99" "hledger User Manuals" +.TH "hledger" "1" "November 2020" "hledger 1.19.99" "hledger User Manuals" @@ -2115,7 +2115,7 @@ Related: #329, #1083. .PP .TS tab(@); -lw(7.4n) lw(11.7n) lw(19.6n) lw(6.8n) lw(19.6n) lw(5.0n). +lw(10.6n) lw(13.2n) lw(13.4n) lw(11.0n) lw(13.4n) lw(8.2n). T{ Report type T}@T{ @@ -2152,7 +2152,7 @@ T}@T{ value at DATE/today T} T{ -balance assertions / assignments +balance assertions/assignments T}@T{ unchanged T}@T{ @@ -2180,7 +2180,7 @@ T}@T{ T}@T{ T} T{ -starting balance (with -H) +starting balance (-H) T}@T{ cost T}@T{ @@ -2193,7 +2193,7 @@ T}@T{ value at DATE/today T} T{ -posting amounts (no report interval) +posting amounts T}@T{ cost T}@T{ @@ -2206,7 +2206,7 @@ T}@T{ value at DATE/today T} T{ -summary posting amounts (with report interval) +summary posting amounts with report interval T}@T{ summarised cost T}@T{ @@ -2239,7 +2239,7 @@ T}@T{ T}@T{ T} T{ -\f[B]balance (bs, bse, cf, is..)\f[R] +\f[B]balance (bs, bse, cf, is)\f[R] T}@T{ T}@T{ T}@T{ @@ -2247,7 +2247,7 @@ T}@T{ T}@T{ T} T{ -balances (no report interval) +balance changes T}@T{ sums of costs T}@T{ @@ -2260,40 +2260,48 @@ T}@T{ value at DATE/today of sums of postings T} T{ -balances changes (with report interval) +budget amounts (--budget) T}@T{ -sums of costs of postings in interval +like balance changes T}@T{ -value at period ends of sums of postings before period end minus value -at period starts of sums of all postings before period start +like balance changes T}@T{ not supported T}@T{ -value at period ends of sums of postings before period end minus value -at period starts of sums of all postings before period start +like balances T}@T{ -value at DATE/today of sums of postings +like balance changes T} T{ -end balances (with report interval and --cumulative or -H) +grand total T}@T{ -sums of costs of postings from report start (or before report start with --H) and interval end +sum of displayed values T}@T{ -value at period ends of sums of all postings before period end (minus -value at report start of of sums of all postings before report start -with --cumulative) +sum of displayed values T}@T{ not supported T}@T{ -value at period ends of sums of all postings before period end (minus -value at report start of of sums of all postings before report start -with --cumulative) +sum of displayed values T}@T{ -value at DATE/today of sums of postings +sum of displayed values T} T{ -starting balances (with report interval and -H) +T}@T{ +T}@T{ +T}@T{ +T}@T{ +T}@T{ +T} +T{ +\f[B]balance (bs, bse, cf, is) with report interval\f[R] +T}@T{ +T}@T{ +T}@T{ +T}@T{ +T}@T{ +T} +T{ +starting balances (-H) T}@T{ sums of costs of postings before report start T}@T{ @@ -2306,43 +2314,56 @@ T}@T{ sums of postings before report start T} T{ -budget amounts with --budget +balance changes (bal, is, bs --change, cf --change) T}@T{ -like balances +sums of costs of postings in period T}@T{ -like balances +same as --value=end T}@T{ not supported T}@T{ -like balances +balance change in each period, valued at period ends T}@T{ -like balances +value at DATE/today of sums of postings T} T{ -grand total (no report interval) +end balances (bal -H, is --H, bs, cf) T}@T{ -sum of displayed values +sums of costs of postings from before report start to period end T}@T{ -sum of displayed values +same as --value=end T}@T{ not supported T}@T{ -sum of displayed values +period end balances, valued at period ends T}@T{ -sum of displayed values +value at DATE/today of sums of postings T} T{ -row totals/averages (with report interval) +budget amounts (--budget) T}@T{ -sums/averages of displayed values +like balance changes/end balances T}@T{ -sums/averages of displayed values +like balance changes/end balances T}@T{ not supported T}@T{ -sums/averages of displayed values +like balances T}@T{ -sums/averages of displayed values +like balance changes/end balances +T} +T{ +row totals, row averages (-T, -A) +T}@T{ +sums, averages of displayed values +T}@T{ +sums, averages of displayed values +T}@T{ +not supported +T}@T{ +sums, averages of displayed values +T}@T{ +sums, averages of displayed values T} T{ column totals @@ -2358,17 +2379,17 @@ T}@T{ sums of displayed values T} T{ -grand total/average +grand total, grand average T}@T{ -sum/average of column totals +sum, average of column totals T}@T{ -sum/average of column totals +sum, average of column totals T}@T{ not supported T}@T{ -sum/average of column totals +sum, average of column totals T}@T{ -sum/average of column totals +sum, average of column totals T} T{ T}@T{ @@ -2379,6 +2400,9 @@ T}@T{ T} .TE .PP +\f[C]--cumulative\f[R] is omitted to save space, it works like +\f[C]-H\f[R] but with a zero starting balance. +.PP \f[B]Glossary:\f[R] .TP \f[I]cost\f[R] @@ -4451,6 +4475,9 @@ time-weighted rate of return (TWR) for your investments for the time period requested. Both rates of return are annualized before display, regardless of the length of reporting interval. +.PP +An example: +https://github.com/simonmichael/hledger/blob/master/examples/roi-unrealised.ledger .SS stats .PP stats diff --git a/hledger/hledger.info b/hledger/hledger.info index 094515f8f..90762f51b 100644 --- a/hledger/hledger.info +++ b/hledger/hledger.info @@ -1786,103 +1786,96 @@ sideways.) It may be useful when troubleshooting. If you find problems, please report them, ideally with a reproducible example. Related: #329, #1083. -Report '-B', '-V', '-X' '--value=then''--value=end' '--value=DATE', -type '--value=cost' '--value=now' ------------------------------------------------------------------------------- +Report '-B', '-V', '-X' '--value=then''--value=end' '--value=DATE', +type '--value=cost' '--value=now' +-------------------------------------------------------------------------------- *print* -posting cost value at report value value at report or value -amounts end or today at journal end at - posting DATE/today - date -balance unchanged unchanged unchangedunchanged unchanged -assertions -/ -assignments +posting cost value at value at value at value +amounts report end posting report or at + or today date journal end DATE/today +balance unchanged unchanged unchanged unchanged unchanged +assertions/assignments *register* -starting cost value at day not value at day value -balance before report or supportedbefore report or at -(with journal start journal start DATE/today --H) -posting cost value at report value value at report or value -amounts end or today at journal end at -(no posting DATE/today -report date -interval) -summary summarised value at period sum value at period value -posting cost ends of ends at -amounts postings DATE/today -(with in -report interval, -interval) valued - at - interval - start -running sum/average sum/average of sum/averagesum/average of sum/average -total/averageof displayed values of displayed values of - displayed displayed displayed - values values values +starting cost value at day not value at day value +balance before supported before at +(-H) report or report or DATE/today + journal journal + start start +posting cost value at value at value at value +amounts report end posting report or at + or today date journal end DATE/today +summary summarised value at sum of value at value +posting cost period ends postings period ends at +amounts in DATE/today +with interval, +report valued at +interval interval + start +running sum/average sum/average sum/average sum/average sum/average +total/averageof displayed of displayed of of displayed of + values values displayed values displayed + values values *balance -(bs, -bse, -cf, -is..)* -balances sums of value at report not value at report or value -(no costs end or today of supportedjournal end of at -report sums of postings sums of postings DATE/today -interval) of - sums - of - postings -balances sums of value at period not value at period value -changes costs of ends of sums of supportedends of sums of at -(with postings postings before postings before DATE/today -report in period end minus period end minus of -interval)interval value at period value at period sums - starts of sums of starts of sums of of - all postings all postings postings - before period before period - start start -end sums of value at period not value at period value -balances costs of ends of sums of supportedends of sums of at -(with postings all postings all postings DATE/today -report from before period end before period end of -interval report (minus value at (minus value at sums -and start (or report start of of report start of of of --cumulativebefore sums of all sums of all postings -or -H) report postings before postings before - start with report start with report start with - -H) and -cumulative) -cumulative) - interval - end -starting sums of value at report not value at report sums -balances costs of start of sums of supportedstart of sums of of -(with postings all postings all postings postings -report before before report before report before -interval report start start report -and start start --H) -budget like like balances not like balances like -amounts balances supported balances +(bs, bse, +cf, is)* +balance sums of value at not value at value +changes costs report end supported report or at + or today of journal end DATE/today + sums of of sums of of sums + postings postings of + postings +budget like balance like balance not like like +amounts changes changes supported balances balance +(-budget) changes +grand sum of sum of not sum of sum of +total displayed displayed supported displayed displayed + values values values values +*balance +(bs, bse, +cf, is) with --budget -grand sum of sum of displayed not sum of displayed sum -total displayed values supportedvalues of -(no values displayed -report values -interval) -row sums/averagessums/averages of not sums/averages of sums/averages -totals/averagesof displayed values supporteddisplayed values of -(with displayed displayed -report values values -interval) -column sums of sums of displayed not sums of displayed sums -totals displayed values supportedvalues of - values displayed - values -grand sum/average sum/average of not sum/average of sum/average -total/averageof columncolumn totals supportedcolumn totals of - totals column - totals +report +interval* +starting sums of value at not value at sums of +balances costs of report start supported report start postings +(-H) postings of sums of of sums of before + before all postings all postings report + report start before before start + report start report start +balance sums of same as not balance value +changes costs of -value=end supported change in at +(bal, is, postings in each period, DATE/today +bs period valued at of sums +-change, period ends of +cf postings +-change) +end sums of same as not period end value +balances costs of -value=end supported balances, at +(bal -H, postings valued at DATE/today +is -H, from before period ends of sums +bs, cf) report start of + to period postings + end +budget like balance like balance not like like +amounts changes/end changes/end supported balances balance +(-budget) balances balances changes/end + balances +row sums, sums, not sums, sums, +totals, averages of averages of supported averages of averages +row displayed displayed displayed of +averages values values values displayed +(-T, -A) values +column sums of sums of not sums of sums of +totals displayed displayed supported displayed displayed + values values values values +grand sum, average sum, average not sum, average sum, +total, of column of column supported of column average +grand totals totals totals of +average column + totals + + '--cumulative' is omitted to save space, it works like '-H' but with +a zero starting balance. *Glossary:* @@ -3810,6 +3803,9 @@ time-weighted rate of return (TWR) for your investments for the time period requested. Both rates of return are annualized before display, regardless of the length of reporting interval. + An example: +https://github.com/simonmichael/hledger/blob/master/examples/roi-unrealised.ledger +  File: hledger.info, Node: stats, Next: tags, Prev: roi, Up: COMMANDS @@ -4198,126 +4194,126 @@ Node: More valuation examples57470 Ref: #more-valuation-examples57679 Node: Effect of valuation on reports59684 Ref: #effect-of-valuation-on-reports59872 -Node: COMMANDS67137 -Ref: #commands67245 -Node: accounts68353 -Ref: #accounts68451 -Node: activity69150 -Ref: #activity69260 -Node: add69643 -Ref: #add69744 -Node: aregister72537 -Ref: #aregister72649 -Node: aregister and custom posting dates74022 -Ref: #aregister-and-custom-posting-dates74195 -Ref: #output-format-174788 -Node: balance75193 -Ref: #balance75310 -Node: Classic balance report76790 -Ref: #classic-balance-report76963 -Node: Customising the classic balance report78287 -Ref: #customising-the-classic-balance-report78515 -Node: Colour support80591 -Ref: #colour-support80758 -Node: Flat mode80854 -Ref: #flat-mode81002 -Node: Depth limited balance reports81415 -Ref: #depth-limited-balance-reports81600 -Node: Percentages82056 -Ref: #percentages82213 -Node: Sorting by amount83350 -Ref: #sorting-by-amount83516 -Node: Multicolumn balance report84010 -Ref: #multicolumn-balance-report84196 -Node: Budget report89793 -Ref: #budget-report89936 -Node: Nested budgets95202 -Ref: #nested-budgets95314 -Ref: #output-format-298797 -Node: balancesheet98994 -Ref: #balancesheet99130 -Node: balancesheetequity100642 -Ref: #balancesheetequity100791 -Node: cashflow101867 -Ref: #cashflow101995 -Node: check-dates103211 -Ref: #check-dates103338 -Node: check-dupes103617 -Ref: #check-dupes103743 -Node: close104036 -Ref: #close104144 -Node: close usage105666 -Ref: #close-usage105759 -Node: codes108572 -Ref: #codes108680 -Node: commodities109392 -Ref: #commodities109519 -Node: descriptions109601 -Ref: #descriptions109729 -Node: diff110033 -Ref: #diff110139 -Node: files111186 -Ref: #files111286 -Node: help111433 -Ref: #help111533 -Node: import112614 -Ref: #import112728 -Node: Importing balance assignments113650 -Ref: #importing-balance-assignments113831 -Node: Commodity display styles114480 -Ref: #commodity-display-styles114651 -Node: incomestatement114780 -Ref: #incomestatement114913 -Node: notes116258 -Ref: #notes116371 -Node: payees116739 -Ref: #payees116845 -Node: prices117265 -Ref: #prices117371 -Node: print117712 -Ref: #print117822 -Node: print-unique122618 -Ref: #print-unique122744 -Node: register123029 -Ref: #register123156 -Node: Custom register output127605 -Ref: #custom-register-output127734 -Node: register-match129071 -Ref: #register-match129205 -Node: rewrite129556 -Ref: #rewrite129671 -Node: Re-write rules in a file131526 -Ref: #re-write-rules-in-a-file131660 -Node: Diff output format132870 -Ref: #diff-output-format133039 -Node: rewrite vs print --auto134131 -Ref: #rewrite-vs.-print---auto134310 -Node: roi134866 -Ref: #roi134964 -Node: stats135976 -Ref: #stats136075 -Node: tags136863 -Ref: #tags136961 -Node: test137480 -Ref: #test137588 -Node: Add-on commands138335 -Ref: #add-on-commands138452 -Node: ui139795 -Ref: #ui139883 -Node: web139937 -Ref: #web140040 -Node: iadd140156 -Ref: #iadd140267 -Node: interest140349 -Ref: #interest140456 -Node: ENVIRONMENT140696 -Ref: #environment140808 -Node: FILES141793 -Ref: #files-1141896 -Node: LIMITATIONS142109 -Ref: #limitations142228 -Node: TROUBLESHOOTING142970 -Ref: #troubleshooting143083 +Node: COMMANDS66891 +Ref: #commands66999 +Node: accounts68107 +Ref: #accounts68205 +Node: activity68904 +Ref: #activity69014 +Node: add69397 +Ref: #add69498 +Node: aregister72291 +Ref: #aregister72403 +Node: aregister and custom posting dates73776 +Ref: #aregister-and-custom-posting-dates73949 +Ref: #output-format-174542 +Node: balance74947 +Ref: #balance75064 +Node: Classic balance report76544 +Ref: #classic-balance-report76717 +Node: Customising the classic balance report78041 +Ref: #customising-the-classic-balance-report78269 +Node: Colour support80345 +Ref: #colour-support80512 +Node: Flat mode80608 +Ref: #flat-mode80756 +Node: Depth limited balance reports81169 +Ref: #depth-limited-balance-reports81354 +Node: Percentages81810 +Ref: #percentages81967 +Node: Sorting by amount83104 +Ref: #sorting-by-amount83270 +Node: Multicolumn balance report83764 +Ref: #multicolumn-balance-report83950 +Node: Budget report89547 +Ref: #budget-report89690 +Node: Nested budgets94956 +Ref: #nested-budgets95068 +Ref: #output-format-298551 +Node: balancesheet98748 +Ref: #balancesheet98884 +Node: balancesheetequity100396 +Ref: #balancesheetequity100545 +Node: cashflow101621 +Ref: #cashflow101749 +Node: check-dates102965 +Ref: #check-dates103092 +Node: check-dupes103371 +Ref: #check-dupes103497 +Node: close103790 +Ref: #close103898 +Node: close usage105420 +Ref: #close-usage105513 +Node: codes108326 +Ref: #codes108434 +Node: commodities109146 +Ref: #commodities109273 +Node: descriptions109355 +Ref: #descriptions109483 +Node: diff109787 +Ref: #diff109893 +Node: files110940 +Ref: #files111040 +Node: help111187 +Ref: #help111287 +Node: import112368 +Ref: #import112482 +Node: Importing balance assignments113404 +Ref: #importing-balance-assignments113585 +Node: Commodity display styles114234 +Ref: #commodity-display-styles114405 +Node: incomestatement114534 +Ref: #incomestatement114667 +Node: notes116012 +Ref: #notes116125 +Node: payees116493 +Ref: #payees116599 +Node: prices117019 +Ref: #prices117125 +Node: print117466 +Ref: #print117576 +Node: print-unique122372 +Ref: #print-unique122498 +Node: register122783 +Ref: #register122910 +Node: Custom register output127359 +Ref: #custom-register-output127488 +Node: register-match128825 +Ref: #register-match128959 +Node: rewrite129310 +Ref: #rewrite129425 +Node: Re-write rules in a file131280 +Ref: #re-write-rules-in-a-file131414 +Node: Diff output format132624 +Ref: #diff-output-format132793 +Node: rewrite vs print --auto133885 +Ref: #rewrite-vs.-print---auto134064 +Node: roi134620 +Ref: #roi134718 +Node: stats135829 +Ref: #stats135928 +Node: tags136716 +Ref: #tags136814 +Node: test137333 +Ref: #test137441 +Node: Add-on commands138188 +Ref: #add-on-commands138305 +Node: ui139648 +Ref: #ui139736 +Node: web139790 +Ref: #web139893 +Node: iadd140009 +Ref: #iadd140120 +Node: interest140202 +Ref: #interest140309 +Node: ENVIRONMENT140549 +Ref: #environment140661 +Node: FILES141646 +Ref: #files-1141749 +Node: LIMITATIONS141962 +Ref: #limitations142081 +Node: TROUBLESHOOTING142823 +Ref: #troubleshooting142936  End Tag Table diff --git a/hledger/hledger.txt b/hledger/hledger.txt index 506fb3afe..0eb20afba 100644 --- a/hledger/hledger.txt +++ b/hledger/hledger.txt @@ -1533,112 +1533,90 @@ OPTIONS problems, please report them, ideally with a reproducible example. Re- lated: #329, #1083. - Report -B, -V, -X --value=then --value=end --value=DATE, - type --value=cost --value=now - ----------------------------------------------------------------------------------------------------- + Report type -B, -V, -X --value=then --value=end --value=DATE, + --value=cost --value=now + -------------------------------------------------------------------------------------------- print - posting cost value at report end value at value at report or value at - amounts or today posting date journal end DATE/today - balance unchanged unchanged unchanged unchanged unchanged - asser- - tions / - assign- - ments + posting cost value at re- value at value at re- value at + amounts port end or posting date port or jour- DATE/today + today nal end + balance as- unchanged unchanged unchanged unchanged unchanged + ser- + tions/as- + signments - regis- - ter - start- cost value at day before not sup- value at day before value at - ing report or journal ported report or journal DATE/today - balance start start - (with - -H) + register + starting cost value at day not sup- value at day value at + balance before report ported before report DATE/today + (-H) or journal or journal + start start + posting cost value at re- value at value at re- value at + amounts port end or posting date port or jour- DATE/today + today nal end - - posting cost value at report end value at value at report or value at - amounts or today posting date journal end DATE/today - (no re- - port - inter- - val) - summary summarised value at period ends sum of post- value at period ends value at - posting cost ings in in- DATE/today - amounts terval, val- - (with ued at in- - report terval start - inter- - val) - running sum/average sum/average of dis- sum/average sum/average of dis- sum/average - to- of displayed played values of displayed played values of displayed - tal/av- values values values - erage + summary summarised value at pe- sum of post- value at pe- value at + posting cost riod ends ings in in- riod ends DATE/today + amounts terval, val- + with report ued at in- + interval terval start + running to- sum/average sum/average sum/average sum/average sum/average + tal/average of displayed of displayed of displayed of displayed of displayed + values values values values values balance - (bs, - bse, - cf, - is..) - bal- sums of value at report end not sup- value at report or value at - ances costs or today of sums of ported journal end of sums DATE/today of - (no re- postings of postings sums of post- - port ings - inter- - val) - bal- sums of value at period ends not sup- value at period ends value at - ances costs of of sums of postings ported of sums of postings DATE/today of - changes postings in before period end before period end sums of post- - (with interval minus value at pe- minus value at pe- ings - report riod starts of sums riod starts of sums - inter- of all postings be- of all postings be- - val) fore period start fore period start - end sums of value at period ends not sup- value at period ends value at - bal- costs of of sums of all post- ported of sums of all post- DATE/today of - ances postings ings before period ings before period sums of post- - (with from report end (minus value at end (minus value at ings - report start (or report start of of report start of of - inter- before re- sums of all postings sums of all postings - val and port start before report start before report start - --cumu- with -H) and with --cumulative) with --cumulative) - lative interval end - or -H) - start- sums of value at report not sup- value at report sums of post- - ing costs of start of sums of all ported start of sums of all ings before - bal- postings be- postings before re- postings before re- report start - ances fore report port start port start - (with start - report - inter- - val and - -H) - budget like bal- like balances not sup- like balances like balances - amounts ances ported - with - --bud- - get - grand sum of dis- sum of displayed not sup- sum of displayed sum of dis- - total played val- values ported values played values - (no re- ues - port - inter- - val) + (bs, bse, + cf, is) + balance sums of costs value at re- not sup- value at re- value at + changes port end or ported port or jour- DATE/today of + today of sums nal end of sums of post- + of postings sums of post- ings + ings + budget like balance like balance not sup- like balances like balance + amounts changes changes ported changes + (--budget) + grand total sum of dis- sum of dis- not sup- sum of dis- sum of dis- + played values played values ported played values played values + + balance + (bs, bse, + cf, is) + with report + interval + starting sums of costs value at re- not sup- value at re- sums of post- + balances of postings port start of ported port start of ings before + (-H) before report sums of all sums of all report start + start postings be- postings be- + fore report fore report + start start + balance sums of costs same as not sup- balance value at + changes of postings --value=end ported change in DATE/today of + (bal, is, in period each period, sums of post- + bs valued at pe- ings + --change, riod ends + cf + --change) + end bal- sums of costs same as not sup- period end value at + ances (bal of postings --value=end ported balances, DATE/today of + -H, is --H, from before valued at pe- sums of post- + bs, cf) report start riod ends ings + to period end + budget like balance like balance not sup- like balances like balance + amounts changes/end changes/end ported changes/end + (--budget) balances balances balances + row totals, sums, aver- sums, aver- not sup- sums, aver- sums, aver- + row aver- ages of dis- ages of dis- ported ages of dis- ages of dis- + ages (-T, played values played values played values played values + -A) + column to- sums of dis- sums of dis- not sup- sums of dis- sums of dis- + tals played values played values ported played values played values + grand to- sum, average sum, average not sup- sum, average sum, average + tal, grand of column to- of column to- ported of column to- of column to- + average tals tals tals tals - - row to- sums/aver- sums/averages of not sup- sums/averages of sums/averages - tals/av- ages of dis- displayed values ported displayed values of displayed - erages played val- values - (with ues - report - inter- - val) - column sums of dis- sums of displayed not sup- sums of displayed sums of dis- - totals played val- values ported values played values - ues - grand sum/average sum/average of col- not sup- sum/average of col- sum/average - to- of column umn totals ported umn totals of column to- - tal/av- totals tals - erage - + --cumulative is omitted to save space, it works like -H but with a zero + starting balance. Glossary: @@ -3257,12 +3235,15 @@ COMMANDS period requested. Both rates of return are annualized before display, regardless of the length of reporting interval. + An example: https://github.com/simonmichael/hledger/blob/master/exam- + ples/roi-unrealised.ledger + stats stats Show some journal statistics. - The stats command displays summary information for the whole journal, - or a matched part of it. With a reporting interval, it shows a report + The stats command displays summary information for the whole journal, + or a matched part of it. With a reporting interval, it shows a report for each report period. Example: @@ -3280,35 +3261,35 @@ COMMANDS Commodities : 1 ($) Market prices : 12 ($) - This command also supports output destination and output format selec- + This command also supports output destination and output format selec- tion. tags tags - List the unique tag names used in the journal. With a TAGREGEX argu- + List the unique tag names used in the journal. With a TAGREGEX argu- ment, only tag names matching the regular expression (case insensitive) - are shown. With QUERY arguments, only transactions matching the query + are shown. With QUERY arguments, only transactions matching the query are considered. With the --values flag, the tags' unique values are listed instead. - With --parsed flag, all tags or values are shown in the order they are + With --parsed flag, all tags or values are shown in the order they are parsed from the input data, including duplicates. - With -E/--empty, any blank/empty values will also be shown, otherwise + With -E/--empty, any blank/empty values will also be shown, otherwise they are omitted. test test Run built-in unit tests. - This command runs the unit tests built in to hledger and hledger-lib, - printing the results on stdout. If any test fails, the exit code will + This command runs the unit tests built in to hledger and hledger-lib, + printing the results on stdout. If any test fails, the exit code will be non-zero. - This is mainly used by hledger developers, but you can also use it to - sanity-check the installed hledger executable on your platform. All - tests are expected to pass - if you ever see a failure, please report + This is mainly used by hledger developers, but you can also use it to + sanity-check the installed hledger executable on your platform. All + tests are expected to pass - if you ever see a failure, please report as a bug! This command also accepts tasty test runner options, written after a -- @@ -3317,35 +3298,35 @@ COMMANDS $ hledger test -- -pData.Amount --color=never - For help on these, see https://github.com/feuerbach/tasty#options (-- + For help on these, see https://github.com/feuerbach/tasty#options (-- --help currently doesn't show them). Add-on commands - hledger also searches for external add-on commands, and will include + hledger also searches for external add-on commands, and will include these in the commands list. These are programs or scripts in your PATH - whose name starts with hledger- and ends with a recognised file exten- + whose name starts with hledger- and ends with a recognised file exten- sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh). - Add-ons can be invoked like any hledger command, but there are a few + Add-ons can be invoked like any hledger command, but there are a few things to be aware of. Eg if the hledger-web add-on is installed, - o hledger -h web shows hledger's help, while hledger web -h shows + o hledger -h web shows hledger's help, while hledger web -h shows hledger-web's help. - o Flags specific to the add-on must have a preceding -- to hide them - from hledger. So hledger web --serve --port 9000 will be rejected; + o Flags specific to the add-on must have a preceding -- to hide them + from hledger. So hledger web --serve --port 9000 will be rejected; you must use hledger web -- --serve --port 9000. o You can always run add-ons directly if preferred: hledger-web --serve --port 9000. - Add-ons are a relatively easy way to add local features or experiment - with new ideas. They can be written in any language, but haskell - scripts have a big advantage: they can use the same hledger (and - haskell) library functions that built-in commands do, for command-line + Add-ons are a relatively easy way to add local features or experiment + with new ideas. They can be written in any language, but haskell + scripts have a big advantage: they can use the same hledger (and + haskell) library functions that built-in commands do, for command-line options, journal parsing, reporting, etc. - Two important add-ons are the hledger-ui and hledger-web user inter- + Two important add-ons are the hledger-ui and hledger-web user inter- faces. These are maintained and released along with hledger: ui @@ -3364,20 +3345,20 @@ COMMANDS hledger-interest generates interest transactions for an account accord- ing to various schemes. - A few more experimental or old add-ons can be found in hledger's bin/ + A few more experimental or old add-ons can be found in hledger's bin/ directory. These are typically prototypes and not guaranteed to work. ENVIRONMENT LEDGER_FILE The journal file path when not specified with -f. Default: - ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- + ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- nal). - A typical value is ~/DIR/YYYY.journal, where DIR is a version-con- - trolled finance directory and YYYY is the current year. Or ~/DIR/cur- + A typical value is ~/DIR/YYYY.journal, where DIR is a version-con- + trolled finance directory and YYYY is the current year. Or ~/DIR/cur- rent.journal, where current.journal is a symbolic link to YYYY.journal. On Mac computers, you can set this and other environment variables in a - more thorough way that also affects applications started from the GUI + more thorough way that also affects applications started from the GUI (say, an Emacs dock icon). Eg on MacOS Catalina I have a ~/.MacOSX/en- vironment.plist file containing @@ -3387,21 +3368,21 @@ ENVIRONMENT To see the effect you may need to killall Dock, or reboot. - COLUMNS The screen width used by the register command. Default: the + COLUMNS The screen width used by the register command. Default: the full terminal width. - NO_COLOR If this variable exists with any value, hledger will not use - ANSI color codes in terminal output. This overrides the + NO_COLOR If this variable exists with any value, hledger will not use + ANSI color codes in terminal output. This overrides the --color/--colour option. FILES - Reads data from one or more files in hledger journal, timeclock, time- - dot, or CSV format specified with -f, or $LEDGER_FILE, or - $HOME/.hledger.journal (on windows, perhaps + Reads data from one or more files in hledger journal, timeclock, time- + dot, or CSV format specified with -f, or $LEDGER_FILE, or + $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). LIMITATIONS - The need to precede addon command options with -- when invoked from + The need to precede addon command options with -- when invoked from hledger is awkward. When input data contains non-ascii characters, a suitable system locale @@ -3417,36 +3398,36 @@ LIMITATIONS In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger add. - Not all of Ledger's journal file syntax is supported. See file format + Not all of Ledger's journal file syntax is supported. See file format differences. - On large data files, hledger is slower and uses more memory than + On large data files, hledger is slower and uses more memory than Ledger. TROUBLESHOOTING - Here are some issues you might encounter when you run hledger (and re- - member you can also seek help from the IRC channel, mail list or bug + Here are some issues you might encounter when you run hledger (and re- + member you can also seek help from the IRC channel, mail list or bug tracker): Successfully installed, but "No command 'hledger' found" stack and cabal install binaries into a special directory, which should - be added to your PATH environment variable. Eg on unix-like systems, + be added to your PATH environment variable. Eg on unix-like systems, that is ~/.local/bin and ~/.cabal/bin respectively. I set a custom LEDGER_FILE, but hledger is still using the default file - LEDGER_FILE should be a real environment variable, not just a shell - variable. The command env | grep LEDGER_FILE should show it. You may + LEDGER_FILE should be a real environment variable, not just a shell + variable. The command env | grep LEDGER_FILE should show it. You may need to use export. Here's an explanation. - Getting errors like "Illegal byte sequence" or "Invalid or incomplete - multibyte or wide character" or "commitAndReleaseBuffer: invalid argu- + Getting errors like "Illegal byte sequence" or "Invalid or incomplete + multibyte or wide character" or "commitAndReleaseBuffer: invalid argu- ment (invalid character)" Programs compiled with GHC (hledger, haskell build tools, etc.) need to have a UTF-8-aware locale configured in the environment, otherwise they - will fail with these kinds of errors when they encounter non-ascii + will fail with these kinds of errors when they encounter non-ascii characters. - To fix it, set the LANG environment variable to some locale which sup- + To fix it, set the LANG environment variable to some locale which sup- ports UTF-8. The locale you choose must be installed on your system. Here's an example of setting LANG temporarily, on Ubuntu GNU/Linux: @@ -3461,8 +3442,8 @@ TROUBLESHOOTING POSIX $ LANG=en_US.utf8 hledger -f my.journal print # ensure it is used for this command - If available, C.UTF-8 will also work. If your preferred locale isn't - listed by locale -a, you might need to install it. Eg on Ubuntu/De- + If available, C.UTF-8 will also work. If your preferred locale isn't + listed by locale -a, you might need to install it. Eg on Ubuntu/De- bian: $ apt-get install language-pack-fr @@ -3482,8 +3463,8 @@ TROUBLESHOOTING $ echo "export LANG=en_US.utf8" >>~/.bash_profile $ bash --login - Exact spelling and capitalisation may be important. Note the differ- - ence on MacOS (UTF-8, not utf8). Some platforms (eg ubuntu) allow + Exact spelling and capitalisation may be important. Note the differ- + ence on MacOS (UTF-8, not utf8). Some platforms (eg ubuntu) allow variant spellings, but others (eg macos) require it to be exact: $ locale -a | grep -iE en_us.*utf @@ -3493,7 +3474,7 @@ TROUBLESHOOTING REPORTING BUGS - Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel + Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list) @@ -3507,7 +3488,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1) @@ -3515,4 +3496,4 @@ SEE ALSO -hledger 1.19.99 October 2020 hledger(1) +hledger 1.19.99 November 2020 hledger(1)