diff --git a/hledger-lib/doc/hledger_csv.5 b/hledger-lib/doc/hledger_csv.5 index 60bbd525f..ac2b2ad6d 100644 --- a/hledger-lib/doc/hledger_csv.5 +++ b/hledger-lib/doc/hledger_csv.5 @@ -85,11 +85,12 @@ date\-format\ %\-m/%\-d/%Y\ %l:%M\ %p \f[I]\f[C]FIELDNAME2\f[]\f[]... .PP This (a) names the CSV fields, in order (names may not contain -whitespace, but may be omitted), and (b) assigns them to journal entry -fields if you use any of these standard field names: \f[C]date\f[], -\f[C]date2\f[], \f[C]status\f[], \f[C]code\f[], \f[C]description\f[], -\f[C]comment\f[], \f[C]account1\f[], \f[C]account2\f[], \f[C]amount\f[], -\f[C]amount\-in\f[], \f[C]amount\-out\f[], \f[C]currency\f[]. +whitespace; uninteresting names may be left blank), and (b) assigns them +to journal entry fields if you use any of these standard field names: +\f[C]date\f[], \f[C]date2\f[], \f[C]status\f[], \f[C]code\f[], +\f[C]description\f[], \f[C]comment\f[], \f[C]account1\f[], +\f[C]account2\f[], \f[C]amount\f[], \f[C]amount\-in\f[], +\f[C]amount\-out\f[], \f[C]currency\f[]. Eg: .IP .nf @@ -154,8 +155,8 @@ matched by one of the PATTERNs. The patterns are case\-insensitive regular expressions which match anywhere within the whole CSV record (it\[aq]s not yet possible to match within a specific field). -When there are multiple patterns they should be written on separate -lines, unindented. +When there are multiple patterns they can be written on separate lines, +unindented. The field assignments are on separate lines indented by at least one space. Examples: diff --git a/hledger-lib/doc/hledger_csv.5.info b/hledger-lib/doc/hledger_csv.5.info index 392b71152..577118d83 100644 --- a/hledger-lib/doc/hledger_csv.5.info +++ b/hledger-lib/doc/hledger_csv.5.info @@ -94,10 +94,11 @@ File: hledger_csv.5.info, Node: field list, Next: field assignment, Prev: dat `fields'_`FIELDNAME1'_, _`FIELDNAME2'_... This (a) names the CSV fields, in order (names may not contain -whitespace, but may be omitted), and (b) assigns them to journal entry -fields if you use any of these standard field names: `date', `date2', -`status', `code', `description', `comment', `account1', `account2', -`amount', `amount-in', `amount-out', `currency'. Eg: +whitespace; uninteresting names may be left blank), and (b) assigns them +to journal entry fields if you use any of these standard field names: +`date', `date2', `status', `code', `description', `comment', +`account1', `account2', `amount', `amount-in', `amount-out', +`currency'. Eg: # use the 1st, 2nd and 4th CSV fields as the entry's date, description and amount, @@ -149,9 +150,9 @@ _`FIELDASSIGNMENTS'_... matched by one of the PATTERNs. The patterns are case-insensitive regular expressions which match anywhere within the whole CSV record (it's not yet possible to match within a specific field). When there are -multiple patterns they should be written on separate lines, unindented. -The field assignments are on separate lines indented by at least one -space. Examples: +multiple patterns they can be written on separate lines, unindented. The +field assignments are on separate lines indented by at least one space. +Examples: # if the CSV record contains "groceries", set account2 to "expenses:groceries" @@ -218,13 +219,13 @@ Node: date-format1413 Ref: #date-format1542 Node: field list2051 Ref: #field-list2190 -Node: field assignment2866 -Ref: #field-assignment3023 -Node: conditional block3528 -Ref: #conditional-block3684 -Node: include4574 -Ref: #include4685 -Node: TIPS4916 -Ref: #tips5000 +Node: field assignment2885 +Ref: #field-assignment3042 +Node: conditional block3547 +Ref: #conditional-block3703 +Node: include4590 +Ref: #include4701 +Node: TIPS4932 +Ref: #tips5016  End Tag Table diff --git a/hledger-lib/doc/hledger_csv.5.txt b/hledger-lib/doc/hledger_csv.5.txt index 55df6e7c8..defc3ac8b 100644 --- a/hledger-lib/doc/hledger_csv.5.txt +++ b/hledger-lib/doc/hledger_csv.5.txt @@ -55,10 +55,10 @@ CSV RULES fieldsFIELDNAME1, FIELDNAME2... This (a) names the CSV fields, in order (names may not contain white- - space, but may be omitted), and (b) assigns them to journal entry - fields if you use any of these standard field names: date, date2, sta- - tus, code, description, comment, account1, account2, amount, amount-in, - amount-out, currency. Eg: + space; uninteresting names may be left blank), and (b) assigns them to + journal entry fields if you use any of these standard field names: + date, date2, status, code, description, comment, account1, account2, + amount, amount-in, amount-out, currency. Eg: # use the 1st, 2nd and 4th CSV fields as the entry's date, description and amount, # and give the 7th and 8th fields meaningful names for later reference: @@ -98,7 +98,7 @@ CSV RULES matched by one of the PATTERNs. The patterns are case-insensitive reg- ular expressions which match anywhere within the whole CSV record (it's not yet possible to match within a specific field). When there are - multiple patterns they should be written on separate lines, unindented. + multiple patterns they can be written on separate lines, unindented. The field assignments are on separate lines indented by at least one space. Examples: diff --git a/hledger-ui/doc/hledger-ui.1 b/hledger-ui/doc/hledger-ui.1 index 8560d3dad..865fc7b87 100644 --- a/hledger-ui/doc/hledger-ui.1 +++ b/hledger-ui/doc/hledger-ui.1 @@ -228,17 +228,24 @@ deeper, \f[C]left\f[] returns to the previous screen, move up and down through lists. Vi\-style \f[C]h\f[]/\f[C]j\f[]/\f[C]k\f[]/\f[C]l\f[] movement keys are also supported. -A tip: movement speed is limited by your keyboard repeat rate, to move +(A tip: movement speed is limited by your keyboard repeat rate, to move faster you may want to adjust that. -(On a mac, the Karabiner app is one way to do that). +On a mac, the Karabiner app is one way to do that.) .PP -\f[C]/\f[] lets you set or change the filter query, which limits the -data shown on most screens (in addition to the quick filters described -below). +On most screens, \f[C]/\f[] lets you set or change the filter query, +which limits the data shown (this filter is in addition to the quick +filters described below). While editing the query you can use typical command\-line edit keys (CTRL\-a/e/d/k, cursor keys etc.), and \f[C]ENTER\f[]to set the new filter or \f[C]ESCAPE\f[]to cancel. .PP +\f[C]d\f[] cycles through the common report period durations: day, week, +month, quarter, year, and unlimited (the default). +When the report duration is limited in this way, \f[C]n\f[] and +\f[C]p\f[] step to the next or previous day/week/month/etc. +(To set arbitrary start/end dates, you can use \f[C]/\f[] to set a +\f[C]date:\f[] query.) +.PP \f[C]BACKSPACE\f[] or \f[C]DELETE\f[] clears any filters in effect. .PP \f[C]ESCAPE\f[] removes any filters currently in effect, and jumps to @@ -273,7 +280,8 @@ Additional screen\-specific keys are described below. This is normally the first screen displayed. It lists accounts and their balances, like hledger\[aq]s balance command. -By default, it shows all accounts and their latest ending balances. +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. .PP @@ -288,8 +296,10 @@ To remove the depth limit, set it higher than the maximum account depth, or press \f[C]ESCAPE\f[]. .PP \f[C]F\f[] toggles flat mode on and off. -In flat mode, accounts are listed without indentation (and account -registers will exclude subaccounts, see below). +In flat mode, accounts are listed without indentation, and show their +subaccount\-excluding balances, except for accounts which have been +clipped by a depth limit, which show their inclusive balances (as with +hledger\[aq]s balance command). .PP \f[C]C\f[] toggles cleared mode, in which uncleared transactions and postings are not shown. @@ -346,12 +356,14 @@ $\ hledger\-ui\ \-\-register\ checking\ \-\-cleared .fi .RE .PP -Normally the register screen shows transactions in the current account +The register screen normally shows transactions in the current account and any of its subaccounts (inclusive mode). -If it was entered from accounts screen in flat mode, it shows -transactions affecting this account specifically, without considering -subaccounts (exclusive mode). -As on the accounts screen you can toggle this with the \f[C]F\f[] key. +If it was entered from the accounts screen in flat mode, where the +selected account was not depth\-clipped and therefore was showing its +subaccount\-excluding balance, the register too will omit the +transactions of subaccounts (exclusive mode). +This means the register always shows the transactions responsible for +the balance being displayed on the accounts screen. .PP \f[C]C\f[] toggles cleared mode, in which uncleared transactions and postings are not shown. diff --git a/hledger-ui/doc/hledger-ui.1.info b/hledger-ui/doc/hledger-ui.1.info index 5c350b17f..52fa55e0a 100644 --- a/hledger-ui/doc/hledger-ui.1.info +++ b/hledger-ui/doc/hledger-ui.1.info @@ -159,15 +159,21 @@ again (or `ESCAPE', or `LEFT') to close it. 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 down through lists. Vi-style -`h'/`j'/`k'/`l' movement keys are also supported. A tip: movement speed -is limited by your keyboard repeat rate, to move faster you may want to -adjust that. (On a mac, the Karabiner app is one way to do that). +`h'/`j'/`k'/`l' movement keys are also supported. (A tip: movement +speed is limited by your keyboard repeat rate, to move faster you may +want to adjust that. On a mac, the Karabiner app is one way to do that.) - `/' lets you set or change the filter query, which limits the data -shown on most screens (in addition to the quick filters described -below). While editing the query you can use typical command-line edit -keys (CTRL-a/e/d/k, cursor keys etc.), and `ENTER'to set the new filter -or `ESCAPE'to cancel. + On most screens, `/' lets you set or change the filter query, which +limits the data shown (this filter is in addition to the quick filters +described below). While editing the query you can use typical +command-line edit keys (CTRL-a/e/d/k, cursor keys etc.), and `ENTER'to +set the new filter or `ESCAPE'to cancel. + + `d' cycles through the common report period durations: day, week, +month, quarter, year, and unlimited (the default). When the report +duration is limited in this way, `n' and `p' step to the next or +previous day/week/month/etc. (To set arbitrary start/end dates, you can +use `/' to set a `date:' query.) `BACKSPACE' or `DELETE' clears any filters in effect. @@ -216,9 +222,9 @@ File: hledger-ui.1.info, Node: Accounts screen, Next: Register screen, Up: SC 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. if you specify a query on the -command line, it shows just the matched accounts and the balances from -matched transactions. +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 normally indented to show the hierarchy (tree mode). To see less detail, set a depth limit by pressing a number key, @@ -228,8 +234,9 @@ limit. To remove the depth limit, set it higher than the maximum account depth, or press `ESCAPE'. `F' toggles flat mode on and off. In flat mode, accounts are listed -without indentation (and account registers will exclude subaccounts, see -below). +without indentation, and show their subaccount-excluding balances, +except for accounts which have been clipped by a depth limit, which show +their inclusive balances (as with hledger's balance command). `C' toggles cleared mode, in which uncleared transactions and postings are not shown. `U' toggles uncleared mode, in which only @@ -278,11 +285,13 @@ a check register. Each line represents one transaction and shows: $ hledger-ui --register checking --cleared - Normally the register screen shows transactions in the current + The register screen normally shows transactions in the current account and any of its subaccounts (inclusive mode). If it was entered -from accounts screen in flat mode, it shows transactions affecting this -account specifically, without considering subaccounts (exclusive mode). -As on the accounts screen you can toggle this with the `F' key. +from the accounts screen in flat mode, where the selected account was +not depth-clipped and therefore was showing its subaccount-excluding +balance, the register too will omit the transactions of subaccounts +(exclusive mode). This means the register always shows the transactions +responsible for the balance being displayed on the accounts screen. `C' toggles cleared mode, in which uncleared transactions and postings are not shown. `U' toggles uncleared mode, in which only @@ -340,15 +349,15 @@ Node: OPTIONS825 Ref: #options924 Node: KEYS3805 Ref: #keys3902 -Node: SCREENS5791 -Ref: #screens5878 -Node: Accounts screen5968 -Ref: #accounts-screen6098 -Node: Register screen7403 -Ref: #register-screen7560 -Node: Transaction screen9381 -Ref: #transaction-screen9541 -Node: Error screen10408 -Ref: #error-screen10532 +Node: SCREENS6114 +Ref: #screens6201 +Node: Accounts screen6291 +Ref: #accounts-screen6421 +Node: Register screen7887 +Ref: #register-screen8044 +Node: Transaction screen10004 +Ref: #transaction-screen10164 +Node: Error screen11031 +Ref: #error-screen11155  End Tag Table diff --git a/hledger-ui/doc/hledger-ui.1.txt b/hledger-ui/doc/hledger-ui.1.txt index b41c8c8b6..c086a4958 100644 --- a/hledger-ui/doc/hledger-ui.1.txt +++ b/hledger-ui/doc/hledger-ui.1.txt @@ -148,15 +148,21 @@ KEYS 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 down through lists. Vi-style h/j/k/l movement keys are also supported. - A tip: movement speed is limited by your keyboard repeat rate, to move - faster you may want to adjust that. (On a mac, the Karabiner app is - one way to do that). + (A tip: movement speed is limited by your keyboard repeat rate, to move + faster you may want to adjust that. On a mac, the Karabiner app is one + way to do that.) - / lets you set or change the filter query, which limits the data shown - on most screens (in addition to the quick filters described below). - While editing the query you can use typical command-line edit keys - (CTRL-a/e/d/k, cursor keys etc.), and ENTERto set the new filter or - ESCAPEto cancel. + On most screens, / lets you set or change the filter query, which lim- + its the data shown (this filter is in addition to the quick filters + described below). While editing the query you can use typical com- + mand-line edit keys (CTRL-a/e/d/k, cursor keys etc.), and ENTERto set + the new filter or ESCAPEto cancel. + + d cycles through the common report period durations: day, week, month, + quarter, year, and unlimited (the default). When the report duration + is limited in this way, n and p step to the next or previous + day/week/month/etc. (To set arbitrary start/end dates, you can use / + to set a date: query.) BACKSPACE or DELETE clears any filters in effect. @@ -187,9 +193,9 @@ 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. if you specify a query - on the command line, it shows just the matched accounts and the bal- - ances from matched transactions. + 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 normally indented to show the hierarchy (tree mode). To see less detail, set a depth limit by pressing a number key, 1 to 9. @@ -199,17 +205,18 @@ SCREENS ESCAPE. F toggles flat mode on and off. In flat mode, accounts are listed - without indentation (and account registers will exclude subaccounts, - see below). + without indentation, and show their subaccount-excluding balances, + except for accounts which have been clipped by a depth limit, which + show their inclusive balances (as with hledger's balance command). - C toggles cleared mode, in which uncleared transactions and postings - are not shown. U toggles uncleared mode, in which only uncleared + C toggles cleared mode, in which uncleared transactions and postings + are not shown. U toggles uncleared mode, in which only uncleared transactions/postings are shown. 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. @@ -218,15 +225,15 @@ 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 current account's historic balance (if no query other than a date - limit is in effect) or the running total starting from zero (other- + limit is in effect) or the running total starting from zero (other- wise), after the transaction. Eg, these will show historic balances: @@ -241,11 +248,14 @@ SCREENS $ hledger-ui --begin 'this month' desc:market $ hledger-ui --register checking --cleared - Normally the register screen shows transactions in the current account - and any of its subaccounts (inclusive mode). If it was entered from - accounts screen in flat mode, it shows transactions affecting this - account specifically, without considering subaccounts (exclusive mode). - As on the accounts screen you can toggle this with the F key. + The register screen normally shows transactions in the current account + and any of its subaccounts (inclusive mode). If it was entered from + the accounts screen in flat mode, where the selected account was not + depth-clipped and therefore was showing its subaccount-excluding bal- + ance, the register too will omit the transactions of subaccounts + (exclusive mode). This means the register always shows the transac- + tions responsible for the balance being displayed on the accounts + screen. C toggles cleared mode, in which uncleared transactions and postings are not shown. U toggles uncleared mode, in which only uncleared diff --git a/hledger/doc/hledger.1 b/hledger/doc/hledger.1 index 2f24ba0ae..15e938bae 100644 --- a/hledger/doc/hledger.1 +++ b/hledger/doc/hledger.1 @@ -465,11 +465,10 @@ T{ T}@T{ T} .TE -.SS Reporting interval +.SS Report interval .PP -A reporting interval can be specified so that commands like register, -balance and activity will divide their reports into multiple report -periods. +A report interval can be specified so that commands like register, +balance and activity will divide their reports into multiple subperiods. The basic intervals can be selected with one of \f[C]\-D/\-\-daily\f[], \f[C]\-W/\-\-weekly\f[], \f[C]\-M/\-\-monthly\f[], \f[C]\-Q/\-\-quarterly\f[], or \f[C]\-Y/\-\-yearly\f[]. @@ -477,15 +476,9 @@ More complex intervals may be specified with a period expression. .SS Period expressions .PP The \f[C]\-p/\-\-period\f[] option accepts period expressions, a -shorthand way of expressing a start date, end date, and or reporting +shorthand way of expressing a start date, end date, and/or report interval all at once. -Note a period expression on the command line will cause any other date -flags -(\f[C]\-b\f[]/\f[C]\-e\f[]/\f[C]\-D\f[]/\f[C]\-W\f[]/\f[C]\-M\f[]/\f[C]\-Q\f[]/\f[C]\-Y\f[]) -to be ignored. .PP -hledger\[aq]s period expressions are similar to Ledger\[aq]s, though not -identical. Here\[aq]s a basic period expression specifying the first quarter of 2009. Note, hledger always treats start dates as inclusive and end dates as @@ -580,11 +573,14 @@ just that day; equivalent to "2009/1/1 to 2009/1/2" T} .TE .PP -Period expressions can also start with (or be) a reporting interval: -\f[C]daily\f[], \f[C]weekly\f[], \f[C]monthly\f[], \f[C]quarterly\f[], -\f[C]yearly\f[], or one of the \f[C]every\ ...\f[] expressions below. -Optionally the word \f[C]in\f[] may appear between the reporting -interval and the start/end dates. +The argument of \f[C]\-p\f[] can also begin with, or be, a report +interval expression. +The basic report intervals are \f[C]daily\f[], \f[C]weekly\f[], +\f[C]monthly\f[], \f[C]quarterly\f[], or \f[C]yearly\f[], which have the +same effect as the \f[C]\-D\f[],\f[C]\-W\f[],\f[C]\-M\f[],\f[C]\-Q\f[], +or \f[C]\-Y\f[] flags. +Between report interval and start/end dates (if any), the word +\f[C]in\f[] is optional. Examples: .PP .TS @@ -597,24 +593,41 @@ T{ \f[C]\-p\ "monthly\ in\ 2008"\f[] T} T{ -\f[C]\-p\ "bimonthly\ from\ 2008"\f[] -T} -T{ \f[C]\-p\ "quarterly"\f[] T} +.TE +.PP +The following more complex report intervals are also supported: +\f[C]biweekly\f[], \f[C]bimonthly\f[], +\f[C]every\ N\ days|weeks|months|quarters|years\f[], +\f[C]every\ Nth\ day\ [of\ month]\f[], +\f[C]every\ Nth\ day\ of\ week\f[]. +.PP +Examples: +.PP +.TS +tab(@); +l. +T{ +\f[C]\-p\ "bimonthly\ from\ 2008"\f[] +T} T{ \f[C]\-p\ "every\ 2\ weeks"\f[] T} T{ \f[C]\-p\ "every\ 5\ days\ from\ 1/3"\f[] T} -T{ -\f[C]\-p\ "every\ 15th\ day\ of\ month"\f[] -T} -T{ -\f[C]\-p\ "every\ 4th\ day\ of\ week"\f[] -T} .TE +.PP +Show historical balances at end of 15th each month (N is exclusive end +date): +.PP +\f[C]hledger\ balance\ \-H\ \-p\ "every\ 16th\ day"\f[] +.PP +Group postings from start of wednesday to end of next tuesday (N is +start date and exclusive end date): +.PP +\f[C]hledger\ register\ checking\ \-p\ "every\ 3rd\ day\ of\ week"\f[] .SS Regular Expressions .PP hledger uses regular expressions in a number of places: @@ -739,15 +752,16 @@ match transaction descriptions .TP .B \f[B]\f[C]date:PERIODEXPR\f[]\f[] match dates within the specified period. -PERIODEXPR should not include a reporting interval. -The command\-line \f[C]\-\-date2\f[] flag makes this match secondary -dates instead (like the \f[C]\-b\f[]/\f[C]\-e\f[]/\f[C]\-p\f[] options). +PERIODEXPR is a period expression (with no report interval). +Examples: \f[C]date:2016\f[], \f[C]date:thismonth\f[], +\f[C]date:2000/2/1\-2/15\f[], date:\f[C]lastweek\-\f[]. +The command\-line \f[C]\-\-date2\f[] flag makes \f[C]date:\f[] match +secondary dates instead. .RS .RE .TP .B \f[B]\f[C]date2:PERIODEXPR\f[]\f[] match secondary dates within the specified period. -PERIODEXPR should not include a reporting interval. .RS .RE .TP diff --git a/hledger/doc/hledger.1.info b/hledger/doc/hledger.1.info index e71505af5..d57bedf3e 100644 --- a/hledger/doc/hledger.1.info +++ b/hledger/doc/hledger.1.info @@ -294,7 +294,7 @@ cur:\\\\$'. * Repeated options:: * Depth limiting:: * Smart dates:: -* Reporting interval:: +* Report interval:: * Period expressions:: * Regular Expressions:: @@ -329,7 +329,7 @@ register will show only the uppermost accounts in the account tree, down to level N. Use this when you want a summary with less detail.  -File: hledger.1.info, Node: Smart dates, Next: Reporting interval, Prev: Depth limiting, Up: OPTIONS +File: hledger.1.info, Node: Smart dates, Next: Report interval, Prev: Depth limiting, Up: OPTIONS 2.4 Smart dates =============== @@ -352,31 +352,28 @@ omitted (defaulting to 1). `today', `yesterday', `tomorrow'  -File: hledger.1.info, Node: Reporting interval, Next: Period expressions, Prev: Smart dates, Up: OPTIONS +File: hledger.1.info, Node: Report interval, Next: Period expressions, Prev: Smart dates, Up: OPTIONS -2.5 Reporting interval -====================== +2.5 Report interval +=================== -A reporting interval can be specified so that commands like register, -balance and activity will divide their reports into multiple report -periods. The basic intervals can be selected with one of `-D/--daily', +A report interval can be specified so that commands like register, +balance and activity will divide their reports into multiple subperiods. +The basic intervals can be selected with one of `-D/--daily', `-W/--weekly', `-M/--monthly', `-Q/--quarterly', or `-Y/--yearly'. More complex intervals may be specified with a period expression.  -File: hledger.1.info, Node: Period expressions, Next: Regular Expressions, Prev: Reporting interval, Up: OPTIONS +File: hledger.1.info, Node: Period expressions, Next: Regular Expressions, Prev: Report interval, Up: OPTIONS 2.6 Period expressions ====================== The `-p/--period' option accepts period expressions, a shorthand way of -expressing a start date, end date, and or reporting interval all at -once. Note a period expression on the command line will cause any other -date flags (`-b'/`-e'/`-D'/`-W'/`-M'/`-Q'/`-Y') to be ignored. +expressing a start date, end date, and/or report interval all at once. - hledger's period expressions are similar to Ledger's, though not -identical. Here's a basic period expression specifying the first quarter -of 2009. Note, hledger always treats start dates as inclusive and end + Here's a basic period expression specifying the first quarter of +2009. Note, hledger always treats start dates as inclusive and end dates as exclusive: `-p "from 2009/1/1 to 2009/4/1"' @@ -411,19 +408,35 @@ date like so: `-p "2009/1"' the month of jan; equivalent to "2009/1/1 to 2009/2/1" `-p "2009/1/1"' just that day; equivalent to "2009/1/1 to 2009/1/2" - Period expressions can also start with (or be) a reporting interval: -`daily', `weekly', `monthly', `quarterly', `yearly', or one of the -`every ...' expressions below. Optionally the word `in' may appear -between the reporting interval and the start/end dates. Examples: + The argument of `-p' can also begin with, or be, a report interval +expression. The basic report intervals are `daily', `weekly', +`monthly', `quarterly', or `yearly', which have the same effect as the +`-D',`-W',`-M',`-Q', or `-Y' flags. Between report interval and +start/end dates (if any), the word `in' is optional. Examples: `-p "weekly from 2009/1/1 to 2009/4/1"' `-p "monthly in 2008"' -`-p "bimonthly from 2008"' `-p "quarterly"' + + The following more complex report intervals are also supported: +`biweekly', `bimonthly', `every N days|weeks|months|quarters|years', +`every Nth day [of month]', `every Nth day of week'. + + Examples: + +`-p "bimonthly from 2008"' `-p "every 2 weeks"' `-p "every 5 days from 1/3"' -`-p "every 15th day of month"' -`-p "every 4th day of week"' + + Show historical balances at end of 15th each month (N is exclusive +end date): + + `hledger balance -H -p "every 16th day"' + + Group postings from start of wednesday to end of next tuesday (N is +start date and exclusive end date): + + `hledger register checking -p "every 3rd day of week"'  File: hledger.1.info, Node: Regular Expressions, Prev: Period expressions, Up: OPTIONS @@ -540,14 +553,14 @@ match (or negatively match) match transaction descriptions *`date:PERIODEXPR'* - match dates within the specified period. PERIODEXPR should not - include a reporting interval. The command-line `--date2' flag - makes this match secondary dates instead (like the `-b'/`-e'/`-p' - options). + 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-'. The + command-line `--date2' flag makes `date:' match secondary dates + instead. *`date2:PERIODEXPR'* - match secondary dates within the specified period. PERIODEXPR - should not include a reporting interval. + match secondary dates within the specified period. *`depth:N'* match (or display, depending on command) accounts at or above this @@ -2079,95 +2092,95 @@ Node: EXAMPLES1875 Ref: #examples1977 Node: OPTIONS3981 Ref: #options4085 -Node: Multiple files8961 -Ref: #multiple-files9086 -Node: Repeated options9351 -Ref: #repeated-options9503 -Node: Depth limiting9623 -Ref: #depth-limiting9768 -Node: Smart dates9969 -Ref: #smart-dates10110 -Node: Reporting interval11107 -Ref: #reporting-interval11266 -Node: Period expressions11609 -Ref: #period-expressions11776 -Node: Regular Expressions13822 -Ref: #regular-expressions13964 -Node: QUERIES15447 -Ref: #queries15551 -Node: COMMANDS18853 -Ref: #commands18967 -Node: accounts19640 -Ref: #accounts19740 -Node: activity20722 -Ref: #activity20834 -Node: add21193 -Ref: #add21294 -Node: balance23953 -Ref: #balance24066 -Node: Flat mode26782 -Ref: #flat-mode26909 -Node: Depth limited balance reports27328 -Ref: #depth-limited-balance-reports27531 -Node: Multicolumn balance reports27952 -Ref: #multicolumn-balance-reports28154 -Node: Market value32803 -Ref: #market-value32967 -Node: Custom balance output33460 -Ref: #custom-balance-output33633 -Node: Output destination35737 -Ref: #output-destination35902 -Node: CSV output36172 -Ref: #csv-output36291 -Node: balancesheet36688 -Ref: #balancesheet36816 -Node: cashflow37468 -Ref: #cashflow37585 -Node: help38275 -Ref: #help38387 -Node: incomestatement39224 -Ref: #incomestatement39354 -Node: info40081 -Ref: #info40188 -Node: man40550 -Ref: #man40647 -Node: print41050 -Ref: #print41155 -Node: register42506 -Ref: #register42619 -Node: Custom register output46960 -Ref: #custom-register-output47091 -Node: stats48388 -Ref: #stats48494 -Node: test49375 -Ref: #test49462 -Node: ADD-ON COMMANDS49829 -Ref: #add-on-commands49965 -Node: api51253 -Ref: #api51345 -Node: autosync51379 -Ref: #autosync51494 -Node: diff53809 -Ref: #diff53919 -Node: equity54583 -Ref: #equity54697 -Node: interest56025 -Ref: #interest56142 -Node: irr59226 -Ref: #irr59339 -Node: print-unique61714 -Ref: #print-unique61844 -Node: rewrite62102 -Ref: #rewrite62221 -Node: ui62750 -Ref: #ui62850 -Node: web62891 -Ref: #web62979 -Node: TROUBLESHOOTING63012 -Ref: #troubleshooting63131 -Node: Run-time problems63185 -Ref: #run-time-problems63328 -Node: Known limitations65272 -Ref: #known-limitations65415 +Node: Multiple files8958 +Ref: #multiple-files9083 +Node: Repeated options9348 +Ref: #repeated-options9500 +Node: Depth limiting9620 +Ref: #depth-limiting9765 +Node: Smart dates9966 +Ref: #smart-dates10104 +Node: Report interval11101 +Ref: #report-interval11251 +Node: Period expressions11587 +Ref: #period-expressions11751 +Node: Regular Expressions14086 +Ref: #regular-expressions14228 +Node: QUERIES15711 +Ref: #queries15815 +Node: COMMANDS19125 +Ref: #commands19239 +Node: accounts19912 +Ref: #accounts20012 +Node: activity20994 +Ref: #activity21106 +Node: add21465 +Ref: #add21566 +Node: balance24225 +Ref: #balance24338 +Node: Flat mode27054 +Ref: #flat-mode27181 +Node: Depth limited balance reports27600 +Ref: #depth-limited-balance-reports27803 +Node: Multicolumn balance reports28224 +Ref: #multicolumn-balance-reports28426 +Node: Market value33075 +Ref: #market-value33239 +Node: Custom balance output33732 +Ref: #custom-balance-output33905 +Node: Output destination36009 +Ref: #output-destination36174 +Node: CSV output36444 +Ref: #csv-output36563 +Node: balancesheet36960 +Ref: #balancesheet37088 +Node: cashflow37740 +Ref: #cashflow37857 +Node: help38547 +Ref: #help38659 +Node: incomestatement39496 +Ref: #incomestatement39626 +Node: info40353 +Ref: #info40460 +Node: man40822 +Ref: #man40919 +Node: print41322 +Ref: #print41427 +Node: register42778 +Ref: #register42891 +Node: Custom register output47232 +Ref: #custom-register-output47363 +Node: stats48660 +Ref: #stats48766 +Node: test49647 +Ref: #test49734 +Node: ADD-ON COMMANDS50101 +Ref: #add-on-commands50237 +Node: api51525 +Ref: #api51617 +Node: autosync51651 +Ref: #autosync51766 +Node: diff54081 +Ref: #diff54191 +Node: equity54855 +Ref: #equity54969 +Node: interest56297 +Ref: #interest56414 +Node: irr59498 +Ref: #irr59611 +Node: print-unique61986 +Ref: #print-unique62116 +Node: rewrite62374 +Ref: #rewrite62493 +Node: ui63022 +Ref: #ui63122 +Node: web63163 +Ref: #web63251 +Node: TROUBLESHOOTING63284 +Ref: #troubleshooting63403 +Node: Run-time problems63457 +Ref: #run-time-problems63600 +Node: Known limitations65544 +Ref: #known-limitations65687  End Tag Table diff --git a/hledger/doc/hledger.1.txt b/hledger/doc/hledger.1.txt index e74d9996b..a8354d07e 100644 --- a/hledger/doc/hledger.1.txt +++ b/hledger/doc/hledger.1.txt @@ -307,23 +307,20 @@ OPTIONS lastweek spaces are optional today, yesterday, tomorrow - Reporting interval - A reporting interval can be specified so that commands like register, - balance and activity will divide their reports into multiple report - periods. The basic intervals can be selected with one of -D/--daily, + Report interval + A report interval can be specified so that commands like register, bal- + ance and activity will divide their reports into multiple subperiods. + The basic intervals can be selected with one of -D/--daily, -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly. More com- plex intervals may be specified with a period expression. Period expressions The -p/--period option accepts period expressions, a shorthand way of - expressing a start date, end date, and or reporting interval all at - once. Note a period expression on the command line will cause any - other date flags (-b/-e/-D/-W/-M/-Q/-Y) to be ignored. + expressing a start date, end date, and/or report interval all at once. - hledger's period expressions are similar to Ledger's, though not iden- - tical. Here's a basic period expression specifying the first quarter - of 2009. Note, hledger always treats start dates as inclusive and end - dates as exclusive: + Here's a basic period expression specifying the first quarter of 2009. + Note, hledger always treats start dates as inclusive and end dates as + exclusive: -p "from 2009/1/1 to 2009/4/1" @@ -342,6 +339,7 @@ OPTIONS -p "1/1 4/1" -p "january-apr" + -p "this year to 4/1" If you specify only one date, the missing start or end date will be the @@ -367,74 +365,91 @@ OPTIONS -p "2009/1/1" just that day; equivalent to "2009/1/1 to 2009/1/2" - Period expressions can also start with (or be) a reporting interval: - daily, weekly, monthly, quarterly, yearly, or one of the every ... - expressions below. Optionally the word in may appear between the - reporting interval and the start/end dates. Examples: + The argument of -p can also begin with, or be, a report interval + expression. The basic report intervals are daily, weekly, monthly, + quarterly, or yearly, which have the same effect as the -D,-W,-M,-Q, or + -Y flags. Between report interval and start/end dates (if any), the + word in is optional. Examples: -p "weekly from 2009/1/1 to 2009/4/1" -p "monthly in 2008" - -p "bimonthly from 2008" -p "quarterly" + + The following more complex report intervals are also supported: + biweekly, bimonthly, every N days|weeks|months|quarters|years, + every Nth day [of month], every Nth day of week. + + Examples: + + + -p "bimonthly from 2008" -p "every 2 weeks" -p "every 5 days from 1/3" - -p "every 15th day of month" - -p "every 4th day of week" + + Show historical balances at end of 15th each month (N is exclusive end + date): + + hledger balance -H -p "every 16th day" + + Group postings from start of wednesday to end of next tuesday (N is + start date and exclusive end date): + + hledger register checking -p "every 3rd day of week" Regular Expressions hledger uses regular expressions in a number of places: - o query terms, on the command line and in the hledger-web search form: + o query terms, on the command line and in the hledger-web search form: REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX o CSV rules conditional blocks: if REGEX ... - o account alias directives and options: alias /REGEX/ = REPLACEMENT, + o account alias directives and options: alias /REGEX/ = REPLACEMENT, --alias /REGEX/=REPLACEMENT - hledger's regular expressions come from the regex-tdfa library. In + hledger's regular expressions come from the regex-tdfa library. In general they: o are case insensitive - o are infix matching (do not need to match the entire thing being + o are infix matching (do not need to match the entire thing being matched) o are POSIX extended regular expressions o also support GNU word boundaries (\<, \>, \b, \B) - o and parenthesised capturing groups and numeric backreferences in + o and parenthesised capturing groups and numeric backreferences in replacement strings o do not support mode modifiers like (?s) Some things to note: - o In the alias directive and --alias option, regular expressions must - be enclosed in forward slashes (/REGEX/). Elsewhere in hledger, + o In the alias directive and --alias option, regular expressions must + be enclosed in forward slashes (/REGEX/). Elsewhere in hledger, these are not required. o To match a regular expression metacharacter like $ as a literal char- acter, prepend a backslash. Eg to search for amounts with the dollar sign in hledger-web, write cur:\$. - o On the command line, some metacharacters like $ have a special mean- + o On the command line, some metacharacters like $ have a special mean- ing to the shell and so must be escaped a second time, with single or - double quotes or another backslash. Eg, to match amounts with the + double quotes or another backslash. Eg, to match amounts with the dollar sign from the command line, write cur:'\$' or cur:\\$. 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, optional prefixes to match specific fields. Multiple + whitespace, optional prefixes to match specific fields. Multiple search terms are combined as follows: - All commands except print: show transactions/postings/accounts which + All commands except print: show transactions/postings/accounts which match (or negatively match) o any of the description terms AND @@ -461,22 +476,22 @@ QUERIES 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 + \. 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:\\$. @@ -484,48 +499,48 @@ QUERIES match transaction descriptions date:PERIODEXPR - match dates within the specified period. PERIODEXPR should not - include a reporting interval. The command-line --date2 flag - makes this match secondary dates instead (like the -b/-e/-p - options). + 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-. The com- + mand-line --date2 flag makes date: match secondary dates + instead. date2:PERIODEXPR - match secondary dates within the specified period. PERIODEXPR - should not include a reporting interval. + 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 real:, real:0 match real or virtual postings respectively status:*, status:!, status: - match cleared, pending, or uncleared/pending transactions + match cleared, pending, or uncleared/pending 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. not: before any of the above negates the match. 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). COMMANDS - hledger provides a number of subcommands; hledger with no arguments + hledger provides a number of subcommands; hledger with no arguments shows a list. If you install additional hledger-* packages, or if you put programs or - scripts named hledger-NAME in your PATH, these will also be listed as + scripts named hledger-NAME in your PATH, these will also be listed as subcommands. - Run a subcommand by writing its name as first argument (eg + Run a subcommand by writing its name as first argument (eg hledger incomestatement). You can also write any unambiguous prefix of a command name (hledger inc), or one of the standard short aliases dis- played in the command list (hledger is). @@ -540,14 +555,14 @@ COMMANDS --drop=N in flat mode: omit N leading account name parts - This command lists all account names that are in use (ie, all the - accounts which have at least one transaction posting to them). With + This command lists all account names that are in use (ie, all the + accounts which have at least one transaction posting to them). With query arguments, only matched account names are shown. - It shows a flat list by default. With --tree, it uses indentation to + It shows a flat list by default. With --tree, it uses indentation to show the account hierarchy. - In flat mode you can add --drop N to omit the first few account name + In flat mode you can add --drop N to omit the first few account name components. Examples: @@ -590,8 +605,8 @@ COMMANDS activity Show an ascii barchart of posting counts per interval. - The activity command displays an ascii histogram showing transaction - counts by day, week, month or other reporting interval (by day is the + The activity command displays an ascii histogram showing transaction + counts by day, week, month or other reporting interval (by day is the default). With query arguments, it counts only matched transactions. $ hledger activity --quarterly @@ -604,24 +619,24 @@ COMMANDS Prompt for transactions and add them to the journal. --no-new-accounts - don't allow creating new accounts; helps prevent typos when + don't allow creating new accounts; helps prevent typos when entering account names - Many hledger users edit their journals directly with a text editor, or - generate them from CSV. For more interactive data entry, there is the - add command, which prompts interactively on the console for new trans- - actions, and appends them to the journal file (if there are multiple + Many hledger users edit their journals directly with a text editor, or + generate them from CSV. For more interactive data entry, there is the + add command, which prompts interactively on the console for new trans- + actions, and appends them to the journal file (if there are multiple -f FILE options, the first file is used.) Existing transactions are not - changed. This is the only hledger command that writes to the journal + changed. This is the only hledger command that writes to the journal file. To use it, just run hledger add and follow the prompts. You can add as - many transactions as you like; when you are finished, enter . or press + many transactions as you like; when you are finished, enter . or press control-d or control-c to exit. Features: - o add tries to provide useful defaults, using the most similar recent + o add tries to provide useful defaults, using the most similar recent transaction (by description) as a template. o You can also set the initial defaults with command line arguments. @@ -629,20 +644,20 @@ COMMANDS o Readline-style edit keys can be used during data entry. o The tab key will auto-complete whenever possible - accounts, descrip- - tions, dates (yesterday, today, tomorrow). If the input area is + tions, dates (yesterday, today, tomorrow). If the input area is empty, it will insert the default value. - o If the journal defines a default commodity, it will be added to any + o If the journal defines a default commodity, it will be added to any bare numbers entered. o A parenthesised transaction code may be entered following a date. o Comments and tags may be entered following a description or amount. - o If you make a mistake, enter < at any prompt to restart the transac- + o If you make a mistake, enter < at any prompt to restart the transac- tion. - o Input prompts are displayed in a different colour when the terminal + o Input prompts are displayed in a different colour when the terminal supports it. Example (see the tutorial for a detailed explanation): @@ -714,7 +729,7 @@ COMMANDS -O FMT --output-format=FMT select the output format. Supported formats: txt, csv. - The balance command displays accounts and balances. It is hledger's + The balance command displays accounts and balances. It is hledger's most featureful and most useful command. $ hledger balance @@ -731,24 +746,24 @@ COMMANDS -------------------- 0 - More precisely, the balance command shows the change to each account's + More precisely, the balance command shows the change to each account's balance caused by all (matched) postings. In the common case where you - do not filter by date and your journal sets the correct opening bal- + do not filter by date and your journal sets the correct opening bal- ances, this is the same as the account's ending balance. - By default, accounts are displayed hierarchically, with subaccounts + By default, accounts are displayed hierarchically, with subaccounts indented below their parent. "Boring" accounts, which contain a single interesting subaccount and no balance of their own, are elided into the - following line for more compact output. (Use --no-elide to prevent + following line for more compact output. (Use --no-elide to prevent this.) - Each account's balance is the "inclusive" balance - it includes the + Each account's balance is the "inclusive" balance - it includes the balances of any subaccounts. - Accounts which have zero balance (and no non-zero subaccounts) are + Accounts which have zero balance (and no non-zero subaccounts) are omitted. Use -E/--empty to show them. - A final total is displayed by default; use -N/--no-total to suppress + A final total is displayed by default; use -N/--no-total to suppress it: $ hledger balance -p 2008/6 expenses --no-total @@ -758,9 +773,9 @@ COMMANDS Flat mode To see a flat list of full account names instead of the default hierar- - chical display, use --flat. In this mode, accounts (unless + chical display, use --flat. In this mode, accounts (unless depth-clipped) show their "exclusive" balance, excluding any subaccount - balances. In this mode, you can also use --drop N to omit the first + balances. In this mode, you can also use --drop N to omit the first few account name components. $ hledger balance -p 2008/6 expenses -N --flat --drop 1 @@ -768,9 +783,9 @@ COMMANDS $1 supplies Depth limited balance reports - With --depth N, balance shows accounts only to the specified depth. - This is very useful to show a complex charts of accounts in less - detail. In flat mode, balances from accounts below the depth limit + With --depth N, balance shows accounts only to the specified depth. + This is very useful to show a complex charts of accounts in less + detail. In flat mode, balances from accounts below the depth limit will be shown as part of a parent account at the depth limit. $ hledger balance -N --depth 1 @@ -780,12 +795,12 @@ COMMANDS $1 liabilities Multicolumn balance reports - With a reporting interval, multiple balance columns will be shown, one - for each report period. There are three types of multi-column balance + With a reporting interval, multiple balance columns will be shown, one + for each report period. There are three types of multi-column balance report, showing different information: 1. By default: each column shows the sum of postings in that period, ie - the account's change of balance in that period. This is useful eg + the account's change of balance in that period. This is useful eg for a monthly income statement: $ hledger balance --quarterly income expenses -E @@ -800,8 +815,8 @@ COMMANDS -------------------++--------------------------------- || $-1 $1 0 0 - 2. With --cumulative: each column shows the ending balance for that - period, accumulating the changes across periods, starting from 0 at + 2. With --cumulative: each column shows the ending balance for that + period, accumulating the changes across periods, starting from 0 at the report start date: $ hledger balance --quarterly income expenses -E --cumulative @@ -817,8 +832,8 @@ COMMANDS || $-1 0 0 0 3. With --historical/-H: each column shows the actual historical ending - balance for that period, accumulating the changes across periods, - starting from the actual balance at the report start date. This is + balance for that period, accumulating the changes across periods, + starting from the actual balance at the report start date. This is useful eg for a multi-period balance sheet, and when you are showing only the data after a certain start date: @@ -834,26 +849,26 @@ COMMANDS ----------------------++------------------------------------- || 0 0 0 - Multi-column balance reports display accounts in flat mode by default; + Multi-column balance reports display accounts in flat mode by default; to see the hierarchy, use --tree. - With a reporting interval (like --quarterly above), the report - start/end dates will be adjusted if necessary so that they encompass + With a reporting interval (like --quarterly above), the report + start/end dates will be adjusted if necessary so that they encompass the displayed report periods. This is so that the first and last peri- ods will be "full" and comparable to the others. - The -E/--empty flag does two things in multicolumn balance reports: - first, the report will show all columns within the specified report - period (without -E, leading and trailing columns with all zeroes are - not shown). Second, all accounts which existed at the report start - date will be considered, not just the ones with activity during the + The -E/--empty flag does two things in multicolumn balance reports: + first, the report will show all columns within the specified report + period (without -E, leading and trailing columns with all zeroes are + not shown). Second, all accounts which existed at the report start + date will be considered, not just the ones with activity during the report period (use -E to include low-activity accounts which would oth- erwise would be omitted). The -T/--row-total flag adds an additional column showing the total for each row. - The -A/--average flag adds a column showing the average value in each + The -A/--average flag adds a column showing the average value in each row. Here's an example of all three: @@ -876,16 +891,16 @@ COMMANDS Market value The -V/--value flag converts all the reported amounts to their "current - market value" using their default market price. That is the latest - market price (P directive) found in the journal (or an included file), + market value" using their default market price. That is the latest + market price (P directive) found in the journal (or an included file), for the amount's commodity, dated on or before the report end date. Unlike Ledger, hledger's -V only uses the market prices recorded with P - directives, ignoring transaction prices recorded as part of posting + directives, ignoring transaction prices recorded as part of posting amounts (which -B/--cost uses). Using -B and -V together is allowed. Custom balance output - In simple (non-multi-column) balance reports, you can customise the + In simple (non-multi-column) balance reports, you can customise the output with --format FMT: $ hledger balance --format "%20(account) %12(total)" @@ -903,7 +918,7 @@ COMMANDS 0 The FMT format string (plus a newline) specifies the formatting applied - to each account/balance pair. It may contain any suitable text, with + to each account/balance pair. It may contain any suitable text, with data fields interpolated like so: %[MIN][.MAX](FIELDNAME) @@ -914,14 +929,14 @@ COMMANDS o FIELDNAME must be enclosed in parentheses, and can be one of: - o depth_spacer - a number of spaces equal to the account's depth, or + o depth_spacer - a number of spaces equal to the account's depth, or if MIN is specified, MIN * depth spaces. o account - the account's name o total - the account's balance/posted total, right justified - Also, FMT can begin with an optional prefix to control how multi-com- + Also, FMT can begin with an optional prefix to control how multi-com- modity amounts are rendered: o %_ - render on multiple lines, bottom-aligned (the default) @@ -930,7 +945,7 @@ COMMANDS o %, - render on one line, comma-separated - There are some quirks. Eg in one-line mode, %(depth_spacer) has no + There are some quirks. Eg in one-line mode, %(depth_spacer) has no effect, instead %(account) has indentation built in. Experimentation may be needed to get pleasing results. @@ -938,19 +953,19 @@ COMMANDS o %(total) - the account's total - o %-20.20(account) - the account's name, left justified, padded to 20 + o %-20.20(account) - the account's name, left justified, padded to 20 characters and clipped at 20 characters - o %,%-50(account) %25(total) - account name padded to 50 characters, - total padded to 20 characters, with multiple commodities rendered on + o %,%-50(account) %25(total) - account name padded to 50 characters, + total padded to 20 characters, with multiple commodities rendered on one line - o %20(total) %2(depth_spacer)%-(account) - the default format for the + o %20(total) %2(depth_spacer)%-(account) - the default format for the single-column balance report Output destination - The balance, print, register and stats commands can write their output - to a destination other than the console. This is controlled by the + The balance, print, register and stats commands can write their output + to a destination other than the console. This is controlled by the -o/--output-file option. $ hledger balance -o - # write to stdout (the default) @@ -958,8 +973,8 @@ COMMANDS CSV output The balance, print and register commands can write their output as CSV. - This is useful for exporting data to other applications, eg to make - charts in a spreadsheet. This is controlled by the -O/--output-format + This is useful for exporting data to other applications, eg to make + charts in a spreadsheet. This is controlled by the -O/--output-format option, or by specifying a .csv file extension with -o/--output-file. $ hledger balance -O csv # write CSV to stdout @@ -973,8 +988,8 @@ COMMANDS --drop=N in flat mode: omit N leading account name parts - This command displays a simple balance sheet. It currently assumes - that you have top-level accounts named asset and liability (plural + This command displays a simple balance sheet. It currently assumes + that you have top-level accounts named asset and liability (plural forms also allowed.) $ hledger balancesheet @@ -1004,9 +1019,9 @@ COMMANDS --drop=N in flat mode: omit N leading account name parts - This command displays a simple cashflow statement It shows the change - in all "cash" (ie, liquid assets) accounts for the period. It cur- - rently assumes that cash accounts are under a top-level account named + This command displays a simple cashflow statement It shows the change + in all "cash" (ie, liquid assets) accounts for the period. It cur- + rently assumes that cash accounts are under a top-level account named asset and do not contain receivable or A/R (plural forms also allowed.) $ hledger cashflow @@ -1026,11 +1041,11 @@ COMMANDS help Show any of the hledger manuals. - The help command displays any of the main hledger man pages. (Unlike - hledger --help, which displays only the hledger man page.) Run it with - no arguments to list available topics (their names are shortened for - easier typing), and run hledger help TOPIC to select one. The output - is similar to a man page, but fixed width. It may be long, so you may + The help command displays any of the main hledger man pages. (Unlike + hledger --help, which displays only the hledger man page.) Run it with + no arguments to list available topics (their names are shortened for + easier typing), and run hledger help TOPIC to select one. The output + is similar to a man page, but fixed width. It may be long, so you may wish to pipe it into a pager. See also info and man. $ hledger help @@ -1059,8 +1074,8 @@ COMMANDS --drop=N in flat mode: omit N leading account name parts - This command displays a simple income statement. It currently assumes - that you have top-level accounts named income (or revenue) and expense + This command displays a simple income statement. It currently assumes + that you have top-level accounts named income (or revenue) and expense (plural forms also allowed.) $ hledger incomestatement @@ -1087,30 +1102,30 @@ COMMANDS info Show any of the hledger manuals using info. - The info command displays any of the hledger reference manuals using - the info hypertextual documentation viewer. This can be a very effi- - cient way to browse large manuals. It requires the "info" program to + The info command displays any of the hledger reference manuals using + the info hypertextual documentation viewer. This can be a very effi- + cient way to browse large manuals. It requires the "info" program to be available in your PATH. - As with help, run it with no arguments to list available topics (manu- + As with help, run it with no arguments to list available topics (manu- als). man Show any of the hledger manuals using man. - The man command displays any of the hledger reference manuals using - man, the standard documentation viewer on unix systems. This will fit - the text to your terminal width, and probably invoke a pager automati- + The man command displays any of the hledger reference manuals using + man, the standard documentation viewer on unix systems. This will fit + the text to your terminal width, and probably invoke a pager automati- cally. It requires the "man" program to be available in your PATH. - As with help, run it with no arguments to list available topics (manu- + As with help, run it with no arguments to list available topics (manu- als). print Show transactions from the journal. -m STR --match=STR - show the transaction whose description is most similar to STR, + show the transaction whose description is most similar to STR, and is most recent -o FILE[.FMT] --output-file=FILE[.FMT] @@ -1142,12 +1157,12 @@ COMMANDS liabilities:debts $1 assets:bank:checking $-1 - The print command displays full transactions from the journal file, - tidily formatted and showing all amounts explicitly. The output of - print is always a valid hledger journal, but it does always not pre- + The print command displays full transactions from the journal file, + tidily formatted and showing all amounts explicitly. The output of + print is always a valid hledger journal, but it does always not pre- serve all original content exactly (eg directives). - hledger's print command also shows all unit prices in effect, or (with + hledger's print command also shows all unit prices in effect, or (with -B/--cost) shows cost amounts. The print command also supports output destination and CSV output. @@ -1159,14 +1174,14 @@ COMMANDS include prior postings in the running total -A --average - show a running average instead of the running total (implies + show a running average instead of the running total (implies --empty) -r --related show postings' siblings instead -w N --width=N - set output width (default: terminal width or COLUMNS. -wN,M + set output width (default: terminal width or COLUMNS. -wN,M sets description width as well) -o FILE[.FMT] --output-file=FILE[.FMT] @@ -1177,7 +1192,7 @@ COMMANDS select the output format. Supported formats: txt, csv. The register command displays postings, one per line, and their running - total. This is typically used with a query selecting a particular + total. This is typically used with a query selecting a particular account, to see that account's activity: $ hledger register checking @@ -1186,8 +1201,8 @@ COMMANDS 2008/06/02 save assets:bank:checking $-1 $1 2008/12/31 pay off assets:bank:checking $-1 0 - The --historical/-H flag adds the balance from any undisplayed prior - postings to the running total. This is useful when you want to see + The --historical/-H flag adds the balance from any undisplayed prior + postings to the running total. This is useful when you want to see only recent activity, with a historically accurate running balance: $ hledger register checking -b 2008/6 --historical @@ -1197,22 +1212,22 @@ COMMANDS The --depth option limits the amount of sub-account detail displayed. - The --average/-A flag shows the running average posting amount instead + The --average/-A flag shows the running average posting amount instead of the running total (so, the final number displayed is the average for - the whole report period). This flag implies --empty (see below). It + the whole report period). This flag implies --empty (see below). It works best when showing just one account and one commodity. - The --related/-r flag shows the other postings in the transactions of + The --related/-r flag shows the other postings in the transactions of the postings which would normally be shown. - With a reporting interval, register shows summary postings, one per + With a reporting interval, register shows summary postings, one per interval, aggregating the postings to each account: $ hledger register --monthly income 2008/01 income:salary $-1 $-1 2008/06 income:gifts $-1 $-2 - Periods with no activity, and summary postings with a zero amount, are + Periods with no activity, and summary postings with a zero amount, are not shown by default; use the --empty/-E flag to see them: $ hledger register --monthly income -E @@ -1229,7 +1244,7 @@ COMMANDS 2008/11 0 $-2 2008/12 0 $-2 - Often, you'll want to see just one line per interval. The --depth + Often, you'll want to see just one line per interval. The --depth option helps with this, causing subaccounts to be aggregated: $ hledger register --monthly assets --depth 1h @@ -1237,19 +1252,19 @@ COMMANDS 2008/06 assets $-1 0 2008/12 assets $-1 $-1 - Note when using report intervals, if you specify start/end dates these - will be adjusted outward if necessary to contain a whole number of - intervals. This ensures that the first and last intervals are full + Note when using report intervals, if you specify start/end dates these + will be adjusted outward if necessary to contain a whole number of + intervals. This ensures that the first and last intervals are full length and comparable to the others in the report. Custom register output - register uses the full terminal width by default, except on windows. - You can override this by setting the COLUMNS environment variable (not + register uses the full terminal width by default, except on windows. + You can override this by setting the COLUMNS environment variable (not a bash shell variable) or by using the --width/-w option. - The description and account columns normally share the space equally - (about half of (width - 40) each). You can adjust this by adding a - description width as part of --width's argument, comma-separated: + The description and account columns normally share the space equally + (about half of (width - 40) each). You can adjust this by adding a + description width as part of --width's argument, comma-separated: --width W,D . Here's a diagram: <--------------------------------- width (W) ----------------------------------> @@ -1265,7 +1280,7 @@ COMMANDS $ hledger reg -w 100,40 # set overall width 100, description width 40 $ hledger reg -w $COLUMNS,40 # use terminal width, and set description width - The register command also supports the -o/--output-file and -O/--out- + The register command also supports the -o/--output-file and -O/--out- put-format options for controlling output destination and CSV output. stats @@ -1287,8 +1302,8 @@ COMMANDS Accounts : 8 (depth 3) Commodities : 1 ($) - The stats command displays summary information for the whole journal, - or a matched part of it. With a reporting interval, it shows a report + The stats command displays summary information for the whole journal, + or a matched part of it. With a reporting interval, it shows a report for each report period. The stats command also supports -o/--output-file for controlling output @@ -1300,37 +1315,37 @@ COMMANDS $ hledger test Cases: 74 Tried: 74 Errors: 0 Failures: 0 - This command runs hledger's built-in unit tests and displays a quick + This command runs hledger's built-in unit tests and displays a quick report. With a regular expression argument, it selects only tests with matching names. It's mainly used in development, but it's also nice to be able to check your hledger executable for smoke at any time. ADD-ON COMMANDS - Add-on commands are executables in your PATH whose name starts with - hledger- and ends with any of these file extensions: none, - .hs,.lhs,.pl,.py,.rb,.rkt,.sh,.bat,.com,.exe. Also, an add-on's name + Add-on commands are executables in your PATH whose name starts with + hledger- and ends with any of these file extensions: none, + .hs,.lhs,.pl,.py,.rb,.rkt,.sh,.bat,.com,.exe. Also, an add-on's name may not be the same as any built-in command or alias. - hledger will detect these and include them in the command list and let - you invoke them with hledger ADDONCMD. However there are some limita- + hledger will detect these and include them in the command list and let + you invoke them with hledger ADDONCMD. However there are some limita- tions: o Options appearing before ADDONCMD will be visible only to hledger and will not be passed to the add-on. Eg: hledger -h web shows hledger's usage, hledger web -h shows hledger-web's usage. - o Options understood only by the add-on must go after a -- argument to - hide them from hledger, which would otherwise reject them. Eg: + o Options understood only by the add-on must go after a -- argument to + hide them from hledger, which would otherwise reject them. Eg: hledger web -- --server. - Sometimes it may be more convenient to just run the add-on directly, + Sometimes it may be more convenient to just run the add-on directly, eg: hledger-web --server. - Add-ons which are written in haskell can take advantage of the - hledger-lib library for journal parsing, reporting, command-line + Add-ons which are written in haskell can take advantage of the + hledger-lib library for journal parsing, reporting, command-line options, etc. - Here are some hledger add-ons available from Hackage, the extra direc- + Here are some hledger add-ons available from Hackage, the extra direc- tory in the hledger source, or elsewhere: api @@ -1388,11 +1403,11 @@ ADD-ON COMMANDS WF:4303001832 -$6.00 [assets:business:bank:wf:bchecking:banking] $6.00 - ledger-autosync, which includes a hledger-autosync alias, downloads + ledger-autosync, which includes a hledger-autosync alias, downloads transactions from your bank(s) via OFX, and prints just the new ones as journal entries which you can add to your journal. It can also operate - on .OFX files which you've downloaded manually. It can be a nice - alternative to hledger's built-in CSV reader, especially if your bank + on .OFX files which you've downloaded manually. It can be a nice + alternative to hledger's built-in CSV reader, especially if your bank supports OFX download. diff @@ -1418,9 +1433,9 @@ ADD-ON COMMANDS 2015/02/02 (acct:two) $2 - hledger-diff compares two journal files. Given an account name, it - prints out the transactions affecting that account which are in one - journal file but not in the other. This can be useful for reconciling + hledger-diff compares two journal files. Given an account name, it + prints out the transactions affecting that account which are in one + journal file but not in the other. This can be useful for reconciling existing journals with bank statements. equity @@ -1447,14 +1462,14 @@ ADD-ON COMMANDS equity:opening balances 0 This prints a journal entry which zeroes out the specified accounts (or - all accounts) with a transfer to/from "equity:closing balances" (like - Ledger's equity command). Also, it prints an similar entry with oppo- + all accounts) with a transfer to/from "equity:closing balances" (like + Ledger's equity command). Also, it prints an similar entry with oppo- site sign for restoring the balances from "equity:opening balances". These can be useful for ending one journal file and starting a new one, - respectively. By zeroing your asset and liability accounts at the end + respectively. By zeroing your asset and liability accounts at the end of a file and restoring them at the start of the next one, you will see - correct asset/liability balances whether you run hledger on just one + correct asset/liability balances whether you run hledger on just one file, or on several files concatenated with include. interest @@ -1535,11 +1550,11 @@ ADD-ON COMMANDS Liabilities:Bank EUR 3700.00 hledger-interest computes interests for a given account. Using command - line flags, the program can be configured to use various schemes for - day-counting, such as act/act, 30/360, 30E/360, and 30/360isda. Fur- - thermore, it supports a (small) number of interest schemes, i.e. + line flags, the program can be configured to use various schemes for + day-counting, such as act/act, 30/360, 30E/360, and 30/360isda. Fur- + thermore, it supports a (small) number of interest schemes, i.e. annual interest with a fixed rate and the scheme mandated by the German - BGB288 (Basiszins fr Verbrauchergeschfte). See the package page for + BGB288 (Basiszins fr Verbrauchergeschfte). See the package page for more. irr @@ -1597,11 +1612,11 @@ ADD-ON COMMANDS 2011/04/01 - 2011/05/01: 32.24% 2011/05/01 - 2011/06/01: 95.92% - hledger-irr computes the internal rate of return, also known as the - effective interest rate, of a given investment. After specifying what - account holds the investment, and what account stores the gains (or - losses, or fees, or cost), it calculates the hypothetical annual rate - of fixed rate investment that would have provided the exact same cash + hledger-irr computes the internal rate of return, also known as the + effective interest rate, of a given investment. After specifying what + account holds the investment, and what account stores the gains (or + losses, or fees, or cost), it calculates the hypothetical annual rate + of fixed rate investment that would have provided the exact same cash flow. See the package page for more. print-unique @@ -1622,8 +1637,8 @@ ADD-ON COMMANDS entries. hledger-rewrite.hs, in hledger's extra directory (compilation - optional), adds postings to existing transactions, optionally with an - amount based on the existing transaction's first amount. See the + optional), adds postings to existing transactions, optionally with an + amount based on the existing transaction's first amount. See the script for more details. $ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ... @@ -1638,26 +1653,26 @@ ADD-ON COMMANDS TROUBLESHOOTING Run-time problems - Here are some issues you might encounter when you run hledger (and - remember you can also seek help from the IRC channel, mail list or bug + Here are some issues you might encounter when you run hledger (and + remember you can also seek help from the IRC channel, mail list or bug tracker): Successfully installed, but "No command 'hledger' found" stack and cabal install binaries into a special directory, which should - be added to your PATH environment variable. Eg on unix-like systems, + be added to your PATH environment variable. Eg on unix-like systems, that is ~/.local/bin and ~/.cabal/bin respectively. I set a custom LEDGER_FILE, but hledger is still using the default file - LEDGER_FILE should be a real environment variable, not just a shell - variable. The command env | grep LEDGER_FILE should show it. You may + LEDGER_FILE should be a real environment variable, not just a shell + variable. The command env | grep LEDGER_FILE should show it. You may need to use export. Here's an explanation. - "Illegal byte sequence" or "Invalid or incomplete multibyte or wide + "Illegal byte sequence" or "Invalid or incomplete multibyte or wide character" errors In order to handle non-ascii letters and symbols (like ), hledger needs an appropriate locale. This is usually configured system-wide; you can also configure it temporarily. The locale may need to be one that sup- - ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always, + ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always, I'm not sure yet). Here's an example of setting the locale temporarily, on ubuntu @@ -1676,7 +1691,7 @@ TROUBLESHOOTING $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile $ bash --login - If we preferred to use eg fr_FR.utf8, we might have to install that + If we preferred to use eg fr_FR.utf8, we might have to install that first: $ apt-get install language-pack-fr @@ -1697,45 +1712,45 @@ TROUBLESHOOTING Known limitations Command line interface - Add-on command options, unless they are also understood by the main - hledger executable, must be written after --, like this: + Add-on command options, unless they are also understood by the main + hledger executable, must be written after --, like this: hledger web -- --server Differences from Ledger - Not all of Ledger's journal file syntax is supported. See file format + Not all of Ledger's journal file syntax is supported. See file format differences. - hledger is slower than Ledger, and uses more memory, on large data + hledger is slower than Ledger, and uses more memory, on large data files. Windows limitations - In a windows CMD window, non-ascii characters and colours are not sup- + In a windows CMD window, non-ascii characters and colours are not sup- ported. In a windows Cygwin/MSYS/Mintty window, the tab key is not supported in hledger add. ENVIRONMENT - COLUMNS The screen width used by the register command. Default: the + COLUMNS The screen width used by the register command. Default: the full terminal width. 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). 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. - hledger can't render non-ascii characters when run from a Windows com- + hledger can't render non-ascii characters when run from a Windows com- mand prompt (up to Windows 7 at least). When input data contains non-ascii characters, a suitable system locale @@ -1745,7 +1760,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) @@ -1759,7 +1774,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)