From b66d8f0f3c9a1e12760696f7e4a60142a6838a39 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 26 Dec 2020 17:29:02 -0800 Subject: [PATCH] ;update manuals --- hledger-ui/hledger-ui.1 | 10 +- hledger-ui/hledger-ui.info | 46 +- hledger-ui/hledger-ui.txt | 8 +- hledger-web/hledger-web.1 | 10 +- hledger-web/hledger-web.info | 38 +- hledger-web/hledger-web.txt | 8 +- hledger/hledger.1 | 91 +- hledger/hledger.info | 912 +++++++++--------- hledger/hledger.txt | 1689 +++++++++++++++++----------------- 9 files changed, 1396 insertions(+), 1416 deletions(-) diff --git a/hledger-ui/hledger-ui.1 b/hledger-ui/hledger-ui.1 index 5e399626f..339793f5b 100644 --- a/hledger-ui/hledger-ui.1 +++ b/hledger-ui/hledger-ui.1 @@ -183,10 +183,16 @@ Some reporting options can also be written as query arguments. hledger help options: .TP \f[B]\f[CB]-h --help\f[B]\f[R] -show general usage (or after COMMAND, command usage) +show general or COMMAND help +.TP +\f[B]\f[CB]--man\f[B]\f[R] +show general or COMMAND user manual with man +.TP +\f[B]\f[CB]--info\f[B]\f[R] +show general or COMMAND user manual with info .TP \f[B]\f[CB]--version\f[B]\f[R] -show version +show general or ADDONCOMMAND version .TP \f[B]\f[CB]--debug[=N]\f[B]\f[R] show debug output (levels 1-9, default: 1) diff --git a/hledger-ui/hledger-ui.info b/hledger-ui/hledger-ui.info index 1f1b04bc8..3882c07b5 100644 --- a/hledger-ui/hledger-ui.info +++ b/hledger-ui/hledger-ui.info @@ -197,10 +197,16 @@ the last one takes precedence. '-h --help' - show general usage (or after COMMAND, command usage) + show general or COMMAND help +'--man' + + show general or COMMAND user manual with man +'--info' + + show general or COMMAND user manual with info '--version' - show version + show general or ADDONCOMMAND version '--debug[=N]' show debug output (levels 1-9, default: 1) @@ -522,23 +528,23 @@ Tag Table: Node: Top71 Node: OPTIONS1488 Ref: #options1585 -Node: KEYS5652 -Ref: #keys5747 -Node: SCREENS10066 -Ref: #screens10171 -Node: Accounts screen10261 -Ref: #accounts-screen10389 -Node: Register screen12604 -Ref: #register-screen12759 -Node: Transaction screen14756 -Ref: #transaction-screen14914 -Node: Error screen15784 -Ref: #error-screen15906 -Node: ENVIRONMENT16150 -Ref: #environment16264 -Node: FILES17071 -Ref: #files17170 -Node: BUGS17383 -Ref: #bugs17460 +Node: KEYS5772 +Ref: #keys5867 +Node: SCREENS10186 +Ref: #screens10291 +Node: Accounts screen10381 +Ref: #accounts-screen10509 +Node: Register screen12724 +Ref: #register-screen12879 +Node: Transaction screen14876 +Ref: #transaction-screen15034 +Node: Error screen15904 +Ref: #error-screen16026 +Node: ENVIRONMENT16270 +Ref: #environment16384 +Node: FILES17191 +Ref: #files17290 +Node: BUGS17503 +Ref: #bugs17580  End Tag Table diff --git a/hledger-ui/hledger-ui.txt b/hledger-ui/hledger-ui.txt index 0afd1817c..ef7c84fe9 100644 --- a/hledger-ui/hledger-ui.txt +++ b/hledger-ui/hledger-ui.txt @@ -178,10 +178,14 @@ OPTIONS hledger help options: -h --help - show general usage (or after COMMAND, command usage) + show general or COMMAND help + + --man show general or COMMAND user manual with man + + --info show general or COMMAND user manual with info --version - show version + show general or ADDONCOMMAND version --debug[=N] show debug output (levels 1-9, default: 1) diff --git a/hledger-web/hledger-web.1 b/hledger-web/hledger-web.1 index c372927fc..237713c45 100644 --- a/hledger-web/hledger-web.1 +++ b/hledger-web/hledger-web.1 @@ -212,10 +212,16 @@ Some reporting options can also be written as query arguments. hledger help options: .TP \f[B]\f[CB]-h --help\f[B]\f[R] -show general usage (or after COMMAND, command usage) +show general or COMMAND help +.TP +\f[B]\f[CB]--man\f[B]\f[R] +show general or COMMAND user manual with man +.TP +\f[B]\f[CB]--info\f[B]\f[R] +show general or COMMAND user manual with info .TP \f[B]\f[CB]--version\f[B]\f[R] -show version +show general or ADDONCOMMAND version .TP \f[B]\f[CB]--debug[=N]\f[B]\f[R] show debug output (levels 1-9, default: 1) diff --git a/hledger-web/hledger-web.info b/hledger-web/hledger-web.info index 4c8e8909e..3dd2a54ed 100644 --- a/hledger-web/hledger-web.info +++ b/hledger-web/hledger-web.info @@ -225,10 +225,16 @@ the last one takes precedence. '-h --help' - show general usage (or after COMMAND, command usage) + show general or COMMAND help +'--man' + + show general or COMMAND user manual with man +'--info' + + show general or COMMAND user manual with info '--version' - show version + show general or ADDONCOMMAND version '--debug[=N]' show debug output (levels 1-9, default: 1) @@ -592,19 +598,19 @@ Tag Table: Node: Top72 Node: OPTIONS1762 Ref: #options1867 -Node: PERMISSIONS8966 -Ref: #permissions9105 -Node: EDITING UPLOADING DOWNLOADING10317 -Ref: #editing-uploading-downloading10498 -Node: RELOADING11332 -Ref: #reloading11466 -Node: JSON API11899 -Ref: #json-api12013 -Node: ENVIRONMENT17503 -Ref: #environment17619 -Node: FILES18352 -Ref: #files18452 -Node: BUGS18665 -Ref: #bugs18743 +Node: PERMISSIONS9086 +Ref: #permissions9225 +Node: EDITING UPLOADING DOWNLOADING10437 +Ref: #editing-uploading-downloading10618 +Node: RELOADING11452 +Ref: #reloading11586 +Node: JSON API12019 +Ref: #json-api12133 +Node: ENVIRONMENT17623 +Ref: #environment17739 +Node: FILES18472 +Ref: #files18572 +Node: BUGS18785 +Ref: #bugs18863  End Tag Table diff --git a/hledger-web/hledger-web.txt b/hledger-web/hledger-web.txt index ea4890444..7e2fcc14d 100644 --- a/hledger-web/hledger-web.txt +++ b/hledger-web/hledger-web.txt @@ -202,10 +202,14 @@ OPTIONS hledger help options: -h --help - show general usage (or after COMMAND, command usage) + show general or COMMAND help + + --man show general or COMMAND user manual with man + + --info show general or COMMAND user manual with info --version - show version + show general or ADDONCOMMAND version --debug[=N] show debug output (levels 1-9, default: 1) diff --git a/hledger/hledger.1 b/hledger/hledger.1 index 27e4c5fcf..ba325a43b 100644 --- a/hledger/hledger.1 +++ b/hledger/hledger.1 @@ -6,8 +6,9 @@ .SH NAME .PP -hledger is a command-line accounting tool for both power users and folks -new to accounting. +This is the command-line interface (CLI) for the hledger accounting +tool. +Here we also describe hledger\[aq]s concepts and file formats. This manual is for hledger 1.20.99. .SH SYNOPSIS .PP @@ -23,11 +24,10 @@ money, time, or any other commodity, using double-entry accounting and a simple, editable file format. hledger is inspired by and largely compatible with ledger(1). .PP -This is hledger\[cq]s command-line interface (there are also terminal -and web interfaces). -Its basic function is to read a plain text file describing financial -transactions (in accounting terms, a general journal) and print useful -reports on standard output, or export them as CSV. +The basic function of the hledger CLI is to read a plain text file +describing financial transactions (in accounting terms, a general +journal) and print useful reports on standard output, or export them as +CSV. hledger can also read some other file formats such as CSV files, translating them to journal format. Additionally, hledger lists other hledger-* executables found in the @@ -75,10 +75,16 @@ by most hledger commands, run \f[C]hledger -h\f[R]. General help options: .TP \f[B]\f[CB]-h --help\f[B]\f[R] -show general usage (or after COMMAND, command usage) +show general or COMMAND help +.TP +\f[B]\f[CB]--man\f[B]\f[R] +show general or COMMAND user manual with man +.TP +\f[B]\f[CB]--info\f[B]\f[R] +show general or COMMAND user manual with info .TP \f[B]\f[CB]--version\f[B]\f[R] -show version +show general or ADDONCOMMAND version .TP \f[B]\f[CB]--debug[=N]\f[B]\f[R] show debug output (levels 1-9, default: 1) @@ -2189,7 +2195,7 @@ AlphaVantage \f[I](experimental)\f[R] Next, the detailed command docs, in alphabetical order. .SS accounts .PP -accounts, a +accounts .PD 0 .P .PD @@ -2408,7 +2414,7 @@ $ hledger areg assets date:jul .fi .SS balance .PP -balance, bal, b +balance, bal .PD 0 .P .PD @@ -3587,48 +3593,21 @@ help .PD 0 .P .PD -Show any of the hledger manuals. +Show the hledger user manual in one of several formats, optionally +positioned at a given TOPIC (if possible). +TOPIC is any heading, or heading prefix, in the manual. +Some examples: commands, print, \[aq]auto postings\[aq], periodic. .PP -The \f[C]help\f[R] command displays any of the main hledger manuals, in -one of several ways. -Run it with no argument to list the manuals, or provide a full or -partial manual name to select one. +This command shows the user manual built in to this hledger version. +It can be useful if the correct version of the hledger manual, or the +usual viewing tools, are not installed on your system. .PP -hledger manuals are available in several formats. -hledger help will use the first of these display methods that it finds: -info, man, $PAGER, less, stdout (or when non-interactive, just stdout). -You can force a particular viewer with the \f[C]--info\f[R], -\f[C]--man\f[R], \f[C]--pager\f[R], \f[C]--cat\f[R] flags. -.PP -Examples: -.IP -.nf -\f[C] -$ hledger help -Please choose a manual by typing \[dq]hledger help MANUAL\[dq] (a substring is ok). -Manuals: hledger hledger-ui hledger-web -\f[R] -.fi -.IP -.nf -\f[C] -$ hledger help h --man - -hledger(1) hledger User Manuals hledger(1) - -NAME - hledger - a command-line accounting tool - -SYNOPSIS - hledger [-f FILE] COMMAND [OPTIONS] [ARGS] - hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS] - hledger - -DESCRIPTION - hledger is a cross-platform program for tracking money, time, or any -\&... -\f[R] -.fi +By default it uses the best viewer it can find in $PATH, in this order: +\f[C]info\f[R], \f[C]man\f[R], $PAGER (unless a topic is specified), +\f[C]less\f[R], or stdout. +When run non-interactively, it always uses stdout. +Or you can select a particular viewer with the \f[C]-i\f[R] (info), +\f[C]-m\f[R] (man), or \f[C]-p\f[R] (pager) flags. .SS import .PP import @@ -3802,7 +3781,7 @@ Prices (and postings providing prices) can be filtered by a query. Price amounts are always displayed with their full precision. .SS print .PP -print, txns, p +print .PD 0 .P .PD @@ -3959,7 +3938,7 @@ $ LEDGER_FILE=unique.journal hledger print-unique .fi .SS register .PP -register, reg, r +register, reg .PD 0 .P .PD @@ -4735,10 +4714,8 @@ $ hledger web --serve (because the \f[C]--serve\f[R] flag belongs to \f[C]hledger-web\f[R], not \f[C]hledger\f[R]). .PP -The \f[C]-h/--help\f[R] and \f[C]--version\f[R] flags work without -\f[C]--\f[R], with their position deciding which program they refer to. -Eg \f[C]hledger -h web\f[R] shows hledger\[aq]s help, -\f[C]hledger web -h\f[R] shows hledger-web\[aq]s help. +The \f[C]-h/--help\f[R] and \f[C]--version\f[R] flags don\[aq]t require +\f[C]--\f[R]. .PP If you have any trouble with this, remember you can always run the add-on program directly, eg: diff --git a/hledger/hledger.info b/hledger/hledger.info index cb0871e92..9ba28b1fc 100644 --- a/hledger/hledger.info +++ b/hledger/hledger.info @@ -6,8 +6,9 @@ File: hledger.info, Node: Top, Next: OPTIONS, Up: (dir) hledger(1) ********** -hledger is a command-line accounting tool for both power users and folks -new to accounting. This manual is for hledger 1.20.99. +This is the command-line interface (CLI) for the hledger accounting +tool. Here we also describe hledger's concepts and file formats. This +manual is for hledger 1.20.99. 'hledger' @@ -20,8 +21,7 @@ money, time, or any other commodity, using double-entry accounting and a simple, editable file format. hledger is inspired by and largely compatible with ledger(1). - This is hledger's command-line interface (there are also terminal and -web interfaces). Its basic function is to read a plain text file + The basic function of the hledger CLI is to read a plain text file describing financial transactions (in accounting terms, a general journal) and print useful reports on standard output, or export them as CSV. hledger can also read some other file formats such as CSV files, @@ -103,10 +103,16 @@ by most hledger commands, run 'hledger -h'. '-h --help' - show general usage (or after COMMAND, command usage) + show general or COMMAND help +'--man' + + show general or COMMAND user manual with man +'--info' + + show general or COMMAND user manual with info '--version' - show version + show general or ADDONCOMMAND version '--debug[=N]' show debug output (levels 1-9, default: 1) @@ -1730,7 +1736,7 @@ File: hledger.info, Node: accounts, Next: activity, Up: COMMANDS 10.1 accounts ============= -accounts, a +accounts Show account names. This command lists account names, either declared with account @@ -1924,7 +1930,7 @@ File: hledger.info, Node: balance, Next: balancesheet, Prev: aregister, Up: 10.5 balance ============ -balance, bal, b +balance, bal Show accounts and their balances. The balance command is hledger's most versatile command. Note, @@ -3021,38 +3027,20 @@ File: hledger.info, Node: help, Next: import, Prev: files, Up: COMMANDS ========== help -Show any of the hledger manuals. +Show the hledger user manual in one of several formats, optionally +positioned at a given TOPIC (if possible). TOPIC is any heading, or +heading prefix, in the manual. Some examples: commands, print, 'auto +postings', periodic. - The 'help' command displays any of the main hledger manuals, in one -of several ways. Run it with no argument to list the manuals, or -provide a full or partial manual name to select one. + This command shows the user manual built in to this hledger version. +It can be useful if the correct version of the hledger manual, or the +usual viewing tools, are not installed on your system. - hledger manuals are available in several formats. hledger help will -use the first of these display methods that it finds: info, man, $PAGER, -less, stdout (or when non-interactive, just stdout). You can force a -particular viewer with the '--info', '--man', '--pager', '--cat' flags. - - Examples: - -$ hledger help -Please choose a manual by typing "hledger help MANUAL" (a substring is ok). -Manuals: hledger hledger-ui hledger-web - -$ hledger help h --man - -hledger(1) hledger User Manuals hledger(1) - -NAME - hledger - a command-line accounting tool - -SYNOPSIS - hledger [-f FILE] COMMAND [OPTIONS] [ARGS] - hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS] - hledger - -DESCRIPTION - hledger is a cross-platform program for tracking money, time, or any -... + By default it uses the best viewer it can find in $PATH, in this +order: 'info', 'man', $PAGER (unless a topic is specified), 'less', or +stdout. When run non-interactively, it always uses stdout. Or you can +select a particular viewer with the '-i' (info), '-m' (man), or '-p' +(pager) flags.  File: hledger.info, Node: import, Next: incomestatement, Prev: help, Up: COMMANDS @@ -3226,7 +3214,7 @@ File: hledger.info, Node: print, Next: print-unique, Prev: prices, Up: COMMA 10.22 print =========== -print, txns, p +print Show transaction journal entries, sorted by date. The print command displays full journal entries (transactions) from @@ -3356,7 +3344,7 @@ File: hledger.info, Node: register, Next: register-match, Prev: print-unique, 10.24 register ============== -register, reg, r +register, reg Show postings and their running total. The register command displays matched postings, across all accounts, @@ -4012,9 +4000,7 @@ $ hledger web --serve (because the '--serve' flag belongs to 'hledger-web', not 'hledger'). - The '-h/--help' and '--version' flags work without '--', with their -position deciding which program they refer to. Eg 'hledger -h web' -shows hledger's help, 'hledger web -h' shows hledger-web's help. + The '-h/--help' and '--version' flags don't require '--'. If you have any trouble with this, remember you can always run the add-on program directly, eg: @@ -7846,425 +7832,425 @@ $ LANG=en_US.UTF-8 hledger -f my.journal print  Tag Table: Node: Top68 -Node: OPTIONS2536 -Ref: #options2637 -Node: General options2779 -Ref: #general-options2904 -Node: Command options6305 -Ref: #command-options6456 -Node: Command arguments6856 -Ref: #command-arguments7014 -Node: Special characters7894 -Ref: #special-characters8057 -Node: Single escaping shell metacharacters8220 -Ref: #single-escaping-shell-metacharacters8461 -Node: Double escaping regular expression metacharacters8862 -Ref: #double-escaping-regular-expression-metacharacters9173 -Node: Triple escaping for add-on commands9699 -Ref: #triple-escaping-for-add-on-commands9959 -Node: Less escaping10603 -Ref: #less-escaping10757 -Node: Unicode characters11081 -Ref: #unicode-characters11246 -Node: Regular expressions12658 -Ref: #regular-expressions12798 -Node: ENVIRONMENT14534 -Ref: #environment14650 -Node: DATA FILES15635 -Ref: #data-files15754 -Node: Data formats16293 -Ref: #data-formats16411 -Node: Multiple files17748 -Ref: #multiple-files17890 -Node: Strict mode18359 -Ref: #strict-mode18474 -Node: TIME PERIODS19122 -Ref: #time-periods19239 -Node: Smart dates19337 -Ref: #smart-dates19463 -Node: Report start & end date20789 -Ref: #report-start-end-date20964 -Node: Report intervals22497 -Ref: #report-intervals22665 -Node: Period expressions23055 -Ref: #period-expressions23195 -Node: DEPTH27638 -Ref: #depth27738 -Node: QUERIES28070 -Ref: #queries28171 -Node: VALUATION32133 -Ref: #valuation32241 -Node: -B Cost32930 -Ref: #b-cost33028 -Node: -V Value33161 -Ref: #v-value33301 -Node: -X Value in specified commodity33496 -Ref: #x-value-in-specified-commodity33689 -Node: Valuation date33838 -Ref: #valuation-date34000 -Node: Market prices34437 -Ref: #market-prices34611 -Node: --infer-value market prices from transactions35532 -Ref: #infer-value-market-prices-from-transactions35775 -Node: Valuation commodity37036 -Ref: #valuation-commodity37239 -Node: Simple valuation examples38444 -Ref: #simple-valuation-examples38640 -Node: --value Flexible valuation39299 -Ref: #value-flexible-valuation39501 -Node: More valuation examples41448 -Ref: #more-valuation-examples41651 -Node: Effect of valuation on reports43656 -Ref: #effect-of-valuation-on-reports43838 -Node: PIVOTING50857 -Ref: #pivoting50962 -Node: OUTPUT52638 -Ref: #output52738 -Node: Output destination52789 -Ref: #output-destination52920 -Node: Output format53345 -Ref: #output-format53466 -Node: COMMANDS55633 -Ref: #commands55745 -Node: accounts59110 -Ref: #accounts59210 -Node: activity59909 -Ref: #activity60021 -Node: add60404 -Ref: #add60507 -Node: aregister63300 -Ref: #aregister63414 -Node: aregister and custom posting dates64908 -Ref: #aregister-and-custom-posting-dates65074 -Node: balance65895 -Ref: #balance66014 -Node: Classic balance report67640 -Ref: #classic-balance-report67815 -Node: Customising the classic balance report69139 -Ref: #customising-the-classic-balance-report69369 -Node: Colour support71445 -Ref: #colour-support71614 -Node: Flat mode71710 -Ref: #flat-mode71860 -Node: Depth limited balance reports72273 -Ref: #depth-limited-balance-reports72460 -Node: Percentages72916 -Ref: #percentages73075 -Node: Sorting by amount74212 -Ref: #sorting-by-amount74380 -Node: Multicolumn balance report74874 -Ref: #multicolumn-balance-report75062 -Node: Budget report80659 -Ref: #budget-report80795 -Node: Budget report start date86084 -Ref: #budget-report-start-date86251 -Node: Nested budgets87583 -Ref: #nested-budgets87730 -Node: balancesheet91170 -Ref: #balancesheet91308 -Node: balancesheetequity92945 -Ref: #balancesheetequity93096 -Node: cashflow94315 -Ref: #cashflow94439 -Node: check95773 -Ref: #check95878 -Node: Basic checks96483 -Ref: #basic-checks96601 -Node: Strict checks97094 -Ref: #strict-checks97235 -Node: Other checks97478 -Ref: #other-checks97618 -Node: Add-on checks97916 -Ref: #add-on-checks98036 -Node: close98489 -Ref: #close98593 -Node: close usage100115 -Ref: #close-usage100210 -Node: codes103023 -Ref: #codes103133 -Node: commodities103845 -Ref: #commodities103974 -Node: descriptions104056 -Ref: #descriptions104186 -Node: diff104490 -Ref: #diff104598 -Node: files105645 -Ref: #files105747 -Node: help105894 -Ref: #help105996 -Node: import107047 -Ref: #import107163 -Node: Importing balance assignments108085 -Ref: #importing-balance-assignments108268 -Node: Commodity display styles108917 -Ref: #commodity-display-styles109090 -Node: incomestatement109219 -Ref: #incomestatement109354 -Node: notes110816 -Ref: #notes110931 -Node: payees111299 -Ref: #payees111407 -Node: prices111827 -Ref: #prices111935 -Node: print112276 -Ref: #print112388 -Node: print-unique117184 -Ref: #print-unique117312 -Node: register117597 -Ref: #register117726 -Node: Custom register output122175 -Ref: #custom-register-output122306 -Node: register-match123643 -Ref: #register-match123779 -Node: rewrite124130 -Ref: #rewrite124247 -Node: Re-write rules in a file126153 -Ref: #re-write-rules-in-a-file126316 -Node: Diff output format127465 -Ref: #diff-output-format127648 -Node: rewrite vs print --auto128740 -Ref: #rewrite-vs.-print---auto128900 -Node: roi129456 -Ref: #roi129556 -Node: stats141766 -Ref: #stats141867 -Node: tags142655 -Ref: #tags142755 -Node: test143274 -Ref: #test143390 -Node: About add-on commands144137 -Ref: #about-add-on-commands144274 -Node: JOURNAL FORMAT145548 -Ref: #journal-format145676 -Node: Transactions147842 -Ref: #transactions147957 -Node: Dates148971 -Ref: #dates149087 -Node: Simple dates149152 -Ref: #simple-dates149272 -Node: Secondary dates149781 -Ref: #secondary-dates149929 -Node: Posting dates151265 -Ref: #posting-dates151388 -Node: Status152760 -Ref: #status152877 -Node: Description154585 -Ref: #description154715 -Node: Payee and note155035 -Ref: #payee-and-note155143 -Node: Comments155478 -Ref: #comments155600 -Node: Tags156794 -Ref: #tags-1156905 -Node: Postings158298 -Ref: #postings158422 -Node: Virtual postings159448 -Ref: #virtual-postings159559 -Node: Account names160864 -Ref: #account-names161001 -Node: Amounts161488 -Ref: #amounts161623 -Node: Digit group marks162747 -Ref: #digit-group-marks162892 -Node: Commodity display style163830 -Ref: #commodity-display-style164004 -Node: Rounding165717 -Ref: #rounding165835 -Node: Transaction prices166247 -Ref: #transaction-prices166413 -Node: Lot prices lot dates168844 -Ref: #lot-prices-lot-dates169027 -Node: Balance assertions169515 -Ref: #balance-assertions169693 -Node: Assertions and ordering170726 -Ref: #assertions-and-ordering170908 -Node: Assertions and included files171608 -Ref: #assertions-and-included-files171845 -Node: Assertions and multiple -f options172178 -Ref: #assertions-and-multiple--f-options172428 -Node: Assertions and commodities172560 -Ref: #assertions-and-commodities172786 -Node: Assertions and prices173943 -Ref: #assertions-and-prices174151 -Node: Assertions and subaccounts174591 -Ref: #assertions-and-subaccounts174814 -Node: Assertions and virtual postings175138 -Ref: #assertions-and-virtual-postings175374 -Node: Assertions and precision175516 -Ref: #assertions-and-precision175703 -Node: Balance assignments175970 -Ref: #balance-assignments176140 -Node: Balance assignments and prices177304 -Ref: #balance-assignments-and-prices177470 -Node: Directives177694 -Ref: #directives177857 -Node: Directives and multiple files183100 -Ref: #directives-and-multiple-files183296 -Node: Comment blocks183960 -Ref: #comment-blocks184137 -Node: Including other files184313 -Ref: #including-other-files184487 -Node: Default year185411 -Ref: #default-year185574 -Node: Declaring commodities185981 -Ref: #declaring-commodities186158 -Node: Commodity error checking188002 -Ref: #commodity-error-checking188152 -Node: Default commodity188409 -Ref: #default-commodity188589 -Node: Declaring market prices189478 -Ref: #declaring-market-prices189667 -Node: Declaring accounts190524 -Ref: #declaring-accounts190704 -Node: Account error checking191906 -Ref: #account-error-checking192072 -Node: Account comments193251 -Ref: #account-comments193435 -Node: Account subdirectives193859 -Ref: #account-subdirectives194044 -Node: Account types194357 -Ref: #account-types194531 -Node: Declaring account types195267 -Ref: #declaring-account-types195446 -Node: Auto-detected account types196096 -Ref: #auto-detected-account-types196337 -Node: Interference from auto-detected account types197234 -Ref: #interference-from-auto-detected-account-types197511 -Node: Old account type syntax197994 -Ref: #old-account-type-syntax198191 -Node: Account display order198491 -Ref: #account-display-order198651 -Node: Rewriting accounts199802 -Ref: #rewriting-accounts199981 -Node: Basic aliases200738 -Ref: #basic-aliases200874 -Node: Regex aliases201578 -Ref: #regex-aliases201740 -Node: Combining aliases202459 -Ref: #combining-aliases202642 -Node: Aliases and multiple files203918 -Ref: #aliases-and-multiple-files204117 -Node: end aliases204696 -Ref: #end-aliases204843 -Node: Default parent account204944 -Ref: #default-parent-account205134 -Node: Periodic transactions206018 -Ref: #periodic-transactions206201 -Node: Periodic rule syntax208118 -Ref: #periodic-rule-syntax208318 -Node: Two spaces between period expression and description!209022 -Ref: #two-spaces-between-period-expression-and-description209335 -Node: Forecasting with periodic transactions210019 -Ref: #forecasting-with-periodic-transactions210318 -Node: Budgeting with periodic transactions212373 -Ref: #budgeting-with-periodic-transactions212606 -Node: Auto postings213015 -Ref: #auto-postings213151 -Node: Auto postings and multiple files215330 -Ref: #auto-postings-and-multiple-files215528 -Node: Auto postings and dates215737 -Ref: #auto-postings-and-dates216005 -Node: Auto postings and transaction balancing / inferred amounts / balance assertions216180 -Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions216525 -Node: Auto posting tags216867 -Ref: #auto-posting-tags217076 -Node: CSV FORMAT217712 -Ref: #csv-format217840 -Node: Examples220426 -Ref: #examples220529 -Node: Basic220737 -Ref: #basic220839 -Node: Bank of Ireland221381 -Ref: #bank-of-ireland221518 -Node: Amazon222980 -Ref: #amazon223100 -Node: Paypal224819 -Ref: #paypal224915 -Node: CSV rules232559 -Ref: #csv-rules232677 -Node: skip232989 -Ref: #skip233084 -Node: fields233459 -Ref: #fields233583 -Node: Transaction field names234748 -Ref: #transaction-field-names234910 -Node: Posting field names235021 -Ref: #posting-field-names235175 -Node: field assignment237545 -Ref: #field-assignment237690 -Node: separator238508 -Ref: #separator238645 -Node: if block239185 -Ref: #if-block239312 -Node: Matching the whole record239713 -Ref: #matching-the-whole-record239890 -Node: Matching individual fields240694 -Ref: #matching-individual-fields240900 -Node: Combining matchers241124 -Ref: #combining-matchers241322 -Node: Rules applied on successful match241635 -Ref: #rules-applied-on-successful-match241828 -Node: if table242482 -Ref: #if-table242603 -Node: end244341 -Ref: #end244455 -Node: date-format244679 -Ref: #date-format244813 -Node: decimal-mark245562 -Ref: #decimal-mark245707 -Node: newest-first246046 -Ref: #newest-first246189 -Node: include246872 -Ref: #include247005 -Node: balance-type247449 -Ref: #balance-type247571 -Node: Tips248271 -Ref: #tips248362 -Node: Rapid feedback248618 -Ref: #rapid-feedback248737 -Node: Valid CSV249197 -Ref: #valid-csv249329 -Node: File Extension249521 -Ref: #file-extension249675 -Node: Reading multiple CSV files250104 -Ref: #reading-multiple-csv-files250291 -Node: Valid transactions250532 -Ref: #valid-transactions250712 -Node: Deduplicating importing251340 -Ref: #deduplicating-importing251521 -Node: Setting amounts252554 -Ref: #setting-amounts252725 -Node: Setting currency/commodity253712 -Ref: #setting-currencycommodity253906 -Node: Referencing other fields255080 -Ref: #referencing-other-fields255282 -Node: How CSV rules are evaluated256179 -Ref: #how-csv-rules-are-evaluated256354 -Node: TIMECLOCK FORMAT257805 -Ref: #timeclock-format257945 -Node: TIMEDOT FORMAT260006 -Ref: #timedot-format260144 -Node: COMMON TASKS264420 -Ref: #common-tasks264549 -Node: Getting help264956 -Ref: #getting-help265090 -Node: Constructing command lines265643 -Ref: #constructing-command-lines265837 -Node: Starting a journal file266534 -Ref: #starting-a-journal-file266734 -Node: Setting opening balances267922 -Ref: #setting-opening-balances268120 -Node: Recording transactions271261 -Ref: #recording-transactions271443 -Node: Reconciling271999 -Ref: #reconciling272144 -Node: Reporting274401 -Ref: #reporting274543 -Node: Migrating to a new file278542 -Ref: #migrating-to-a-new-file278692 -Node: LIMITATIONS278991 -Ref: #limitations279119 -Node: TROUBLESHOOTING279862 -Ref: #troubleshooting279977 +Node: OPTIONS2509 +Ref: #options2610 +Node: General options2752 +Ref: #general-options2877 +Node: Command options6398 +Ref: #command-options6549 +Node: Command arguments6949 +Ref: #command-arguments7107 +Node: Special characters7987 +Ref: #special-characters8150 +Node: Single escaping shell metacharacters8313 +Ref: #single-escaping-shell-metacharacters8554 +Node: Double escaping regular expression metacharacters8955 +Ref: #double-escaping-regular-expression-metacharacters9266 +Node: Triple escaping for add-on commands9792 +Ref: #triple-escaping-for-add-on-commands10052 +Node: Less escaping10696 +Ref: #less-escaping10850 +Node: Unicode characters11174 +Ref: #unicode-characters11339 +Node: Regular expressions12751 +Ref: #regular-expressions12891 +Node: ENVIRONMENT14627 +Ref: #environment14743 +Node: DATA FILES15728 +Ref: #data-files15847 +Node: Data formats16386 +Ref: #data-formats16504 +Node: Multiple files17841 +Ref: #multiple-files17983 +Node: Strict mode18452 +Ref: #strict-mode18567 +Node: TIME PERIODS19215 +Ref: #time-periods19332 +Node: Smart dates19430 +Ref: #smart-dates19556 +Node: Report start & end date20882 +Ref: #report-start-end-date21057 +Node: Report intervals22590 +Ref: #report-intervals22758 +Node: Period expressions23148 +Ref: #period-expressions23288 +Node: DEPTH27731 +Ref: #depth27831 +Node: QUERIES28163 +Ref: #queries28264 +Node: VALUATION32226 +Ref: #valuation32334 +Node: -B Cost33023 +Ref: #b-cost33121 +Node: -V Value33254 +Ref: #v-value33394 +Node: -X Value in specified commodity33589 +Ref: #x-value-in-specified-commodity33782 +Node: Valuation date33931 +Ref: #valuation-date34093 +Node: Market prices34530 +Ref: #market-prices34704 +Node: --infer-value market prices from transactions35625 +Ref: #infer-value-market-prices-from-transactions35868 +Node: Valuation commodity37129 +Ref: #valuation-commodity37332 +Node: Simple valuation examples38537 +Ref: #simple-valuation-examples38733 +Node: --value Flexible valuation39392 +Ref: #value-flexible-valuation39594 +Node: More valuation examples41541 +Ref: #more-valuation-examples41744 +Node: Effect of valuation on reports43749 +Ref: #effect-of-valuation-on-reports43931 +Node: PIVOTING50950 +Ref: #pivoting51055 +Node: OUTPUT52731 +Ref: #output52831 +Node: Output destination52882 +Ref: #output-destination53013 +Node: Output format53438 +Ref: #output-format53559 +Node: COMMANDS55726 +Ref: #commands55838 +Node: accounts59203 +Ref: #accounts59303 +Node: activity59999 +Ref: #activity60111 +Node: add60494 +Ref: #add60597 +Node: aregister63390 +Ref: #aregister63504 +Node: aregister and custom posting dates64998 +Ref: #aregister-and-custom-posting-dates65164 +Node: balance65985 +Ref: #balance66104 +Node: Classic balance report67727 +Ref: #classic-balance-report67902 +Node: Customising the classic balance report69226 +Ref: #customising-the-classic-balance-report69456 +Node: Colour support71532 +Ref: #colour-support71701 +Node: Flat mode71797 +Ref: #flat-mode71947 +Node: Depth limited balance reports72360 +Ref: #depth-limited-balance-reports72547 +Node: Percentages73003 +Ref: #percentages73162 +Node: Sorting by amount74299 +Ref: #sorting-by-amount74467 +Node: Multicolumn balance report74961 +Ref: #multicolumn-balance-report75149 +Node: Budget report80746 +Ref: #budget-report80882 +Node: Budget report start date86171 +Ref: #budget-report-start-date86338 +Node: Nested budgets87670 +Ref: #nested-budgets87817 +Node: balancesheet91257 +Ref: #balancesheet91395 +Node: balancesheetequity93032 +Ref: #balancesheetequity93183 +Node: cashflow94402 +Ref: #cashflow94526 +Node: check95860 +Ref: #check95965 +Node: Basic checks96570 +Ref: #basic-checks96688 +Node: Strict checks97181 +Ref: #strict-checks97322 +Node: Other checks97565 +Ref: #other-checks97705 +Node: Add-on checks98003 +Ref: #add-on-checks98123 +Node: close98576 +Ref: #close98680 +Node: close usage100202 +Ref: #close-usage100297 +Node: codes103110 +Ref: #codes103220 +Node: commodities103932 +Ref: #commodities104061 +Node: descriptions104143 +Ref: #descriptions104273 +Node: diff104577 +Ref: #diff104685 +Node: files105732 +Ref: #files105834 +Node: help105981 +Ref: #help106083 +Node: import106810 +Ref: #import106926 +Node: Importing balance assignments107848 +Ref: #importing-balance-assignments108031 +Node: Commodity display styles108680 +Ref: #commodity-display-styles108853 +Node: incomestatement108982 +Ref: #incomestatement109117 +Node: notes110579 +Ref: #notes110694 +Node: payees111062 +Ref: #payees111170 +Node: prices111590 +Ref: #prices111698 +Node: print112039 +Ref: #print112151 +Node: print-unique116938 +Ref: #print-unique117066 +Node: register117351 +Ref: #register117480 +Node: Custom register output121926 +Ref: #custom-register-output122057 +Node: register-match123394 +Ref: #register-match123530 +Node: rewrite123881 +Ref: #rewrite123998 +Node: Re-write rules in a file125904 +Ref: #re-write-rules-in-a-file126067 +Node: Diff output format127216 +Ref: #diff-output-format127399 +Node: rewrite vs print --auto128491 +Ref: #rewrite-vs.-print---auto128651 +Node: roi129207 +Ref: #roi129307 +Node: stats141517 +Ref: #stats141618 +Node: tags142406 +Ref: #tags142506 +Node: test143025 +Ref: #test143141 +Node: About add-on commands143888 +Ref: #about-add-on-commands144025 +Node: JOURNAL FORMAT145156 +Ref: #journal-format145284 +Node: Transactions147450 +Ref: #transactions147565 +Node: Dates148579 +Ref: #dates148695 +Node: Simple dates148760 +Ref: #simple-dates148880 +Node: Secondary dates149389 +Ref: #secondary-dates149537 +Node: Posting dates150873 +Ref: #posting-dates150996 +Node: Status152368 +Ref: #status152485 +Node: Description154193 +Ref: #description154323 +Node: Payee and note154643 +Ref: #payee-and-note154751 +Node: Comments155086 +Ref: #comments155208 +Node: Tags156402 +Ref: #tags-1156513 +Node: Postings157906 +Ref: #postings158030 +Node: Virtual postings159056 +Ref: #virtual-postings159167 +Node: Account names160472 +Ref: #account-names160609 +Node: Amounts161096 +Ref: #amounts161231 +Node: Digit group marks162355 +Ref: #digit-group-marks162500 +Node: Commodity display style163438 +Ref: #commodity-display-style163612 +Node: Rounding165325 +Ref: #rounding165443 +Node: Transaction prices165855 +Ref: #transaction-prices166021 +Node: Lot prices lot dates168452 +Ref: #lot-prices-lot-dates168635 +Node: Balance assertions169123 +Ref: #balance-assertions169301 +Node: Assertions and ordering170334 +Ref: #assertions-and-ordering170516 +Node: Assertions and included files171216 +Ref: #assertions-and-included-files171453 +Node: Assertions and multiple -f options171786 +Ref: #assertions-and-multiple--f-options172036 +Node: Assertions and commodities172168 +Ref: #assertions-and-commodities172394 +Node: Assertions and prices173551 +Ref: #assertions-and-prices173759 +Node: Assertions and subaccounts174199 +Ref: #assertions-and-subaccounts174422 +Node: Assertions and virtual postings174746 +Ref: #assertions-and-virtual-postings174982 +Node: Assertions and precision175124 +Ref: #assertions-and-precision175311 +Node: Balance assignments175578 +Ref: #balance-assignments175748 +Node: Balance assignments and prices176912 +Ref: #balance-assignments-and-prices177078 +Node: Directives177302 +Ref: #directives177465 +Node: Directives and multiple files182708 +Ref: #directives-and-multiple-files182904 +Node: Comment blocks183568 +Ref: #comment-blocks183745 +Node: Including other files183921 +Ref: #including-other-files184095 +Node: Default year185019 +Ref: #default-year185182 +Node: Declaring commodities185589 +Ref: #declaring-commodities185766 +Node: Commodity error checking187610 +Ref: #commodity-error-checking187760 +Node: Default commodity188017 +Ref: #default-commodity188197 +Node: Declaring market prices189086 +Ref: #declaring-market-prices189275 +Node: Declaring accounts190132 +Ref: #declaring-accounts190312 +Node: Account error checking191514 +Ref: #account-error-checking191680 +Node: Account comments192859 +Ref: #account-comments193043 +Node: Account subdirectives193467 +Ref: #account-subdirectives193652 +Node: Account types193965 +Ref: #account-types194139 +Node: Declaring account types194875 +Ref: #declaring-account-types195054 +Node: Auto-detected account types195704 +Ref: #auto-detected-account-types195945 +Node: Interference from auto-detected account types196842 +Ref: #interference-from-auto-detected-account-types197119 +Node: Old account type syntax197602 +Ref: #old-account-type-syntax197799 +Node: Account display order198099 +Ref: #account-display-order198259 +Node: Rewriting accounts199410 +Ref: #rewriting-accounts199589 +Node: Basic aliases200346 +Ref: #basic-aliases200482 +Node: Regex aliases201186 +Ref: #regex-aliases201348 +Node: Combining aliases202067 +Ref: #combining-aliases202250 +Node: Aliases and multiple files203526 +Ref: #aliases-and-multiple-files203725 +Node: end aliases204304 +Ref: #end-aliases204451 +Node: Default parent account204552 +Ref: #default-parent-account204742 +Node: Periodic transactions205626 +Ref: #periodic-transactions205809 +Node: Periodic rule syntax207726 +Ref: #periodic-rule-syntax207926 +Node: Two spaces between period expression and description!208630 +Ref: #two-spaces-between-period-expression-and-description208943 +Node: Forecasting with periodic transactions209627 +Ref: #forecasting-with-periodic-transactions209926 +Node: Budgeting with periodic transactions211981 +Ref: #budgeting-with-periodic-transactions212214 +Node: Auto postings212623 +Ref: #auto-postings212759 +Node: Auto postings and multiple files214938 +Ref: #auto-postings-and-multiple-files215136 +Node: Auto postings and dates215345 +Ref: #auto-postings-and-dates215613 +Node: Auto postings and transaction balancing / inferred amounts / balance assertions215788 +Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions216133 +Node: Auto posting tags216475 +Ref: #auto-posting-tags216684 +Node: CSV FORMAT217320 +Ref: #csv-format217448 +Node: Examples220034 +Ref: #examples220137 +Node: Basic220345 +Ref: #basic220447 +Node: Bank of Ireland220989 +Ref: #bank-of-ireland221126 +Node: Amazon222588 +Ref: #amazon222708 +Node: Paypal224427 +Ref: #paypal224523 +Node: CSV rules232167 +Ref: #csv-rules232285 +Node: skip232597 +Ref: #skip232692 +Node: fields233067 +Ref: #fields233191 +Node: Transaction field names234356 +Ref: #transaction-field-names234518 +Node: Posting field names234629 +Ref: #posting-field-names234783 +Node: field assignment237153 +Ref: #field-assignment237298 +Node: separator238116 +Ref: #separator238253 +Node: if block238793 +Ref: #if-block238920 +Node: Matching the whole record239321 +Ref: #matching-the-whole-record239498 +Node: Matching individual fields240302 +Ref: #matching-individual-fields240508 +Node: Combining matchers240732 +Ref: #combining-matchers240930 +Node: Rules applied on successful match241243 +Ref: #rules-applied-on-successful-match241436 +Node: if table242090 +Ref: #if-table242211 +Node: end243949 +Ref: #end244063 +Node: date-format244287 +Ref: #date-format244421 +Node: decimal-mark245170 +Ref: #decimal-mark245315 +Node: newest-first245654 +Ref: #newest-first245797 +Node: include246480 +Ref: #include246613 +Node: balance-type247057 +Ref: #balance-type247179 +Node: Tips247879 +Ref: #tips247970 +Node: Rapid feedback248226 +Ref: #rapid-feedback248345 +Node: Valid CSV248805 +Ref: #valid-csv248937 +Node: File Extension249129 +Ref: #file-extension249283 +Node: Reading multiple CSV files249712 +Ref: #reading-multiple-csv-files249899 +Node: Valid transactions250140 +Ref: #valid-transactions250320 +Node: Deduplicating importing250948 +Ref: #deduplicating-importing251129 +Node: Setting amounts252162 +Ref: #setting-amounts252333 +Node: Setting currency/commodity253320 +Ref: #setting-currencycommodity253514 +Node: Referencing other fields254688 +Ref: #referencing-other-fields254890 +Node: How CSV rules are evaluated255787 +Ref: #how-csv-rules-are-evaluated255962 +Node: TIMECLOCK FORMAT257413 +Ref: #timeclock-format257553 +Node: TIMEDOT FORMAT259614 +Ref: #timedot-format259752 +Node: COMMON TASKS264028 +Ref: #common-tasks264157 +Node: Getting help264564 +Ref: #getting-help264698 +Node: Constructing command lines265251 +Ref: #constructing-command-lines265445 +Node: Starting a journal file266142 +Ref: #starting-a-journal-file266342 +Node: Setting opening balances267530 +Ref: #setting-opening-balances267728 +Node: Recording transactions270869 +Ref: #recording-transactions271051 +Node: Reconciling271607 +Ref: #reconciling271752 +Node: Reporting274009 +Ref: #reporting274151 +Node: Migrating to a new file278150 +Ref: #migrating-to-a-new-file278300 +Node: LIMITATIONS278599 +Ref: #limitations278727 +Node: TROUBLESHOOTING279470 +Ref: #troubleshooting279585  End Tag Table diff --git a/hledger/hledger.txt b/hledger/hledger.txt index 5beddb68d..85d52216e 100644 --- a/hledger/hledger.txt +++ b/hledger/hledger.txt @@ -4,8 +4,9 @@ HLEDGER(1) hledger User Manuals HLEDGER(1) NAME - hledger is a command-line accounting tool for both power users and - folks new to accounting. This manual is for hledger 1.20.99. + This is the command-line interface (CLI) for the hledger accounting + tool. Here we also describe hledger's concepts and file formats. This + manual is for hledger 1.20.99. SYNOPSIS hledger @@ -15,13 +16,12 @@ SYNOPSIS hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS] DESCRIPTION - hledger is a reliable, cross-platform set of programs for tracking - money, time, or any other commodity, using double-entry accounting and - a simple, editable file format. hledger is inspired by and largely + hledger is a reliable, cross-platform set of programs for tracking + money, time, or any other commodity, using double-entry accounting and + a simple, editable file format. hledger is inspired by and largely compatible with ledger(1). - This is hledger's command-line interface (there are also terminal and - web interfaces). Its basic function is to read a plain text file de- + The basic function of the hledger CLI is to read a plain text file de- scribing financial transactions (in accounting terms, a general jour- nal) and print useful reports on standard output, or export them as CSV. hledger can also read some other file formats such as CSV files, @@ -63,10 +63,14 @@ OPTIONS General help options: -h --help - show general usage (or after COMMAND, command usage) + show general or COMMAND help + + --man show general or COMMAND user manual with man + + --info show general or COMMAND user manual with info --version - show version + show general or ADDONCOMMAND version --debug[=N] show debug output (levels 1-9, default: 1) @@ -553,6 +557,7 @@ TIME PERIODS Examples: -b 2016/3/17 begin on St. Patrick's day 2016 + -e 12/1 end at the start of december 1st of the current year (11/30 will be the last date included) -b thismonth all transactions on or after the 1st of the current month @@ -622,6 +627,8 @@ TIME PERIODS -p "2009Q1" first quarter of 2009, equivalent to "2009/1/1 to 2009/4/1" + + -p "q4" fourth quarter of the cur- rent year @@ -685,7 +692,6 @@ TIME PERIODS each month -p "every 11/05" yearly periods with boundaries on 5th of Nov -p "every 5th Nov" same - -p "every Nov 5th" same Show historical balances at end of 15th each month (N is exclusive end @@ -1125,6 +1131,7 @@ VALUATION posting cost value at re- value at value at re- value at amounts port end or posting date port or jour- DATE/today today nal end + balance as- unchanged unchanged unchanged unchanged unchanged ser- tions/as- @@ -1191,8 +1198,6 @@ VALUATION row aver- ages of dis- ages of dis- ported ages of dis- ages of dis- ages (-T, played values played values played values played values -A) - - column to- sums of dis- sums of dis- not sup- sums of dis- sums of dis- tals played values played values ported played values played values grand to- sum, average sum, average not sup- sum, average sum, average @@ -1200,6 +1205,7 @@ VALUATION average tals tals tals tals + --cumulative is omitted to save space, it works like -H but with a zero starting balance. @@ -1454,7 +1460,7 @@ COMMANDS Next, the detailed command docs, in alphabetical order. accounts - accounts, a + accounts Show account names. This command lists account names, either declared with account direc- @@ -1629,7 +1635,7 @@ COMMANDS $ hledger areg assets date:jul balance - balance, bal, b + balance, bal Show accounts and their balances. The balance command is hledger's most versatile command. Note, despite @@ -2566,44 +2572,25 @@ COMMANDS help help - Show any of the hledger manuals. + Show the hledger user manual in one of several formats, optionally po- + sitioned at a given TOPIC (if possible). TOPIC is any heading, or + heading prefix, in the manual. Some examples: commands, print, 'auto + postings', periodic. - The help command displays any of the main hledger manuals, in one of - several ways. Run it with no argument to list the manuals, or provide - a full or partial manual name to select one. + This command shows the user manual built in to this hledger version. + It can be useful if the correct version of the hledger manual, or the + usual viewing tools, are not installed on your system. - hledger manuals are available in several formats. hledger help will - use the first of these display methods that it finds: info, man, - $PAGER, less, stdout (or when non-interactive, just stdout). You can - force a particular viewer with the --info, --man, --pager, --cat flags. - - Examples: - - $ hledger help - Please choose a manual by typing "hledger help MANUAL" (a substring is ok). - Manuals: hledger hledger-ui hledger-web - - $ hledger help h --man - - hledger(1) hledger User Manuals hledger(1) - - NAME - hledger - a command-line accounting tool - - SYNOPSIS - hledger [-f FILE] COMMAND [OPTIONS] [ARGS] - hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS] - hledger - - DESCRIPTION - hledger is a cross-platform program for tracking money, time, or any - ... + By default it uses the best viewer it can find in $PATH, in this order: + info, man, $PAGER (unless a topic is specified), less, or stdout. When + run non-interactively, it always uses stdout. Or you can select a par- + ticular viewer with the -i (info), -m (man), or -p (pager) flags. import import - Read new transactions added to each FILE since last run, and add them - to the main journal file. Or with --dry-run, just print the transac- - tions that would be added. Or with --catchup, just mark all of the + Read new transactions added to each FILE since last run, and add them + to the main journal file. Or with --dry-run, just print the transac- + tions that would be added. Or with --catchup, just mark all of the FILEs' transactions as imported, without actually importing any. The input files are specified as arguments - no need to write -f before @@ -2614,23 +2601,23 @@ COMMANDS ing transactions are always added to the input files in increasing date order, and by saving .latest.FILE state files. - The --dry-run output is in journal format, so you can filter it, eg to + The --dry-run output is in journal format, so you can filter it, eg to see only uncategorised transactions: $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions Importing balance assignments - Entries added by import will have their posting amounts made explicit - (like hledger print -x). This means that any balance assignments in - imported files must be evaluated; but, imported files don't get to see - the main file's account balances. As a result, importing entries with + Entries added by import will have their posting amounts made explicit + (like hledger print -x). This means that any balance assignments in + imported files must be evaluated; but, imported files don't get to see + the main file's account balances. As a result, importing entries with balance assignments (eg from an institution that provides only balances - and not posting amounts) will probably generate incorrect posting + and not posting amounts) will probably generate incorrect posting amounts. To avoid this problem, use print instead of import: $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE - (If you think import should leave amounts implicit like print does, + (If you think import should leave amounts implicit like print does, please test it and send a pull request.) Commodity display styles @@ -2639,16 +2626,16 @@ COMMANDS incomestatement incomestatement, is - This command displays an income statement, showing revenues and ex- + This command displays an income statement, showing revenues and ex- penses during one or more periods. Amounts are shown with normal posi- tive sign, as in conventional financial statements. The revenue and expense accounts shown are those accounts declared with - the Revenue or Expense type, or otherwise all accounts under a top- - level revenue or income or expense account (case insensitive, plurals + the Revenue or Expense type, or otherwise all accounts under a top- + level revenue or income or expense account (case insensitive, plurals allowed). - (This report is essentially similar to "hledger balance --change rev- + (This report is essentially similar to "hledger balance --change rev- enues expenses", with revenues sign-flipped.) Example: @@ -2675,13 +2662,13 @@ COMMANDS 0 With a reporting interval, multiple columns will be shown, one for each - report period. Normally incomestatement shows revenues/expenses per - period, though as with multicolumn balance reports you can alter the - report mode with --change/--cumulative/--historical. Instead of abso- + report period. Normally incomestatement shows revenues/expenses per + period, though as with multicolumn balance reports you can alter the + report mode with --change/--cumulative/--historical. Instead of abso- lute values percentages can be displayed with -%. This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, html, and (experimen- + tions The output formats supported are txt, csv, html, and (experimen- tal) json. notes @@ -2689,8 +2676,8 @@ COMMANDS List the unique notes that appear in transactions. This command lists the unique notes that appear in transactions, in al- - phabetic order. You can add a query to select a subset of transac- - tions. The note is the part of the transaction description after a | + phabetic order. You can add a query to select a subset of transac- + tions. The note is the part of the transaction description after a | character (or if there is no |, the whole description). Example: @@ -2704,8 +2691,8 @@ COMMANDS List the unique payee/payer names that appear in transactions. This command lists the unique payee/payer names that appear in transac- - tions, in alphabetic order. You can add a query to select a subset of - transactions. The payee/payer is the part of the transaction descrip- + tions, in alphabetic order. You can add a query to select a subset of + transactions. The payee/payer is the part of the transaction descrip- tion before a | character (or if there is no |, the whole description). Example: @@ -2717,22 +2704,22 @@ COMMANDS prices prices - Print market price directives from the journal. With --costs, also - print synthetic market prices based on transaction prices. With --in- - verted-costs, also print inverse prices based on transaction prices. - Prices (and postings providing prices) can be filtered by a query. + Print market price directives from the journal. With --costs, also + print synthetic market prices based on transaction prices. With --in- + verted-costs, also print inverse prices based on transaction prices. + Prices (and postings providing prices) can be filtered by a query. Price amounts are always displayed with their full precision. print - print, txns, p + print Show transaction journal entries, sorted by date. The print command displays full journal entries (transactions) from the - journal file in date order, tidily formatted. With --date2, transac- + journal file in date order, tidily formatted. With --date2, transac- tions are sorted by secondary date instead. print's output is always a valid hledger journal. - It preserves all transaction information, but it does not preserve di- + It preserves all transaction information, but it does not preserve di- rectives or inter-transaction comments $ hledger print @@ -2759,43 +2746,43 @@ COMMANDS Normally, the journal entry's explicit or implicit amount style is pre- served. For example, when an amount is omitted in the journal, it will - not appear in the output. Similarly, when a transaction price is im- - plied but not written, it will not appear in the output. You can use - the -x/--explicit flag to make all amounts and transaction prices ex- - plicit, which can be useful for troubleshooting or for making your + not appear in the output. Similarly, when a transaction price is im- + plied but not written, it will not appear in the output. You can use + the -x/--explicit flag to make all amounts and transaction prices ex- + plicit, which can be useful for troubleshooting or for making your journal more readable and robust against data entry errors. -x is also implied by using any of -B,-V,-X,--value. - Note, -x/--explicit will cause postings with a multi-commodity amount - (these can arise when a multi-commodity transaction has an implicit - amount) to be split into multiple single-commodity postings, keeping + Note, -x/--explicit will cause postings with a multi-commodity amount + (these can arise when a multi-commodity transaction has an implicit + amount) to be split into multiple single-commodity postings, keeping the output parseable. - With -B/--cost, amounts with transaction prices are converted to cost + With -B/--cost, amounts with transaction prices are converted to cost using that price. This can be used for troubleshooting. - With -m/--match and a STR argument, print will show at most one trans- - action: the one one whose description is most similar to STR, and is - most recent. STR should contain at least two characters. If there is + With -m/--match and a STR argument, print will show at most one trans- + action: the one one whose description is most similar to STR, and is + most recent. STR should contain at least two characters. If there is no similar-enough match, no transaction will be shown. With --new, for each FILE being read, hledger reads (and writes) a spe- - cial state file (.latest.FILE in the same directory), containing the - latest transaction date(s) that were seen last time FILE was read. - When this file is found, only transactions with newer dates (and new - transactions on the latest date) are printed. This is useful for ig- - noring already-seen entries in import data, such as downloaded CSV + cial state file (.latest.FILE in the same directory), containing the + latest transaction date(s) that were seen last time FILE was read. + When this file is found, only transactions with newer dates (and new + transactions on the latest date) are printed. This is useful for ig- + noring already-seen entries in import data, such as downloaded CSV files. Eg: $ hledger -f bank1.csv print --new (shows transactions added since last print --new on this file) - This assumes that transactions added to FILE always have same or in- - creasing dates, and that transactions on the same day do not get re- + This assumes that transactions added to FILE always have same or in- + creasing dates, and that transactions on the same day do not get re- ordered. See also the import command. This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, and (experimental) + tions The output formats supported are txt, csv, and (experimental) json and sql. Here's an example of print's CSV output: @@ -2814,20 +2801,20 @@ COMMANDS "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","","" "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" - o There is one CSV record per posting, with the parent transaction's + o There is one CSV record per posting, with the parent transaction's fields repeated. o The "txnidx" (transaction index) field shows which postings belong to - the same transaction. (This number might change if transactions are - reordered within the file, files are parsed/included in a different + the same transaction. (This number might change if transactions are + reordered within the file, files are parsed/included in a different order, etc.) - o The amount is separated into "commodity" (the symbol) and "amount" + o The amount is separated into "commodity" (the symbol) and "amount" (numeric quantity) fields. o The numeric amount is repeated in either the "credit" or "debit" col- - umn, for convenience. (Those names are not accurate in the account- - ing sense; it just puts negative amounts under credit and zero or + umn, for convenience. (Those names are not accurate in the account- + ing sense; it just puts negative amounts under credit and zero or greater amounts under debit.) print-unique @@ -2847,18 +2834,18 @@ COMMANDS (acct:one) 1 register - register, reg, r + register, reg Show postings and their running total. The register command displays matched postings, across all accounts, in - date order, with their running total or running historical balance. - (See also the aregister command, which shows matched transactions in a + date order, with their running total or running historical balance. + (See also the aregister command, which shows matched transactions in a specific account.) register normally shows line per posting, but note that multi-commodity amounts will occupy multiple lines (one line per commodity). - It is typically used with a query selecting a particular account, to + It is typically used with a query selecting a particular account, to see that account's activity: $ hledger register checking @@ -2869,8 +2856,8 @@ COMMANDS With --date2, it shows and sorts by secondary date instead. - 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 @@ -2880,18 +2867,18 @@ 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 - is affected by --historical. It works best when showing just one ac- + the whole report period). This flag implies --empty (see below). It + is affected by --historical. It works best when showing just one ac- count 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. - The --invert flag negates all amounts. For example, it can be used on + The --invert flag negates all amounts. For example, it can be used on an income account where amounts are normally displayed as negative num- - bers. It's also useful to show postings on the checking account to- + bers. It's also useful to show postings on the checking account to- gether with the related account: $ hledger register --related --invert assets:checking @@ -2903,7 +2890,7 @@ COMMANDS 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 @@ -2920,7 +2907,7 @@ COMMANDS 2008/11 0 $-2 2008/12 0 $-2 - Often, you'll want to see just one line per interval. The --depth op- + Often, you'll want to see just one line per interval. The --depth op- tion helps with this, causing subaccounts to be aggregated: $ hledger register --monthly assets --depth 1h @@ -2928,17 +2915,17 @@ 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 in- - tervals. 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 in- + tervals. 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 + The description and account columns normally share the space equally (about half of (width - 40) each). You can adjust this by adding a de- scription width as part of --width's argument, comma-separated: --width W,D . Here's a diagram (won't display correctly in --help): @@ -2957,27 +2944,27 @@ COMMANDS $ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 This command also supports the output destination and output format op- - tions The output formats supported are txt, csv, and (experimental) + tions The output formats supported are txt, csv, and (experimental) json. register-match register-match Print the one posting whose transaction description is closest to DESC, - in the style of the register command. If there are multiple equally - good matches, it shows the most recent. Query options (options, not - arguments) can be used to restrict the search space. Helps ledger-au- + in the style of the register command. If there are multiple equally + good matches, it shows the most recent. Query options (options, not + arguments) can be used to restrict the search space. Helps ledger-au- tosync detect already-seen transactions when importing. rewrite rewrite Print all transactions, rewriting the postings of matched transactions. - For now the only rewrite available is adding new postings, like print + For now the only rewrite available is adding new postings, like print --auto. This is a start at a generic rewriter of transaction entries. It reads - the default journal and prints the transactions, like print, but adds + the default journal and prints the transactions, like print, but adds one or more specified postings to any transactions matching QUERY. The - posting amounts can be fixed, or a multiplier of the existing transac- + posting amounts can be fixed, or a multiplier of the existing transac- tion's first posting amount. Examples: @@ -2993,7 +2980,7 @@ COMMANDS (reserve:grocery) *0.25 ; reserve 25% for grocery (reserve:) *0.25 ; reserve 25% for grocery - Note the single quotes to protect the dollar sign from bash, and the + Note the single quotes to protect the dollar sign from bash, and the two spaces between account and amount. More: @@ -3003,16 +2990,16 @@ COMMANDS $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"' $ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify' - Argument for --add-posting option is a usual posting of transaction - with an exception for amount specification. More precisely, you can + Argument for --add-posting option is a usual posting of transaction + with an exception for amount specification. More precisely, you can use '*' (star symbol) before the amount to indicate that that this is a - factor for an amount of original matched posting. If the amount in- + factor for an amount of original matched posting. If the amount in- cludes a commodity name, the new posting amount will be in the new com- - modity; otherwise, it will be in the matched posting amount's commod- + modity; otherwise, it will be in the matched posting amount's commod- ity. Re-write rules in a file - During the run this tool will execute so called "Automated Transac- + During the run this tool will execute so called "Automated Transac- tions" found in any journal it process. I.e instead of specifying this operations in command line you can put them in a journal file. @@ -3027,7 +3014,7 @@ COMMANDS budget:gifts *-1 assets:budget *1 - Note that '=' (equality symbol) that is used instead of date in trans- + Note that '=' (equality symbol) that is used instead of date in trans- actions you usually write. It indicates the query by which you want to match the posting to add new ones. @@ -3040,12 +3027,12 @@ COMMANDS --add-posting 'assets:budget *1' \ > rewritten-tidy-output.journal - It is important to understand that relative order of such entries in - journal is important. You can re-use result of previously added post- + It is important to understand that relative order of such entries in + journal is important. You can re-use result of previously added post- ings. Diff output format - To use this tool for batch modification of your journal files you may + To use this tool for batch modification of your journal files you may find useful output in form of unified diff. $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33' @@ -3069,10 +3056,10 @@ COMMANDS If you'll pass this through patch tool you'll get transactions contain- ing the posting that matches your query be updated. Note that multiple - files might be update according to list of input files specified via + files might be update according to list of input files specified via --file options and include directives inside of these files. - Be careful. Whole transaction being re-formatted in a style of output + Be careful. Whole transaction being re-formatted in a style of output from hledger print. See also: @@ -3080,49 +3067,49 @@ COMMANDS https://github.com/simonmichael/hledger/issues/99 rewrite vs. print --auto - This command predates print --auto, and currently does much the same + This command predates print --auto, and currently does much the same thing, but with these differences: - o with multiple files, rewrite lets rules in any file affect all other - files. print --auto uses standard directive scoping; rules affect + o with multiple files, rewrite lets rules in any file affect all other + files. print --auto uses standard directive scoping; rules affect only child files. - o rewrite's query limits which transactions can be rewritten; all are + o rewrite's query limits which transactions can be rewritten; all are printed. print --auto's query limits which transactions are printed. - o rewrite applies rules specified on command line or in the journal. + o rewrite applies rules specified on command line or in the journal. print --auto applies rules specified in the journal. roi roi - Shows the time-weighted (TWR) and money-weighted (IRR) rate of return + Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on your investments. - This command assumes that you have account(s) that hold nothing but + This command assumes that you have account(s) that hold nothing but your investments and whenever you record current appraisal/valuation of these investments you offset unrealized profit and loss into account(s) that, again, hold nothing but unrealized profit and loss. - Any transactions affecting balance of investment account(s) and not - originating from unrealized profit and loss account(s) are assumed to + Any transactions affecting balance of investment account(s) and not + originating from unrealized profit and loss account(s) are assumed to be your investments or withdrawals. - At a minimum, you need to supply a query (which could be just an ac- + At a minimum, you need to supply a query (which could be just an ac- count name) to select your investments with --inv, and another query to identify your profit and loss transactions with --pnl. - This command will compute and display the internalized rate of return - (IRR) and time-weighted rate of return (TWR) for your investments for - the time period requested. Both rates of return are annualized before + This command will compute and display the internalized rate of return + (IRR) and time-weighted rate of return (TWR) for your investments for + the time period requested. Both rates of return are annualized before display, regardless of the length of reporting interval. Note, in some cases this report can fail, for these reasons: - o Error (NotBracketed): No solution for Internal Rate of Return (IRR). - Possible causes: IRR is huge (>1000000%), balance of investment be- + o Error (NotBracketed): No solution for Internal Rate of Return (IRR). + Possible causes: IRR is huge (>1000000%), balance of investment be- comes negative at some point in time. - o Error (SearchFailed): Failed to find solution for Internal Rate of + o Error (SearchFailed): Failed to find solution for Internal Rate of Return (IRR). Either search does not converge to a solution, or con- verges too slowly. @@ -3133,67 +3120,67 @@ COMMANDS More background: - "ROI" stands for "return on investment". Traditionally this was com- - puted as a difference between current value of investment and its ini- + "ROI" stands for "return on investment". Traditionally this was com- + puted as a difference between current value of investment and its ini- tial value, expressed in percentage of the initial value. However, this approach is only practical in simple cases, where invest- - ments receives no in-flows or out-flows of money, and where rate of + ments receives no in-flows or out-flows of money, and where rate of growth is fixed over time. For more complex scenarios you need differ- - ent ways to compute rate of return, and this command implements two of + ent ways to compute rate of return, and this command implements two of them: IRR and TWR. - Internal rate of return, or "IRR" (also called "money-weighted rate of - return") takes into account effects of in-flows and out-flows. + Internal rate of return, or "IRR" (also called "money-weighted rate of + return") takes into account effects of in-flows and out-flows. Naively, if you are withdrawing from your investment, your future gains - would be smaller (in absolute numbers), and will be a smaller percent- - age of your initial investment, and if you are adding to your invest- - ment, you will receive bigger absolute gains (but probably at the same - rate of return). IRR is a way to compute rate of return for each pe- - riod between in-flow or out-flow of money, and then combine them in a + would be smaller (in absolute numbers), and will be a smaller percent- + age of your initial investment, and if you are adding to your invest- + ment, you will receive bigger absolute gains (but probably at the same + rate of return). IRR is a way to compute rate of return for each pe- + riod between in-flow or out-flow of money, and then combine them in a way that gives you an annual rate of return that investment is expected to generate. - As mentioned before, in-flows and out-flows would be any cash that you - personally put in or withdraw, and for the "roi" command, these are - transactions that involve account(s) matching --inv argument and NOT + As mentioned before, in-flows and out-flows would be any cash that you + personally put in or withdraw, and for the "roi" command, these are + transactions that involve account(s) matching --inv argument and NOT involve account(s) matching --pnl argument. - Presumably, you will also record changes in the value of your invest- - ment, and balance them against "profit and loss" (or "unrealized + Presumably, you will also record changes in the value of your invest- + ment, and balance them against "profit and loss" (or "unrealized gains") account. Note that in order for IRR to compute the precise ef- - fect of your in-flows and out-flows on the rate of return, you will - need to record the value of your investement on or close to the days + fect of your in-flows and out-flows on the rate of return, you will + need to record the value of your investement on or close to the days when in- or out-flows occur. - Implementation of IRR in hledger should match the XIRR formula in Ex- + Implementation of IRR in hledger should match the XIRR formula in Ex- cel. - Second way to compute rate of return that roi command implements is + Second way to compute rate of return that roi command implements is called "time-weighted rate of return" or "TWR". Like IRR, it will also - break the history of your investment into periods between in-flows and + break the history of your investment into periods between in-flows and out-flows to compute rate of return per each period and then a compound rate of return. However, internal workings of TWR are quite different. - In technical terms, IRR uses the same approach as computation of net + In technical terms, IRR uses the same approach as computation of net present value, and tries to find a discount rate that makes net present value of all the cash flows of your investment to add up to zero. This - could be hard to wrap your head around, especially if you haven't done + could be hard to wrap your head around, especially if you haven't done discounted cash flow analysis before. - TWR represents your investment as an imaginary "unit fund" where in- - flows/ out-flows lead to buying or selling "units" of your investment + TWR represents your investment as an imaginary "unit fund" where in- + flows/ out-flows lead to buying or selling "units" of your investment and changes in its value change the value of "investment unit". Change - in "unit price" over the reporting period gives you rate of return of + in "unit price" over the reporting period gives you rate of return of your investment. - References: * Explanation of rate of return * Explanation of IRR * Ex- - planation of TWR * Examples of computing IRR and TWR and discussion of + References: * Explanation of rate of return * Explanation of IRR * Ex- + planation of TWR * Examples of computing IRR and TWR and discussion of the limitations of both metrics More examples: - Lets say that we found an investment in Snake Oil that is proising to + Lets say that we found an investment in Snake Oil that is proising to give us 10% annually: 2019-01-01 Investing in Snake Oil @@ -3204,7 +3191,7 @@ COMMANDS investment:snake oil = $110 equity:unrealized gains - For now, basic computation of the rate of return, as well as IRR and + For now, basic computation of the rate of return, as well as IRR and TWR, gives us the expected 10%: $ hledger roi -Y --inv investment --pnl "unrealized" @@ -3214,10 +3201,10 @@ COMMANDS | 1 || 2019-01-01 | 2019-12-31 || 0 | 100 | 110 | 10 || 10.00% | 10.00% | +---++------------+------------++---------------+----------+-------------+-----++--------+--------+ - However, lets say that shorty after investing in the Snake Oil we - started to have second thoughs, so we prompty withdrew $90, leaving - only $10 in. Before Christmas, though, we started to get the "fear of - mission out", so we put the $90 back in. So for most of the year, our + However, lets say that shorty after investing in the Snake Oil we + started to have second thoughs, so we prompty withdrew $90, leaving + only $10 in. Before Christmas, though, we started to get the "fear of + mission out", so we put the $90 back in. So for most of the year, our investment was just $10 dollars, and it gave us just $1 in growth: 2019-01-01 Investing in Snake Oil @@ -3248,10 +3235,10 @@ COMMANDS Here, IRR tells us that we made close to 10% on the $10 dollars that we had in the account most of the time. And TWR is ... just 1%? Why? - Based on the transactions in our journal, TWR "think" that we are buy- - ing back $90 worst of Snake Oil at the same price that it had at the + Based on the transactions in our journal, TWR "think" that we are buy- + ing back $90 worst of Snake Oil at the same price that it had at the beginning of they year, and then after that our $100 investment gets $1 - increase in value, or 1% of $100. Let's take a closer look at what is + increase in value, or 1% of $100. Let's take a closer look at what is happening here by asking for quarterly reports instead of annual: $ hledger roi -Q --inv investment --pnl "unrealized" @@ -3264,10 +3251,10 @@ COMMANDS | 4 || 2019-10-01 | 2019-12-31 || 10 | 90 | 101 | 1 || 37.80% | 4.03% | +---++------------+------------++---------------+----------+-------------+-----++--------+-------+ - Now both IRR and TWR are thrown off by the fact that all of the growth - for our investment happens in Q4 2019. This happes because IRR compu- + Now both IRR and TWR are thrown off by the fact that all of the growth + for our investment happens in Q4 2019. This happes because IRR compu- tation is still yielding 9.32% and TWR is still 1%, but this time these - are rates for three month period instead of twelve, so in order to get + are rates for three month period instead of twelve, so in order to get an annual rate they should be multiplied by four! Let's try to keep a better record of how Snake Oil grew in value: @@ -3312,10 +3299,10 @@ COMMANDS | 4 || 2019-10-01 | 2019-12-31 || 10.75 | 90 | 101.00 | 0.25 || 8.05% | 1.00% | +---++------------+------------++---------------+----------+-------------+------++--------+--------+ - Something is still wrong with TWR computation for Q4, and if you have - been paying attention you know what it is already: big $90 buy-back is - recorded prior to the only transaction that captures the change of - value of Snake Oil that happened in this time period. Lets combine + Something is still wrong with TWR computation for Q4, and if you have + been paying attention you know what it is already: big $90 buy-back is + recorded prior to the only transaction that captures the change of + value of Snake Oil that happened in this time period. Lets combine transactions from 30th and 31st of Dec into one: 2019-12-30 Fear of missing out and growth of Snake Oil @@ -3336,7 +3323,7 @@ COMMANDS | 4 || 2019-10-01 | 2019-12-31 || 10.75 | 90 | 101.00 | 0.25 || 8.05% | 9.57% | +---++------------+------------++---------------+----------+-------------+------++--------+--------+ - And for annual report, TWR now reports the exact profitability of our + And for annual report, TWR now reports the exact profitability of our investment: $ hledger roi -Y --inv investment --pnl "unrealized" @@ -3350,8 +3337,8 @@ COMMANDS stats Show some journal statistics. - The stats command displays summary information for the whole journal, - or a matched part of it. With a reporting interval, it shows a report + The stats command displays summary information for the whole journal, + or a matched part of it. With a reporting interval, it shows a report for each report period. Example: @@ -3369,35 +3356,35 @@ COMMANDS Commodities : 1 ($) Market prices : 12 ($) - This command also supports output destination and output format selec- + This command also supports output destination and output format selec- tion. tags tags - List the unique tag names used in the journal. With a TAGREGEX argu- + List the unique tag names used in the journal. With a TAGREGEX argu- ment, only tag names matching the regular expression (case insensitive) - are shown. With QUERY arguments, only transactions matching the query + are shown. With QUERY arguments, only transactions matching the query are considered. With the --values flag, the tags' unique values are listed instead. - With --parsed flag, all tags or values are shown in the order they are + With --parsed flag, all tags or values are shown in the order they are parsed from the input data, including duplicates. - With -E/--empty, any blank/empty values will also be shown, otherwise + With -E/--empty, any blank/empty values will also be shown, otherwise they are omitted. test test Run built-in unit tests. - This command runs the unit tests built in to hledger and hledger-lib, - printing the results on stdout. If any test fails, the exit code will + This command runs the unit tests built in to hledger and hledger-lib, + printing the results on stdout. If any test fails, the exit code will be non-zero. - This is mainly used by hledger developers, but you can also use it to - sanity-check the installed hledger executable on your platform. All - tests are expected to pass - if you ever see a failure, please report + This is mainly used by hledger developers, but you can also use it to + sanity-check the installed hledger executable on your platform. All + tests are expected to pass - if you ever see a failure, please report as a bug! This command also accepts tasty test runner options, written after a -- @@ -3406,7 +3393,7 @@ COMMANDS $ hledger test -- -pData.Amount --color=never - For help on these, see https://github.com/feuerbach/tasty#options (-- + For help on these, see https://github.com/feuerbach/tasty#options (-- --help currently doesn't show them). About add-on commands @@ -3414,16 +3401,16 @@ COMMANDS o whose name starts with hledger- - o whose name ends with a recognised file extension: .bat,.com,.exe, + o whose name ends with a recognised file extension: .bat,.com,.exe, .hs,.lhs,.pl,.py,.rb,.rkt,.sh or none o and (on unix, mac) which are executable by the current user. - Add-ons are a relatively easy way to add local features or experiment - with new ideas. They can be written in any language, but haskell - scripts have a big advantage: they can use the same hledger library - functions that built-in commands use for command-line options, parsing - and reporting. Some experimental/example add-on scripts can be found + Add-ons are a relatively easy way to add local features or experiment + with new ideas. They can be written in any language, but haskell + scripts have a big advantage: they can use the same hledger library + functions that built-in commands use for command-line options, parsing + and reporting. Some experimental/example add-on scripts can be found in the hledger repo's bin/ directory. Note in a hledger command line, add-on command flags must have a double @@ -3437,9 +3424,7 @@ COMMANDS (because the --serve flag belongs to hledger-web, not hledger). - The -h/--help and --version flags work without --, with their position - deciding which program they refer to. Eg hledger -h web shows - hledger's help, hledger web -h shows hledger-web's help. + The -h/--help and --version flags don't require --. If you have any trouble with this, remember you can always run the add- on program directly, eg: @@ -3450,16 +3435,16 @@ JOURNAL FORMAT hledger's default file format, representing a General Journal. hledger's usual data source is a plain text file containing journal en- - tries in hledger journal format. This file represents a standard ac- - counting general journal. I use file names ending in .journal, but + tries in hledger journal format. This file represents a standard ac- + counting general journal. I use file names ending in .journal, but that's not required. The journal file contains a number of transaction entries, each describing a transfer of money (or any commodity) between two or more named accounts, in a simple format readable by both hledger and humans. - hledger's journal format is a compatible subset, mostly, of ledger's - journal format, so hledger can work with compatible ledger journal - files as well. It's safe, and encouraged, to run both hledger and + hledger's journal format is a compatible subset, mostly, of ledger's + journal format, so hledger can work with compatible ledger journal + files as well. It's safe, and encouraged, to run both hledger and ledger on the same journal file, eg to validate the results you're get- ting. @@ -3467,24 +3452,24 @@ JOURNAL FORMAT the add or web or import commands to create and update it. Many users, though, edit the journal file with a text editor, and track - changes with a version control system such as git. Editor addons such - as ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, and + changes with a version control system such as git. Editor addons such + as ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, and hledger-vscode for Visual Studio Code, make this easier, adding colour, formatting, tab completion, and useful commands. See Editor configura- tion at hledger.org for the full list. - Here's a description of each part of the file format (and hledger's - data model). These are mostly in the order you'll use them, but in - some cases related concepts have been grouped together for easy refer- - ence, or linked before they are introduced, so feel free to skip over + Here's a description of each part of the file format (and hledger's + data model). These are mostly in the order you'll use them, but in + some cases related concepts have been grouped together for easy refer- + ence, or linked before they are introduced, so feel free to skip over anything that looks unnecessary right now. Transactions - Transactions are the main unit of information in a journal file. They - represent events, typically a movement of some quantity of commodities + Transactions are the main unit of information in a journal file. They + represent events, typically a movement of some quantity of commodities between two or more named accounts. - Each transaction is recorded as a journal entry, beginning with a sim- + Each transaction is recorded as a journal entry, beginning with a sim- ple date in column 0. This can be followed by any of the following op- tional fields, separated by spaces: @@ -3494,11 +3479,11 @@ JOURNAL FORMAT o a description (any remaining text until end of line or a semicolon) - o a comment (any remaining text following a semicolon until end of + o a comment (any remaining text following a semicolon until end of line, and any following indented lines beginning with a semicolon) o 0 or more indented posting lines, describing what was transferred and - the accounts involved (indented comment lines are also allowed, but + the accounts involved (indented comment lines are also allowed, but not blank lines or non-indented lines). Here's a simple journal file containing one transaction: @@ -3509,35 +3494,35 @@ JOURNAL FORMAT Dates Simple dates - Dates in the journal file use simple dates format: YYYY-MM-DD or + Dates in the journal file use simple dates format: YYYY-MM-DD or YYYY/MM/DD or YYYY.MM.DD, with leading zeros optional. The year may be - omitted, in which case it will be inferred from the context: the cur- - rent transaction, the default year set with a default year directive, - or the current date when the command is run. Some examples: + omitted, in which case it will be inferred from the context: the cur- + rent transaction, the default year set with a default year directive, + or the current date when the command is run. Some examples: 2010-01-31, 2010/01/31, 2010.1.31, 1/31. - (The UI also accepts simple dates, as well as the more flexible smart + (The UI also accepts simple dates, as well as the more flexible smart dates documented in the hledger manual.) Secondary dates - Real-life transactions sometimes involve more than one date - eg the + Real-life transactions sometimes involve more than one date - eg the date you write a cheque, and the date it clears in your bank. When you - want to model this, for more accurate daily balances, you can specify + want to model this, for more accurate daily balances, you can specify individual posting dates. - Or, you can use the older secondary date feature (Ledger calls it aux- - iliary date or effective date). Note: we support this for compatibil- - ity, but I usually recommend avoiding this feature; posting dates are + Or, you can use the older secondary date feature (Ledger calls it aux- + iliary date or effective date). Note: we support this for compatibil- + ity, but I usually recommend avoiding this feature; posting dates are almost always clearer and simpler. A secondary date is written after the primary date, following an equals - sign. If the year is omitted, the primary date's year is assumed. - When running reports, the primary (left) date is used by default, but - with the --date2 flag (or --aux-date or --effective), the secondary + sign. If the year is omitted, the primary date's year is assumed. + When running reports, the primary (left) date is used by default, but + with the --date2 flag (or --aux-date or --effective), the secondary (right) date will be used instead. - The meaning of secondary dates is up to you, but it's best to follow a - consistent rule. Eg "primary = the bank's clearing date, secondary = + The meaning of secondary dates is up to you, but it's best to follow a + consistent rule. Eg "primary = the bank's clearing date, secondary = date the transaction was initiated, if different", as shown here: 2010/2/23=2/19 movie ticket @@ -3551,11 +3536,11 @@ JOURNAL FORMAT 2010-02-19 movie ticket assets:checking $-10 $-10 Posting dates - You can give individual postings a different date from their parent - transaction, by adding a posting comment containing a tag (see below) + You can give individual postings a different date from their parent + transaction, by adding a posting comment containing a tag (see below) like date:DATE. This is probably the best way to control posting dates - precisely. Eg in this example the expense should appear in May re- - ports, and the deduction from checking should be reported on 6/1 for + precisely. Eg in this example the expense should appear in May re- + ports, and the deduction from checking should be reported on 6/1 for easy bank reconciliation: 2015/5/30 @@ -3568,22 +3553,22 @@ JOURNAL FORMAT $ hledger -f t.j register checking 2015-06-01 assets:checking $-10 $-10 - DATE should be a simple date; if the year is not specified it will use - the year of the transaction's date. You can set the secondary date - similarly, with date2:DATE2. The date: or date2: tags must have a - valid simple date value if they are present, eg a date: tag with no + DATE should be a simple date; if the year is not specified it will use + the year of the transaction's date. You can set the secondary date + similarly, with date2:DATE2. The date: or date2: tags must have a + valid simple date value if they are present, eg a date: tag with no value is not allowed. Ledger's earlier, more compact bracketed date syntax is also supported: - [DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any + [DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any square-bracketed sequence of the 0123456789/-.= characters in this way. - With this syntax, DATE infers its year from the transaction and DATE2 + With this syntax, DATE infers its year from the transaction and DATE2 infers its year from DATE. Status - Transactions, or individual postings within a transaction, can have a - status mark, which is a single character before the transaction de- - scription or posting account name, separated from it by a space, indi- + Transactions, or individual postings within a transaction, can have a + status mark, which is a single character before the transaction de- + scription or posting account name, separated from it by a space, indi- cating one of three statuses: mark status @@ -3592,23 +3577,23 @@ JOURNAL FORMAT ! pending * cleared - When reporting, you can filter by status with the -U/--unmarked, - -P/--pending, and -C/--cleared flags; or the status:, status:!, and + When reporting, you can filter by status with the -U/--unmarked, + -P/--pending, and -C/--cleared flags; or the status:, status:!, and status:* queries; or the U, P, C keys in hledger-ui. - Note, in Ledger and in older versions of hledger, the "unmarked" state - is called "uncleared". As of hledger 1.3 we have renamed it to un- + Note, in Ledger and in older versions of hledger, the "unmarked" state + is called "uncleared". As of hledger 1.3 we have renamed it to un- marked for clarity. - To replicate Ledger and old hledger's behaviour of also matching pend- + To replicate Ledger and old hledger's behaviour of also matching pend- ing, combine -U and -P. - Status marks are optional, but can be helpful eg for reconciling with + Status marks are optional, but can be helpful eg for reconciling with real-world accounts. Some editor modes provide highlighting and short- - cuts for working with status. Eg in Emacs ledger-mode, you can toggle + cuts for working with status. Eg in Emacs ledger-mode, you can toggle transaction status with C-c C-e, or posting status with C-c C-c. - What "uncleared", "pending", and "cleared" actually mean is up to you. + What "uncleared", "pending", and "cleared" actually mean is up to you. Here's one suggestion: status meaning @@ -3619,34 +3604,34 @@ JOURNAL FORMAT cleared complete, reconciled as far as possible, and considered cor- rect - With this scheme, you would use -PC to see the current balance at your + With this scheme, you would use -PC to see the current balance at your bank, -U to see things which will probably hit your bank soon (like un- - cashed checks), and no flags to see the most up-to-date state of your + cashed checks), and no flags to see the most up-to-date state of your finances. Description - A transaction's description is the rest of the line following the date - and status mark (or until a comment begins). Sometimes called the + A transaction's description is the rest of the line following the date + and status mark (or until a comment begins). Sometimes called the "narration" in traditional bookkeeping, it can be used for whatever you - wish, or left blank. Transaction descriptions can be queried, unlike + wish, or left blank. Transaction descriptions can be queried, unlike comments. Payee and note You can optionally include a | (pipe) character in descriptions to sub- divide the description into separate fields for payee/payer name on the left (up to the first |) and an additional note field on the right (af- - ter the first |). This may be worthwhile if you need to do more pre- + ter the first |). This may be worthwhile if you need to do more pre- cise querying and pivoting by payee or by note. Comments Lines in the journal beginning with a semicolon (;) or hash (#) or star - (*) are comments, and will be ignored. (Star comments cause org-mode - nodes to be ignored, allowing emacs users to fold and navigate their + (*) are comments, and will be ignored. (Star comments cause org-mode + nodes to be ignored, allowing emacs users to fold and navigate their journals with org-mode or orgstruct-mode.) - You can attach comments to a transaction by writing them after the de- + You can attach comments to a transaction by writing them after the de- scription and/or indented on the following lines (before the postings). - Similarly, you can attach comments to an individual posting by writing + Similarly, you can attach comments to an individual posting by writing them after the amount and/or indented on the following lines. Transac- tion and posting comments must begin with a semicolon (;). @@ -3670,24 +3655,24 @@ JOURNAL FORMAT ; another comment line for posting 2 ; a file comment (because not indented) - You can also comment larger regions of a file using comment and end + You can also comment larger regions of a file using comment and end comment directives. Tags - Tags are a way to add extra labels or labelled data to postings and + Tags are a way to add extra labels or labelled data to postings and transactions, which you can then search or pivot on. - A simple tag is a word (which may contain hyphens) followed by a full + A simple tag is a word (which may contain hyphens) followed by a full colon, written inside a transaction or posting comment line: 2017/1/16 bought groceries ; sometag: - Tags can have a value, which is the text after the colon, up to the + Tags can have a value, which is the text after the colon, up to the next comma or end of line, with leading/trailing whitespace removed: expenses:food $10 ; a-posting-tag: the tag value - Note this means hledger's tag values can not contain commas or new- + Note this means hledger's tag values can not contain commas or new- lines. Ending at commas means you can write multiple short tags on one line, comma separated: @@ -3701,57 +3686,57 @@ JOURNAL FORMAT o "tag2" is another tag, whose value is "some value ..." - Tags in a transaction comment affect the transaction and all of its - postings, while tags in a posting comment affect only that posting. - For example, the following transaction has three tags (A, TAG2, third- + Tags in a transaction comment affect the transaction and all of its + postings, while tags in a posting comment affect only that posting. + For example, the following transaction has three tags (A, TAG2, third- tag) and the posting has four (those plus posting-tag): 1/1 a transaction ; A:, TAG2: ; third-tag: a third transaction tag, <- with a value (a) $1 ; posting-tag: - Tags are like Ledger's metadata feature, except hledger's tag values + Tags are like Ledger's metadata feature, except hledger's tag values are simple strings. Postings - A posting is an addition of some amount to, or removal of some amount - from, an account. Each posting line begins with at least one space or + A posting is an addition of some amount to, or removal of some amount + from, an account. Each posting line begins with at least one space or tab (2 or 4 spaces is common), followed by: o (optional) a status character (empty, !, or *), followed by a space - o (required) an account name (any text, optionally containing single + o (required) an account name (any text, optionally containing single spaces, until end of line or a double space) o (optional) two or more spaces or tabs followed by an amount. - Positive amounts are being added to the account, negative amounts are + Positive amounts are being added to the account, negative amounts are being removed. The amounts within a transaction must always sum up to zero. As a con- - venience, one amount may be left blank; it will be inferred so as to + venience, one amount may be left blank; it will be inferred so as to balance the transaction. - Be sure to note the unusual two-space delimiter between account name - and amount. This makes it easy to write account names containing spa- - ces. But if you accidentally leave only one space (or tab) before the + Be sure to note the unusual two-space delimiter between account name + and amount. This makes it easy to write account names containing spa- + ces. But if you accidentally leave only one space (or tab) before the amount, the amount will be considered part of the account name. Virtual postings A posting with a parenthesised account name is called a virtual posting - or unbalanced posting, which means it is exempt from the usual rule + or unbalanced posting, which means it is exempt from the usual rule that a transaction's postings must balance add up to zero. - This is not part of double entry accounting, so you might choose to - avoid this feature. Or you can use it sparingly for certain special - cases where it can be convenient. Eg, you could set opening balances + This is not part of double entry accounting, so you might choose to + avoid this feature. Or you can use it sparingly for certain special + cases where it can be convenient. Eg, you could set opening balances without using a balancing equity account: 1/1 opening balances (assets:checking) $1000 (assets:savings) $2000 - A posting with a bracketed account name is called a balanced virtual + A posting with a bracketed account name is called a balanced virtual posting. The balanced virtual postings in a transaction must add up to zero (separately from other postings). Eg: @@ -3763,34 +3748,34 @@ JOURNAL FORMAT [assets:checking:available] $10 ; <- (something:else) $5 ; <- not required to balance - Ordinary non-parenthesised, non-bracketed postings are called real - postings. You can exclude virtual postings from reports with the + Ordinary non-parenthesised, non-bracketed postings are called real + postings. You can exclude virtual postings from reports with the -R/--real flag or real:1 query. Account names - Account names typically have several parts separated by a full colon, - from which hledger derives a hierarchical chart of accounts. They can - be anything you like, but in finance there are traditionally five top- + Account names typically have several parts separated by a full colon, + from which hledger derives a hierarchical chart of accounts. They can + be anything you like, but in finance there are traditionally five top- level accounts: assets, liabilities, income, expenses, and equity. - Account names may contain single spaces, eg: assets:accounts receiv- - able. Because of this, they must always be followed by two or more + Account names may contain single spaces, eg: assets:accounts receiv- + able. Because of this, they must always be followed by two or more spaces (or newline). Account names can be aliased. Amounts - After the account name, there is usually an amount. (Important: be- + After the account name, there is usually an amount. (Important: be- tween account name and amount, there must be two or more spaces.) - hledger's amount format is flexible, supporting several international - formats. Here are some examples. Amounts have a number (the "quan- + hledger's amount format is flexible, supporting several international + formats. Here are some examples. Amounts have a number (the "quan- tity"): 1 - ..and usually a currency or commodity name (the "commodity"). This is - a symbol, word, or phrase, to the left or right of the quantity, with + ..and usually a currency or commodity name (the "commodity"). This is + a symbol, word, or phrase, to the left or right of the quantity, with or without a separating space: $1 @@ -3802,13 +3787,13 @@ JOURNAL FORMAT 3 "no. 42 green apples" Amounts can be preceded by a minus sign (or a plus sign, though plus is - the default), The sign can be written before or after a left-side com- + the default), The sign can be written before or after a left-side com- modity symbol: -$1 $-1 - One or more spaces between the sign and the number are acceptable when + One or more spaces between the sign and the number are acceptable when parsing (but they won't be displayed in output): + $1 @@ -3825,8 +3810,8 @@ JOURNAL FORMAT 1,23456780000009 Digit group marks - In the integer part of the quantity (left of the decimal mark), groups - of digits can optionally be separated by a "digit group mark" - a + In the integer part of the quantity (left of the decimal mark), groups + of digits can optionally be separated by a "digit group mark" - a space, comma, or period (different from the decimal mark): $1,000,000.00 @@ -3834,7 +3819,7 @@ JOURNAL FORMAT INR 9,99,99,999.00 1 000 000.9455 - Note, a number containing a single group mark and no decimal mark is + Note, a number containing a single group mark and no decimal mark is ambiguous. Are these group marks or decimal marks ? 1,000 @@ -3842,9 +3827,9 @@ JOURNAL FORMAT hledger will treat them both as decimal marks by default (cf #793). If you use digit group marks, to prevent confusion and undetected typos we - recommend you write commodity directives at the top of the file to ex- - plicitly declare the decimal mark (and optionally a digit group mark). - Note, these formats ("amount styles") are specific to each commodity, + recommend you write commodity directives at the top of the file to ex- + plicitly declare the decimal mark (and optionally a digit group mark). + Note, these formats ("amount styles") are specific to each commodity, so if your data uses multiple formats, hledger can handle it: commodity $1,000.00 @@ -3854,43 +3839,43 @@ JOURNAL FORMAT Commodity display style For the amounts in each commodity, hledger chooses a consistent display - style. (Excluding price amounts, which are always displayed as writ- + style. (Excluding price amounts, which are always displayed as writ- ten). The display style is chosen as follows: - o If there is a commodity directive (or default commodity directive) + o If there is a commodity directive (or default commodity directive) for the commodity, its style is used (see examples above). - o Otherwise the style is inferred from the amounts in that commodity + o Otherwise the style is inferred from the amounts in that commodity seen in the journal. - o Or if there are no such amounts in the journal, a default style is + o Or if there are no such amounts in the journal, a default style is used (like $1000.00). A style is inferred from the journal amounts in a commodity as follows: - o Use the general style (decimal mark, symbol placement) of the first + o Use the general style (decimal mark, symbol placement) of the first amount - o Use the first-seen digit group style (digit group mark, digit group + o Use the first-seen digit group style (digit group mark, digit group sizes), if any o Use the maximum number of decimal places of all. - Transaction price amounts don't affect the commodity display style di- + Transaction price amounts don't affect the commodity display style di- rectly, but occasionally they can do so indirectly (eg when a posting's - amount is inferred using a transaction price). If you find this caus- + amount is inferred using a transaction price). If you find this caus- ing problems, use a commodity directive to fix the display style. In summary, each commodity's amounts will be normalised to o the style declared by a commodity directive - o or, the style of the first posting amount in the journal, with the - first-seen digit group style and the maximum-seen number of decimal + o or, the style of the first posting amount in the journal, with the + first-seen digit group style and the maximum-seen number of decimal places. So if your reports are showing amounts in a way you don't like, eg with - too many decimal places, use a commodity directive to set the commod- + too many decimal places, use a commodity directive to set the commod- ity's display style. For example: # declare euro, dollar and bitcoin commodities and set their display styles: @@ -3900,17 +3885,17 @@ JOURNAL FORMAT Rounding Amounts are stored internally as decimal numbers with up to 255 decimal - places, and displayed with the number of decimal places specified by - the commodity display style. Note, hledger uses banker's rounding: it - rounds to the nearest even number, eg 0.5 displayed with zero decimal - places is "0"). (Guaranteed since hledger 1.17.1; in older versions + places, and displayed with the number of decimal places specified by + the commodity display style. Note, hledger uses banker's rounding: it + rounds to the nearest even number, eg 0.5 displayed with zero decimal + places is "0"). (Guaranteed since hledger 1.17.1; in older versions this could vary if hledger was built with Decimal < 0.5.1.) Transaction prices Within a transaction, you can note an amount's price in another commod- - ity. This can be used to document the cost (in a purchase) or selling - price (in a sale). For example, transaction prices are useful to - record purchases of a foreign currency. Note transaction prices are + ity. This can be used to document the cost (in a purchase) or selling + price (in a sale). For example, transaction prices are useful to + record purchases of a foreign currency. Note transaction prices are fixed at the time of the transaction, and do not change over time. See also market prices, which represent prevailing exchange rates on a cer- tain date. @@ -3936,14 +3921,14 @@ JOURNAL FORMAT assets:euros EUR100 ; one hundred euros purchased assets:dollars $-135 ; for $135 - 4. Like 1, but the @ is parenthesised, i.e. (@); this is for compati- - bility with Ledger journals (Virtual posting costs), and is equiva- + 4. Like 1, but the @ is parenthesised, i.e. (@); this is for compati- + bility with Ledger journals (Virtual posting costs), and is equiva- lent to 1 in hledger. 5. Like 2, but as in 4 the @@ is parenthesised, i.e. (@@); in hledger, this is equivalent to 2. - Use the -B/--cost flag to convert amounts to their transaction price's + Use the -B/--cost flag to convert amounts to their transaction price's commodity, if any. (mnemonic: "B" is from "cost Basis", as in Ledger). Eg here is how -B affects the balance report for the example above: @@ -3954,8 +3939,8 @@ JOURNAL FORMAT $-135 assets:dollars $135 assets:euros # <- the euros' cost - Note -B is sensitive to the order of postings when a transaction price - is inferred: the inferred price will be in the commodity of the last + Note -B is sensitive to the order of postings when a transaction price + is inferred: the inferred price will be in the commodity of the last amount. So if example 3's postings are reversed, while the transaction is equivalent, -B shows something different: @@ -3968,18 +3953,18 @@ JOURNAL FORMAT EUR100 assets:euros Lot prices, lot dates - Ledger allows another kind of price, lot price (four variants: {UNIT- + Ledger allows another kind of price, lot price (four variants: {UNIT- PRICE}, {{TOTALPRICE}}, {=FIXEDUNITPRICE}, {{=FIXEDTOTALPRICE}}), and/or a lot date ([DATE]) to be specified. These are normally used to - select a lot when selling investments. hledger will parse these, for - compatibility with Ledger journals, but currently ignores them. A - transaction price, lot price and/or lot date may appear in any order, + select a lot when selling investments. hledger will parse these, for + compatibility with Ledger journals, but currently ignores them. A + transaction price, lot price and/or lot date may appear in any order, after the posting amount and before the balance assertion if any. Balance assertions - hledger supports Ledger-style balance assertions in journal files. - These look like, for example, = EXPECTEDBALANCE following a posting's - amount. Eg here we assert the expected dollar balance in accounts a + hledger supports Ledger-style balance assertions in journal files. + These look like, for example, = EXPECTEDBALANCE following a posting's + amount. Eg here we assert the expected dollar balance in accounts a and b after each posting: 2013/1/1 @@ -3991,32 +3976,32 @@ JOURNAL FORMAT b $-1 =$-2 After reading a journal file, hledger will check all balance assertions - and report an error if any of them fail. Balance assertions can pro- - tect you from, eg, inadvertently disrupting reconciled balances while - cleaning up old entries. You can disable them temporarily with the + and report an error if any of them fail. Balance assertions can pro- + tect you from, eg, inadvertently disrupting reconciled balances while + cleaning up old entries. You can disable them temporarily with the -I/--ignore-assertions flag, which can be useful for troubleshooting or - for reading Ledger files. (Note: this flag currently does not disable + for reading Ledger files. (Note: this flag currently does not disable balance assignments, below). Assertions and ordering - hledger sorts an account's postings and assertions first by date and - then (for postings on the same day) by parse order. Note this is dif- + hledger sorts an account's postings and assertions first by date and + then (for postings on the same day) by parse order. Note this is dif- ferent from Ledger, which sorts assertions only by parse order. (Also, - Ledger assertions do not see the accumulated effect of repeated post- + Ledger assertions do not see the accumulated effect of repeated post- ings to the same account within a transaction.) So, hledger balance assertions keep working if you reorder differently- - dated transactions within the journal. But if you reorder same-dated - transactions or postings, assertions might break and require updating. + dated transactions within the journal. But if you reorder same-dated + transactions or postings, assertions might break and require updating. This order dependence does bring an advantage: precise control over the order of postings and assertions within a day, so you can assert intra- day balances. Assertions and included files - With included files, things are a little more complicated. Including - preserves the ordering of postings and assertions. If you have multi- - ple postings to an account on the same day, split across different - files, and you also want to assert the account's balance on the same + With included files, things are a little more complicated. Including + preserves the ordering of postings and assertions. If you have multi- + ple postings to an account on the same day, split across different + files, and you also want to assert the account's balance on the same day, you'll have to put the assertion in the right file. Assertions and multiple -f options @@ -4024,15 +4009,15 @@ JOURNAL FORMAT -f options. Use include or concatenate the files instead. Assertions and commodities - The asserted balance must be a simple single-commodity amount, and in - fact the assertion checks only this commodity's balance within the - (possibly multi-commodity) account balance. This is how assertions + The asserted balance must be a simple single-commodity amount, and in + fact the assertion checks only this commodity's balance within the + (possibly multi-commodity) account balance. This is how assertions work in Ledger also. We could call this a "partial" balance assertion. To assert the balance of more than one commodity in an account, you can write multiple postings, each asserting one commodity's balance. - You can make a stronger "total" balance assertion by writing a double + You can make a stronger "total" balance assertion by writing a double equals sign (== EXPECTEDBALANCE). This asserts that there are no other unasserted commodities in the account (or, that their balance is 0). @@ -4052,7 +4037,7 @@ JOURNAL FORMAT a 0 == $1 It's not yet possible to make a complete assertion about a balance that - has multiple commodities. One workaround is to isolate each commodity + has multiple commodities. One workaround is to isolate each commodity into its own subaccount: 2013/1/1 @@ -4066,21 +4051,21 @@ JOURNAL FORMAT a:euro 0 == 1EUR Assertions and prices - Balance assertions ignore transaction prices, and should normally be + Balance assertions ignore transaction prices, and should normally be written without one: 2019/1/1 (a) $1 @ EUR1 = $1 - We do allow prices to be written there, however, and print shows them, - even though they don't affect whether the assertion passes or fails. - This is for backward compatibility (hledger's close command used to - generate balance assertions with prices), and because balance assign- + We do allow prices to be written there, however, and print shows them, + even though they don't affect whether the assertion passes or fails. + This is for backward compatibility (hledger's close command used to + generate balance assertions with prices), and because balance assign- ments do use them (see below). Assertions and subaccounts - The balance assertions above (= and ==) do not count the balance from - subaccounts; they check the account's exclusive balance only. You can + The balance assertions above (= and ==) do not count the balance from + subaccounts; they check the account's exclusive balance only. You can assert the balance including subaccounts by writing =* or ==*, eg: 2019/1/1 @@ -4094,16 +4079,16 @@ JOURNAL FORMAT tual. They are not affected by the --real/-R flag or real: query. Assertions and precision - Balance assertions compare the exactly calculated amounts, which are - not always what is shown by reports. Eg a commodity directive may - limit the display precision, but this will not affect balance asser- + Balance assertions compare the exactly calculated amounts, which are + not always what is shown by reports. Eg a commodity directive may + limit the display precision, but this will not affect balance asser- tions. Balance assertion failure messages show exact amounts. Balance assignments - Ledger-style balance assignments are also supported. These are like - balance assertions, but with no posting amount on the left side of the - equals sign; instead it is calculated automatically so as to satisfy - the assertion. This can be a convenience during data entry, eg when + Ledger-style balance assignments are also supported. These are like + balance assertions, but with no posting amount on the left side of the + equals sign; instead it is calculated automatically so as to satisfy + the assertion. This can be a convenience during data entry, eg when setting opening balances: ; starting a new journal, set asset account balances @@ -4121,14 +4106,14 @@ JOURNAL FORMAT expenses:misc The calculated amount depends on the account's balance in the commodity - at that point (which depends on the previously-dated postings of the - commodity to that account since the last balance assertion or assign- + at that point (which depends on the previously-dated postings of the + commodity to that account since the last balance assertion or assign- ment). Note that using balance assignments makes your journal a little less explicit; to know the exact amount posted, you have to run hledger or do the calculations yourself, instead of just reading it. Balance assignments and prices - A transaction price in a balance assignment will cause the calculated + A transaction price in a balance assignment will cause the calculated amount to have that price attached: 2019/1/1 @@ -4139,81 +4124,81 @@ JOURNAL FORMAT (a) $1 @ EUR2 = $1 @ EUR2 Directives - A directive is a line in the journal beginning with a special keyword, + A directive is a line in the journal beginning with a special keyword, that influences how the journal is processed. hledger's directives are based on a subset of Ledger's, but there are many differences (and also some differences between hledger versions). Directives' behaviour and interactions can get a little bit complex, so - here is a table summarising the directives and their effects, with - links to more detailed docs. Note part of this table is hidden when + here is a table summarising the directives and their effects, with + links to more detailed docs. Note part of this table is hidden when viewed in a web browser - scroll it sideways to see more. - direc- end di- subdi- purpose can affect (as of + direc- end di- subdi- purpose can affect (as of tive rective rec- 2018/06) tives ------------------------------------------------------------------------------------ - account any document account names, de- all entries in all - text clare account types & dis- files, before or + account any document account names, de- all entries in all + text clare account types & dis- files, before or play order after alias end rewrite account names following entries - aliases until end of cur- + aliases until end of cur- rent file or end directive - apply end apply prepend a common parent to following entries - account account account names until end of cur- + apply end apply prepend a common parent to following entries + account account account names until end of cur- rent file or end directive comment end com- ignore part of journal following entries - ment until end of cur- + ment until end of cur- rent file or end directive - commod- format declare a commodity and its number notation: + commod- format declare a commodity and its number notation: ity number notation & display following entries style in that commodity in all files ; dis- play style: amounts of that commodity in reports - D declare a commodity to be default commodity: + D declare a commodity to be default commodity: used for commodityless following commod- - amounts, and its number no- ityless entries un- - tation & display style til end of current - file; number nota- + amounts, and its number no- ityless entries un- + tation & display style til end of current + file; number nota- tion: following en- - tries in that com- + tries in that com- modity until end of - current file; dis- + current file; dis- play style: amounts of that commodity in reports include include entries/directives what the included from another file directives affect P declare a market price for a amounts of that - commodity commodity in re- - ports, when -V is + commodity commodity in re- + ports, when -V is used - Y declare a year for yearless following entries - dates until end of cur- + Y declare a year for yearless following entries + dates until end of cur- rent file - = declare an auto posting all entries in par- - rule, adding postings to ent/current/child + = declare an auto posting all entries in par- + rule, adding postings to ent/current/child other transactions files (but not sib- ling files, see #1212) And some definitions: - subdi- optional indented directive line immediately following a parent + subdi- optional indented directive line immediately following a parent rec- directive tive number how to interpret numbers when parsing journal entries (the iden- - nota- tity of the decimal separator character). (Currently each com- + nota- tity of the decimal separator character). (Currently each com- tion modity can have its own notation, even in the same file.) - dis- how to display amounts of a commodity in reports (symbol side + dis- how to display amounts of a commodity in reports (symbol side play and spacing, digit groups, decimal separator, decimal places) style - direc- which entries and (when there are multiple files) which files + direc- which entries and (when there are multiple files) which files tive are affected by a directive scope @@ -4222,35 +4207,35 @@ JOURNAL FORMAT ports). Some directives have multiple effects. Directives and multiple files - If you use multiple -f/--file options, or the include directive, - hledger will process multiple input files. But note that directives + If you use multiple -f/--file options, or the include directive, + hledger will process multiple input files. But note that directives which affect input (see above) typically last only until the end of the file in which they occur. This may seem inconvenient, but it's intentional; it makes reports sta- - ble and deterministic, independent of the order of input. Otherwise - you could see different numbers if you happened to write -f options in - a different order, or if you moved includes around while cleaning up + ble and deterministic, independent of the order of input. Otherwise + you could see different numbers if you happened to write -f options in + a different order, or if you moved includes around while cleaning up your files. - It can be surprising though; for example, it means that alias direc- + It can be surprising though; for example, it means that alias direc- tives do not affect parent or sibling files (see below). Comment blocks - A line containing just comment starts a commented region of the file, + A line containing just comment starts a commented region of the file, and a line containing just end comment (or the end of the current file) ends it. See also comments. Including other files - You can pull in the content of additional files by writing an include + You can pull in the content of additional files by writing an include directive, like this: include FILEPATH - Only journal files can include, and only journal, timeclock or timedot + Only journal files can include, and only journal, timeclock or timedot files can be included (not CSV files, currently). - If the file path does not begin with a slash, it is relative to the + If the file path does not begin with a slash, it is relative to the current file's folder. A tilde means home directory, eg: include ~/main.journal. @@ -4259,17 +4244,17 @@ JOURNAL FORMAT *.journal. There is limited support for recursive wildcards: **/ (the slash is re- - quired) matches 0 or more subdirectories. It's not super convenient - since you have to avoid include cycles and including directories, but + quired) matches 0 or more subdirectories. It's not super convenient + since you have to avoid include cycles and including directories, but this can be done, eg: include */**/*.journal. The path may also be prefixed to force a specific file format, overrid- - ing the file extension (as described in hledger.1 -> Input files): in- + ing the file extension (as described in hledger.1 -> Input files): in- clude timedot:~/notes/2020*.md. Default year - You can set a default year to be used for subsequent dates which don't - specify a year. This is a line beginning with Y followed by the year. + You can set a default year to be used for subsequent dates which don't + specify a year. This is a line beginning with Y followed by the year. Eg: Y2009 ; set default year to 2009 @@ -4291,19 +4276,19 @@ JOURNAL FORMAT Declaring commodities The commodity directive has several functions: - 1. It declares commodities which may be used in the journal. This is + 1. It declares commodities which may be used in the journal. This is currently not enforced, but can serve as documentation. - 2. It declares what decimal mark character (period or comma) to expect - when parsing input - useful to disambiguate international number - formats in your data. (Without this, hledger will parse both 1,000 + 2. It declares what decimal mark character (period or comma) to expect + when parsing input - useful to disambiguate international number + formats in your data. (Without this, hledger will parse both 1,000 and 1.000 as 1). - 3. It declares a commodity's display style in output - decimal and + 3. It declares a commodity's display style in output - decimal and digit group marks, number of decimal places, symbol placement etc. - You are likely to run into one of the problems solved by commodity di- - rectives, sooner or later, so it's a good idea to just always use them + You are likely to run into one of the problems solved by commodity di- + rectives, sooner or later, so it's a good idea to just always use them to declare your commodities. A commodity directive is just the word commodity followed by an amount. @@ -4316,8 +4301,8 @@ JOURNAL FORMAT ; separating thousands with comma. commodity 1,000.0000 AAAA - or on multiple lines, using the "format" subdirective. (In this case - the commodity symbol appears twice and should be the same in both + or on multiple lines, using the "format" subdirective. (In this case + the commodity symbol appears twice and should be the same in both places.): ; commodity SYMBOL @@ -4330,28 +4315,28 @@ JOURNAL FORMAT format INR 1,00,00,000.00 The quantity of the amount does not matter; only the format is signifi- - cant. The number must include a decimal mark: either a period or a + cant. The number must include a decimal mark: either a period or a comma, followed by 0 or more decimal digits. - Note hledger normally uses banker's rounding, so 0.5 displayed with + Note hledger normally uses banker's rounding, so 0.5 displayed with zero decimal digits is "0". (More at Commodity display style.) Commodity error checking - In strict mode, enabled with the -s/--strict flag, hledger will report - an error if a commodity symbol is used that has not been declared by a - commodity directive. This works similarly to account error checking, + In strict mode, enabled with the -s/--strict flag, hledger will report + an error if a commodity symbol is used that has not been declared by a + commodity directive. This works similarly to account error checking, see the notes there for more details. Default commodity - The D directive sets a default commodity, to be used for amounts with- + The D directive sets a default commodity, to be used for amounts with- out a commodity symbol (ie, plain numbers). This commodity will be ap- plied to all subsequent commodity-less amounts, or until the next D di- rective. (Note, this is different from Ledger's D.) - For compatibility/historical reasons, D also acts like a commodity di- + For compatibility/historical reasons, D also acts like a commodity di- rective, setting the commodity's display style (for output) and decimal mark (for parsing input). As with commodity, the amount must always be - written with a decimal mark (period or comma). If both directives are + written with a decimal mark (period or comma). If both directives are used, commodity's style takes precedence. The syntax is D AMOUNT. Eg: @@ -4365,9 +4350,9 @@ JOURNAL FORMAT b Declaring market prices - The P directive declares a market price, which is an exchange rate be- - tween two commodities on a certain date. (In Ledger, they are called - "historical prices".) These are often obtained from a stock exchange, + The P directive declares a market price, which is an exchange rate be- + tween two commodities on a certain date. (In Ledger, they are called + "historical prices".) These are often obtained from a stock exchange, cryptocurrency exchange, or the foreign exchange market. Here is the format: @@ -4378,78 +4363,78 @@ JOURNAL FORMAT o COMMODITYA is the symbol of the commodity being priced - o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com- + o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com- modity, giving the price in commodity B of one unit of commodity A. - These two market price directives say that one euro was worth 1.35 US + These two market price directives say that one euro was worth 1.35 US dollars during 2009, and $1.40 from 2010 onward: P 2009/1/1 EUR $1.35 P 2010/1/1 EUR $1.40 - The -V, -X and --value flags use these market prices to show amount + The -V, -X and --value flags use these market prices to show amount values in another commodity. See Valuation. Declaring accounts account directives can be used to declare accounts (ie, the places that - amounts are transferred from and to). Though not required, these dec- + 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 help hledger know your accounts' types (asset, liability, - equity, revenue, expense), useful for reports like balancesheet and + o They can help hledger know your accounts' types (asset, liability, + equity, revenue, expense), useful for reports like balancesheet and incomestatement. - o They control account display order in reports, allowing non-alpha- + o They control account display order in reports, allowing non-alpha- betic sorting (eg Revenues to appear above Expenses). - o They can store extra information about accounts (account numbers, + o They can store extra information about accounts (account numbers, notes, etc.) - o They help with account name completion in the add command, hledger- + o They help with account name completion in the add command, hledger- iadd, hledger-web, ledger-mode etc. - o In strict mode, they restrict which accounts may be posted to by + 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 + The simplest form is just the word account followed by a hledger-style account name, eg this account directive declares the assets:bank:check- ing account: account assets:bank:checking Account error checking - By default, accounts come into existence when a transaction references - them by name. This is convenient, but it means hledger can't warn you + By default, accounts come into existence when a transaction references + them by name. This is convenient, but it means hledger can't warn you when you mis-spell an account name in the journal. Usually you'll find - the error later, as an extra account in balance reports, or an incor- + the error later, as an extra account in balance reports, or an incor- rect balance when reconciling. - In strict mode, enabled with the -s/--strict flag, hledger will report - an error if any transaction uses an account name that has not been de- + In strict mode, enabled with the -s/--strict flag, hledger will report + an error if any transaction uses an account name that has not been de- clared by an account directive. Some notes: - o The declaration is case-sensitive; transactions must use the correct + 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- + 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 + 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- + 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" + 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 @@ -4463,7 +4448,7 @@ JOURNAL 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 @@ -4482,21 +4467,21 @@ JOURNAL 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 @@ -4508,8 +4493,8 @@ JOURNAL 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: @@ -4522,7 +4507,7 @@ JOURNAL 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 @@ -4532,9 +4517,9 @@ JOURNAL 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: @@ -4546,8 +4531,8 @@ JOURNAL 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 @@ -4557,8 +4542,8 @@ JOURNAL 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: @@ -4580,20 +4565,20 @@ JOURNAL 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 @@ -4611,14 +4596,14 @@ JOURNAL 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 @@ -4626,49 +4611,49 @@ JOURNAL 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: @@ -4679,20 +4664,20 @@ JOURNAL 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 @@ -4714,14 +4699,14 @@ JOURNAL 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 @@ -4738,7 +4723,7 @@ JOURNAL 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 @@ -4747,49 +4732,49 @@ JOURNAL 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, + 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. - 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 transaction rules also have a second meaning: they are used to @@ -4804,17 +4789,17 @@ JOURNAL 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: @@ -4828,67 +4813,67 @@ JOURNAL 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: @@ -4898,27 +4883,27 @@ JOURNAL 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' @@ -4957,24 +4942,24 @@ JOURNAL 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. @@ -4984,11 +4969,11 @@ JOURNAL 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 @@ -4999,20 +4984,20 @@ JOURNAL FORMAT CSV FORMAT How hledger reads CSV data, and the CSV rules file format. - hledger can read CSV files (Character Separated Value - usually comma, - semicolon, or tab) containing dated records as if they were journal + hledger can read CSV files (Character Separated Value - usually comma, + semicolon, or tab) containing dated records as if they were journal files, automatically converting each CSV record into a transaction. (To learn about writing CSV, see CSV output.) We describe each CSV file's format with a corresponding rules file. By - default this is named like the CSV file with a .rules extension added. - Eg when reading FILE.csv, hledger also looks for FILE.csv.rules in the - same directory as FILE.csv. You can specify a different rules file - with the --rules-file option. If a rules file is not found, hledger + default this is named like the CSV file with a .rules extension added. + Eg when reading FILE.csv, hledger also looks for FILE.csv.rules in the + same directory as FILE.csv. You can specify a different rules file + with the --rules-file option. If a rules file is not found, hledger will create a sample rules file, which you'll need to adjust. - This file contains rules describing the CSV data (header line, fields + This file contains rules describing the CSV data (header line, fields layout, date format etc.), and how to construct hledger journal entries (transactions) from it. Often there will also be a list of conditional rules for categorising transactions based on their descriptions. @@ -5021,38 +5006,38 @@ CSV FORMAT skip skip one or more header lines or matched CSV records - fields name CSV fields, assign them to hledger + fields name CSV fields, assign them to hledger fields - field assignment assign a value to one hledger field, + field assignment assign a value to one hledger field, with interpolation separator a custom field separator - if block apply some rules to CSV records matched + if block apply some rules to CSV records matched by patterns - if table apply some rules to CSV records matched + if table apply some rules to CSV records matched by patterns, alternate syntax end skip the remaining CSV records date-format how to parse dates in CSV records decimal-mark the decimal mark used in CSV amounts, if ambiguous - newest-first disambiguate record order when there's + newest-first disambiguate record order when there's only one date include inline another CSV rules file balance-type choose which type of balance assignments to use - Note, for best error messages when reading CSV files, use a .csv, .tsv + Note, for best error messages when reading CSV files, use a .csv, .tsv or .ssv file extension or file prefix - see File Extension below. There's an introductory Convert CSV files tutorial on hledger.org. Examples - Here are some sample hledger CSV rules files. See also the full col- + Here are some sample hledger CSV rules files. See also the full col- lection at: https://github.com/simonmichael/hledger/tree/master/examples/csv Basic - At minimum, the rules file must identify the date and amount fields, - and often it also specifies the date format and how many header lines + At minimum, the rules file must identify the date and amount fields, + and often it also specifies the date format and how many header lines there are. Here's a simple CSV file and a rules file for it: Date, Description, Id, Amount @@ -5071,8 +5056,8 @@ CSV FORMAT Default account names are chosen, since we didn't set them. Bank of Ireland - Here's a CSV with two amount fields (Debit and Credit), and a balance - field, which we can use to add balance assertions, which is not neces- + Here's a CSV with two amount fields (Debit and Credit), and a balance + field, which we can use to add balance assertions, which is not neces- sary but provides extra error checking: Date,Details,Debit,Credit,Balance @@ -5114,13 +5099,13 @@ CSV FORMAT assets:bank:boi:checking EUR-5.0 = EUR126.0 expenses:unknown EUR5.0 - The balance assertions don't raise an error above, because we're read- - ing directly from CSV, but they will be checked if these entries are + The balance assertions don't raise an error above, because we're read- + ing directly from CSV, but they will be checked if these entries are imported into a journal file. Amazon Here we convert amazon.com order history, and use an if block to gener- - ate a third posting if there's a fee. (In practice you'd probably get + ate a third posting if there's a fee. (In practice you'd probably get this data from your bank instead, but it's an example.) "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID" @@ -5172,7 +5157,7 @@ CSV FORMAT expenses:fees $1.00 Paypal - Here's a real-world rules file for (customised) Paypal CSV, with some + Here's a real-world rules file for (customised) Paypal CSV, with some Paypal-specific rules, and a second rules file included: "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note" @@ -5327,9 +5312,9 @@ CSV FORMAT skip skip N - The word "skip" followed by a number (or no number, meaning 1) tells - hledger to ignore this many non-empty lines preceding the CSV data. - (Empty/blank lines are skipped automatically.) You'll need this when- + The word "skip" followed by a number (or no number, meaning 1) tells + hledger to ignore this many non-empty lines preceding the CSV data. + (Empty/blank lines are skipped automatically.) You'll need this when- ever your CSV data contains header lines. It also has a second purpose: it can be used inside if blocks to ignore @@ -5338,27 +5323,27 @@ CSV FORMAT fields fields FIELDNAME1, FIELDNAME2, ... - A fields list (the word "fields" followed by comma-separated field - names) is the quick way to assign CSV field values to hledger fields. + A fields list (the word "fields" followed by comma-separated field + names) is the quick way to assign CSV field values to hledger fields. It does two things: - 1. it names the CSV fields. This is optional, but can be convenient + 1. it names the CSV fields. This is optional, but can be convenient later for interpolating them. 2. when you use a standard hledger field name, it assigns the CSV value to that part of the hledger transaction. - Here's an example that says "use the 1st, 2nd and 4th fields as the - transaction's date, description and amount; name the last two fields + Here's an example that says "use the 1st, 2nd and 4th fields as the + transaction's date, description and amount; name the last two fields for later reference; and ignore the others": fields date, description, , amount, , , somefield, anotherfield - Field names may not contain whitespace. Fields you don't care about - can be left unnamed. Currently there must be least two items (there + Field names may not contain whitespace. Fields you don't care about + can be left unnamed. Currently there must be least two items (there must be at least one comma). - Note, always use comma in the fields list, even if your CSV uses an- + Note, always use comma in the fields list, even if your CSV uses an- other separator character. Here are the standard hledger field/pseudo-field names. For more about @@ -5371,52 +5356,52 @@ CSV FORMAT Posting field names account - accountN, where N is 1 to 99, causes a posting to be generated, with + accountN, where N is 1 to 99, causes a posting to be generated, with that account name. - Most often there are two postings, so you'll want to set account1 and - account2. Typically account1 is associated with the CSV file, and is - set once with a top-level assignment, while account2 is set based on + Most often there are two postings, so you'll want to set account1 and + account2. Typically account1 is associated with the CSV file, and is + set once with a top-level assignment, while account2 is set based on each transaction's description, and in conditional blocks. - If a posting's account name is left unset but its amount is set (see - below), a default account name will be chosen (like "expenses:unknown" + If a posting's account name is left unset but its amount is set (see + below), a default account name will be chosen (like "expenses:unknown" or "income:unknown"). amount - amountN sets posting N's amount. If the CSV uses separate fields for - inflows and outflows, you can use amountN-in and amountN-out instead. - By assigning to amount1, amount2, ... etc. you can generate anywhere + amountN sets posting N's amount. If the CSV uses separate fields for + inflows and outflows, you can use amountN-in and amountN-out instead. + By assigning to amount1, amount2, ... etc. you can generate anywhere from 0 to 99 postings. - There is also an older, unnumbered form of these names, suitable for + There is also an older, unnumbered form of these names, suitable for 2-posting transactions, which sets both posting 1's and (negated) post- - ing 2's amount: amount, or amount-in and amount-out. This is still - supported because it keeps pre-hledger-1.17 csv rules files working, - and because it can be more succinct, and because it converts posting + ing 2's amount: amount, or amount-in and amount-out. This is still + supported because it keeps pre-hledger-1.17 csv rules files working, + and because it can be more succinct, and because it converts posting 2's amount to cost if there's a transaction price, which can be useful. If you have an existing rules file using the unnumbered form, you might - want to use the numbered form in certain conditional blocks, without - having to update and retest all the old rules. To facilitate this, - posting 1 ignores amount/amount-in/amount-out if any of + want to use the numbered form in certain conditional blocks, without + having to update and retest all the old rules. To facilitate this, + posting 1 ignores amount/amount-in/amount-out if any of amount1/amount1-in/amount1-out are assigned, and posting 2 ignores them - if any of amount2/amount2-in/amount2-out are assigned, avoiding con- + if any of amount2/amount2-in/amount2-out are assigned, avoiding con- flicts. currency If the CSV has the currency symbol in a separate field (ie, not part of - the amount field), you can use currencyN to prepend it to posting N's + the amount field), you can use currencyN to prepend it to posting N's amount. Or, currency with no number affects all postings. balance - balanceN sets a balance assertion amount (or if the posting amount is + balanceN sets a balance assertion amount (or if the posting amount is left empty, a balance assignment) on posting N. - Also, for compatibility with hledger <1.17: balance with no number is + Also, for compatibility with hledger <1.17: balance with no number is equivalent to balance1. - You can adjust the type of assertion/assignment with the balance-type + You can adjust the type of assertion/assignment with the balance-type rule (see below). comment @@ -5428,11 +5413,11 @@ CSV FORMAT field assignment HLEDGERFIELDNAME FIELDVALUE - Instead of or in addition to a fields list, you can use a "field as- - signment" rule to set the value of a single hledger field, by writing - its name (any of the standard hledger field names above) followed by a - text value. The value may contain interpolated CSV fields, referenced - by their 1-based position in the CSV record (%N), or by the name they + Instead of or in addition to a fields list, you can use a "field as- + signment" rule to set the value of a single hledger field, by writing + its name (any of the standard hledger field names above) followed by a + text value. The value may contain interpolated CSV fields, referenced + by their 1-based position in the CSV record (%N), or by the name they were given in the fields list (%CSVFIELDNAME). Some examples: # set the amount to the 4th CSV field, with " USD" appended @@ -5441,14 +5426,14 @@ CSV FORMAT # combine three fields to make a comment, containing note: and date: tags comment note: %somefield - %anotherfield, date: %1 - Interpolation strips outer whitespace (so a CSV value like " 1 " be- + Interpolation strips outer whitespace (so a CSV value like " 1 " be- comes 1 when interpolated) (#1051). See TIPS below for more about ref- erencing other fields. separator - You can use the separator rule to read other kinds of character-sepa- - rated data. The argument is any single separator character, or the - words tab or space (case insensitive). Eg, for comma-separated values + You can use the separator rule to read other kinds of character-sepa- + rated data. The argument is any single separator character, or the + words tab or space (case insensitive). Eg, for comma-separated values (CSV): separator , @@ -5461,7 +5446,7 @@ CSV FORMAT separator TAB - If the input file has a .csv, .ssv or .tsv file extension (or a csv:, + If the input file has a .csv, .ssv or .tsv file extension (or a csv:, ssv:, tsv: prefix), the appropriate separator will be inferred automat- ically, and you won't need this rule. @@ -5476,8 +5461,8 @@ CSV FORMAT RULE RULE - Conditional blocks ("if blocks") are a block of rules that are applied - only to CSV records which match certain patterns. They are often used + Conditional blocks ("if blocks") are a block of rules that are applied + only to CSV records which match certain patterns. They are often used for customising account names based on transaction descriptions. Matching the whole record @@ -5485,16 +5470,16 @@ CSV FORMAT REGEX - REGEX is a case-insensitive regular expression which tries to match - anywhere within the CSV record. It is a POSIX ERE (extended regular - expression) that also supports GNU word boundaries (\b, \B, \<, \>), + REGEX is a case-insensitive regular expression which tries to match + anywhere within the CSV record. It is a POSIX ERE (extended regular + expression) that also supports GNU word boundaries (\b, \B, \<, \>), and nothing else. If you have trouble, be sure to check our https://hledger.org/hledger.html#regular-expressions doc. - Important note: the record that is matched is not the original record, - but a synthetic one, with any enclosing double quotes (but not enclos- + Important note: the record that is matched is not the original record, + but a synthetic one, with any enclosing double quotes (but not enclos- ing whitespace) removed, and always comma-separated (which means that a - field containing a comma will appear like two fields). Eg, if the + field containing a comma will appear like two fields). Eg, if the original record is 2020-01-01; "Acme, Inc."; 1,000, the REGEX will ac- tually see 2020-01-01,Acme, Inc., 1,000). @@ -5503,14 +5488,14 @@ CSV FORMAT %CSVFIELD REGEX - which matches just the content of a particular CSV field. CSVFIELD is - a percent sign followed by the field's name or column number, like + which matches just the content of a particular CSV field. CSVFIELD is + a percent sign followed by the field's name or column number, like %date or %1. Combining matchers A single matcher can be written on the same line as the "if"; or multi- ple matchers can be written on the following lines, non-indented. Mul- - tiple matchers are OR'd (any one of them can match), unless one begins + tiple matchers are OR'd (any one of them can match), unless one begins with an & symbol, in which case it is AND'ed with the previous matcher. if @@ -5519,8 +5504,8 @@ CSV FORMAT RULE Rules applied on successful match - After the patterns there should be one or more rules to apply, all in- - dented by at least one space. Three kinds of rule are allowed in con- + After the patterns there should be one or more rules to apply, all in- + dented by at least one space. Three kinds of rule are allowed in con- ditional blocks: o field assignments (to set a hledger field) @@ -5550,11 +5535,11 @@ CSV FORMAT MATCHER3,VALUE31,VALUE32,...,VALUE3n - Conditional tables ("if tables") are a different syntax to specify - field assignments that will be applied only to CSV records which match + Conditional tables ("if tables") are a different syntax to specify + field assignments that will be applied only to CSV records which match certain patterns. - MATCHER could be either field or record matcher, as described above. + MATCHER could be either field or record matcher, as described above. When MATCHER matches, values from that row would be assigned to the CSV fields named on the if line, in the same order. @@ -5578,17 +5563,17 @@ CSV FORMAT ... CSVFIELDNAMEn VALUE3n - Each line starting with MATCHER should contain enough (possibly empty) + Each line starting with MATCHER should contain enough (possibly empty) values for all the listed fields. - Rules would be checked and applied in the order they are listed in the + Rules would be checked and applied in the order they are listed in the table and, like with if blocks, later rules (in the same or another ta- ble) or if blocks could override the effect of any rule. - Instead of ',' you can use a variety of other non-alphanumeric charac- + Instead of ',' you can use a variety of other non-alphanumeric charac- ters as a separator. First character after if is taken to be the sepa- - rator for the rest of the table. It is the responsibility of the user - to ensure that separator does not occur inside MATCHERs and values - + rator for the rest of the table. It is the responsibility of the user + to ensure that separator does not occur inside MATCHERs and values - there is no way to escape separator. Example: @@ -5599,7 +5584,7 @@ CSV FORMAT 2020/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call-out end - This rule can be used inside if blocks (only), to make hledger stop + This rule can be used inside if blocks (only), to make hledger stop reading this CSV file and move on to the next input file, or to command execution. Eg: @@ -5610,10 +5595,10 @@ CSV FORMAT date-format date-format DATEFMT - This is a helper for the date (and date2) fields. If your CSV dates - are not formatted like YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll - need to add a date-format rule describing them with a strptime date - parsing pattern, which must parse the CSV date value completely. Some + This is a helper for the date (and date2) fields. If your CSV dates + are not formatted like YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll + need to add a date-format rule describing them with a strptime date + parsing pattern, which must parse the CSV date value completely. Some examples: # MM/DD/YY @@ -5641,22 +5626,22 @@ CSV FORMAT decimal-mark , - hledger automatically accepts either period or comma as a decimal mark - when parsing numbers (cf Amounts). However if any numbers in the CSV - contain digit group marks, such as thousand-separating commas, you - should declare the decimal mark explicitly with this rule, to avoid + hledger automatically accepts either period or comma as a decimal mark + when parsing numbers (cf Amounts). However if any numbers in the CSV + contain digit group marks, such as thousand-separating commas, you + should declare the decimal mark explicitly with this rule, to avoid misparsed numbers. newest-first - hledger always sorts the generated transactions by date. Transactions - on the same date should appear in the same order as their CSV records, - as hledger can usually auto-detect whether the CSV's normal order is + hledger always sorts the generated transactions by date. Transactions + on the same date should appear in the same order as their CSV records, + as hledger can usually auto-detect whether the CSV's normal order is oldest first or newest first. But if all of the following are true: - o the CSV might sometimes contain just one day of data (all records + o the CSV might sometimes contain just one day of data (all records having the same date) - o the CSV records are normally in reverse chronological order (newest + o the CSV records are normally in reverse chronological order (newest at the top) o and you care about preserving the order of same-day transactions @@ -5669,9 +5654,9 @@ CSV FORMAT include include RULESFILE - This includes the contents of another CSV rules file at this point. - RULESFILE is an absolute file path or a path relative to the current - file's directory. This can be useful for sharing common rules between + This includes the contents of another CSV rules file at this point. + RULESFILE is an absolute file path or a path relative to the current + file's directory. This can be useful for sharing common rules between several rules files, eg: # someaccount.csv.rules @@ -5686,10 +5671,10 @@ CSV FORMAT balance-type Balance assertions generated by assigning to balanceN are of the simple - = type by default, which is a single-commodity, subaccount-excluding + = type by default, which is a single-commodity, subaccount-excluding assertion. You may find the subaccount-including variants more useful, - eg if you have created some virtual subaccounts of checking to help - with budgeting. You can select a different type of assertion with the + eg if you have created some virtual subaccounts of checking to help + with budgeting. You can select a different type of assertion with the balance-type rule: # balance assertions will consider all commodities and all subaccounts @@ -5704,19 +5689,19 @@ CSV FORMAT Tips Rapid feedback - It's a good idea to get rapid feedback while creating/troubleshooting + It's a good idea to get rapid feedback while creating/troubleshooting CSV rules. Here's a good way, using entr from http://eradman.com/entr- project : $ ls foo.csv* | entr bash -c 'echo ----; hledger -f foo.csv print desc:SOMEDESC' - A desc: query (eg) is used to select just one, or a few, transactions - of interest. "bash -c" is used to run multiple commands, so we can - echo a separator each time the command re-runs, making it easier to + A desc: query (eg) is used to select just one, or a few, transactions + of interest. "bash -c" is used to run multiple commands, so we can + echo a separator each time the command re-runs, making it easier to read the output. Valid CSV - hledger accepts CSV conforming to RFC 4180. When CSV values are en- + hledger accepts CSV conforming to RFC 4180. When CSV values are en- closed in quotes, note: o they must be double quotes (not single quotes) @@ -5724,9 +5709,9 @@ CSV FORMAT o spaces outside the quotes are not allowed File Extension - To help hledger identify the format and show the right error messages, - CSV/SSV/TSV files should normally be named with a .csv, .ssv or .tsv - filename extension. Or, the file path should be prefixed with csv:, + To help hledger identify the format and show the right error messages, + CSV/SSV/TSV files should normally be named with a .csv, .ssv or .tsv + filename extension. Or, the file path should be prefixed with csv:, ssv: or tsv:. Eg: $ hledger -f foo.ssv print @@ -5735,48 +5720,48 @@ CSV FORMAT $ cat foo | hledger -f ssv:- foo - You can override the file extension with a separator rule if needed. + You can override the file extension with a separator rule if needed. See also: Input files in the hledger manual. Reading multiple CSV files - If you use multiple -f options to read multiple CSV files at once, - hledger will look for a correspondingly-named rules file for each CSV - file. But if you use the --rules-file option, that rules file will be + If you use multiple -f options to read multiple CSV files at once, + hledger will look for a correspondingly-named rules file for each CSV + file. But if you use the --rules-file option, that rules file will be used for all the CSV files. Valid transactions After reading a CSV file, hledger post-processes and validates the gen- erated journal entries as it would for a journal file - balancing them, - applying balance assignments, and canonicalising amount styles. Any - errors at this stage will be reported in the usual way, displaying the + applying balance assignments, and canonicalising amount styles. Any + errors at this stage will be reported in the usual way, displaying the problem entry. There is one exception: balance assertions, if you have generated them, - will not be checked, since normally these will work only when the CSV - data is part of the main journal. If you do need to check balance as- + will not be checked, since normally these will work only when the CSV + data is part of the main journal. If you do need to check balance as- sertions generated from CSV right away, pipe into another hledger: $ hledger -f file.csv print | hledger -f- print Deduplicating, importing - When you download a CSV file periodically, eg to get your latest bank - transactions, the new file may overlap with the old one, containing + When you download a CSV file periodically, eg to get your latest bank + transactions, the new file may overlap with the old one, containing some of the same records. The import command will (a) detect the new transactions, and (b) append just those transactions to your main journal. It is idempotent, so you - don't have to remember how many times you ran it or with which version - of the CSV. (It keeps state in a hidden .latest.FILE.csv file.) This + don't have to remember how many times you ran it or with which version + of the CSV. (It keeps state in a hidden .latest.FILE.csv file.) This is the easiest way to import CSV data. Eg: # download the latest CSV files, then run this command. # Note, no -f flags needed here. $ hledger import *.csv [--dry] - This method works for most CSV files. (Where records have a stable + This method works for most CSV files. (Where records have a stable chronological order, and new records appear only at the new end.) - A number of other tools and workflows, hledger-specific and otherwise, + A number of other tools and workflows, hledger-specific and otherwise, exist for converting, deduplicating, classifying and managing CSV data. See: @@ -5787,30 +5772,30 @@ CSV FORMAT Setting amounts A posting amount can be set in one of these ways: - o by assigning (with a fields list or field assignment) to amountN + o by assigning (with a fields list or field assignment) to amountN (posting N's amount) or amount (posting 1's amount) - o by assigning to amountN-in and amountN-out (or amount-in and amount- - out). For each CSV record, whichever of these has a non-zero value - will be used, with appropriate sign. If both contain a non-zero + o by assigning to amountN-in and amountN-out (or amount-in and amount- + out). For each CSV record, whichever of these has a non-zero value + will be used, with appropriate sign. If both contain a non-zero value, this may not work. - o by assigning to balanceN (or balance) instead of the above, setting - the amount indirectly via a balance assignment. If you do this the + o by assigning to balanceN (or balance) instead of the above, setting + the amount indirectly via a balance assignment. If you do this the default account name may be wrong, so you should set that explicitly. There is some special handling for an amount's sign: - o If an amount value is parenthesised, it will be de-parenthesised and + o If an amount value is parenthesised, it will be de-parenthesised and sign-flipped. - o If an amount value begins with a double minus sign, those cancel out + o If an amount value begins with a double minus sign, those cancel out and are removed. o If an amount value begins with a plus sign, that will be removed Setting currency/commodity - If the currency/commodity symbol is included in the CSV's amount + If the currency/commodity symbol is included in the CSV's amount field(s): 2020-01-01,foo,$123.00 @@ -5829,7 +5814,7 @@ CSV FORMAT 2020-01-01,foo,USD,123.00 You can assign that to the currency pseudo-field, which has the special - effect of prepending itself to every amount in the transaction (on the + effect of prepending itself to every amount in the transaction (on the left, with no separating space): fields date,description,currency,amount @@ -5838,7 +5823,7 @@ CSV FORMAT expenses:unknown USD123.00 income:unknown USD-123.00 - Or, you can use a field assignment to construct the amount yourself, + Or, you can use a field assignment to construct the amount yourself, with more control. Eg to put the symbol on the right, and separated by a space: @@ -5849,13 +5834,13 @@ CSV FORMAT expenses:unknown 123.00 USD income:unknown -123.00 USD - Note we used a temporary field name (cur) that is not currency - that + Note we used a temporary field name (cur) that is not currency - that would trigger the prepending effect, which we don't want here. Referencing other fields - In field assignments, you can interpolate only CSV fields, not hledger - fields. In the example below, there's both a CSV field and a hledger - field named amount1, but %amount1 always means the CSV field, not the + In field assignments, you can interpolate only CSV fields, not hledger + fields. In the example below, there's both a CSV field and a hledger + field named amount1, but %amount1 always means the CSV field, not the hledger field: # Name the third CSV field "amount1" @@ -5867,7 +5852,7 @@ CSV FORMAT # Set comment to the CSV amount1 (not the amount1 assigned above) comment %amount1 - Here, since there's no CSV amount1 field, %amount1 will produce a lit- + Here, since there's no CSV amount1 field, %amount1 will produce a lit- eral "amount1": fields date,description,csvamount @@ -5875,7 +5860,7 @@ CSV FORMAT # Can't interpolate amount1 here comment %amount1 - When there are multiple field assignments to the same hledger field, + When there are multiple field assignments to the same hledger field, only the last one takes effect. Here, comment's value will be be B, or C if "something" is matched, but never A: @@ -5885,14 +5870,14 @@ CSV FORMAT comment C How CSV rules are evaluated - Here's how to think of CSV rules being evaluated (if you really need + Here's how to think of CSV rules being evaluated (if you really need to). First, - o include - all includes are inlined, from top to bottom, depth first. - (At each include point the file is inlined and scanned for further + o include - all includes are inlined, from top to bottom, depth first. + (At each include point the file is inlined and scanned for further includes, recursively, before proceeding.) - Then "global" rules are evaluated, top to bottom. If a rule is re- + Then "global" rules are evaluated, top to bottom. If a rule is re- peated, the last one wins: o skip (at top level) @@ -5906,33 +5891,33 @@ CSV FORMAT Then for each CSV record in turn: - o test all if blocks. If any of them contain a end rule, skip all re- - maining CSV records. Otherwise if any of them contain a skip rule, - skip that many CSV records. If there are multiple matched skip + o test all if blocks. If any of them contain a end rule, skip all re- + maining CSV records. Otherwise if any of them contain a skip rule, + skip that many CSV records. If there are multiple matched skip rules, the first one wins. - o collect all field assignments at top level and in matched if blocks. - When there are multiple assignments for a field, keep only the last + o collect all field assignments at top level and in matched if blocks. + When there are multiple assignments for a field, keep only the last one. - o compute a value for each hledger field - either the one that was as- + o compute a value for each hledger field - either the one that was as- signed to it (and interpolate the %CSVFIELDNAME references), or a de- fault o generate a synthetic hledger transaction from these values. - This is all part of the CSV reader, one of several readers hledger can - use to parse input files. When all files have been read successfully, - the transactions are passed as input to whichever hledger command the + This is all part of the CSV reader, one of several readers hledger can + use to parse input files. When all files have been read successfully, + the transactions are passed as input to whichever hledger command the user specified. TIMECLOCK FORMAT The time logging format of timeclock.el, as read by hledger. - hledger can read time logs in timeclock format. As with Ledger, these + hledger can read time logs in timeclock format. As with Ledger, these are (a subset of) timeclock.el's format, containing clock-in and clock- - out entries as in the example below. The date is a simple date. The - time format is HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. + out entries as in the example below. The date is a simple date. The + time format is HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. The timezone, if present, must be four digits and is ignored (currently the time is always interpreted as a local time). @@ -5941,9 +5926,9 @@ TIMECLOCK FORMAT i 2015/03/31 22:21:45 another account o 2015/04/01 02:00:34 - hledger treats each clock-in/clock-out pair as a transaction posting - some number of hours to an account. Or if the session spans more than - one day, it is split into several transactions, one for each day. For + hledger treats each clock-in/clock-out pair as a transaction posting + some number of hours to an account. Or if the session spans more than + one day, it is split into several transactions, one for each day. For the above time log, hledger print generates these journal entries: $ hledger -f t.timeclock print @@ -5964,69 +5949,69 @@ TIMECLOCK FORMAT To generate time logs, ie to clock in and clock out, you could: - o use emacs and the built-in timeclock.el, or the extended timeclock- + o use emacs and the built-in timeclock.el, or the extended timeclock- x.el and perhaps the extras in ledgerutils.el o at the command line, use these bash aliases: shell alias ti="echo - i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG" alias to="echo o + i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG" alias to="echo o `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG" o or use the old ti and to scripts in the ledger 2.x repository. These - rely on a "timeclock" executable which I think is just the ledger 2 + rely on a "timeclock" executable which I think is just the ledger 2 executable renamed. TIMEDOT FORMAT hledger's human-friendly time logging format. - Timedot is a plain text format for logging dated, categorised quanti- - ties (of time, usually), supported by hledger. It is convenient for - approximate and retroactive time logging, eg when the real-time clock- - in/out required with a timeclock file is too precise or too interrup- - tive. It can be formatted like a bar chart, making clear at a glance + Timedot is a plain text format for logging dated, categorised quanti- + ties (of time, usually), supported by hledger. It is convenient for + approximate and retroactive time logging, eg when the real-time clock- + in/out required with a timeclock file is too precise or too interrup- + tive. It can be formatted like a bar chart, making clear at a glance where time was spent. - Though called "timedot", this format is read by hledger as commodity- - less quantities, so it could be used to represent dated quantities + Though called "timedot", this format is read by hledger as commodity- + less quantities, so it could be used to represent dated quantities other than time. In the docs below we'll assume it's time. - A timedot file contains a series of day entries. A day entry begins - with a non-indented hledger-style simple date (Y-M-D, Y/M/D, Y.M.D..) - Any additional text on the same line is used as a transaction descrip- + A timedot file contains a series of day entries. A day entry begins + with a non-indented hledger-style simple date (Y-M-D, Y/M/D, Y.M.D..) + Any additional text on the same line is used as a transaction descrip- tion for this day. This is followed by optionally-indented timelog items for that day, one - per line. Each timelog item is a note, usually a hledger:style:ac- - count:name representing a time category, followed by two or more spa- - ces, and a quantity. Each timelog item generates a hledger transac- + per line. Each timelog item is a note, usually a hledger:style:ac- + count:name representing a time category, followed by two or more spa- + ces, and a quantity. Each timelog item generates a hledger transac- tion. Quantities can be written as: - o dots: a sequence of dots (.) representing quarter hours. Spaces may + o dots: a sequence of dots (.) representing quarter hours. Spaces may optionally be used for grouping. Eg: .... .. o an integral or decimal number, representing hours. Eg: 1.5 - o an integral or decimal number immediately followed by a unit symbol - s, m, h, d, w, mo, or y, representing seconds, minutes, hours, days + o an integral or decimal number immediately followed by a unit symbol + s, m, h, d, w, mo, or y, representing seconds, minutes, hours, days weeks, months or years respectively. Eg: 90m. The following equiva- - lencies are assumed, currently: 1m = 60s, 1h = 60m, 1d = 24h, 1w = + lencies are assumed, currently: 1m = 60s, 1h = 60m, 1d = 24h, 1w = 7d, 1mo = 30d, 1y=365d. - There is some flexibility allowing notes and todo lists to be kept + There is some flexibility allowing notes and todo lists to be kept right in the time log, if needed: o Blank lines and lines beginning with # or ; are ignored. o Lines not ending with a double-space and quantity are parsed as items - taking no time, which will not appear in balance reports by default. + taking no time, which will not appear in balance reports by default. (Add -E to see them.) - o Org mode headlines (lines beginning with one or more * followed by a - space) can be used as date lines or timelog items (the stars are ig- - nored). Also all org headlines before the first date line are ig- - nored. This means org users can manage their timelog as an org out- - line (eg using org-mode/orgstruct-mode in Emacs), for organisation, + o Org mode headlines (lines beginning with one or more * followed by a + space) can be used as date lines or timelog items (the stars are ig- + nored). Also all org headlines before the first date line are ig- + nored. This means org users can manage their timelog as an org out- + line (eg using org-mode/orgstruct-mode in Emacs), for organisation, faster navigation, controlling visibility etc. Examples: @@ -6091,7 +6076,7 @@ TIMEDOT FORMAT ------------++---------------------------------------- || 7.75 2.25 8.00 - I prefer to use period for separating account components. We can make + I prefer to use period for separating account components. We can make this work with an account alias: 2016/2/4 @@ -6108,9 +6093,9 @@ TIMEDOT FORMAT Here is a sample.timedot. COMMON TASKS - Here are some quick examples of how to do some basic tasks with - hledger. For more details, see the reference section below, the - hledger_journal(5) manual, or the more extensive docs at + Here are some quick examples of how to do some basic tasks with + hledger. For more details, see the reference section below, the + hledger_journal(5) manual, or the more extensive docs at https://hledger.org. Getting help @@ -6126,26 +6111,26 @@ COMMON TASKS https://hledger.org#help-feedback Constructing command lines - hledger has an extensive and powerful command line interface. We + hledger has an extensive and powerful command line interface. We strive to keep it simple and ergonomic, but you may run into one of the confusing real world details described in OPTIONS, below. If that hap- pens, here are some tips that may help: - o command-specific options must go after the command (it's fine to put + o command-specific options must go after the command (it's fine to put all options there) (hledger CMD OPTS ARGS) - o running add-on executables directly simplifies command line parsing + o running add-on executables directly simplifies command line parsing (hledger-ui OPTS ARGS) o enclose "problematic" args in single quotes - o if needed, also add a backslash to hide regular expression metachar- + o if needed, also add a backslash to hide regular expression metachar- acters from the shell o to see how a misbehaving command is being parsed, add --debug=2. Starting a journal file - hledger looks for your accounting data in a journal file, + hledger looks for your accounting data in a journal file, $HOME/.hledger.journal by default: $ hledger stats @@ -6153,9 +6138,9 @@ COMMON TASKS Please create it first, eg with "hledger add" or a text editor. Or, specify an existing journal file with -f or LEDGER_FILE. - You can override this by setting the LEDGER_FILE environment variable. + You can override this by setting the LEDGER_FILE environment variable. It's a good practice to keep this important file under version control, - and to start a new file each year. So you could do something like + and to start a new file each year. So you could do something like this: $ mkdir ~/finance @@ -6179,20 +6164,20 @@ COMMON TASKS Market prices : 0 () Setting opening balances - Pick a starting date for which you can look up the balances of some - real-world assets (bank accounts, wallet..) and liabilities (credit + Pick a starting date for which you can look up the balances of some + real-world assets (bank accounts, wallet..) and liabilities (credit cards..). - To avoid a lot of data entry, you may want to start with just one or + To avoid a lot of data entry, you may want to start with just one or two accounts, like your checking account or cash wallet; and pick a re- - cent starting date, like today or the start of the week. You can al- - ways come back later and add more accounts and older transactions, eg + cent starting date, like today or the start of the week. You can al- + ways come back later and add more accounts and older transactions, eg going back to january 1st. - Add an opening balances transaction to the journal, declaring the bal- + Add an opening balances transaction to the journal, declaring the bal- ances on this date. Here are two ways to do it: - o The first way: open the journal in any text editor and save an entry + o The first way: open the journal in any text editor and save an entry like this: 2020-01-01 * opening balances @@ -6202,19 +6187,19 @@ COMMON TASKS liabilities:creditcard $-50 = $-50 equity:opening/closing balances - These are start-of-day balances, ie whatever was in the account at + These are start-of-day balances, ie whatever was in the account at the end of the previous day. - The * after the date is an optional status flag. Here it means + The * after the date is an optional status flag. Here it means "cleared & confirmed". - The currency symbols are optional, but usually a good idea as you'll + The currency symbols are optional, but usually a good idea as you'll be dealing with multiple currencies sooner or later. - The = amounts are optional balance assertions, providing extra error + The = amounts are optional balance assertions, providing extra error checking. - o The second way: run hledger add and follow the prompts to record a + o The second way: run hledger add and follow the prompts to record a similar transaction: $ hledger add @@ -6251,18 +6236,18 @@ COMMON TASKS Starting the next transaction (. or ctrl-D/ctrl-C to quit) Date [2020-01-01]: . - If you're using version control, this could be a good time to commit + If you're using version control, this could be a good time to commit the journal. Eg: $ git commit -m 'initial balances' 2020.journal Recording transactions - As you spend or receive money, you can record these transactions using - one of the methods above (text editor, hledger add) or by using the - hledger-iadd or hledger-web add-ons, or by using the import command to + As you spend or receive money, you can record these transactions using + one of the methods above (text editor, hledger add) or by using the + hledger-iadd or hledger-web add-ons, or by using the import command to convert CSV data downloaded from your bank. - Here are some simple transactions, see the hledger_journal(5) manual + Here are some simple transactions, see the hledger_journal(5) manual and hledger.org for more ideas: 2020/1/10 * gift received @@ -6278,22 +6263,22 @@ COMMON TASKS assets:bank:checking $1000 Reconciling - Periodically you should reconcile - compare your hledger-reported bal- - ances against external sources of truth, like bank statements or your - bank's website - to be sure that your ledger accurately represents the - real-world balances (and, that the real-world institutions have not - made a mistake!). This gets easy and fast with (1) practice and (2) - frequency. If you do it daily, it can take 2-10 minutes. If you let - it pile up, expect it to take longer as you hunt down errors and dis- + Periodically you should reconcile - compare your hledger-reported bal- + ances against external sources of truth, like bank statements or your + bank's website - to be sure that your ledger accurately represents the + real-world balances (and, that the real-world institutions have not + made a mistake!). This gets easy and fast with (1) practice and (2) + frequency. If you do it daily, it can take 2-10 minutes. If you let + it pile up, expect it to take longer as you hunt down errors and dis- crepancies. A typical workflow: - 1. Reconcile cash. Count what's in your wallet. Compare with what - hledger reports (hledger bal cash). If they are different, try to - remember the missing transaction, or look for the error in the al- - ready-recorded transactions. A register report can be helpful - (hledger reg cash). If you can't find the error, add an adjustment + 1. Reconcile cash. Count what's in your wallet. Compare with what + hledger reports (hledger bal cash). If they are different, try to + remember the missing transaction, or look for the error in the al- + ready-recorded transactions. A register report can be helpful + (hledger reg cash). If you can't find the error, add an adjustment transaction. Eg if you have $105 after the above, and can't explain the missing $2, it could be: @@ -6303,26 +6288,26 @@ COMMON TASKS 2. Reconcile checking. Log in to your bank's website. Compare today's (cleared) balance with hledger's cleared balance (hledger bal check- - ing -C). If they are different, track down the error or record the - missing transaction(s) or add an adjustment transaction, similar to + ing -C). If they are different, track down the error or record the + missing transaction(s) or add an adjustment transaction, similar to the above. Unlike the cash case, you can usually compare the trans- - action history and running balance from your bank with the one re- - ported by hledger reg checking -C. This will be easier if you gen- - erally record transaction dates quite similar to your bank's clear- + action history and running balance from your bank with the one re- + ported by hledger reg checking -C. This will be easier if you gen- + erally record transaction dates quite similar to your bank's clear- ing dates. 3. Repeat for other asset/liability accounts. - Tip: instead of the register command, use hledger-ui to see a live-up- + Tip: instead of the register command, use hledger-ui to see a live-up- dating register while you edit the journal: hledger-ui --watch --regis- ter checking -C - After reconciling, it could be a good time to mark the reconciled - transactions' status as "cleared and confirmed", if you want to track - that, by adding the * marker. Eg in the paycheck transaction above, + After reconciling, it could be a good time to mark the reconciled + transactions' status as "cleared and confirmed", if you want to track + that, by adding the * marker. Eg in the paycheck transaction above, insert * between 2020-01-15 and paycheck - If you're using version control, this can be another good time to com- + If you're using version control, this can be another good time to com- mit: $ git commit -m 'txns' 2020.journal @@ -6394,7 +6379,7 @@ COMMON TASKS -------------------- 0 - Show only asset and liability balances, as a flat list, limited to + Show only asset and liability balances, as a flat list, limited to depth 2: $ hledger bal assets liabilities --flat -2 @@ -6404,7 +6389,7 @@ COMMON TASKS -------------------- $4055 - Show the same thing without negative numbers, formatted as a simple + Show the same thing without negative numbers, formatted as a simple balance sheet: $ hledger bs --flat -2 @@ -6471,15 +6456,15 @@ COMMON TASKS 2020-01-13 **** Migrating to a new file - At the end of the year, you may want to continue your journal in a new + At the end of the year, you may want to continue your journal in a new file, so that old transactions don't slow down or clutter your reports, - and to help ensure the integrity of your accounting history. See the + and to help ensure the integrity of your accounting history. See the close command. If using version control, don't forget to git add the new file. LIMITATIONS - The need to precede add-on command options with -- when invoked from + The need to precede add-on command options with -- when invoked from hledger is awkward. When input data contains non-ascii characters, a suitable system locale @@ -6495,36 +6480,36 @@ LIMITATIONS In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger add. - Not all of Ledger's journal file syntax is supported. See file format + Not all of Ledger's journal file syntax is supported. See file format differences. - On large data files, hledger is slower and uses more memory than + On large data files, hledger is slower and uses more memory than Ledger. TROUBLESHOOTING - Here are some issues you might encounter when you run hledger (and re- - member you can also seek help from the IRC channel, mail list or bug + Here are some issues you might encounter when you run hledger (and re- + member you can also seek help from the IRC channel, mail list or bug tracker): Successfully installed, but "No command 'hledger' found" stack and cabal install binaries into a special directory, which should - be added to your PATH environment variable. Eg on unix-like systems, + be added to your PATH environment variable. Eg on unix-like systems, that is ~/.local/bin and ~/.cabal/bin respectively. I set a custom LEDGER_FILE, but hledger is still using the default file - LEDGER_FILE should be a real environment variable, not just a shell - variable. The command env | grep LEDGER_FILE should show it. You may + LEDGER_FILE should be a real environment variable, not just a shell + variable. The command env | grep LEDGER_FILE should show it. You may need to use export. Here's an explanation. - Getting errors like "Illegal byte sequence" or "Invalid or incomplete - multibyte or wide character" or "commitAndReleaseBuffer: invalid argu- + Getting errors like "Illegal byte sequence" or "Invalid or incomplete + multibyte or wide character" or "commitAndReleaseBuffer: invalid argu- ment (invalid character)" Programs compiled with GHC (hledger, haskell build tools, etc.) need to have a UTF-8-aware locale configured in the environment, otherwise they - will fail with these kinds of errors when they encounter non-ascii + will fail with these kinds of errors when they encounter non-ascii characters. - To fix it, set the LANG environment variable to some locale which sup- + To fix it, set the LANG environment variable to some locale which sup- ports UTF-8. The locale you choose must be installed on your system. Here's an example of setting LANG temporarily, on Ubuntu GNU/Linux: @@ -6539,8 +6524,8 @@ TROUBLESHOOTING POSIX $ LANG=en_US.utf8 hledger -f my.journal print # ensure it is used for this command - If available, C.UTF-8 will also work. If your preferred locale isn't - listed by locale -a, you might need to install it. Eg on Ubuntu/De- + If available, C.UTF-8 will also work. If your preferred locale isn't + listed by locale -a, you might need to install it. Eg on Ubuntu/De- bian: $ apt-get install language-pack-fr @@ -6560,8 +6545,8 @@ TROUBLESHOOTING $ echo "export LANG=en_US.utf8" >>~/.bash_profile $ bash --login - Exact spelling and capitalisation may be important. Note the differ- - ence on MacOS (UTF-8, not utf8). Some platforms (eg ubuntu) allow + Exact spelling and capitalisation may be important. Note the differ- + ence on MacOS (UTF-8, not utf8). Some platforms (eg ubuntu) allow variant spellings, but others (eg macos) require it to be exact: $ locale -a | grep -iE en_us.*utf @@ -6571,7 +6556,7 @@ TROUBLESHOOTING REPORTING BUGS - Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel + Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel or hledger mail list)