diff --git a/hledger-lib/hledger_journal.5 b/hledger-lib/hledger_journal.5 index 090b0e974..25c930781 100644 --- a/hledger-lib/hledger_journal.5 +++ b/hledger-lib/hledger_journal.5 @@ -1332,15 +1332,13 @@ market prices to show amount values in another commodity. See Valuation. .SS Declaring accounts .PP -\f[C]account\f[R] directives can be used to pre-declare accounts. -Though not required, they can provide several benefits: +\f[C]account\f[R] directives can be used to declare accounts (ie, the +places that amounts are transferred from and to). +Though not required, these declarations can provide several benefits: .IP \[bu] 2 They can document your intended chart of accounts, providing a reference. .IP \[bu] 2 -They can store extra information about accounts (account numbers, notes, -etc.) -.IP \[bu] 2 They can help hledger know your accounts\[aq] types (asset, liability, equity, revenue, expense), useful for reports like balancesheet and incomestatement. @@ -1348,17 +1346,55 @@ incomestatement. They control account display order in reports, allowing non-alphabetic sorting (eg Revenues to appear above Expenses). .IP \[bu] 2 +They can store extra information about accounts (account numbers, notes, +etc.) +.IP \[bu] 2 They help with account name completion in the add command, hledger-iadd, hledger-web, ledger-mode etc. +.IP \[bu] 2 +In strict mode, they restrict which accounts may be posted to by +transactions, which helps detect typos. .PP The simplest form is just the word \f[C]account\f[R] followed by a -hledger-style account name, eg: +hledger-style account name, eg this account directive declares the +\f[C]assets:bank:checking\f[R] account: .IP .nf \f[C] account assets:bank:checking \f[R] .fi +.SS Account existence +.PP +By default, accounts come into existence when a transaction references +them. +This is convenient, but when you mis-spell an account name in a +transaction, hledger won\[aq]t be able to detect it. +Usually this isn\[aq]t a big problem, as you\[aq]ll notice the error in +balance reports, or when reconciling account balances. +.PP +When you want more error checking, you can enable strict mode with the +\f[C]-s\f[R]/\f[C]--strict\f[R] flag. +Then hledger will will report an error if any transaction references an +account that has not been declared by an account directive. +Some things to note: +.IP \[bu] 2 +The declaration is case-sensitive; transactions must use the correct +account name capitalisation. +.IP \[bu] 2 +The account directive\[aq]s scope is \[dq]whole file and below\[dq] (see +directives). +This means it affects all of the current file, and any files it +includes, but not parent or sibling files. +The position of account directives within the file does not matter, +though it\[aq]s usual to put them at the top. +.IP \[bu] 2 +Accounts can only be declared in \f[C]journal\f[R] files (but will +affect included files in other formats). +.IP \[bu] 2 +It\[aq]s currently not possible to declare \[dq]all possible +subaccounts\[dq] with a wildcard; every account posted to must be +declared. .SS Account comments .PP Comments, beginning with a semicolon, can be added: diff --git a/hledger-lib/hledger_journal.info b/hledger-lib/hledger_journal.info index 190653f05..3cfafa4a7 100644 --- a/hledger-lib/hledger_journal.info +++ b/hledger-lib/hledger_journal.info @@ -1202,37 +1202,71 @@ File: hledger_journal.info, Node: Declaring accounts, Next: Rewriting accounts 1.13.8 Declaring accounts ------------------------- -'account' directives can be used to pre-declare accounts. Though not -required, they can provide several benefits: +'account' directives can be used to declare accounts (ie, the places +that amounts are transferred from and to). Though not required, these +declarations can provide several benefits: * They can document your intended chart of accounts, providing a reference. - * They can store extra information about accounts (account numbers, - notes, etc.) * They can help hledger know your accounts' types (asset, liability, equity, revenue, expense), useful for reports like balancesheet and incomestatement. * They control account display order in reports, allowing non-alphabetic sorting (eg Revenues to appear above Expenses). + * They can store extra information about accounts (account numbers, + notes, etc.) * They help with account name completion in the add command, hledger-iadd, hledger-web, ledger-mode etc. + * In strict mode, they restrict which accounts may be posted to by + transactions, which helps detect typos. The simplest form is just the word 'account' followed by a -hledger-style account name, eg: +hledger-style account name, eg this account directive declares the +'assets:bank:checking' account: account assets:bank:checking * Menu: +* Account existence:: * Account comments:: * Account subdirectives:: * Account types:: * Account display order::  -File: hledger_journal.info, Node: Account comments, Next: Account subdirectives, Up: Declaring accounts +File: hledger_journal.info, Node: Account existence, Next: Account comments, Up: Declaring accounts -1.13.8.1 Account comments +1.13.8.1 Account existence +.......................... + +By default, accounts come into existence when a transaction references +them. This is convenient, but when you mis-spell an account name in a +transaction, hledger won't be able to detect it. Usually this isn't a +big problem, as you'll notice the error in balance reports, or when +reconciling account balances. + + When you want more error checking, you can enable strict mode with +the '-s'/'--strict' flag. Then hledger will will report an error if any +transaction references an account that has not been declared by an +account directive. Some things to note: + + * The declaration is case-sensitive; transactions must use the + correct account name capitalisation. + * The account directive's scope is "whole file and below" (see + directives). This means it affects all of the current file, and + any files it includes, but not parent or sibling files. The + position of account directives within the file does not matter, + though it's usual to put them at the top. + * Accounts can only be declared in 'journal' files (but will affect + included files in other formats). + * It's currently not possible to declare "all possible subaccounts" + with a wildcard; every account posted to must be declared. + + +File: hledger_journal.info, Node: Account comments, Next: Account subdirectives, Prev: Account existence, Up: Declaring accounts + +1.13.8.2 Account comments ......................... Comments, beginning with a semicolon, can be added: @@ -1252,7 +1286,7 @@ account assets:bank:checking ; same-line comment, note 2+ spaces before ;  File: hledger_journal.info, Node: Account subdirectives, Next: Account types, Prev: Account comments, Up: Declaring accounts -1.13.8.2 Account subdirectives +1.13.8.3 Account subdirectives .............................. We also allow (and ignore) Ledger-style indented subdirectives, just for @@ -1270,7 +1304,7 @@ account ACCTNAME [ACCTTYPE] [;COMMENT]  File: hledger_journal.info, Node: Account types, Next: Account display order, Prev: Account subdirectives, Up: Declaring accounts -1.13.8.3 Account types +1.13.8.4 Account types ...................... hledger recognises five main types of account, corresponding to the @@ -1349,7 +1383,7 @@ account expenses X  File: hledger_journal.info, Node: Account display order, Prev: Account types, Up: Declaring accounts -1.13.8.4 Account display order +1.13.8.5 Account display order .............................. Account directives also set the order in which accounts are displayed, @@ -1962,48 +1996,50 @@ 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 +Node: Account existence45990 +Ref: #account-existence46151 +Node: Account comments47387 +Ref: #account-comments47576 +Node: Account subdirectives48000 +Ref: #account-subdirectives48195 +Node: Account types48508 +Ref: #account-types48692 +Node: Account display order51738 +Ref: #account-display-order51908 +Node: Rewriting accounts53059 +Ref: #rewriting-accounts53244 +Node: Basic aliases54001 +Ref: #basic-aliases54147 +Node: Regex aliases54851 +Ref: #regex-aliases55023 +Node: Combining aliases55742 +Ref: #combining-aliases55935 +Node: Aliases and multiple files57211 +Ref: #aliases-and-multiple-files57420 +Node: end aliases57999 +Ref: #end-aliases58156 +Node: Default parent account58257 +Ref: #default-parent-account58425 +Node: Periodic transactions59309 +Ref: #periodic-transactions59484 +Node: Periodic rule syntax61356 +Ref: #periodic-rule-syntax61562 +Node: Two spaces between period expression and description!62266 +Ref: #two-spaces-between-period-expression-and-description62585 +Node: Forecasting with periodic transactions63269 +Ref: #forecasting-with-periodic-transactions63574 +Node: Budgeting with periodic transactions65629 +Ref: #budgeting-with-periodic-transactions65868 +Node: Auto postings66277 +Ref: #auto-postings66417 +Node: Auto postings and multiple files68596 +Ref: #auto-postings-and-multiple-files68800 +Node: Auto postings and dates69009 +Ref: #auto-postings-and-dates69283 +Node: Auto postings and transaction balancing / inferred amounts / balance assertions69458 +Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions69809 +Node: Auto posting tags70151 +Ref: #auto-posting-tags70366  End Tag Table diff --git a/hledger-lib/hledger_journal.txt b/hledger-lib/hledger_journal.txt index 9ed1cb723..bdd958a1e 100644 --- a/hledger-lib/hledger_journal.txt +++ b/hledger-lib/hledger_journal.txt @@ -941,15 +941,13 @@ FILE FORMAT values in another commodity. See Valuation. Declaring accounts - account directives can be used to pre-declare accounts. Though not re- - quired, they can provide several benefits: + account directives can be used to declare accounts (ie, the places that + amounts are transferred from and to). Though not required, these dec- + larations can provide several benefits: o They can document your intended chart of accounts, providing a refer- ence. - 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 incomestatement. @@ -957,18 +955,52 @@ FILE FORMAT 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 can store extra information about accounts (account numbers, + notes, etc.) + + o They help with account name completion in the add command, hledger- iadd, hledger-web, ledger-mode etc. + o In strict mode, they restrict which accounts may be posted to by + transactions, which helps detect typos. + The simplest form is just the word account followed by a hledger-style - account name, eg: + account name, eg this account directive declares the assets:bank:check- + ing account: account assets:bank:checking + Account existence + By default, accounts come into existence when a transaction references + them. This is convenient, but when you mis-spell an account name in a + transaction, hledger won't be able to detect it. Usually this isn't a + big problem, as you'll notice the error in balance reports, or when + reconciling account balances. + + When you want more error checking, you can enable strict mode with the + -s/--strict flag. Then hledger will will report an error if any trans- + action references an account that has not been declared by an account + directive. Some things to note: + + o The declaration is case-sensitive; transactions must use the correct + account name capitalisation. + + o The account directive's scope is "whole file and below" (see direc- + tives). This means it affects all of the current file, and any files + it includes, but not parent or sibling files. The position of ac- + count directives within the file does not matter, though it's usual + to put them at the top. + + o Accounts can only be declared in journal files (but will affect in- + cluded files in other formats). + + o It's currently not possible to declare "all possible subaccounts" + with a wildcard; every account posted to must be declared. + 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 @@ -982,7 +1014,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 @@ -1001,21 +1033,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 @@ -1027,8 +1059,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: @@ -1041,7 +1073,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 @@ -1051,9 +1083,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: @@ -1065,8 +1097,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 @@ -1076,8 +1108,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: @@ -1099,20 +1131,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 @@ -1130,14 +1162,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 @@ -1145,49 +1177,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: @@ -1198,20 +1230,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 @@ -1233,14 +1265,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 @@ -1257,7 +1289,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 @@ -1266,50 +1298,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 @@ -1321,17 +1353,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: @@ -1345,67 +1377,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: @@ -1415,27 +1447,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' @@ -1474,24 +1506,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. @@ -1501,11 +1533,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 @@ -1516,7 +1548,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) @@ -1530,7 +1562,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) diff --git a/hledger-ui/hledger-ui.1 b/hledger-ui/hledger-ui.1 index 08e4bd4e6..16297012b 100644 --- a/hledger-ui/hledger-ui.1 +++ b/hledger-ui/hledger-ui.1 @@ -88,6 +88,9 @@ use some other field or tag for the account name \f[B]\f[CB]-I --ignore-assertions\f[B]\f[R] disable balance assertion checks (note: does not disable balance assignments) +.TP +\f[B]\f[CB]-s --strict\f[B]\f[R] +do extra error checking (check that all posted accounts are declared) .PP hledger reporting options: .TP diff --git a/hledger-ui/hledger-ui.info b/hledger-ui/hledger-ui.info index 31b216d24..0e467c830 100644 --- a/hledger-ui/hledger-ui.info +++ b/hledger-ui/hledger-ui.info @@ -99,6 +99,10 @@ the data. disable balance assertion checks (note: does not disable balance assignments) +'-s --strict' + + do extra error checking (check that all posted accounts are + declared) hledger reporting options: @@ -517,24 +521,24 @@ Tag Table: Node: Top71 Node: OPTIONS1476 Ref: #options1573 -Node: keys5545 -Ref: #keys5640 -Node: screens9972 -Ref: #screens10077 -Node: accounts screen10167 -Ref: #accounts-screen10295 -Node: Register screen12510 -Ref: #register-screen12665 -Node: Transaction screen14662 -Ref: #transaction-screen14820 -Node: Error screen15690 -Ref: #error-screen15812 -Node: ENVIRONMENT16056 -Ref: #environment16170 -Node: FILES16977 -Ref: #files17076 -Node: BUGS17289 -Ref: #bugs17366 +Node: keys5640 +Ref: #keys5735 +Node: screens10067 +Ref: #screens10172 +Node: accounts screen10262 +Ref: #accounts-screen10390 +Node: Register screen12605 +Ref: #register-screen12760 +Node: Transaction screen14757 +Ref: #transaction-screen14915 +Node: Error screen15785 +Ref: #error-screen15907 +Node: ENVIRONMENT16151 +Ref: #environment16265 +Node: FILES17072 +Ref: #files17171 +Node: BUGS17384 +Ref: #bugs17461  End Tag Table diff --git a/hledger-ui/hledger-ui.txt b/hledger-ui/hledger-ui.txt index be2a3b40a..af9e3184b 100644 --- a/hledger-ui/hledger-ui.txt +++ b/hledger-ui/hledger-ui.txt @@ -84,6 +84,10 @@ OPTIONS disable balance assertion checks (note: does not disable balance assignments) + -s --strict + do extra error checking (check that all posted accounts are de- + clared) + hledger reporting options: -b --begin=DATE @@ -108,7 +112,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 @@ -131,21 +135,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 @@ -154,15 +158,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 @@ -182,91 +186,91 @@ 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.) keys - ? shows a help dialog listing all keys. (some of these also appear in + ? shows a help dialog listing all keys. (some of these also appear in the quick help at the bottom of each screen.) press ? again (or escape, or left, or q) to close it. the following keys work on most screens: the cursor keys navigate: right (or enter) goes deeper, left returns to - the previous screen, up/down/page up/page down/home/end move up and + the previous screen, up/down/page up/page down/home/end move up and down through lists. Emacs-style (ctrl-p/ctrl-n/ctrl-f/ctrl-b) movement - keys are also supported (but not vi-style keys, since hledger-1.19, - sorry!). A tip: movement speed is limited by your keyboard repeat - rate, to move faster you may want to adjust it. (If you're on a mac, + keys are also supported (but not vi-style keys, since hledger-1.19, + sorry!). A tip: movement speed is limited by your keyboard repeat + rate, to move faster you may want to adjust it. (If you're on a mac, the karabiner app is one way to do that.) - with shift pressed, the cursor keys adjust the report period, limiting - the transactions to be shown (by default, all are shown). shift- - down/up steps downward and upward through these standard report period - durations: year, quarter, month, week, day. then, shift-left/right - moves to the previous/next period. T sets the report period to today. - with the --watch option, when viewing a "current" period (the current + with shift pressed, the cursor keys adjust the report period, limiting + the transactions to be shown (by default, all are shown). shift- + down/up steps downward and upward through these standard report period + durations: year, quarter, month, week, day. then, shift-left/right + moves to the previous/next period. T sets the report period to today. + with the --watch option, when viewing a "current" period (the current day, week, month, quarter, or year), the period will move automatically to track the current date. to set a non-standard period, you can use / and a date: query. - / lets you set a general filter query limiting the data shown, using - the same query terms as in hledger and hledger-web. while editing the - query, you can use ctrl-a/e/d/k, bs, cursor keys; press enter to set + / lets you set a general filter query limiting the data shown, using + the same query terms as in hledger and hledger-web. while editing the + query, you can use ctrl-a/e/d/k, bs, cursor keys; press enter to set it, or escapeto cancel. there are also keys for quickly adjusting some - common filters like account depth and transaction status (see below). + common filters like account depth and transaction status (see below). backspace or delete removes all filters, showing all transactions. - as mentioned above, by default hledger-ui hides future transactions - + as mentioned above, by default hledger-ui hides future transactions - both ordinary transactions recorded in the journal, and periodic trans- - actions generated by rule. f toggles forecast mode, in which fu- + actions generated by rule. f toggles forecast mode, in which fu- ture/forecasted transactions are shown. (experimental) - escape resets the UI state and jumps back to the top screen, restoring + escape resets the UI state and jumps back to the top screen, restoring the app's initial state at startup. Or, it cancels minibuffer data en- try or the help dialog. ctrl-l redraws the screen and centers the selection if possible (selec- - tions near the top won't be centered, since we don't scroll above the + tions near the top won't be centered, since we don't scroll above the top). - g reloads from the data file(s) and updates the current screen and any - previous screens. (with large files, this could cause a noticeable + g reloads from the data file(s) and updates the current screen and any + previous screens. (with large files, this could cause a noticeable pause.) - i toggles balance assertion checking. disabling balance assertions + i toggles balance assertion checking. disabling balance assertions temporarily can be useful for troubleshooting. - a runs command-line hledger's add command, and reloads the updated + a runs command-line hledger's add command, and reloads the updated file. this allows some basic data entry. - a is like a, but runs the hledger-iadd tool, which provides a terminal - interface. this key will be available if hledger-iadd is installed in + a is like a, but runs the hledger-iadd tool, which provides a terminal + interface. this key will be available if hledger-iadd is installed in $path. - e runs $hledger_ui_editor, or $editor, or a default (emacsclient -a "" - -nw) on the journal file. with some editors (emacs, vi), the cursor - will be positioned at the current transaction when invoked from the - register and transaction screens, and at the error location (if possi- + e runs $hledger_ui_editor, or $editor, or a default (emacsclient -a "" + -nw) on the journal file. with some editors (emacs, vi), the cursor + will be positioned at the current transaction when invoked from the + register and transaction screens, and at the error location (if possi- ble) when invoked from the error screen. - b toggles cost mode, showing amounts in their transaction price's com- + b toggles cost mode, showing amounts in their transaction price's com- modity (like toggling the -b/--cost flag). - v toggles value mode, showing amounts' current market value in their - default valuation commodity (like toggling the -v/--market flag). - note, "current market value" means the value on the report end date if - specified, otherwise today. to see the value on another date, you can - temporarily set that as the report end date. eg: to see a transaction - as it was valued on july 30, go to the accounts or register screen, + v toggles value mode, showing amounts' current market value in their + default valuation commodity (like toggling the -v/--market flag). + note, "current market value" means the value on the report end date if + specified, otherwise today. to see the value on another date, you can + temporarily set that as the report end date. eg: to see a transaction + as it was valued on july 30, go to the accounts or register screen, press /, and add date:-7/30 to the query. at most one of cost or value mode can be active at once. - there's not yet any visual reminder when cost or value mode is active; + there's not yet any visual reminder when cost or value mode is active; for now pressing b b v should reliably reset to normal mode. - with --watch active, if you save an edit to the journal file while + with --watch active, if you save an edit to the journal file while viewing the transaction screen in cost or value mode, the b/v keys will - stop working. to work around, press g to force a manual reload, or + stop working. to work around, press g to force a manual reload, or exit the transaction screen. q quits the application. @@ -275,43 +279,43 @@ keys screens accounts screen - this is normally the first screen displayed. it lists accounts and - their balances, like hledger's balance command. by default, it shows - all accounts and their latest ending balances (including the balances - of subaccounts). if you specify a query on the command line, it shows + this is normally the first screen displayed. it lists accounts and + their balances, like hledger's balance command. by default, it shows + all accounts and their latest ending balances (including the balances + of subaccounts). if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. - Account names are shown as a flat list by default; press t to toggle - tree mode. In list mode, account balances are exclusive of subac- - counts, except where subaccounts are hidden by a depth limit (see be- + Account names are shown as a flat list by default; press t to toggle + tree mode. In list mode, account balances are exclusive of subac- + counts, except where subaccounts are hidden by a depth limit (see be- low). In tree mode, all account balances are inclusive of subaccounts. - To see less detail, press a number key, 1 to 9, to set a depth limit. + To see less detail, press a number key, 1 to 9, to set a depth limit. Or use - to decrease and +/= to increase the depth limit. 0 shows even - less detail, collapsing all accounts to a single total. To remove the + less detail, collapsing all accounts to a single total. To remove the depth limit, set it higher than the maximum account depth, or press ES- CAPE. H toggles between showing historical balances or period balances. His- - torical balances (the default) are ending balances at the end of the - report period, taking into account all transactions before that date - (filtered by the filter query if any), including transactions before - the start of the report period. In other words, historical balances - are what you would see on a bank statement for that account (unless - disturbed by a filter query). Period balances ignore transactions be- - fore the report start date, so they show the change in balance during + torical balances (the default) are ending balances at the end of the + report period, taking into account all transactions before that date + (filtered by the filter query if any), including transactions before + the start of the report period. In other words, historical balances + are what you would see on a bank statement for that account (unless + disturbed by a filter query). Period balances ignore transactions be- + fore the report start date, so they show the change in balance during the report period. They are more useful eg when viewing a time log. U toggles filtering by unmarked status, including or excluding unmarked postings in the balances. Similarly, P toggles pending postings, and C - toggles cleared postings. (By default, balances include all postings; - if you activate one or two status filters, only those postings are in- + toggles cleared postings. (By default, balances include all postings; + if you activate one or two status filters, only those postings are in- cluded; and if you activate all three, the filter is removed.) R toggles real mode, in which virtual postings are ignored. - Z toggles nonzero mode, in which only accounts with nonzero balances - are shown (hledger-ui shows zero items by default, unlike command-line + Z toggles nonzero mode, in which only accounts with nonzero balances + are shown (hledger-ui shows zero items by default, unlike command-line hledger). Press right or enter to view an account's transactions register. @@ -320,63 +324,63 @@ screens This screen shows the transactions affecting a particular account, like a check register. Each line represents one transaction and shows: - o the other account(s) involved, in abbreviated form. (If there are - both real and virtual postings, it shows only the accounts affected + o the other account(s) involved, in abbreviated form. (If there are + both real and virtual postings, it shows only the accounts affected by real postings.) - o the overall change to the current account's balance; positive for an + o the overall change to the current account's balance; positive for an inflow to this account, negative for an outflow. o the running historical total or period total for the current account, - after the transaction. This can be toggled with H. Similar to the - accounts screen, the historical total is affected by transactions - (filtered by the filter query) before the report start date, while + after the transaction. This can be toggled with H. Similar to the + accounts screen, the historical total is affected by transactions + (filtered by the filter query) before the report start date, while the period total is not. If the historical total is not disturbed by - a filter query, it will be the running historical balance you would + a filter query, it will be the running historical balance you would see on a bank register for the current account. - Transactions affecting this account's subaccounts will be included in + Transactions affecting this account's subaccounts will be included in the register if the accounts screen is in tree mode, or if it's in list - mode but this account has subaccounts which are not shown due to a - depth limit. In other words, the register always shows the transac- - tions contributing to the balance shown on the accounts screen. Tree + mode but this account has subaccounts which are not shown due to a + depth limit. In other words, the register always shows the transac- + tions contributing to the balance shown on the accounts screen. Tree mode/list mode can be toggled with t here also. - U toggles filtering by unmarked status, showing or hiding unmarked + U toggles filtering by unmarked status, showing or hiding unmarked transactions. Similarly, P toggles pending transactions, and C toggles - cleared transactions. (By default, transactions with all statuses are - shown; if you activate one or two status filters, only those transac- + cleared transactions. (By default, transactions with all statuses are + shown; if you activate one or two status filters, only those transac- tions are shown; and if you activate all three, the filter is removed.) R toggles real mode, in which virtual postings are ignored. - Z toggles nonzero mode, in which only transactions posting a nonzero - change are shown (hledger-ui shows zero items by default, unlike com- + Z toggles nonzero mode, in which only transactions posting a nonzero + change are shown (hledger-ui shows zero items by default, unlike com- mand-line hledger). Press right (or enter) to view the selected transaction in detail. Transaction screen - This screen shows a single transaction, as a general journal entry, - similar to hledger's print command and journal format (hledger_jour- + This screen shows a single transaction, as a general journal entry, + similar to hledger's print command and journal format (hledger_jour- nal(5)). - The transaction's date(s) and any cleared flag, transaction code, de- - scription, comments, along with all of its account postings are shown. - Simple transactions have two postings, but there can be more (or in + The transaction's date(s) and any cleared flag, transaction code, de- + scription, comments, along with all of its account postings are shown. + Simple transactions have two postings, but there can be more (or in certain cases, fewer). - up and down will step through all transactions listed in the previous - account register screen. In the title bar, the numbers in parentheses - show your position within that account register. They will vary de- + up and down will step through all transactions listed in the previous + account register screen. In the title bar, the numbers in parentheses + show your position within that account register. They will vary de- pending on which account register you came from (remember most transac- - tions appear in multiple account registers). The #N number preceding + tions appear in multiple account registers). The #N number preceding them is the transaction's position within the complete unfiltered jour- nal, which is a more stable id (at least until the next reload). Error screen - This screen will appear if there is a problem, such as a parse error, - when you press g to reload. Once you have fixed the problem, press g + This screen will appear if there is a problem, such as a parse error, + when you press g to reload. Once you have fixed the problem, press g again to reload and resume normal operation. (Or, you can press escape to cancel the reload attempt.) @@ -384,15 +388,15 @@ ENVIRONMENT COLUMNS The screen width to use. Default: the full terminal width. 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 @@ -403,13 +407,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-ui can't read from stdin). @@ -417,24 +421,24 @@ BUGS -V affects only the accounts screen. When you press g, the current and all previous screens are regenerated, - which may cause a noticeable pause with large files. Also there is no + which may cause a noticeable pause with large files. Also there is no visual indication that this is in progress. - --watch is not yet fully robust. It works well for normal usage, but - many file changes in a short time (eg saving the file thousands of - times with an editor macro) can cause problems at least on OSX. Symp- - toms include: unresponsive UI, periodic resetting of the cursor posi- + --watch is not yet fully robust. It works well for normal usage, but + many file changes in a short time (eg saving the file thousands of + times with an editor macro) can cause problems at least on OSX. Symp- + toms include: unresponsive UI, periodic resetting of the cursor posi- tion, momentary display of parse errors, high CPU usage eventually sub- siding, and possibly a small but persistent build-up of CPU usage until the program is restarted. - Also, if you are viewing files mounted from another machine, --watch + Also, if you are viewing files mounted from another machine, --watch requires that both machine clocks are roughly in step. 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) @@ -448,7 +452,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) diff --git a/hledger-web/hledger-web.1 b/hledger-web/hledger-web.1 index 91b162ca2..e0839b53b 100644 --- a/hledger-web/hledger-web.1 +++ b/hledger-web/hledger-web.1 @@ -118,6 +118,9 @@ use some other field or tag for the account name \f[B]\f[CB]-I --ignore-assertions\f[B]\f[R] disable balance assertion checks (note: does not disable balance assignments) +.TP +\f[B]\f[CB]-s --strict\f[B]\f[R] +do extra error checking (check that all posted accounts are declared) .PP hledger reporting options: .TP diff --git a/hledger-web/hledger-web.info b/hledger-web/hledger-web.info index c4e771c0a..5e58a6a65 100644 --- a/hledger-web/hledger-web.info +++ b/hledger-web/hledger-web.info @@ -127,6 +127,10 @@ before options, as shown in the synopsis above. disable balance assertion checks (note: does not disable balance assignments) +'-s --strict' + + do extra error checking (check that all posted accounts are + declared) hledger reporting options: @@ -587,20 +591,20 @@ Tag Table: Node: Top72 Node: OPTIONS1752 Ref: #options1857 -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 +Node: PERMISSIONS8956 +Ref: #permissions9095 +Node: EDITING UPLOADING DOWNLOADING10307 +Ref: #editing-uploading-downloading10488 +Node: RELOADING11322 +Ref: #reloading11456 +Node: JSON API11889 +Ref: #json-api12003 +Node: ENVIRONMENT17493 +Ref: #environment17609 +Node: FILES18342 +Ref: #files18442 +Node: BUGS18655 +Ref: #bugs18733  End Tag Table diff --git a/hledger-web/hledger-web.txt b/hledger-web/hledger-web.txt index ee7af5239..0f03603d9 100644 --- a/hledger-web/hledger-web.txt +++ b/hledger-web/hledger-web.txt @@ -108,6 +108,10 @@ OPTIONS disable balance assertion checks (note: does not disable balance assignments) + -s --strict + do extra error checking (check that all posted accounts are de- + clared) + hledger reporting options: -b --begin=DATE @@ -132,7 +136,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 @@ -155,21 +159,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 @@ -178,15 +182,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 @@ -206,54 +210,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 @@ -263,44 +267,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. @@ -308,8 +312,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 @@ -326,7 +330,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 @@ -367,25 +371,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 @@ -481,22 +485,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 @@ -507,13 +511,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). @@ -527,7 +531,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) @@ -541,7 +545,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) diff --git a/hledger/hledger.1 b/hledger/hledger.1 index 442659eac..a7dc21851 100644 --- a/hledger/hledger.1 +++ b/hledger/hledger.1 @@ -566,6 +566,9 @@ use some other field or tag for the account name \f[B]\f[CB]-I --ignore-assertions\f[B]\f[R] disable balance assertion checks (note: does not disable balance assignments) +.TP +\f[B]\f[CB]-s --strict\f[B]\f[R] +do extra error checking (check that all posted accounts are declared) .PP General reporting options: .TP @@ -1060,6 +1063,25 @@ use a single parent file which includes the others .IP \[bu] 2 or concatenate the files into one before reading, eg: \f[C]cat a.journal b.journal | hledger -f- CMD\f[R]. +.SS Strict mode +.PP +hledger checks input files for valid data. +By default, the most important errors are detected, while still +accepting easy journal files without a lot of declarations: +.IP \[bu] 2 +Are the input files parseable, with valid syntax ? +.IP \[bu] 2 +Are all transactions balanced ? +.IP \[bu] 2 +Do all balance assertions pass ? +.PP +With the \f[C]-s\f[R]/\f[C]--strict\f[R] flag, additional checks are +performed: +.IP \[bu] 2 +Are all accounts referenced by transactions declared with an account +directive ? +.PP +\f[I]experimental.\f[R] .SS Output destination .PP hledger commands send their output to the terminal by default. diff --git a/hledger/hledger.info b/hledger/hledger.info index 060274b43..31220727b 100644 --- a/hledger/hledger.info +++ b/hledger/hledger.info @@ -500,6 +500,7 @@ File: hledger.info, Node: OPTIONS, Next: COMMANDS, Prev: COMMON TASKS, Up: T * Special characters in arguments and queries:: * Unicode characters:: * Input files:: +* Strict mode:: * Output destination:: * Output format:: * Regular expressions:: @@ -557,6 +558,10 @@ by most hledger commands, run 'hledger -h'. disable balance assertion checks (note: does not disable balance assignments) +'-s --strict' + + do extra error checking (check that all posted accounts are + declared) General reporting options: @@ -934,7 +939,7 @@ hledger is expected to handle non-ascii characters correctly: terminal, and vice versa. (See eg #961).  -File: hledger.info, Node: Input files, Next: Output destination, Prev: Unicode characters, Up: OPTIONS +File: hledger.info, Node: Input files, Next: Strict mode, Prev: Unicode characters, Up: OPTIONS 2.7 Input files =============== @@ -997,9 +1002,30 @@ big journal. There are some limitations with this: a.journal b.journal | hledger -f- CMD'.  -File: hledger.info, Node: Output destination, Next: Output format, Prev: Input files, Up: OPTIONS +File: hledger.info, Node: Strict mode, Next: Output destination, Prev: Input files, Up: OPTIONS -2.8 Output destination +2.8 Strict mode +=============== + +hledger checks input files for valid data. By default, the most +important errors are detected, while still accepting easy journal files +without a lot of declarations: + + * Are the input files parseable, with valid syntax ? + * Are all transactions balanced ? + * Do all balance assertions pass ? + + With the '-s'/'--strict' flag, additional checks are performed: + + * Are all accounts referenced by transactions declared with an + account directive ? + + _experimental._ + + +File: hledger.info, Node: Output destination, Next: Output format, Prev: Strict mode, Up: OPTIONS + +2.9 Output destination ====================== hledger commands send their output to the terminal by default. You can @@ -1017,8 +1043,8 @@ $ hledger print -o - # write to stdout (the default)  File: hledger.info, Node: Output format, Next: Regular expressions, Prev: Output destination, Up: OPTIONS -2.9 Output format -================= +2.10 Output format +================== Some commands (print, register, the balance commands) offer a choice of output format. In addition to the usual plain text format ('txt'), @@ -1071,7 +1097,7 @@ $ hledger balancesheet -o foo.txt -O html # write HTML to foo.txt  File: hledger.info, Node: Regular expressions, Next: Smart dates, Prev: Output format, Up: OPTIONS -2.10 Regular expressions +2.11 Regular expressions ======================== hledger uses regular expressions in a number of places: @@ -1116,7 +1142,7 @@ they support:  File: hledger.info, Node: Smart dates, Next: Report start & end date, Prev: Regular expressions, Up: OPTIONS -2.11 Smart dates +2.12 Smart dates ================ hledger's user interfaces accept a flexible "smart date" syntax (unlike @@ -1155,7 +1181,7 @@ results:  File: hledger.info, Node: Report start & end date, Next: Report intervals, Prev: Smart dates, Up: OPTIONS -2.12 Report start & end date +2.13 Report start & end date ============================ Most hledger reports show the full span of time represented by the @@ -1198,7 +1224,7 @@ thismonth'  File: hledger.info, Node: Report intervals, Next: Period expressions, Prev: Report start & end date, Up: OPTIONS -2.13 Report intervals +2.14 Report intervals ===================== A report interval can be specified so that commands like register, @@ -1211,7 +1237,7 @@ intervals can not be specified with a query.  File: hledger.info, Node: Period expressions, Next: Depth limiting, Prev: Report intervals, Up: OPTIONS -2.14 Period expressions +2.15 Period expressions ======================= The '-p/--period' option accepts period expressions, a shorthand way of @@ -1336,7 +1362,7 @@ start date and exclusive end date):  File: hledger.info, Node: Depth limiting, Next: Pivoting, Prev: Period expressions, Up: OPTIONS -2.15 Depth limiting +2.16 Depth limiting =================== With the '--depth N' option (short form: '-N'), commands like account, @@ -1348,7 +1374,7 @@ less detail. This flag has the same effect as a 'depth:' query argument  File: hledger.info, Node: Pivoting, Next: Valuation, Prev: Depth limiting, Up: OPTIONS -2.16 Pivoting +2.17 Pivoting ============= Normally hledger sums amounts, and organizes them in a hierarchy, based @@ -1405,7 +1431,7 @@ $ hledger balance --pivot member acct:.  File: hledger.info, Node: Valuation, Prev: Pivoting, Up: OPTIONS -2.17 Valuation +2.18 Valuation ============== Instead of reporting amounts in their original commodity, hledger can @@ -1432,7 +1458,7 @@ usually one of those is all you need.  File: hledger.info, Node: -B Cost, Next: -V Value, Up: Valuation -2.17.1 -B: Cost +2.18.1 -B: Cost --------------- The '-B/--cost' flag converts amounts to their cost or sale amount at @@ -1441,7 +1467,7 @@ transaction time, if they have a transaction price specified.  File: hledger.info, Node: -V Value, Next: -X Value in specified commodity, Prev: -B Cost, Up: Valuation -2.17.2 -V: Value +2.18.2 -V: Value ---------------- The '-V/--market' flag converts amounts to market value in their default @@ -1451,7 +1477,7 @@ _valuation date(s)_, if any. More on these in a minute.  File: hledger.info, Node: -X Value in specified commodity, Next: Valuation date, Prev: -V Value, Up: Valuation -2.17.3 -X: Value in specified commodity +2.18.3 -X: Value in specified commodity --------------------------------------- The '-X/--exchange=COMM' option is like '-V', except you tell it which @@ -1461,7 +1487,7 @@ that.  File: hledger.info, Node: Valuation date, Next: Market prices, Prev: -X Value in specified commodity, Up: Valuation -2.17.4 Valuation date +2.18.4 Valuation date --------------------- Since market prices can change from day to day, market value reports @@ -1478,7 +1504,7 @@ of the period, by default.  File: hledger.info, Node: Market prices, Next: --infer-value market prices from transactions, Prev: Valuation date, Up: Valuation -2.17.5 Market prices +2.18.5 Market prices -------------------- _(experimental)_ @@ -1509,7 +1535,7 @@ converted.  File: hledger.info, Node: --infer-value market prices from transactions, Next: Valuation commodity, Prev: Market prices, Up: Valuation -2.17.6 -infer-value: market prices from transactions +2.18.6 -infer-value: market prices from transactions ---------------------------------------------------- _(experimental)_ @@ -1544,7 +1570,7 @@ you, read all of this Valuation section carefully, and try adding  File: hledger.info, Node: Valuation commodity, Next: Simple valuation examples, Prev: --infer-value market prices from transactions, Up: Valuation -2.17.7 Valuation commodity +2.18.7 Valuation commodity -------------------------- _(experimental)_ @@ -1584,7 +1610,7 @@ converted.  File: hledger.info, Node: Simple valuation examples, Next: --value Flexible valuation, Prev: Valuation commodity, Up: Valuation -2.17.8 Simple valuation examples +2.18.8 Simple valuation examples -------------------------------- Here are some quick examples of '-V': @@ -1619,7 +1645,7 @@ $ hledger -f t.j bal -N euros -V  File: hledger.info, Node: --value Flexible valuation, Next: More valuation examples, Prev: Simple valuation examples, Up: Valuation -2.17.9 -value: Flexible valuation +2.18.9 -value: Flexible valuation --------------------------------- '-B', '-V' and '-X' are special cases of the more general '--value' @@ -1667,7 +1693,7 @@ this commodity, deducing market prices as described above.  File: hledger.info, Node: More valuation examples, Next: Effect of valuation on reports, Prev: --value Flexible valuation, Up: Valuation -2.17.10 More valuation examples +2.18.10 More valuation examples ------------------------------- Here are some examples showing the effect of '--value', as seen with @@ -1781,7 +1807,7 @@ $ hledger print -X A  File: hledger.info, Node: Effect of valuation on reports, Prev: More valuation examples, Up: Valuation -2.17.11 Effect of valuation on reports +2.18.11 Effect of valuation on reports -------------------------------------- Here is a reference for how valuation is supposed to affect each part of @@ -4406,190 +4432,192 @@ Node: Migrating to a new file16412 Ref: #migrating-to-a-new-file16560 Node: OPTIONS16859 Ref: #options16966 -Node: General options17336 -Ref: #general-options17461 -Node: Command options20767 -Ref: #command-options20918 -Node: Command arguments21316 -Ref: #command-arguments21463 -Node: Queries22343 -Ref: #queries22498 -Node: Special characters in arguments and queries26460 -Ref: #special-characters-in-arguments-and-queries26688 -Node: More escaping27139 -Ref: #more-escaping27301 -Node: Even more escaping27597 -Ref: #even-more-escaping27791 -Node: Less escaping28462 -Ref: #less-escaping28624 -Node: Unicode characters28869 -Ref: #unicode-characters29051 -Node: Input files30463 -Ref: #input-files30606 -Node: Output destination32905 -Ref: #output-destination33057 -Node: Output format33482 -Ref: #output-format33632 -Node: Regular expressions35799 -Ref: #regular-expressions35956 -Node: Smart dates37692 -Ref: #smart-dates37843 -Node: Report start & end date39204 -Ref: #report-start-end-date39376 -Node: Report intervals40873 -Ref: #report-intervals41038 -Node: Period expressions41428 -Ref: #period-expressions41588 -Node: Depth limiting45961 -Ref: #depth-limiting46105 -Node: Pivoting46437 -Ref: #pivoting46560 -Node: Valuation48236 -Ref: #valuation48338 -Node: -B Cost49027 -Ref: #b-cost49131 -Node: -V Value49264 -Ref: #v-value49410 -Node: -X Value in specified commodity49605 -Ref: #x-value-in-specified-commodity49804 -Node: Valuation date49953 -Ref: #valuation-date50121 -Node: Market prices50543 -Ref: #market-prices50723 -Node: --infer-value market prices from transactions51665 -Ref: #infer-value-market-prices-from-transactions51914 -Node: Valuation commodity53196 -Ref: #valuation-commodity53405 -Node: Simple valuation examples54631 -Ref: #simple-valuation-examples54833 -Node: --value Flexible valuation55492 -Ref: #value-flexible-valuation55700 -Node: More valuation examples57647 -Ref: #more-valuation-examples57856 -Node: Effect of valuation on reports59861 -Ref: #effect-of-valuation-on-reports60049 -Node: COMMANDS67068 -Ref: #commands67176 -Node: accounts68284 -Ref: #accounts68382 -Node: activity69081 -Ref: #activity69191 -Node: add69574 -Ref: #add69675 -Node: aregister72468 -Ref: #aregister72580 -Node: aregister and custom posting dates73953 -Ref: #aregister-and-custom-posting-dates74126 -Ref: #output-format-174719 -Node: balance75124 -Ref: #balance75241 -Node: Classic balance report76721 -Ref: #classic-balance-report76894 -Node: Customising the classic balance report78218 -Ref: #customising-the-classic-balance-report78446 -Node: Colour support80522 -Ref: #colour-support80689 -Node: Flat mode80785 -Ref: #flat-mode80933 -Node: Depth limited balance reports81346 -Ref: #depth-limited-balance-reports81531 -Node: Percentages81987 -Ref: #percentages82144 -Node: Sorting by amount83281 -Ref: #sorting-by-amount83447 -Node: Multicolumn balance report83941 -Ref: #multicolumn-balance-report84127 -Node: Budget report89724 -Ref: #budget-report89867 -Node: Budget report start date95156 -Ref: #budget-report-start-date95321 -Node: Nested budgets96653 -Ref: #nested-budgets96798 -Ref: #output-format-2100281 -Node: balancesheet100442 -Ref: #balancesheet100578 -Node: balancesheetequity102090 -Ref: #balancesheetequity102239 -Node: cashflow103315 -Ref: #cashflow103443 -Node: check-dates104659 -Ref: #check-dates104786 -Node: check-dupes105065 -Ref: #check-dupes105191 -Node: close105484 -Ref: #close105592 -Node: close usage107114 -Ref: #close-usage107207 -Node: codes110020 -Ref: #codes110128 -Node: commodities110840 -Ref: #commodities110967 -Node: descriptions111049 -Ref: #descriptions111177 -Node: diff111481 -Ref: #diff111587 -Node: files112634 -Ref: #files112734 -Node: help112881 -Ref: #help112981 -Node: import114062 -Ref: #import114176 -Node: Importing balance assignments115098 -Ref: #importing-balance-assignments115279 -Node: Commodity display styles115928 -Ref: #commodity-display-styles116099 -Node: incomestatement116228 -Ref: #incomestatement116361 -Node: notes117706 -Ref: #notes117819 -Node: payees118187 -Ref: #payees118293 -Node: prices118713 -Ref: #prices118819 -Node: print119160 -Ref: #print119270 -Node: print-unique124066 -Ref: #print-unique124192 -Node: register124477 -Ref: #register124604 -Node: Custom register output129053 -Ref: #custom-register-output129182 -Node: register-match130519 -Ref: #register-match130653 -Node: rewrite131004 -Ref: #rewrite131119 -Node: Re-write rules in a file132974 -Ref: #re-write-rules-in-a-file133108 -Node: Diff output format134318 -Ref: #diff-output-format134487 -Node: rewrite vs print --auto135579 -Ref: #rewrite-vs.-print---auto135758 -Node: roi136314 -Ref: #roi136412 -Node: stats148622 -Ref: #stats148721 -Node: tags149509 -Ref: #tags149607 -Node: test150126 -Ref: #test150234 -Node: Add-on commands150981 -Ref: #add-on-commands151098 -Node: ui152441 -Ref: #ui152529 -Node: web152583 -Ref: #web152686 -Node: iadd152802 -Ref: #iadd152913 -Node: interest152995 -Ref: #interest153102 -Node: ENVIRONMENT153342 -Ref: #environment153454 -Node: FILES154439 -Ref: #files-1154542 -Node: LIMITATIONS154755 -Ref: #limitations154874 -Node: TROUBLESHOOTING155616 -Ref: #troubleshooting155729 +Node: General options17352 +Ref: #general-options17477 +Node: Command options20878 +Ref: #command-options21029 +Node: Command arguments21427 +Ref: #command-arguments21574 +Node: Queries22454 +Ref: #queries22609 +Node: Special characters in arguments and queries26571 +Ref: #special-characters-in-arguments-and-queries26799 +Node: More escaping27250 +Ref: #more-escaping27412 +Node: Even more escaping27708 +Ref: #even-more-escaping27902 +Node: Less escaping28573 +Ref: #less-escaping28735 +Node: Unicode characters28980 +Ref: #unicode-characters29162 +Node: Input files30574 +Ref: #input-files30710 +Node: Strict mode33009 +Ref: #strict-mode33145 +Node: Output destination33626 +Ref: #output-destination33778 +Node: Output format34203 +Ref: #output-format34355 +Node: Regular expressions36522 +Ref: #regular-expressions36679 +Node: Smart dates38415 +Ref: #smart-dates38566 +Node: Report start & end date39927 +Ref: #report-start-end-date40099 +Node: Report intervals41596 +Ref: #report-intervals41761 +Node: Period expressions42151 +Ref: #period-expressions42311 +Node: Depth limiting46684 +Ref: #depth-limiting46828 +Node: Pivoting47160 +Ref: #pivoting47283 +Node: Valuation48959 +Ref: #valuation49061 +Node: -B Cost49750 +Ref: #b-cost49854 +Node: -V Value49987 +Ref: #v-value50133 +Node: -X Value in specified commodity50328 +Ref: #x-value-in-specified-commodity50527 +Node: Valuation date50676 +Ref: #valuation-date50844 +Node: Market prices51266 +Ref: #market-prices51446 +Node: --infer-value market prices from transactions52388 +Ref: #infer-value-market-prices-from-transactions52637 +Node: Valuation commodity53919 +Ref: #valuation-commodity54128 +Node: Simple valuation examples55354 +Ref: #simple-valuation-examples55556 +Node: --value Flexible valuation56215 +Ref: #value-flexible-valuation56423 +Node: More valuation examples58370 +Ref: #more-valuation-examples58579 +Node: Effect of valuation on reports60584 +Ref: #effect-of-valuation-on-reports60772 +Node: COMMANDS67791 +Ref: #commands67899 +Node: accounts69007 +Ref: #accounts69105 +Node: activity69804 +Ref: #activity69914 +Node: add70297 +Ref: #add70398 +Node: aregister73191 +Ref: #aregister73303 +Node: aregister and custom posting dates74676 +Ref: #aregister-and-custom-posting-dates74849 +Ref: #output-format-175442 +Node: balance75847 +Ref: #balance75964 +Node: Classic balance report77444 +Ref: #classic-balance-report77617 +Node: Customising the classic balance report78941 +Ref: #customising-the-classic-balance-report79169 +Node: Colour support81245 +Ref: #colour-support81412 +Node: Flat mode81508 +Ref: #flat-mode81656 +Node: Depth limited balance reports82069 +Ref: #depth-limited-balance-reports82254 +Node: Percentages82710 +Ref: #percentages82867 +Node: Sorting by amount84004 +Ref: #sorting-by-amount84170 +Node: Multicolumn balance report84664 +Ref: #multicolumn-balance-report84850 +Node: Budget report90447 +Ref: #budget-report90590 +Node: Budget report start date95879 +Ref: #budget-report-start-date96044 +Node: Nested budgets97376 +Ref: #nested-budgets97521 +Ref: #output-format-2101004 +Node: balancesheet101165 +Ref: #balancesheet101301 +Node: balancesheetequity102813 +Ref: #balancesheetequity102962 +Node: cashflow104038 +Ref: #cashflow104166 +Node: check-dates105382 +Ref: #check-dates105509 +Node: check-dupes105788 +Ref: #check-dupes105914 +Node: close106207 +Ref: #close106315 +Node: close usage107837 +Ref: #close-usage107930 +Node: codes110743 +Ref: #codes110851 +Node: commodities111563 +Ref: #commodities111690 +Node: descriptions111772 +Ref: #descriptions111900 +Node: diff112204 +Ref: #diff112310 +Node: files113357 +Ref: #files113457 +Node: help113604 +Ref: #help113704 +Node: import114785 +Ref: #import114899 +Node: Importing balance assignments115821 +Ref: #importing-balance-assignments116002 +Node: Commodity display styles116651 +Ref: #commodity-display-styles116822 +Node: incomestatement116951 +Ref: #incomestatement117084 +Node: notes118429 +Ref: #notes118542 +Node: payees118910 +Ref: #payees119016 +Node: prices119436 +Ref: #prices119542 +Node: print119883 +Ref: #print119993 +Node: print-unique124789 +Ref: #print-unique124915 +Node: register125200 +Ref: #register125327 +Node: Custom register output129776 +Ref: #custom-register-output129905 +Node: register-match131242 +Ref: #register-match131376 +Node: rewrite131727 +Ref: #rewrite131842 +Node: Re-write rules in a file133697 +Ref: #re-write-rules-in-a-file133831 +Node: Diff output format135041 +Ref: #diff-output-format135210 +Node: rewrite vs print --auto136302 +Ref: #rewrite-vs.-print---auto136481 +Node: roi137037 +Ref: #roi137135 +Node: stats149345 +Ref: #stats149444 +Node: tags150232 +Ref: #tags150330 +Node: test150849 +Ref: #test150957 +Node: Add-on commands151704 +Ref: #add-on-commands151821 +Node: ui153164 +Ref: #ui153252 +Node: web153306 +Ref: #web153409 +Node: iadd153525 +Ref: #iadd153636 +Node: interest153718 +Ref: #interest153825 +Node: ENVIRONMENT154065 +Ref: #environment154177 +Node: FILES155162 +Ref: #files-1155265 +Node: LIMITATIONS155478 +Ref: #limitations155597 +Node: TROUBLESHOOTING156339 +Ref: #troubleshooting156452  End Tag Table diff --git a/hledger/hledger.txt b/hledger/hledger.txt index 0db7f1f91..4a3261a9a 100644 --- a/hledger/hledger.txt +++ b/hledger/hledger.txt @@ -464,6 +464,10 @@ OPTIONS disable balance assertion checks (note: does not disable balance assignments) + -s --strict + do extra error checking (check that all posted accounts are de- + clared) + General reporting options: -b --begin=DATE @@ -488,7 +492,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 @@ -511,21 +515,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 @@ -534,15 +538,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 @@ -554,26 +558,26 @@ OPTIONS To see options for a particular command, including command-specific op- tions, run: hledger COMMAND -h. - Command-specific options must be written after the command name, eg: + Command-specific options must be written after the command name, eg: hledger print -x. - Additionally, if the command is an addon, you may need to put its op- - tions after a double-hyphen, eg: hledger ui -- --watch. Or, you can + Additionally, if the command is an addon, you may need to put its op- + tions after a double-hyphen, eg: hledger ui -- --watch. Or, you can run the addon executable directly: hledger-ui --watch. Command arguments - Most hledger commands accept arguments after the command name, which + Most hledger commands accept arguments after the command name, which are often a query, filtering the data in some way. - You can save a set of command line options/arguments in a file, and - then reuse them by writing @FILENAME as a command line argument. Eg: - hledger bal @foo.args. (To prevent this, eg if you have an argument - that begins with a literal @, precede it with --, eg: hledger bal -- + You can save a set of command line options/arguments in a file, and + then reuse them by writing @FILENAME as a command line argument. Eg: + hledger bal @foo.args. (To prevent this, eg if you have an argument + that begins with a literal @, precede it with --, eg: hledger bal -- @ARG). - Inside the argument file, each line should contain just one option or + Inside the argument file, each line should contain just one option or argument. Avoid the use of spaces, except inside quotes (or you'll see - a confusing error). Between a flag and its argument, use = (or noth- + a confusing error). Between a flag and its argument, use = (or noth- ing). Bad: assets depth:2 @@ -585,7 +589,7 @@ OPTIONS depth:2 -X=USD - For special characters (see below), use one less level of quoting than + For special characters (see below), use one less level of quoting than you would at the command prompt. Bad: -X"$" @@ -597,16 +601,16 @@ OPTIONS See also: Save frequently used options. Queries - One of hledger's strengths is being able to quickly report on precise - subsets of your data. Most commands accept an optional query expres- - sion, written as arguments after the command name, to filter the data - by date, account name or other criteria. The syntax is similar to a + One of hledger's strengths is being able to quickly report on precise + subsets of your data. Most commands accept an optional query expres- + sion, written as arguments after the command name, to filter the data + by date, account name or other criteria. The syntax is similar to a web search: one or more space-separated search terms, quotes to enclose - whitespace, prefixes to match specific fields, a not: prefix to negate + whitespace, prefixes to match specific fields, a not: prefix to negate the match. - We do not yet support arbitrary boolean combinations of search terms; - instead most commands show transactions/postings/accounts which match + We do not yet support arbitrary boolean combinations of search terms; + instead most commands show transactions/postings/accounts which match (or negatively match): o any of the description terms AND @@ -627,31 +631,31 @@ OPTIONS o match all the other terms. - The following kinds of search terms can be used. Remember these can + The following kinds of search terms can be used. Remember these can also be prefixed with not:, eg to exclude a particular subaccount. REGEX, acct:REGEX - match account names by this regular expression. (With no pre- + match account names by this regular expression. (With no pre- fix, acct: is assumed.) same as above amt:N, amt:N, amt:>=N - match postings with a single-commodity amount that is equal to, - less than, or greater than N. (Multi-commodity amounts are not + match postings with a single-commodity amount that is equal to, + less than, or greater than N. (Multi-commodity amounts are not tested, and will always match.) The comparison has two modes: if N is preceded by a + or - sign (or is 0), the two signed numbers - are compared. Otherwise, the absolute magnitudes are compared, + are compared. Otherwise, the absolute magnitudes are compared, ignoring sign. code:REGEX match by transaction code (eg check number) cur:REGEX - match postings or transactions including any amounts whose cur- - rency/commodity symbol is fully matched by REGEX. (For a par- + match postings or transactions including any amounts whose cur- + rency/commodity symbol is fully matched by REGEX. (For a par- tial match, use .*REGEX.*). Note, to match characters which are regex-significant, like the dollar sign ($), you need to prepend - \. And when using the command line you need to add one more - level of quoting to hide it from the shell, so eg do: hledger + \. And when using the command line you need to add one more + level of quoting to hide it from the shell, so eg do: hledger print cur:'\$' or hledger print cur:\\$. desc:REGEX @@ -659,20 +663,20 @@ OPTIONS date:PERIODEXPR match dates within the specified period. PERIODEXPR is a period - expression (with no report interval). Examples: date:2016, - date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the - --date2 command line flag is present, this matches secondary + expression (with no report interval). Examples: date:2016, + date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the + --date2 command line flag is present, this matches secondary dates instead. date2:PERIODEXPR match secondary dates within the specified period. depth:N - match (or display, depending on command) accounts at or above + match (or display, depending on command) accounts at or above this depth note:REGEX - match transaction notes (part of description right of |, or + match transaction notes (part of description right of |, or whole description when there's no |) payee:REGEX @@ -686,35 +690,35 @@ OPTIONS match unmarked, pending, or cleared transactions respectively tag:REGEX[=REGEX] - match by tag name, and optionally also by tag value. Note a - tag: query is considered to match a transaction if it matches - any of the postings. Also remember that postings inherit the + match by tag name, and optionally also by tag value. Note a + tag: query is considered to match a transaction if it matches + any of the postings. Also remember that postings inherit the tags of their parent transaction. The following special search term is used automatically in hledger-web, only: inacct:ACCTNAME - tells hledger-web to show the transaction register for this ac- + tells hledger-web to show the transaction register for this ac- count. Can be filtered further with acct etc. Some of these can also be expressed as command-line options (eg depth:2 - is equivalent to --depth 2). Generally you can mix options and query - arguments, and the resulting query will be their intersection (perhaps + is equivalent to --depth 2). Generally you can mix options and query + arguments, and the resulting query will be their intersection (perhaps excluding the -p/--period option). Special characters in arguments and queries In shell command lines, option and argument values which contain "prob- lematic" characters, ie spaces, and also characters significant to your - shell such as <, >, (, ), | and $, should be escaped by enclosing them + shell such as <, >, (, ), | and $, should be escaped by enclosing them in quotes or by writing backslashes before the characters. Eg: - hledger register -p 'last year' "accounts receivable (receiv- + hledger register -p 'last year' "accounts receivable (receiv- able|payable)" amt:\>100. More escaping Characters significant both to the shell and in regular expressions may - need one extra level of escaping. These include parentheses, the pipe + need one extra level of escaping. These include parentheses, the pipe symbol and the dollar sign. Eg, to match the dollar symbol, bash users should do: @@ -725,9 +729,9 @@ OPTIONS hledger balance cur:\\$ Even more escaping - When hledger runs an addon executable (eg you type hledger ui, hledger - runs hledger-ui), it de-escapes command-line options and arguments - once, so you might need to triple-escape. Eg in bash, running the ui + When hledger runs an addon executable (eg you type hledger ui, hledger + runs hledger-ui), it de-escapes command-line options and arguments + once, so you might need to triple-escape. Eg in bash, running the ui command and matching the dollar sign, it's: hledger ui cur:'\\$' @@ -752,8 +756,8 @@ OPTIONS hledger-ui cur:\\$ Less escaping - Inside an argument file, or in the search field of hledger-ui or - hledger-web, or at a GHCI prompt, you need one less level of escaping + Inside an argument file, or in the search field of hledger-ui or + hledger-web, or at a GHCI prompt, you need one less level of escaping than at the command line. And backslashes may work better than quotes. Eg: @@ -762,41 +766,41 @@ OPTIONS Unicode characters hledger is expected to handle non-ascii characters correctly: - o they should be parsed correctly in input files and on the command - line, by all hledger tools (add, iadd, hledger-web's search/add/edit + o they should be parsed correctly in input files and on the command + line, by all hledger tools (add, iadd, hledger-web's search/add/edit forms, etc.) - o they should be displayed correctly by all hledger tools, and on- + o they should be displayed correctly by all hledger tools, and on- screen alignment should be preserved. This requires a well-configured environment. Here are some tips: - o A system locale must be configured, and it must be one that can de- - code the characters being used. In bash, you can set a locale like - this: export LANG=en_US.UTF-8. There are some more details in Trou- - bleshooting. This step is essential - without it, hledger will quit - on encountering a non-ascii character (as with all GHC-compiled pro- + o A system locale must be configured, and it must be one that can de- + code the characters being used. In bash, you can set a locale like + this: export LANG=en_US.UTF-8. There are some more details in Trou- + bleshooting. This step is essential - without it, hledger will quit + on encountering a non-ascii character (as with all GHC-compiled pro- grams). - o your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) + o your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) must support unicode o the terminal must be using a font which includes the required unicode glyphs - o the terminal should be configured to display wide characters as dou- + o the terminal should be configured to display wide characters as dou- ble width (for report alignment) - o on Windows, for best results you should run hledger in the same kind - of environment in which it was built. Eg hledger built in the stan- - dard CMD.EXE environment (like the binaries on our download page) - might show display problems when run in a cygwin or msys terminal, + o on Windows, for best results you should run hledger in the same kind + of environment in which it was built. Eg hledger built in the stan- + dard CMD.EXE environment (like the binaries on our download page) + might show display problems when run in a cygwin or msys terminal, and vice versa. (See eg #961). Input files hledger reads transactions from a data file (and the add command writes to it). By default this file is $HOME/.hledger.journal (or on Windows, - something like C:/Users/USER/.hledger.journal). You can override this + something like C:/Users/USER/.hledger.journal). You can override this with the $LEDGER_FILE environment variable: $ setenv LEDGER_FILE ~/finance/2016.journal @@ -810,49 +814,67 @@ OPTIONS $ cat some.journal | hledger -f- - Usually the data file is in hledger's journal format, but it can be in + Usually the data file is in hledger's journal format, but it can be in any of the supported file formats, which currently are: Reader: Reads: Used for file exten- sions: ----------------------------------------------------------------------------- - journal hledger journal files and some Ledger .journal .j .hledger + journal hledger journal files and some Ledger .journal .j .hledger journals, for transactions .ledger - time- timeclock files, for precise time log- .timeclock + time- timeclock files, for precise time log- .timeclock clock ging timedot timedot files, for approximate time .timedot logging csv comma/semicolon/tab/other-separated .csv .ssv .tsv values, for data import - hledger detects the format automatically based on the file extensions - shown above. If it can't recognise the file extension, it assumes - journal format. So for non-journal files, it's important to use a + hledger detects the format automatically based on the file extensions + shown above. If it can't recognise the file extension, it assumes + journal format. So for non-journal files, it's important to use a recognised file extension, so as to either read successfully or to show relevant error messages. - When you can't ensure the right file extension, not to worry: you can + When you can't ensure the right file extension, not to worry: you can force a specific reader/format by prefixing the file path with the for- mat and a colon. Eg to read a .dat file as csv: $ hledger -f csv:/some/csv-file.dat stats $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- - You can specify multiple -f options, to read multiple files as one big + You can specify multiple -f options, to read multiple files as one big journal. There are some limitations with this: o directives in one file will not affect the other files - o balance assertions will not see any account balances from previous + o balance assertions will not see any account balances from previous files If you need either of those things, you can o use a single parent file which includes the others - o or concatenate the files into one before reading, eg: cat a.journal + o or concatenate the files into one before reading, eg: cat a.journal b.journal | hledger -f- CMD. + Strict mode + hledger checks input files for valid data. By default, the most impor- + tant errors are detected, while still accepting easy journal files + without a lot of declarations: + + o Are the input files parseable, with valid syntax ? + + o Are all transactions balanced ? + + o Do all balance assertions pass ? + + With the -s/--strict flag, additional checks are performed: + + o Are all accounts referenced by transactions declared with an account + directive ? + + experimental. + Output destination hledger commands send their output to the terminal by default. You can of course redirect this, eg into a file, using standard shell syntax: @@ -981,6 +1003,7 @@ OPTIONS last/this/next -1, 0, 1 periods from the current period day/week/month/quar- ter/year + 20181201 8 digit YYYYMMDD with valid year month and day 201812 6 digit YYYYMM with valid year and month @@ -1071,7 +1094,6 @@ OPTIONS 1, 2009 -p "from 2009/1" the same -p "from 2009" the same - -p "to 2009" everything before january 1, 2009 @@ -1117,6 +1139,7 @@ OPTIONS 2008/11/25" -p "quarterly from starts on 2009/04/01, ends on 2009/06/30, 2009-05-05 to 2009-06-01" which are first and last days of Q2 2009 + -p "yearly from starts on 2009/01/01, first day of 2009 2009-12-29" @@ -1569,8 +1592,6 @@ OPTIONS balance (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- @@ -1593,6 +1614,8 @@ OPTIONS 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-