From 5e54920160f1d908ce091eda0fa1ad83ac9457b7 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 23 May 2019 22:26:43 -0700 Subject: [PATCH] ;regen embedded manuals --- hledger-api/hledger-api.1 | 100 +- hledger-api/hledger-api.info | 9 +- hledger-api/hledger-api.txt | 12 +- hledger-lib/hledger_csv.5 | 290 +-- hledger-lib/hledger_csv.info | 129 +- hledger-lib/hledger_csv.txt | 106 +- hledger-lib/hledger_journal.5 | 1066 +++++------ hledger-lib/hledger_journal.info | 256 +-- hledger-lib/hledger_journal.txt | 607 +++--- hledger-lib/hledger_timeclock.5 | 58 +- hledger-lib/hledger_timeclock.info | 5 +- hledger-lib/hledger_timeclock.txt | 11 +- hledger-lib/hledger_timedot.5 | 104 +- hledger-lib/hledger_timedot.info | 9 +- hledger-lib/hledger_timedot.txt | 10 +- hledger-ui/hledger-ui.1 | 357 ++-- hledger-ui/hledger-ui.info | 33 +- hledger-ui/hledger-ui.txt | 50 +- hledger-web/hledger-web.1 | 337 ++-- hledger-web/hledger-web.info | 57 +- hledger-web/hledger-web.txt | 38 +- hledger/hledger.1 | 2850 +++++++++++++++------------- hledger/hledger.info | 642 +++++-- hledger/hledger.txt | 844 ++++---- 24 files changed, 4335 insertions(+), 3645 deletions(-) diff --git a/hledger-api/hledger-api.1 b/hledger-api/hledger-api.1 index ea7cdefa3..11cf963cf 100644 --- a/hledger-api/hledger-api.1 +++ b/hledger-api/hledger-api.1 @@ -1,46 +1,46 @@ -.TH "hledger\-api" "1" "March 2019" "hledger\-api 1.14" "hledger User Manuals" +.TH "hledger-api" "1" "March 2019" "hledger-api 1.14.99" "hledger User Manuals" .SH NAME .PP -hledger\-api \- web API server for the hledger accounting tool +hledger-api - web API server for the hledger accounting tool .SH SYNOPSIS .PP -\f[C]hledger\-api\ [OPTIONS]\f[] +\f[C]hledger-api [OPTIONS]\f[R] .PD 0 .P .PD -\f[C]hledger\ api\ \-\-\ [OPTIONS]\f[] +\f[C]hledger api -- [OPTIONS]\f[R] .SH DESCRIPTION .PP -hledger is a cross\-platform program for tracking money, time, or any -other commodity, using double\-entry accounting and a simple, editable +hledger is a cross-platform program 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). .PP -hledger\-api is a simple web API server, intended to support -client\-side web apps operating on hledger data. -It comes with a series of simple client\-side app examples, which drive +hledger-api is a simple web API server, intended to support client-side +web apps operating on hledger data. +It comes with a series of simple client-side app examples, which drive its evolution. .PP Like hledger, it reads data from one or more files in hledger journal, -timeclock, timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). +timeclock, timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). For more about this see hledger(1), hledger_journal(5) etc. .PP The server listens on IP address 127.0.0.1, accessible only to local requests, by default. -You can change this with \f[C]\-\-host\f[], eg -\f[C]\-\-host\ 0.0.0.0\f[] to listen on all addresses. -Note there is no other access control, and hledger\-api allows file +You can change this with \f[C]--host\f[R], eg \f[C]--host 0.0.0.0\f[R] +to listen on all addresses. +Note there is no other access control, and hledger-api allows file browsing, so on shared machines you will certainly need to put it behind an authenticating proxy to restrict access. .PP You can change the TCP port it listens on (default: 8001) with -\f[C]\-p\ PORT\f[]. +\f[C]-p PORT\f[R]. .PP API methods look like: .IP @@ -52,73 +52,59 @@ API methods look like: /api/v1/commodities /api/v1/accounts /api/v1/accounts/ACCTNAME -\f[] +\f[R] .fi .PP -See \f[C]/api/swagger.json\f[] for a full list in Swagger 2.0 format. -(Or you can run \f[C]hledger\-api\ \-\-swagger\f[] to print this in the +See \f[C]/api/swagger.json\f[R] for a full list in Swagger 2.0 format. +(Or you can run \f[C]hledger-api --swagger\f[R] to print this in the console.) .PP -hledger\-api also serves files, from the current directory by default, -and the \f[C]/\f[] path will also show a directory listing. -This is convenient for serving client\-side web code, in addition to the -server\-side api. +hledger-api also serves files, from the current directory by default, +and the \f[C]/\f[R] path will also show a directory listing. +This is convenient for serving client-side web code, in addition to the +server-side api. .SH OPTIONS .PP -Note: if invoking hledger\-api as a hledger subcommand, write -\f[C]\-\-\f[] before options as shown above. +Note: if invoking hledger-api as a hledger subcommand, write +\f[C]--\f[R] before options as shown above. .TP -.B \f[C]\-f\ \-\-file=FILE\f[] +.B \f[C]-f --file=FILE\f[R] use a different input file. -For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or -\f[C]$HOME/.hledger.journal\f[]) -.RS -.RE +For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or +\f[C]$HOME/.hledger.journal\f[R]) .TP -.B \f[C]\-d\ \-\-static\-dir=DIR\f[] -serve files from a different directory (default: \f[C]\&.\f[]) -.RS -.RE +.B \f[C]-d --static-dir=DIR\f[R] +serve files from a different directory (default: \f[C].\f[R]) .TP -.B \f[C]\-\-host=IPADDR\f[] +.B \f[C]--host=IPADDR\f[R] listen on this IP address (default: 127.0.0.1) -.RS -.RE .TP -.B \f[C]\-p\ \-\-port=PORT\f[] +.B \f[C]-p --port=PORT\f[R] listen on this TCP port (default: 8001) -.RS -.RE .TP -.B \f[C]\-\-swagger\f[] +.B \f[C]--swagger\f[R] print API docs in Swagger 2.0 format, and exit -.RS -.RE .TP -.B \f[C]\-\-version\f[] +.B \f[C]--version\f[R] show version -.RS -.RE .TP -.B \f[C]\-h\ \-\-help\f[] +.B \f[C]-h --help\f[R] show usage -.RS -.RE .SH ENVIRONMENT .PP -\f[B]LEDGER_FILE\f[] The journal file path when not specified with -\f[C]\-f\f[]. -Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps -\f[C]C:/Users/USER/.hledger.journal\f[]). +\f[B]LEDGER_FILE\f[R] The journal file path when not specified with +\f[C]-f\f[R]. +Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps +\f[C]C:/Users/USER/.hledger.journal\f[R]). .SH FILES .PP Reads data from one or more files in hledger journal, timeclock, -timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). +timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). .SH BUGS .PP -The need to precede options with \f[C]\-\-\f[] when invoked from hledger +The need to precede options with \f[C]--\f[R] when invoked from hledger is awkward. diff --git a/hledger-api/hledger-api.info b/hledger-api/hledger-api.info index c5e2916d4..5628b927c 100644 --- a/hledger-api/hledger-api.info +++ b/hledger-api/hledger-api.info @@ -3,8 +3,8 @@ This is hledger-api.info, produced by makeinfo version 6.5 from stdin.  File: hledger-api.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-api(1) hledger-api 1.14 -******************************* +hledger-api(1) hledger-api 1.14.99 +********************************** hledger-api is a simple web API server, intended to support client-side web apps operating on hledger data. It comes with a series of simple @@ -41,6 +41,7 @@ you can run 'hledger-api --swagger' to print this in the console.) hledger-api also serves files, from the current directory by default, and the '/' path will also show a directory listing. This is convenient for serving client-side web code, in addition to the server-side api. + * Menu: * OPTIONS:: @@ -80,7 +81,7 @@ options as shown above.  Tag Table: Node: Top72 -Node: OPTIONS1660 -Ref: #options1745 +Node: OPTIONS1667 +Ref: #options1752  End Tag Table diff --git a/hledger-api/hledger-api.txt b/hledger-api/hledger-api.txt index 213913b38..7a3ec721d 100644 --- a/hledger-api/hledger-api.txt +++ b/hledger-api/hledger-api.txt @@ -27,11 +27,11 @@ DESCRIPTION hledger_journal(5) etc. The server listens on IP address 127.0.0.1, accessible only to local - requests, by default. You can change this with --host, eg - --host 0.0.0.0 to listen on all addresses. Note there is no other - access control, and hledger-api allows file browsing, so on shared - machines you will certainly need to put it behind an authenticating - proxy to restrict access. + requests, by default. You can change this with --host, eg --host + 0.0.0.0 to listen on all addresses. Note there is no other access con- + trol, and hledger-api allows file browsing, so on shared machines you + will certainly need to put it behind an authenticating proxy to + restrict access. You can change the TCP port it listens on (default: 8001) with -p PORT. @@ -117,4 +117,4 @@ SEE ALSO -hledger-api 1.14 March 2019 hledger-api(1) +hledger-api 1.14.99 March 2019 hledger-api(1) diff --git a/hledger-lib/hledger_csv.5 b/hledger-lib/hledger_csv.5 index 2a82395cf..ebdeb7f05 100644 --- a/hledger-lib/hledger_csv.5 +++ b/hledger-lib/hledger_csv.5 @@ -1,17 +1,17 @@ -.TH "hledger_csv" "5" "March 2019" "hledger 1.14" "hledger User Manuals" +.TH "hledger_csv" "5" "March 2019" "hledger 1.14.99" "hledger User Manuals" .SH NAME .PP -CSV \- how hledger reads CSV data, and the CSV rules file format +CSV - how hledger reads CSV data, and the CSV rules file format .SH DESCRIPTION .PP -hledger can read CSV (comma\-separated value) files as if they were +hledger can read CSV (comma-separated value) files as if they were journal files, automatically converting each CSV record into a transaction. -(To learn about \f[I]writing\f[] CSV, see CSV output.) +(To learn about \f[I]writing\f[R] CSV, see CSV output.) .PP Converting CSV to transactions requires some special conversion rules. These do several things: @@ -24,58 +24,57 @@ templating language they can add refinements based on patterns in the CSV data, eg categorizing transactions with more detailed account names. .PP -When reading a CSV file named \f[C]FILE.csv\f[], hledger looks for a -conversion rules file named \f[C]FILE.csv.rules\f[] in the same +When reading a CSV file named \f[C]FILE.csv\f[R], hledger looks for a +conversion rules file named \f[C]FILE.csv.rules\f[R] in the same directory. -You can override this with the \f[C]\-\-rules\-file\f[] option. -If the rules file does not exist, hledger will auto\-create one with -some example rules, which you\[aq]ll need to adjust. +You can override this with the \f[C]--rules-file\f[R] option. +If the rules file does not exist, hledger will auto-create one with some +example rules, which you\[aq]ll need to adjust. .PP -At minimum, the rules file must identify the \f[C]date\f[] and -\f[C]amount\f[] fields. -It may also be necessary to specify the date format, and the number of -header lines to skip. +At minimum, the rules file must identify the date and amount fields. +It\[aq]s often necessary to specify the date format, and the number of +header lines to skip, also. Eg: .IP .nf \f[C] -fields\ date,\ _,\ _,\ amount -date\-format\ \ %d/%m/%Y -skip\ 1 -\f[] +fields date, _, _, amount +date-format %d/%m/%Y +skip 1 +\f[R] .fi .PP A more complete example: .IP .nf \f[C] -#\ hledger\ CSV\ rules\ for\ amazon.com\ order\ history +# hledger CSV rules for amazon.com order history -#\ sample: -#\ "Date","Type","To/From","Name","Status","Amount","Fees","Transaction\ ID" -#\ "Jul\ 29,\ 2012","Payment","To","Adapteva,\ Inc.","Completed","$25.00","$0.00","17LA58JSK6PRD4HDGLNJQPI1PB9N8DKPVHL" +# sample: +# \[dq]Date\[dq],\[dq]Type\[dq],\[dq]To/From\[dq],\[dq]Name\[dq],\[dq]Status\[dq],\[dq]Amount\[dq],\[dq]Fees\[dq],\[dq]Transaction ID\[dq] +# \[dq]Jul 29, 2012\[dq],\[dq]Payment\[dq],\[dq]To\[dq],\[dq]Adapteva, Inc.\[dq],\[dq]Completed\[dq],\[dq]$25.00\[dq],\[dq]$0.00\[dq],\[dq]17LA58JSK6PRD4HDGLNJQPI1PB9N8DKPVHL\[dq] -#\ skip\ one\ header\ line -skip\ 1 +# skip one header line +skip 1 -#\ name\ the\ csv\ fields\ (and\ assign\ the\ transaction\[aq]s\ date,\ amount\ and\ code) -fields\ date,\ _,\ toorfrom,\ name,\ amzstatus,\ amount,\ fees,\ code +# name the csv fields (and assign the transaction\[aq]s date, amount and code) +fields date, _, toorfrom, name, amzstatus, amount, fees, code -#\ how\ to\ parse\ the\ date -date\-format\ %b\ %\-d,\ %Y +# how to parse the date +date-format %b %-d, %Y -#\ combine\ two\ fields\ to\ make\ the\ description -description\ %toorfrom\ %name +# combine two fields to make the description +description %toorfrom %name -#\ save\ these\ fields\ as\ tags -comment\ \ \ \ \ status:%amzstatus,\ fees:%fees +# save these fields as tags +comment status:%amzstatus, fees:%fees -#\ set\ the\ base\ account\ for\ all\ transactions -account1\ \ \ \ assets:amazon +# set the base account for all transactions +account1 assets:amazon -#\ flip\ the\ sign\ on\ the\ amount -amount\ \ \ \ \ \ \-%amount -\f[] +# flip the sign on the amount +amount -%amount +\f[R] .fi .PP For more examples, see Convert CSV files. @@ -83,11 +82,11 @@ For more examples, see Convert CSV files. .PP The following seven kinds of rule can appear in the rules file, in any order. -Blank lines and lines beginning with \f[C]#\f[] or \f[C];\f[] are +Blank lines and lines beginning with \f[C]#\f[R] or \f[C];\f[R] are ignored. .SS skip .PP -\f[C]skip\f[]\f[I]\f[CI]N\f[I]\f[] +\f[C]skip\f[R]\f[I]\f[CI]N\f[I]\f[R] .PP Skip this number of CSV records at the beginning. You\[aq]ll need this whenever your CSV data contains header lines. @@ -95,122 +94,123 @@ Eg: .IP .nf \f[C] -#\ ignore\ the\ first\ CSV\ line -skip\ 1 -\f[] +# ignore the first CSV line +skip 1 +\f[R] .fi -.SS date\-format +.SS date-format .PP -\f[C]date\-format\f[]\f[I]\f[CI]DATEFMT\f[I]\f[] +\f[C]date-format\f[R]\f[I]\f[CI]DATEFMT\f[I]\f[R] .PP -When your CSV date fields are not formatted like \f[C]YYYY/MM/DD\f[] (or -\f[C]YYYY\-MM\-DD\f[] or \f[C]YYYY.MM.DD\f[]), you\[aq]ll need to +When your CSV date fields are not formatted like \f[C]YYYY/MM/DD\f[R] +(or \f[C]YYYY-MM-DD\f[R] or \f[C]YYYY.MM.DD\f[R]), you\[aq]ll need to specify the format. -DATEFMT is a strptime\-like date parsing pattern, which must parse the +DATEFMT is a strptime-like date parsing pattern, which must parse the date field values completely. Examples: .IP .nf \f[C] -#\ for\ dates\ like\ "11/06/2013": -date\-format\ %m/%d/%Y -\f[] +# for dates like \[dq]11/06/2013\[dq]: +date-format %m/%d/%Y +\f[R] .fi .IP .nf \f[C] -#\ for\ dates\ like\ "6/11/2013"\ (note\ the\ \-\ to\ make\ leading\ zeros\ optional): -date\-format\ %\-d/%\-m/%Y -\f[] +# for dates like \[dq]6/11/2013\[dq] (note the - to make leading zeros optional): +date-format %-d/%-m/%Y +\f[R] .fi .IP .nf \f[C] -#\ for\ dates\ like\ "2013\-Nov\-06": -date\-format\ %Y\-%h\-%d -\f[] +# for dates like \[dq]2013-Nov-06\[dq]: +date-format %Y-%h-%d +\f[R] .fi .IP .nf \f[C] -#\ for\ dates\ like\ "11/6/2013\ 11:32\ PM": -date\-format\ %\-m/%\-d/%Y\ %l:%M\ %p -\f[] +# for dates like \[dq]11/6/2013 11:32 PM\[dq]: +date-format %-m/%-d/%Y %l:%M %p +\f[R] .fi .SS field list .PP -\f[C]fields\f[]\f[I]\f[CI]FIELDNAME1\f[I]\f[], -\f[I]\f[CI]FIELDNAME2\f[I]\f[]... +\f[C]fields\f[R]\f[I]\f[CI]FIELDNAME1\f[I]\f[R], +\f[I]\f[CI]FIELDNAME2\f[I]\f[R]... .PP This (a) names the CSV fields, in order (names may not contain whitespace; uninteresting names may be left blank), and (b) assigns them to journal entry fields if you use any of these standard field names: -\f[C]date\f[], \f[C]date2\f[], \f[C]status\f[], \f[C]code\f[], -\f[C]description\f[], \f[C]comment\f[], \f[C]account1\f[], -\f[C]account2\f[], \f[C]amount\f[], \f[C]amount\-in\f[], -\f[C]amount\-out\f[], \f[C]currency\f[], \f[C]balance\f[]. +\f[C]date\f[R], \f[C]date2\f[R], \f[C]status\f[R], \f[C]code\f[R], +\f[C]description\f[R], \f[C]comment\f[R], \f[C]account1\f[R], +\f[C]account2\f[R], \f[C]amount\f[R], \f[C]amount-in\f[R], +\f[C]amount-out\f[R], \f[C]currency\f[R], \f[C]balance\f[R], +\f[C]balance1\f[R], \f[C]balance2\f[R]. Eg: .IP .nf \f[C] -#\ use\ the\ 1st,\ 2nd\ and\ 4th\ CSV\ fields\ as\ the\ entry\[aq]s\ date,\ description\ and\ amount, -#\ and\ give\ the\ 7th\ and\ 8th\ fields\ meaningful\ names\ for\ later\ reference: +# use the 1st, 2nd and 4th CSV fields as the entry\[aq]s date, description and amount, +# and give the 7th and 8th fields meaningful names for later reference: # -#\ CSV\ field: -#\ \ \ \ \ \ 1\ \ \ \ \ 2\ \ \ \ \ \ \ \ \ \ \ \ 3\ 4\ \ \ \ \ \ \ 5\ 6\ 7\ \ \ \ \ \ \ \ \ \ 8 -#\ entry\ field: -fields\ date,\ description,\ ,\ amount,\ ,\ ,\ somefield,\ anotherfield -\f[] +# CSV field: +# 1 2 3 4 5 6 7 8 +# entry field: +fields date, description, , amount, , , somefield, anotherfield +\f[R] .fi .SS field assignment .PP -\f[I]\f[CI]ENTRYFIELDNAME\f[I]\f[] \f[I]\f[CI]FIELDVALUE\f[I]\f[] +\f[I]\f[CI]ENTRYFIELDNAME\f[I]\f[R] \f[I]\f[CI]FIELDVALUE\f[I]\f[R] .PP This sets a journal entry field (one of the standard names above) to the given text value, which can include CSV field values interpolated by -name (\f[C]%CSVFIELDNAME\f[]) or 1\-based position (\f[C]%N\f[]). - Eg: +name (\f[C]%CSVFIELDNAME\f[R]) or 1-based position (\f[C]%N\f[R]). +Eg: .IP .nf \f[C] -#\ set\ the\ amount\ to\ the\ 4th\ CSV\ field\ with\ "USD\ "\ prepended -amount\ USD\ %4 -\f[] +# set the amount to the 4th CSV field with \[dq]USD \[dq] prepended +amount USD %4 +\f[R] .fi .IP .nf \f[C] -#\ combine\ three\ fields\ to\ make\ a\ comment\ (containing\ two\ tags) -comment\ note:\ %somefield\ \-\ %anotherfield,\ date:\ %1 -\f[] +# combine three fields to make a comment (containing two tags) +comment note: %somefield - %anotherfield, date: %1 +\f[R] .fi .PP Field assignments can be used instead of or in addition to a field list. .SS conditional block .PP -\f[C]if\f[] \f[I]\f[CI]PATTERN\f[I]\f[] +\f[C]if\f[R] \f[I]\f[CI]PATTERN\f[I]\f[R] .PD 0 .P .PD -\ \ \ \ \f[I]\f[CI]FIELDASSIGNMENTS\f[I]\f[]... +\ \ \ \ \f[I]\f[CI]FIELDASSIGNMENTS\f[I]\f[R]... .PP -\f[C]if\f[] +\f[C]if\f[R] .PD 0 .P .PD -\f[I]\f[CI]PATTERN\f[I]\f[] +\f[I]\f[CI]PATTERN\f[I]\f[R] .PD 0 .P .PD -\f[I]\f[CI]PATTERN\f[I]\f[]... +\f[I]\f[CI]PATTERN\f[I]\f[R]... .PD 0 .P .PD -\ \ \ \ \f[I]\f[CI]FIELDASSIGNMENTS\f[I]\f[]... +\ \ \ \ \f[I]\f[CI]FIELDASSIGNMENTS\f[I]\f[R]... .PP This applies one or more field assignments, only to those CSV records matched by one of the PATTERNs. -The patterns are case\-insensitive regular expressions which match +The patterns are case-insensitive regular expressions which match anywhere within the whole CSV record (it\[aq]s not yet possible to match within a specific field). When there are multiple patterns they can be written on separate lines, @@ -221,46 +221,46 @@ Examples: .IP .nf \f[C] -#\ if\ the\ CSV\ record\ contains\ "groceries",\ set\ account2\ to\ "expenses:groceries" -if\ groceries -\ account2\ expenses:groceries -\f[] +# if the CSV record contains \[dq]groceries\[dq], set account2 to \[dq]expenses:groceries\[dq] +if groceries + account2 expenses:groceries +\f[R] .fi .IP .nf \f[C] -#\ if\ the\ CSV\ record\ contains\ any\ of\ these\ patterns,\ set\ account2\ and\ comment\ as\ shown +# if the CSV record contains any of these patterns, set account2 and comment as shown if -monthly\ service\ fee -atm\ transaction\ fee -banking\ thru\ software -\ account2\ expenses:business:banking -\ comment\ \ XXX\ deductible\ ?\ check\ it -\f[] +monthly service fee +atm transaction fee +banking thru software + account2 expenses:business:banking + comment XXX deductible ? check it +\f[R] .fi .SS include .PP -\f[C]include\f[]\f[I]\f[CI]RULESFILE\f[I]\f[] +\f[C]include\f[R]\f[I]\f[CI]RULESFILE\f[I]\f[R] .PP Include another rules file at this point. -\f[C]RULESFILE\f[] is either an absolute file path or a path relative to -the current file\[aq]s directory. +\f[C]RULESFILE\f[R] is either an absolute file path or a path relative +to the current file\[aq]s directory. Eg: .IP .nf \f[C] -#\ rules\ reused\ with\ several\ CSV\ files -include\ common.rules -\f[] +# rules reused with several CSV files +include common.rules +\f[R] .fi -.SS newest\-first +.SS newest-first .PP -\f[C]newest\-first\f[] +\f[C]newest-first\f[R] .PP Consider adding this rule if all of the following are true: you might be processing just one day of data, your CSV records are in reverse chronological order (newest first), and you care about preserving the -order of same\-day transactions. +order of same-day transactions. It usually isn\[aq]t needed, because hledger autodetects the CSV order, but when all CSV records have the same date it will assume they are oldest first. @@ -268,49 +268,69 @@ oldest first. .SS CSV ordering .PP The generated journal entries will be sorted by date. -The order of same\-day entries will be preserved (except in the special -case where you might need \f[C]newest\-first\f[], see above). +The order of same-day entries will be preserved (except in the special +case where you might need \f[C]newest-first\f[R], see above). .SS CSV accounts .PP -Each journal entry will have two postings, to \f[C]account1\f[] and -\f[C]account2\f[] respectively. +Each journal entry will have two postings, to \f[C]account1\f[R] and +\f[C]account2\f[R] respectively. It\[aq]s not yet possible to generate entries with more than two postings. -It\[aq]s conventional and recommended to use \f[C]account1\f[] for the +It\[aq]s conventional and recommended to use \f[C]account1\f[R] for the account whose CSV we are reading. .SS CSV amounts .PP -The \f[C]amount\f[] field sets the amount of the \f[C]account1\f[] -posting. -.PP -If the CSV has debit/credit amounts in separate fields, assign to the -\f[C]amount\-in\f[] and \f[C]amount\-out\f[] pseudo fields instead. -(Whichever one has a value will be used, with appropriate sign. -If both contain a value, it may not work so well.) -.PP -If an amount value is parenthesised, it will be de\-parenthesised and -sign\-flipped. +A transaction amount must be set, in one of these ways: +.IP \[bu] 2 +with an \f[C]amount\f[R] field assignment, which sets the first +posting\[aq]s amount +.IP \[bu] 2 +(When the CSV has debit and credit amounts in separate fields:) +.PD 0 +.P +.PD +with field assignments for the \f[C]amount-in\f[R] and +\f[C]amount-out\f[R] pseudo fields (both of them). +Whichever one has a value will be used, with appropriate sign. +If both contain a value, it might not work so well. +.IP \[bu] 2 +or implicitly by means of a balance assignment (see below). .PP +There is some special handling for sign in amounts: +.IP \[bu] 2 +If an amount value is parenthesised, it will be de-parenthesised and +sign-flipped. +.IP \[bu] 2 If an amount value begins with a double minus sign, those will cancel out and be removed. .PP -If the CSV has the currency symbol in a separate field, assign that to -the \f[C]currency\f[] pseudo field to have it prepended to the amount. -Or, you can use a field assignment to \f[C]amount\f[] that interpolates -both CSV fields (giving more control, eg to put the currency symbol on -the right). -.SS CSV balance assertions +If the currency/commodity symbol is provided as a separate CSV field, +assign it to the \f[C]currency\f[R] pseudo field; the symbol will be +prepended to the amount (TODO: when there is an amount). +Or, you can use an \f[C]amount\f[R] field assignment for more control, +eg: +.IP +.nf +\f[C] +fields date,description,currency,amount +amount %amount %currency +\f[R] +.fi +.SS CSV balance assertions/assignments .PP -If the CSV includes a running balance, you can assign that to the -\f[C]balance\f[] pseudo field; whenever the running balance value is -non\-empty, it will be asserted as the balance after the -\f[C]account1\f[] posting. +If the CSV includes a running balance, you can assign that to one of the +pseudo fields \f[C]balance\f[R] (or \f[C]balance1\f[R]) or +\f[C]balance2\f[R]. +This will generate a balance assertion (or if the amount is left empty, +a balance assignment), on the first or second posting, whenever the +running balance field is non-empty. +(TODO: #1000) .SS Reading multiple CSV files .PP -You can read multiple CSV files at once using multiple \f[C]\-f\f[] +You can read multiple CSV files at once using multiple \f[C]-f\f[R] arguments on the command line, and hledger will look for a -correspondingly\-named rules file for each. -Note if you use the \f[C]\-\-rules\-file\f[] option, this one rules file +correspondingly-named rules file for each. +Note if you use the \f[C]--rules-file\f[R] option, this one rules file will be used for all the CSV files being read. diff --git a/hledger-lib/hledger_csv.info b/hledger-lib/hledger_csv.info index 453281fff..03a27f70d 100644 --- a/hledger-lib/hledger_csv.info +++ b/hledger-lib/hledger_csv.info @@ -3,8 +3,8 @@ This is hledger_csv.info, produced by makeinfo version 6.5 from stdin.  File: hledger_csv.info, Node: Top, Next: CSV RULES, Up: (dir) -hledger_csv(5) hledger 1.14 -*************************** +hledger_csv(5) hledger 1.14.99 +****************************** hledger can read CSV (comma-separated value) files as if they were journal files, automatically converting each CSV record into a @@ -25,9 +25,9 @@ can override this with the '--rules-file' option. If the rules file does not exist, hledger will auto-create one with some example rules, which you'll need to adjust. - At minimum, the rules file must identify the 'date' and 'amount' -fields. It may also be necessary to specify the date format, and the -number of header lines to skip. Eg: + At minimum, the rules file must identify the date and amount fields. +It's often necessary to specify the date format, and the number of +header lines to skip, also. Eg: fields date, _, _, amount date-format %d/%m/%Y @@ -63,6 +63,7 @@ account1 assets:amazon amount -%amount For more examples, see Convert CSV files. + * Menu: * CSV RULES:: @@ -76,6 +77,7 @@ File: hledger_csv.info, Node: CSV RULES, Next: CSV TIPS, Prev: Top, Up: Top The following seven kinds of rule can appear in the rules file, in any order. Blank lines and lines beginning with '#' or ';' are ignored. + * Menu: * skip:: @@ -137,8 +139,8 @@ File: hledger_csv.info, Node: field list, Next: field assignment, Prev: date- whitespace; uninteresting names may be left blank), and (b) assigns them to journal entry fields if you use any of these standard field names: 'date', 'date2', 'status', 'code', 'description', 'comment', 'account1', -'account2', 'amount', 'amount-in', 'amount-out', 'currency', 'balance'. -Eg: +'account2', 'amount', 'amount-in', 'amount-out', 'currency', 'balance', +'balance1', 'balance2'. Eg: # use the 1st, 2nd and 4th CSV fields as the entry's date, description and amount, # and give the 7th and 8th fields meaningful names for later reference: @@ -244,7 +246,7 @@ File: hledger_csv.info, Node: CSV TIPS, Prev: CSV RULES, Up: Top * CSV ordering:: * CSV accounts:: * CSV amounts:: -* CSV balance assertions:: +* CSV balance assertions/assignments:: * Reading multiple CSV files::  @@ -269,42 +271,53 @@ two postings. It's conventional and recommended to use 'account1' for the account whose CSV we are reading.  -File: hledger_csv.info, Node: CSV amounts, Next: CSV balance assertions, Prev: CSV accounts, Up: CSV TIPS +File: hledger_csv.info, Node: CSV amounts, Next: CSV balance assertions/assignments, Prev: CSV accounts, Up: CSV TIPS 2.3 CSV amounts =============== -The 'amount' field sets the amount of the 'account1' posting. +A transaction amount must be set, in one of these ways: - If the CSV has debit/credit amounts in separate fields, assign to the -'amount-in' and 'amount-out' pseudo fields instead. (Whichever one has -a value will be used, with appropriate sign. If both contain a value, -it may not work so well.) + * with an 'amount' field assignment, which sets the first posting's + amount - If an amount value is parenthesised, it will be de-parenthesised and -sign-flipped. + * (When the CSV has debit and credit amounts in separate fields:) + with field assignments for the 'amount-in' and 'amount-out' pseudo + fields (both of them). Whichever one has a value will be used, + with appropriate sign. If both contain a value, it might not work + so well. - If an amount value begins with a double minus sign, those will cancel -out and be removed. + * or implicitly by means of a balance assignment (see below). - If the CSV has the currency symbol in a separate field, assign that -to the 'currency' pseudo field to have it prepended to the amount. Or, -you can use a field assignment to 'amount' that interpolates both CSV -fields (giving more control, eg to put the currency symbol on the -right). + There is some special handling for sign in amounts: + + * If an amount value is parenthesised, it will be de-parenthesised + and sign-flipped. + * If an amount value begins with a double minus sign, those will + cancel out and be removed. + + If the currency/commodity symbol is provided as a separate CSV field, +assign it to the 'currency' pseudo field; the symbol will be prepended +to the amount (TODO: when there is an amount). Or, you can use an +'amount' field assignment for more control, eg: + +fields date,description,currency,amount +amount %amount %currency  -File: hledger_csv.info, Node: CSV balance assertions, Next: Reading multiple CSV files, Prev: CSV amounts, Up: CSV TIPS +File: hledger_csv.info, Node: CSV balance assertions/assignments, Next: Reading multiple CSV files, Prev: CSV amounts, Up: CSV TIPS -2.4 CSV balance assertions -========================== +2.4 CSV balance assertions/assignments +====================================== -If the CSV includes a running balance, you can assign that to the -'balance' pseudo field; whenever the running balance value is non-empty, -it will be asserted as the balance after the 'account1' posting. +If the CSV includes a running balance, you can assign that to one of the +pseudo fields 'balance' (or 'balance1') or 'balance2'. This will +generate a balance assertion (or if the amount is left empty, a balance +assignment), on the first or second posting, whenever the running +balance field is non-empty. (TODO: #1000)  -File: hledger_csv.info, Node: Reading multiple CSV files, Prev: CSV balance assertions, Up: CSV TIPS +File: hledger_csv.info, Node: Reading multiple CSV files, Prev: CSV balance assertions/assignments, Up: CSV TIPS 2.5 Reading multiple CSV files ============================== @@ -317,33 +330,33 @@ one rules file will be used for all the CSV files being read.  Tag Table: Node: Top72 -Node: CSV RULES2163 -Ref: #csv-rules2271 -Node: skip2533 -Ref: #skip2627 -Node: date-format2799 -Ref: #date-format2926 -Node: field list3476 -Ref: #field-list3613 -Node: field assignment4318 -Ref: #field-assignment4473 -Node: conditional block4977 -Ref: #conditional-block5131 -Node: include6027 -Ref: #include6157 -Node: newest-first6388 -Ref: #newest-first6502 -Node: CSV TIPS6913 -Ref: #csv-tips7007 -Node: CSV ordering7125 -Ref: #csv-ordering7243 -Node: CSV accounts7424 -Ref: #csv-accounts7562 -Node: CSV amounts7816 -Ref: #csv-amounts7962 -Node: CSV balance assertions8737 -Ref: #csv-balance-assertions8919 -Node: Reading multiple CSV files9124 -Ref: #reading-multiple-csv-files9294 +Node: CSV RULES2167 +Ref: #csv-rules2275 +Node: skip2538 +Ref: #skip2632 +Node: date-format2804 +Ref: #date-format2931 +Node: field list3481 +Ref: #field-list3618 +Node: field assignment4348 +Ref: #field-assignment4503 +Node: conditional block5007 +Ref: #conditional-block5161 +Node: include6057 +Ref: #include6187 +Node: newest-first6418 +Ref: #newest-first6532 +Node: CSV TIPS6943 +Ref: #csv-tips7037 +Node: CSV ordering7167 +Ref: #csv-ordering7285 +Node: CSV accounts7466 +Ref: #csv-accounts7604 +Node: CSV amounts7858 +Ref: #csv-amounts8016 +Node: CSV balance assertions/assignments9096 +Ref: #csv-balance-assertionsassignments9314 +Node: Reading multiple CSV files9635 +Ref: #reading-multiple-csv-files9817  End Tag Table diff --git a/hledger-lib/hledger_csv.txt b/hledger-lib/hledger_csv.txt index 091cd7700..e7294c0a9 100644 --- a/hledger-lib/hledger_csv.txt +++ b/hledger-lib/hledger_csv.txt @@ -29,8 +29,8 @@ DESCRIPTION you'll need to adjust. At minimum, the rules file must identify the date and amount fields. - It may also be necessary to specify the date format, and the number of - header lines to skip. Eg: + It's often necessary to specify the date format, and the number of + header lines to skip, also. Eg: fields date, _, _, amount date-format %d/%m/%Y @@ -83,10 +83,10 @@ CSV RULES date-format date-formatDATEFMT - When your CSV date fields are not formatted like YYYY/MM/DD (or - YYYY-MM-DD or YYYY.MM.DD), you'll need to specify the format. DATEFMT - is a strptime-like date parsing pattern, which must parse the date - field values completely. Examples: + When your CSV date fields are not formatted like YYYY/MM/DD (or YYYY- + MM-DD or YYYY.MM.DD), you'll need to specify the format. DATEFMT is a + strptime-like date parsing pattern, which must parse the date field + values completely. Examples: # for dates like "11/06/2013": date-format %m/%d/%Y @@ -107,7 +107,8 @@ CSV RULES space; uninteresting names may be left blank), and (b) assigns them to journal entry fields if you use any of these standard field names: date, date2, status, code, description, comment, account1, account2, - amount, amount-in, amount-out, currency, balance. Eg: + amount, amount-in, amount-out, currency, balance, balance1, balance2. + Eg: # use the 1st, 2nd and 4th CSV fields as the entry's date, description and amount, # and give the 7th and 8th fields meaningful names for later reference: @@ -120,10 +121,9 @@ CSV RULES field assignment ENTRYFIELDNAME FIELDVALUE - This sets a journal entry field (one of the standard names above) to - the given text value, which can include CSV field values interpolated - by name (%CSVFIELDNAME) or 1-based position (%N). - Eg: + This sets a journal entry field (one of the standard names above) to + the given text value, which can include CSV field values interpolated + by name (%CSVFIELDNAME) or 1-based position (%N). Eg: # set the amount to the 4th CSV field with "USD " prepended amount USD %4 @@ -131,7 +131,7 @@ CSV RULES # combine three fields to make a comment (containing two tags) comment note: %somefield - %anotherfield, date: %1 - Field assignments can be used instead of or in addition to a field + Field assignments can be used instead of or in addition to a field list. conditional block @@ -143,12 +143,12 @@ CSV RULES PATTERN... FIELDASSIGNMENTS... - This applies one or more field assignments, only to those CSV records + This applies one or more field assignments, only to those CSV records matched by one of the PATTERNs. The patterns are case-insensitive reg- ular expressions which match anywhere within the whole CSV record (it's - not yet possible to match within a specific field). When there are - multiple patterns they can be written on separate lines, unindented. - The field assignments are on separate lines indented by at least one + not yet possible to match within a specific field). When there are + multiple patterns they can be written on separate lines, unindented. + The field assignments are on separate lines indented by at least one space. Examples: # if the CSV record contains "groceries", set account2 to "expenses:groceries" @@ -175,59 +175,71 @@ CSV RULES newest-first newest-first - Consider adding this rule if all of the following are true: you might - be processing just one day of data, your CSV records are in reverse - chronological order (newest first), and you care about preserving the - order of same-day transactions. It usually isn't needed, because - hledger autodetects the CSV order, but when all CSV records have the + Consider adding this rule if all of the following are true: you might + be processing just one day of data, your CSV records are in reverse + chronological order (newest first), and you care about preserving the + order of same-day transactions. It usually isn't needed, because + hledger autodetects the CSV order, but when all CSV records have the same date it will assume they are oldest first. CSV TIPS CSV ordering - The generated journal entries will be sorted by date. The order of - same-day entries will be preserved (except in the special case where + The generated journal entries will be sorted by date. The order of + same-day entries will be preserved (except in the special case where you might need newest-first, see above). CSV accounts - Each journal entry will have two postings, to account1 and account2 + Each journal entry will have two postings, to account1 and account2 respectively. It's not yet possible to generate entries with more than - two postings. It's conventional and recommended to use account1 for + two postings. It's conventional and recommended to use account1 for the account whose CSV we are reading. CSV amounts - The amount field sets the amount of the account1 posting. + A transaction amount must be set, in one of these ways: - If the CSV has debit/credit amounts in separate fields, assign to the - amount-in and amount-out pseudo fields instead. (Whichever one has a - value will be used, with appropriate sign. If both contain a value, it - may not work so well.) + o with an amount field assignment, which sets the first posting's + amount - If an amount value is parenthesised, it will be de-parenthesised and - sign-flipped. + o (When the CSV has debit and credit amounts in separate fields:) + with field assignments for the amount-in and amount-out pseudo fields + (both of them). Whichever one has a value will be used, with appropri- + ate sign. If both contain a value, it might not work so well. - If an amount value begins with a double minus sign, those will cancel - out and be removed. + o or implicitly by means of a balance assignment (see below). - If the CSV has the currency symbol in a separate field, assign that to - the currency pseudo field to have it prepended to the amount. Or, you - can use a field assignment to amount that interpolates both CSV fields - (giving more control, eg to put the currency symbol on the right). + There is some special handling for sign in amounts: - CSV balance assertions - If the CSV includes a running balance, you can assign that to the bal- - ance pseudo field; whenever the running balance value is non-empty, it - will be asserted as the balance after the account1 posting. + 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 will cancel + out and be removed. + + If the currency/commodity symbol is provided as a separate CSV field, + assign it to the currency pseudo field; the symbol will be prepended to + the amount (TODO: when there is an amount). Or, you can use an amount + field assignment for more control, eg: + + fields date,description,currency,amount + amount %amount %currency + + CSV balance assertions/assignments + If the CSV includes a running balance, you can assign that to one of + the pseudo fields balance (or balance1) or balance2. This will gener- + ate a balance assertion (or if the amount is left empty, a balance + assignment), on the first or second posting, whenever the running bal- + ance field is non-empty. (TODO: #1000) Reading multiple CSV files - You can read multiple CSV files at once using multiple -f arguments on - the command line, and hledger will look for a correspondingly-named + You can read multiple CSV files at once using multiple -f arguments on + the command line, and hledger will look for a correspondingly-named rules file for each. Note if you use the --rules-file option, this one rules file will be used for all the CSV files being read. 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) @@ -241,7 +253,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1) @@ -249,4 +261,4 @@ SEE ALSO -hledger 1.14 March 2019 hledger_csv(5) +hledger 1.14.99 March 2019 hledger_csv(5) diff --git a/hledger-lib/hledger_journal.5 b/hledger-lib/hledger_journal.5 index 84b9bc650..bc8128b86 100644 --- a/hledger-lib/hledger_journal.5 +++ b/hledger-lib/hledger_journal.5 @@ -1,19 +1,19 @@ .\"t -.TH "hledger_journal" "5" "March 2019" "hledger 1.14" "hledger User Manuals" +.TH "hledger_journal" "5" "March 2019" "hledger 1.14.99" "hledger User Manuals" .SH NAME .PP -Journal \- hledger\[aq]s default file format, representing a General +Journal - hledger\[aq]s default file format, representing a General Journal .SH DESCRIPTION .PP hledger\[aq]s usual data source is a plain text file containing journal entries in hledger journal format. This file represents a standard accounting general journal. -I use file names ending in \f[C]\&.journal\f[], but that\[aq]s not +I use file names ending in \f[C].journal\f[R], but that\[aq]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 @@ -34,33 +34,33 @@ Here\[aq]s an example: .IP .nf \f[C] -;\ A\ sample\ journal\ file.\ This\ is\ a\ comment. +; A sample journal file. This is a comment. -2008/01/01\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ transaction\[aq]s\ first\ line\ starts\ in\ column\ 0,\ contains\ date\ and\ description -\ \ \ \ assets:bank:checking\ \ $1\ \ \ \ ;\ <\-\ posting\ lines\ start\ with\ whitespace,\ each\ contains\ an\ account\ name -\ \ \ \ income:salary\ \ \ \ \ \ \ \ $\-1\ \ \ \ ;\ \ \ \ followed\ by\ at\ least\ two\ spaces\ and\ an\ amount +2008/01/01 income ; <- transaction\[aq]s first line starts in column 0, contains date and description + assets:bank:checking $1 ; <- posting lines start with whitespace, each contains an account name + income:salary $-1 ; followed by at least two spaces and an amount -2008/06/01\ gift -\ \ \ \ assets:bank:checking\ \ $1\ \ \ \ ;\ <\-\ at\ least\ two\ postings\ in\ a\ transaction -\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ ;\ <\-\ their\ amounts\ must\ balance\ to\ 0 +2008/06/01 gift + assets:bank:checking $1 ; <- at least two postings in a transaction + income:gifts $-1 ; <- their amounts must balance to 0 -2008/06/02\ save -\ \ \ \ assets:bank:saving\ \ \ \ $1 -\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ ;\ <\-\ one\ amount\ may\ be\ omitted;\ here\ $\-1\ is\ inferred +2008/06/02 save + assets:bank:saving $1 + assets:bank:checking ; <- one amount may be omitted; here $-1 is inferred -2008/06/03\ eat\ &\ shop\ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ description\ can\ be\ anything -\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ $1 -\ \ \ \ expenses:supplies\ \ \ \ \ $1\ \ \ \ ;\ <\-\ this\ transaction\ debits\ two\ expense\ accounts -\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ $\-2\ inferred +2008/06/03 eat & shop ; <- description can be anything + expenses:food $1 + expenses:supplies $1 ; <- this transaction debits two expense accounts + assets:cash ; <- $-2 inferred -2008/10/01\ take\ a\ loan -\ \ \ \ assets:bank:checking\ \ $1 -\ \ \ \ liabilities:debts\ \ \ \ $\-1 +2008/10/01 take a loan + assets:bank:checking $1 + liabilities:debts $-1 -2008/12/31\ *\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ an\ optional\ *\ or\ !\ after\ the\ date\ means\ "cleared"\ (or\ anything\ you\ want) -\ \ \ \ liabilities:debts\ \ \ \ \ $1 -\ \ \ \ assets:bank:checking -\f[] +2008/12/31 * pay off ; <- an optional * or ! after the date means \[dq]cleared\[dq] (or anything you want) + liabilities:debts $1 + assets:bank:checking +\f[R] .fi .SH FILE FORMAT .SS Transactions @@ -71,7 +71,7 @@ Each transaction is represented by a journal entry beginning with a simple date in column 0. This can be followed by any of the following, separated by spaces: .IP \[bu] 2 -(optional) a status character (empty, \f[C]!\f[], or \f[C]*\f[]) +(optional) a status character (empty, \f[C]!\f[R], or \f[C]*\f[R]) .IP \[bu] 2 (optional) a transaction code (any short number or text, enclosed in parentheses) @@ -91,13 +91,13 @@ from, an account. Each posting line begins with at least one space or tab (2 or 4 spaces is common), followed by: .IP \[bu] 2 -(optional) a status character (empty, \f[C]!\f[], or \f[C]*\f[]), +(optional) a status character (empty, \f[C]!\f[R], or \f[C]*\f[R]), followed by a space .IP \[bu] 2 (required) an account name (any text, optionally containing \f[B]single -spaces\f[], until end of line or a double space) +spaces\f[R], until end of line or a double space) .IP \[bu] 2 -(optional) \f[B]two or more spaces\f[] or tabs followed by an amount. +(optional) \f[B]two or more spaces\f[R] or tabs followed by an amount. .PP Positive amounts are being added to the account, negative amounts are being removed. @@ -106,24 +106,24 @@ The amounts within a transaction must always sum up to zero. As a convenience, one amount may be left blank; it will be inferred so as to balance the transaction. .PP -Be sure to note the unusual two\-space delimiter between account name -and amount. +Be sure to note the unusual two-space delimiter between account name and +amount. This makes it easy to write account names containing spaces. But if you accidentally leave only one space (or tab) before the amount, the amount will be considered part of the account name. .SS Dates .SS Simple dates .PP -Within a journal file, transaction dates use Y/M/D (or Y\-M\-D or Y.M.D) +Within a journal file, transaction dates use Y/M/D (or Y-M-D or Y.M.D) Leading zeros are optional. The year may be omitted, in which case it will be inferred from the -context \- the current transaction, the default year set with a default +context - the current transaction, the default year set with a default year directive, or the current date when the command is run. -Some examples: \f[C]2010/01/31\f[], \f[C]1/31\f[], -\f[C]2010\-01\-31\f[], \f[C]2010.1.31\f[]. +Some examples: \f[C]2010/01/31\f[R], \f[C]1/31\f[R], +\f[C]2010-01-31\f[R], \f[C]2010.1.31\f[R]. .SS Secondary dates .PP -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, eg for more accurate balances, you can specify individual posting dates, which I recommend. @@ -133,8 +133,8 @@ feature, supported for compatibility with Ledger. A secondary date can be written after the primary date, separated by an equals sign. The primary date, on the left, is used by default; the secondary date, -on the right, is used when the \f[C]\-\-date2\f[] flag is specified -(\f[C]\-\-aux\-date\f[] or \f[C]\-\-effective\f[] also work). +on the right, is used when the \f[C]--date2\f[R] flag is specified +(\f[C]--aux-date\f[R] or \f[C]--effective\f[R] also work). .PP The meaning of secondary dates is up to you, but it\[aq]s best to follow a consistent rule. @@ -147,36 +147,36 @@ unspecified. .IP .nf \f[C] -2010/2/23=2/19\ movie\ ticket -\ \ expenses:cinema\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10 -\ \ assets:checking -\f[] +2010/2/23=2/19 movie ticket + expenses:cinema $10 + assets:checking +\f[R] .fi .IP .nf \f[C] -$\ hledger\ register\ checking -2010/02/23\ movie\ ticket\ \ \ \ \ \ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ $\-10 -\f[] +$ hledger register checking +2010/02/23 movie ticket assets:checking $-10 $-10 +\f[R] .fi .IP .nf \f[C] -$\ hledger\ register\ checking\ \-\-date2 -2010/02/19\ movie\ ticket\ \ \ \ \ \ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ $\-10 -\f[] +$ hledger register checking --date2 +2010/02/19 movie ticket assets:checking $-10 $-10 +\f[R] .fi .PP Secondary dates require some effort; you must use them consistently in your journal entries and remember whether to use or not use the -\f[C]\-\-date2\f[] flag for your reports. +\f[C]--date2\f[R] flag for your reports. They are included in hledger for Ledger compatibility, but posting dates are a more powerful and less confusing alternative. .SS Posting dates .PP You can give individual postings a different date from their parent transaction, by adding a posting comment containing a tag (see below) -like \f[C]date:DATE\f[]. +like \f[C]date:DATE\f[R]. This is probably the best way to control posting dates precisely. Eg in this example the expense should appear in May reports, and the deduction from checking should be reported on 6/1 for easy bank @@ -185,36 +185,37 @@ reconciliation: .nf \f[C] 2015/5/30 -\ \ \ \ expenses:food\ \ \ \ \ $10\ \ \ ;\ food\ purchased\ on\ saturday\ 5/30 -\ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ ;\ bank\ cleared\ it\ on\ monday,\ date:6/1 -\f[] + expenses:food $10 ; food purchased on saturday 5/30 + assets:checking ; bank cleared it on monday, date:6/1 +\f[R] .fi .IP .nf \f[C] -$\ hledger\ \-f\ t.j\ register\ food -2015/05/30\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ \ \ \ \ \ \ \ \ \ $10 -\f[] +$ hledger -f t.j register food +2015/05/30 expenses:food $10 $10 +\f[R] .fi .IP .nf \f[C] -$\ hledger\ \-f\ t.j\ register\ checking -2015/06/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ \ $\-10 -\f[] +$ hledger -f t.j register checking +2015/06/01 assets:checking $-10 $-10 +\f[R] .fi .PP DATE should be a simple date; if the year is not specified it will use the year of the transaction\[aq]s date. -You can set the secondary date similarly, with \f[C]date2:DATE2\f[]. -The \f[C]date:\f[] or \f[C]date2:\f[] tags must have a valid simple date -value if they are present, eg a \f[C]date:\f[] tag with no value is not -allowed. +You can set the secondary date similarly, with \f[C]date2:DATE2\f[R]. +The \f[C]date:\f[R] or \f[C]date2:\f[R] tags must have a valid simple +date value if they are present, eg a \f[C]date:\f[R] tag with no value +is not allowed. .PP Ledger\[aq]s earlier, more compact bracketed date syntax is also -supported: \f[C][DATE]\f[], \f[C][DATE=DATE2]\f[] or \f[C][=DATE2]\f[]. -hledger will attempt to parse any square\-bracketed sequence of the -\f[C]0123456789/\-.=\f[] characters in this way. +supported: \f[C][DATE]\f[R], \f[C][DATE=DATE2]\f[R] or +\f[C][=DATE2]\f[R]. +hledger will attempt to parse any square-bracketed sequence of the +\f[C]0123456789/-.=\f[R] characters in this way. With this syntax, DATE infers its year from the transaction and DATE2 infers its year from DATE. .SS Status @@ -239,38 +240,39 @@ T}@T{ unmarked T} T{ -\f[C]!\f[] +\f[C]!\f[R] T}@T{ pending T} T{ -\f[C]*\f[] +\f[C]*\f[R] T}@T{ cleared T} .TE .PP When reporting, you can filter by status with the -\f[C]\-U/\-\-unmarked\f[], \f[C]\-P/\-\-pending\f[], and -\f[C]\-C/\-\-cleared\f[] flags; or the \f[C]status:\f[], -\f[C]status:!\f[], and \f[C]status:*\f[] queries; or the U, P, C keys in -hledger\-ui. +\f[C]-U/--unmarked\f[R], \f[C]-P/--pending\f[R], and +\f[C]-C/--cleared\f[R] flags; or the \f[C]status:\f[R], +\f[C]status:!\f[R], and \f[C]status:*\f[R] queries; or the U, P, C keys +in hledger-ui. .PP -Note, in Ledger and in older versions of hledger, the "unmarked" state -is called "uncleared". +Note, in Ledger and in older versions of hledger, the \[dq]unmarked\[dq] +state is called \[dq]uncleared\[dq]. As of hledger 1.3 we have renamed it to unmarked for clarity. .PP To replicate Ledger and old hledger\[aq]s behaviour of also matching -pending, combine \-U and \-P. +pending, combine -U and -P. .PP Status marks are optional, but can be helpful eg for reconciling with -real\-world accounts. +real-world accounts. Some editor modes provide highlighting and shortcuts 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. +Eg in Emacs ledger-mode, you can toggle transaction status with C-c C-e, +or posting status with C-c C-c. .PP -What "uncleared", "pending", and "cleared" actually mean is up to you. +What \[dq]uncleared\[dq], \[dq]pending\[dq], and \[dq]cleared\[dq] +actually mean is up to you. Here\[aq]s one suggestion: .PP .TS @@ -299,20 +301,20 @@ complete, reconciled as far as possible, and considered correct T} .TE .PP -With this scheme, you would use \f[C]\-PC\f[] to see the current balance -at your bank, \f[C]\-U\f[] to see things which will probably hit your +With this scheme, you would use \f[C]-PC\f[R] to see the current balance +at your bank, \f[C]-U\f[R] to see things which will probably hit your bank soon (like uncashed checks), and no flags to see the most -up\-to\-date state of your finances. +up-to-date state of your finances. .SS Description .PP A transaction\[aq]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. +Sometimes called the \[dq]narration\[dq] in traditional bookkeeping, it +can be used for whatever you wish, or left blank. Transaction descriptions can be queried, unlike comments. .SS Payee and note .PP -You can optionally include a \f[C]|\f[] (pipe) character in a +You can optionally include a \f[C]|\f[R] (pipe) character in a description to subdivide it into a payee/payer name on the left and additional notes on the right. This may be worthwhile if you need to do more precise querying and @@ -322,71 +324,71 @@ pivoting by payee. 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: \f[C]assets\f[], \f[C]liabilities\f[], -\f[C]income\f[], \f[C]expenses\f[], and \f[C]equity\f[]. +five top-level accounts: \f[C]assets\f[R], \f[C]liabilities\f[R], +\f[C]income\f[R], \f[C]expenses\f[R], and \f[C]equity\f[R]. .PP Account names may contain single spaces, eg: -\f[C]assets:accounts\ receivable\f[]. +\f[C]assets:accounts receivable\f[R]. Because of this, they must always be followed by \f[B]two or more -spaces\f[] (or newline). +spaces\f[R] (or newline). .PP Account names can be aliased. .SS Amounts .PP After the account name, there is usually an amount. Important: between account name and amount, there must be \f[B]two or -more spaces\f[]. +more spaces\f[R]. .PP Amounts consist of a number and (usually) a currency symbol or commodity name. Some examples: .PP -\f[C]2.00001\f[] +\f[C]2.00001\f[R] .PD 0 .P .PD -\f[C]$1\f[] +\f[C]$1\f[R] .PD 0 .P .PD -\f[C]4000\ AAPL\f[] +\f[C]4000 AAPL\f[R] .PD 0 .P .PD -\f[C]3\ "green\ apples"\f[] +\f[C]3 \[dq]green apples\[dq]\f[R] .PD 0 .P .PD -\f[C]\-$1,000,000.00\f[] +\f[C]-$1,000,000.00\f[R] .PD 0 .P .PD -\f[C]INR\ 9,99,99,999.00\f[] +\f[C]INR 9,99,99,999.00\f[R] .PD 0 .P .PD -\f[C]EUR\ \-2.000.000,00\f[] +\f[C]EUR -2.000.000,00\f[R] .PD 0 .P .PD -\f[C]1\ 999\ 999.9455\f[] +\f[C]1 999 999.9455\f[R] .PD 0 .P .PD -\f[C]EUR\ 1E3\f[] +\f[C]EUR 1E3\f[R] .PD 0 .P .PD -\f[C]1000E\-6s\f[] +\f[C]1000E-6s\f[R] .PP As you can see, the amount format is somewhat flexible: .IP \[bu] 2 -amounts are a number (the "quantity") and optionally a currency -symbol/commodity name (the "commodity"). +amounts are a number (the \[dq]quantity\[dq]) and optionally a currency +symbol/commodity name (the \[dq]commodity\[dq]). .IP \[bu] 2 the commodity is a symbol, word, or phrase, on the left or right, with or without a separating space. -If the commodity contains numbers, spaces or non\-word punctuation it +If the commodity contains numbers, spaces or non-word punctuation it must be enclosed in double quotes. .IP \[bu] 2 negative amounts with a commodity on the left can have the minus sign @@ -399,7 +401,7 @@ groups decimal part can be separated by comma or period and should be different from digit groups separator .IP \[bu] 2 -scientific E\-notation is allowed. +scientific E-notation is allowed. Be careful not to use a digit group separator character in scientific notation, as it\[aq]s not supported and it might get mistaken for a decimal point. @@ -408,8 +410,8 @@ commodity directive will prevent this.) .PP You can use any of these variations when recording data. However, there is some ambiguous way of representing numbers like -\f[C]$1.000\f[] and \f[C]$1,000\f[] both may mean either one thousand or -one dollar. +\f[C]$1.000\f[R] and \f[C]$1,000\f[R] both may mean either one thousand +or one dollar. By default hledger will assume that this is sole delimiter is used only for decimals. On the other hand commodity format declared prior to that line will help @@ -417,12 +419,12 @@ to resolve that ambiguity differently: .IP .nf \f[C] -commodity\ $1,000.00 +commodity $1,000.00 -2017/12/25\ New\ life\ of\ Scrooge -\ \ \ \ expenses:gifts\ \ $1,000 -\ \ \ \ assets -\f[] +2017/12/25 New life of Scrooge + expenses:gifts $1,000 + assets +\f[R] .fi .PP Though journal may contain mixed styles to represent amount, when @@ -438,51 +440,51 @@ commodity in the journal, and the precision (number of decimal places) will be the maximum from all posting amounts in that commmodity .IP \[bu] 2 or if there are no such amounts in the journal, a default format is used -(like \f[C]$1000.00\f[]). +(like \f[C]$1000.00\f[R]). .PP -Price amounts and amounts in \f[C]D\f[] directives usually don\[aq]t +Price amounts and amounts in \f[C]D\f[R] directives usually don\[aq]t affect amount format inference, but in some situations they can do so indirectly. -(Eg when D\[aq]s default commodity is applied to a commodity\-less +(Eg when D\[aq]s default commodity is applied to a commodity-less amount, or when an amountless posting is balanced using a price\[aq]s -commodity, or when \-V is used.) If you find this causing problems, set +commodity, or when -V is used.) If you find this causing problems, set the desired format with a commodity directive. .SS Virtual Postings .PP When you parenthesise the account name in a posting, we call that a -\f[I]virtual posting\f[], which means: +\f[I]virtual posting\f[R], which means: .IP \[bu] 2 it is ignored when checking that the transaction is balanced .IP \[bu] 2 -it is excluded from reports when the \f[C]\-\-real/\-R\f[] flag is used, -or the \f[C]real:1\f[] query. +it is excluded from reports when the \f[C]--real/-R\f[R] flag is used, +or the \f[C]real:1\f[R] query. .PP You could use this, eg, to set an account\[aq]s opening balance without -needing to use the \f[C]equity:opening\ balances\f[] account: +needing to use the \f[C]equity:opening balances\f[R] account: .IP .nf \f[C] -1/1\ special\ unbalanced\ posting\ to\ set\ initial\ balance -\ \ (assets:checking)\ \ \ $1000 -\f[] +1/1 special unbalanced posting to set initial balance + (assets:checking) $1000 +\f[R] .fi .PP When the account name is bracketed, we call it a \f[I]balanced virtual -posting\f[]. +posting\f[R]. This is like an ordinary virtual posting except the balanced virtual postings in a transaction must balance to 0, like the real postings (but separately from them). -Balanced virtual postings are also excluded by \f[C]\-\-real/\-R\f[] or -\f[C]real:1\f[]. +Balanced virtual postings are also excluded by \f[C]--real/-R\f[R] or +\f[C]real:1\f[R]. .IP .nf \f[C] -1/1\ buy\ food\ with\ cash,\ and\ update\ some\ budget\-tracking\ subaccounts\ elsewhere -\ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10 -\ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10 -\ \ [assets:checking:available]\ \ \ \ \ $10 -\ \ [assets:checking:budget:food]\ \ $\-10 -\f[] +1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere + expenses:food $10 + assets:cash $-10 + [assets:checking:available] $10 + [assets:checking:budget:food] $-10 +\f[R] .fi .PP Virtual postings have some legitimate uses, but those are few. @@ -490,8 +492,8 @@ You can usually find an equivalent journal entry using real postings, which is more correct and provides better error checking. .SS Balance Assertions .PP -hledger supports Ledger\-style balance assertions in journal files. -These look like, for example, \f[C]=\ EXPECTEDBALANCE\f[] following a +hledger supports Ledger-style balance assertions in journal files. +These look like, for example, \f[C]= EXPECTEDBALANCE\f[R] following a posting\[aq]s amount. Eg here we assert the expected dollar balance in accounts a and b after each posting: @@ -499,13 +501,13 @@ each posting: .nf \f[C] 2013/1/1 -\ \ a\ \ \ $1\ \ =$1 -\ \ b\ \ \ \ \ \ \ =$\-1 + a $1 =$1 + b =$-1 2013/1/2 -\ \ a\ \ \ $1\ \ =$2 -\ \ b\ \ $\-1\ \ =$\-2 -\f[] + a $1 =$2 + b $-1 =$-2 +\f[R] .fi .PP After reading a journal file, hledger will check all balance assertions @@ -513,7 +515,7 @@ and report an error if any of them fail. Balance assertions can protect you from, eg, inadvertently disrupting reconciled balances while cleaning up old entries. You can disable them temporarily with the -\f[C]\-I/\-\-ignore\-assertions\f[] flag, which can be useful for +\f[C]-I/--ignore-assertions\f[R] flag, which can be useful for troubleshooting or for reading Ledger files. .SS Assertions and ordering .PP @@ -525,12 +527,12 @@ order. postings to the same account within a transaction.) .PP 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. +differently-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. +intra-day balances. .SS Assertions and included files .PP With included files, things are a little more complicated. @@ -539,47 +541,47 @@ If you have multiple postings to an account on the same day, split across different files, and you also want to assert the account\[aq]s balance on the same day, you\[aq]ll have to put the assertion in the right file. -.SS Assertions and multiple \-f options +.SS Assertions and multiple -f options .PP Balance assertions don\[aq]t work well across files specified with -multiple \-f options. +multiple -f options. Use include or concatenate the files instead. .SS Assertions and commodities .PP -The asserted balance must be a simple single\-commodity amount, and in +The asserted balance must be a simple single-commodity amount, and in fact the assertion checks only this commodity\[aq]s balance within the -(possibly multi\-commodity) account balance. +(possibly multi-commodity) account balance. .PD 0 .P .PD This is how assertions work in Ledger also. -We could call this a "partial" balance assertion. +We could call this a \[dq]partial\[dq] balance assertion. .PP To assert the balance of more than one commodity in an account, you can write multiple postings, each asserting one commodity\[aq]s balance. .PP -You can make a stronger "total" balance assertion by writing a double -equals sign (\f[C]==\ EXPECTEDBALANCE\f[]). +You can make a stronger \[dq]total\[dq] balance assertion by writing a +double equals sign (\f[C]== EXPECTEDBALANCE\f[R]). This asserts that there are no other unasserted commodities in the account (or, that their balance is 0). .IP .nf \f[C] 2013/1/1 -\ \ a\ \ \ $1 -\ \ a\ \ \ \ 1€ -\ \ b\ \ $\-1 -\ \ c\ \ \ \-1€ + a $1 + a 1\[Eu] + b $-1 + c -1\[Eu] -2013/1/2\ \ ;\ These\ assertions\ succeed -\ \ a\ \ \ \ 0\ \ =\ \ $1 -\ \ a\ \ \ \ 0\ \ =\ \ \ 1€ -\ \ b\ \ \ \ 0\ ==\ $\-1 -\ \ c\ \ \ \ 0\ ==\ \ \-1€ +2013/1/2 ; These assertions succeed + a 0 = $1 + a 0 = 1\[Eu] + b 0 == $-1 + c 0 == -1\[Eu] -2013/1/3\ \ ;\ This\ assertion\ fails\ as\ \[aq]a\[aq]\ also\ contains\ 1€ -\ \ a\ \ \ \ 0\ ==\ \ $1 -\f[] +2013/1/3 ; This assertion fails as \[aq]a\[aq] also contains 1\[Eu] + a 0 == $1 +\f[R] .fi .PP It\[aq]s not yet possible to make a complete assertion about a balance @@ -589,15 +591,15 @@ One workaround is to isolate each commodity into its own subaccount: .nf \f[C] 2013/1/1 -\ \ a:usd\ \ \ $1 -\ \ a:euro\ \ \ 1€ -\ \ b + a:usd $1 + a:euro 1\[Eu] + b 2013/1/2 -\ \ a\ \ \ \ \ \ \ \ 0\ ==\ \ 0 -\ \ a:usd\ \ \ \ 0\ ==\ $1 -\ \ a:euro\ \ \ 0\ ==\ \ 1€ -\f[] + a 0 == 0 + a:usd 0 == $1 + a:euro 0 == 1\[Eu] +\f[R] .fi .SS Assertions and prices .PP @@ -607,38 +609,38 @@ written without one: .nf \f[C] 2019/1/1 -\ \ (a)\ \ \ \ \ $1\ \@\ €1\ =\ $1 -\f[] + (a) $1 \[at] \[Eu]1 = $1 +\f[R] .fi .PP We do allow prices to be written there, however, and print shows them, even though they don\[aq]t affect whether the assertion passes or fails. This is for backward compatibility (hledger\[aq]s close command used to generate balance assertions with prices), and because balance -\f[I]assignments\f[] do use them (see below). +\f[I]assignments\f[R] do use them (see below). .SS Assertions and subaccounts .PP -The balance assertions above (\f[C]=\f[] and \f[C]==\f[]) do not count +The balance assertions above (\f[C]=\f[R] and \f[C]==\f[R]) do not count the balance from subaccounts; they check the account\[aq]s exclusive balance only. -You can assert the balance including subaccounts by writing \f[C]=*\f[] -or \f[C]==*\f[], eg: +You can assert the balance including subaccounts by writing \f[C]=*\f[R] +or \f[C]==*\f[R], eg: .IP .nf \f[C] 2019/1/1 -\ \ equity:opening\ balances -\ \ checking:a\ \ \ \ \ \ \ 5 -\ \ checking:b\ \ \ \ \ \ \ 5 -\ \ checking\ \ \ \ \ \ \ \ \ 1\ \ ==*\ 11 -\f[] + equity:opening balances + checking:a 5 + checking:b 5 + checking 1 ==* 11 +\f[R] .fi .SS Assertions and virtual postings .PP Balance assertions are checked against all postings, both real and virtual. -They are not affected by the \f[C]\-\-real/\-R\f[] flag or -\f[C]real:\f[] query. +They are not affected by the \f[C]--real/-R\f[R] flag or \f[C]real:\f[R] +query. .SS Assertions and precision .PP Balance assertions compare the exactly calculated amounts, which are not @@ -648,7 +650,7 @@ not affect balance assertions. Balance assertion failure messages show exact amounts. .SS Balance Assignments .PP -Ledger\-style balance assignments are also supported. +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. @@ -657,28 +659,28 @@ balances: .IP .nf \f[C] -;\ starting\ a\ new\ journal,\ set\ asset\ account\ balances\ -2016/1/1\ opening\ balances -\ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ =\ $409.32 -\ \ assets:savings\ \ \ \ \ \ \ \ \ \ \ \ \ =\ $735.24 -\ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ $42 -\ \ equity:opening\ balances -\f[] +; starting a new journal, set asset account balances +2016/1/1 opening balances + assets:checking = $409.32 + assets:savings = $735.24 + assets:cash = $42 + equity:opening balances +\f[R] .fi .PP or when adjusting a balance to reality: .IP .nf \f[C] -;\ no\ cash\ left;\ update\ balance,\ record\ any\ untracked\ spending\ as\ a\ generic\ expense +; no cash left; update balance, record any untracked spending as a generic expense 2016/1/15 -\ \ assets:cash\ \ \ \ =\ $0 -\ \ expenses:misc -\f[] + assets:cash = $0 + expenses:misc +\f[R] .fi .PP The calculated amount depends on the account\[aq]s balance in the -commodity at that point (which depends on the previously\-dated postings +commodity at that point (which depends on the previously-dated postings of the commodity to that account since the last balance assertion or assignment). Note that using balance assignments makes your journal a little less @@ -692,16 +694,16 @@ amount to have that price attached: .nf \f[C] 2019/1/1 -\ \ (a)\ \ \ \ \ \ \ \ \ \ \ \ \ =\ $1\ \@\ €2 -\f[] + (a) = $1 \[at] \[Eu]2 +\f[R] .fi .IP .nf \f[C] -$\ hledger\ print\ \-\-explicit +$ hledger print --explicit 2019/01/01 -\ \ \ \ (a)\ \ \ \ \ \ \ \ \ $1\ \@\ €2\ =\ $1\ \@\ €2 -\f[] + (a) $1 \[at] \[Eu]2 = $1 \[at] \[Eu]2 +\f[R] .fi .SS Transaction prices .PP @@ -718,27 +720,28 @@ certain date. .PP There are several ways to record a transaction price: .IP "1." 3 -Write the price per unit, as \f[C]\@\ UNITPRICE\f[] after the amount: +Write the price per unit, as \f[C]\[at] UNITPRICE\f[R] after the amount: .RS 4 .IP .nf \f[C] 2009/1/1 -\ \ assets:euros\ \ \ \ \ €100\ \@\ $1.35\ \ ;\ one\ hundred\ euros\ purchased\ at\ $1.35\ each -\ \ assets:dollars\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ balancing\ amount\ is\ \-$135.00 -\f[] + assets:euros \[Eu]100 \[at] $1.35 ; one hundred euros purchased at $1.35 each + assets:dollars ; balancing amount is -$135.00 +\f[R] .fi .RE .IP "2." 3 -Write the total price, as \f[C]\@\@\ TOTALPRICE\f[] after the amount: +Write the total price, as \f[C]\[at]\[at] TOTALPRICE\f[R] after the +amount: .RS 4 .IP .nf \f[C] 2009/1/1 -\ \ assets:euros\ \ \ \ \ €100\ \@\@\ $135\ \ ;\ one\ hundred\ euros\ purchased\ at\ $135\ for\ the\ lot -\ \ assets:dollars -\f[] + assets:euros \[Eu]100 \[at]\[at] $135 ; one hundred euros purchased at $135 for the lot + assets:dollars +\f[R] .fi .RE .IP "3." 3 @@ -749,58 +752,58 @@ hledger infer the price that balances the transaction: .nf \f[C] 2009/1/1 -\ \ assets:euros\ \ \ \ \ €100\ \ \ \ \ \ \ \ \ \ ;\ one\ hundred\ euros\ purchased -\ \ assets:dollars\ \ $\-135\ \ \ \ \ \ \ \ \ \ ;\ for\ $135 -\f[] + assets:euros \[Eu]100 ; one hundred euros purchased + assets:dollars $-135 ; for $135 +\f[R] .fi .RE .PP (Ledger users: Ledger uses a different syntax for fixed prices, -\f[C]{=UNITPRICE}\f[], which hledger currently ignores). +\f[C]{=UNITPRICE}\f[R], which hledger currently ignores). .PP -Use the \f[C]\-B/\-\-cost\f[] flag to convert amounts to their -transaction price\[aq]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: +Use the \f[C]-B/--cost\f[R] flag to convert amounts to their transaction +price\[aq]s commodity, if any. +(mnemonic: \[dq]B\[dq] is from \[dq]cost Basis\[dq], as in Ledger). +Eg here is how -B affects the balance report for the example above: .IP .nf \f[C] -$\ hledger\ bal\ \-N\ \-\-flat -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-135\ \ assets:dollars -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros -$\ hledger\ bal\ \-N\ \-\-flat\ \-B -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-135\ \ assets:dollars -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $135\ \ assets:euros\ \ \ \ #\ <\-\ the\ euros\[aq]\ cost -\f[] +$ hledger bal -N --flat + $-135 assets:dollars + \[Eu]100 assets:euros +$ hledger bal -N --flat -B + $-135 assets:dollars + $135 assets:euros # <- the euros\[aq] cost +\f[R] .fi .PP -Note \-B is sensitive to the order of postings when a transaction price +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\[aq]s postings are reversed, while the transaction is -equivalent, \-B shows something different: +equivalent, -B shows something different: .IP .nf \f[C] 2009/1/1 -\ \ assets:dollars\ \ $\-135\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ 135\ dollars\ sold -\ \ assets:euros\ \ \ \ \ €100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ for\ 100\ euros -\f[] + assets:dollars $-135 ; 135 dollars sold + assets:euros \[Eu]100 ; for 100 euros +\f[R] .fi .IP .nf \f[C] -$\ hledger\ bal\ \-N\ \-\-flat\ \-B -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €\-100\ \ assets:dollars\ \ #\ <\-\ the\ dollars\[aq]\ selling\ price -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros -\f[] +$ hledger bal -N --flat -B + \[Eu]-100 assets:dollars # <- the dollars\[aq] selling price + \[Eu]100 assets:euros +\f[R] .fi .SS Comments .PP -Lines in the journal beginning with a semicolon (\f[C];\f[]) or hash -(\f[C]#\f[]) or star (\f[C]*\f[]) 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.) +Lines in the journal beginning with a semicolon (\f[C];\f[R]) or hash +(\f[C]#\f[R]) or star (\f[C]*\f[R]) 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.) .PP You can attach comments to a transaction by writing them after the description and/or indented on the following lines (before the @@ -808,35 +811,35 @@ postings). Similarly, you can attach comments to an individual posting by writing them after the amount and/or indented on the following lines. Transaction and posting comments must begin with a semicolon -(\f[C];\f[]). +(\f[C];\f[R]). .PP Some examples: .IP .nf \f[C] -#\ a\ file\ comment +# a file comment -;\ also\ a\ file\ comment +; also a file comment comment -This\ is\ a\ multiline\ file\ comment, -which\ continues\ until\ a\ line -where\ the\ "end\ comment"\ string -appears\ on\ its\ own\ (or\ end\ of\ file). -end\ comment +This is a multiline file comment, +which continues until a line +where the \[dq]end comment\[dq] string +appears on its own (or end of file). +end comment -2012/5/14\ something\ \ ;\ a\ transaction\ comment -\ \ \ \ ;\ the\ transaction\ comment,\ continued -\ \ \ \ posting1\ \ 1\ \ ;\ a\ comment\ for\ posting\ 1 -\ \ \ \ posting2 -\ \ \ \ ;\ a\ comment\ for\ posting\ 2 -\ \ \ \ ;\ another\ comment\ line\ for\ posting\ 2 -;\ a\ file\ comment\ (because\ not\ indented) -\f[] +2012/5/14 something ; a transaction comment + ; the transaction comment, continued + posting1 1 ; a comment for posting 1 + posting2 + ; a comment for posting 2 + ; another comment line for posting 2 +; a file comment (because not indented) +\f[R] .fi .PP -You can also comment larger regions of a file using \f[C]comment\f[] and -\f[C]end\ comment\f[] directives. +You can also comment larger regions of a file using \f[C]comment\f[R] +and \f[C]end comment\f[R] directives. .SS Tags .PP Tags are a way to add extra labels or labelled data to postings and @@ -847,8 +850,8 @@ colon, written inside a transaction or posting comment line: .IP .nf \f[C] -2017/1/16\ bought\ groceries\ \ \ \ ;\ sometag: -\f[] +2017/1/16 bought groceries ; sometag: +\f[R] .fi .PP Tags can have a value, which is the text after the colon, up to the next @@ -856,8 +859,8 @@ comma or end of line, with leading/trailing whitespace removed: .IP .nf \f[C] -\ \ \ \ expenses:food\ \ \ \ $10\ \ \ ;\ a\-posting\-tag:\ the\ tag\ value -\f[] + expenses:food $10 ; a-posting-tag: the tag value +\f[R] .fi .PP Note this means hledger\[aq]s tag values can not contain commas or @@ -867,31 +870,31 @@ comma separated: .IP .nf \f[C] -\ \ \ \ assets:checking\ \ \ \ \ \ \ ;\ a\ comment\ containing\ tag1:,\ tag2:\ some\ value\ ... -\f[] + assets:checking ; a comment containing tag1:, tag2: some value ... +\f[R] .fi .PP Here, .IP \[bu] 2 -"\f[C]a\ comment\ containing\f[]" is just comment text, not a tag +\[dq]\f[C]a comment containing\f[R]\[dq] is just comment text, not a tag .IP \[bu] 2 -"\f[C]tag1\f[]" is a tag with no value +\[dq]\f[C]tag1\f[R]\[dq] is a tag with no value .IP \[bu] 2 -"\f[C]tag2\f[]" is another tag, whose value is -"\f[C]some\ value\ ...\f[]" +\[dq]\f[C]tag2\f[R]\[dq] is another tag, whose value is +\[dq]\f[C]some value ...\f[R]\[dq] .PP 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 (\f[C]A\f[], -\f[C]TAG2\f[], \f[C]third\-tag\f[]) and the posting has four (those plus -\f[C]posting\-tag\f[]): +For example, the following transaction has three tags (\f[C]A\f[R], +\f[C]TAG2\f[R], \f[C]third-tag\f[R]) and the posting has four (those +plus \f[C]posting-tag\f[R]): .IP .nf \f[C] -1/1\ a\ transaction\ \ ;\ A:,\ TAG2: -\ \ \ \ ;\ third\-tag:\ a\ third\ transaction\ tag,\ <\-\ with\ a\ value -\ \ \ \ (a)\ \ $1\ \ ;\ posting\-tag: -\f[] +1/1 a transaction ; A:, TAG2: + ; third-tag: a third transaction tag, <- with a value + (a) $1 ; posting-tag: +\f[R] .fi .PP Tags are like Ledger\[aq]s metadata feature, except hledger\[aq]s tag @@ -924,7 +927,7 @@ can affect (as of 2018/06) T} _ T{ -\f[C]account\f[] +\f[C]account\f[R] T}@T{ T}@T{ any text @@ -934,9 +937,9 @@ T}@T{ all entries in all files, before or after T} T{ -\f[C]alias\f[] +\f[C]alias\f[R] T}@T{ -\f[C]end\ aliases\f[] +\f[C]end aliases\f[R] T}@T{ T}@T{ rewrite account names @@ -945,9 +948,9 @@ following inline/included entries until end of current file or end directive T} T{ -\f[C]apply\ account\f[] +\f[C]apply account\f[R] T}@T{ -\f[C]end\ apply\ account\f[] +\f[C]end apply account\f[R] T}@T{ T}@T{ prepend a common parent to account names @@ -956,9 +959,9 @@ following inline/included entries until end of current file or end directive T} T{ -\f[C]comment\f[] +\f[C]comment\f[R] T}@T{ -\f[C]end\ comment\f[] +\f[C]end comment\f[R] T}@T{ T}@T{ ignore part of journal @@ -967,10 +970,10 @@ following inline/included entries until end of current file or end directive T} T{ -\f[C]commodity\f[] +\f[C]commodity\f[R] T}@T{ T}@T{ -\f[C]format\f[] +\f[C]format\f[R] T}@T{ declare a commodity and its number notation & display style T}@T{ @@ -978,7 +981,7 @@ number notation: following entries in that commodity in all files; display style: amounts of that commodity in reports T} T{ -\f[C]D\f[] +\f[C]D\f[R] T}@T{ T}@T{ T}@T{ @@ -990,7 +993,7 @@ following commodityless entries and entries in that commodity in all files; display style: amounts of that commodity in reports T} T{ -\f[C]include\f[] +\f[C]include\f[R] T}@T{ T}@T{ T}@T{ @@ -999,16 +1002,16 @@ T}@T{ what the included directives affect T} T{ -\f[C]P\f[] +\f[C]P\f[R] T}@T{ T}@T{ T}@T{ declare a market price for a commodity T}@T{ -amounts of that commodity in reports, when \-V is used +amounts of that commodity in reports, when -V is used T} T{ -\f[C]Y\f[] +\f[C]Y\f[R] T}@T{ T}@T{ T}@T{ @@ -1056,7 +1059,7 @@ affect, and whether they are focussed on input (parsing) or output (reports). Some directives have multiple effects. .PP -If you have a journal made up of multiple files, or pass multiple \-f +If you have a journal made up of multiple files, or pass multiple -f options on the command line, note that directives which affect input typically last only until the end of their defining file. This provides more simplicity and predictability, eg reports are not @@ -1064,9 +1067,9 @@ changed by writing file options in a different order. It can be surprising at times though. .SS Comment blocks .PP -A line containing just \f[C]comment\f[] starts a commented region of the -file, and a line containing just \f[C]end\ comment\f[] (or the end of -the current file) ends it. +A line containing just \f[C]comment\f[R] starts a commented region of +the file, and a line containing just \f[C]end comment\f[R] (or the end +of the current file) ends it. See also comments. .SS Including other files .PP @@ -1075,75 +1078,75 @@ directive, like this: .IP .nf \f[C] -include\ path/to/file.journal -\f[] +include path/to/file.journal +\f[R] .fi .PP If the path does not begin with a slash, it is relative to the current file. The include file path may contain common glob patterns (e.g. -\f[C]*\f[]). +\f[C]*\f[R]). .PP -The \f[C]include\f[] directive can only be used in journal files. +The \f[C]include\f[R] directive can only be used in journal files. It can include journal, timeclock or timedot files, but not CSV files. .SS Default year .PP You can set a default year to be used for subsequent dates which don\[aq]t specify a year. -This is a line beginning with \f[C]Y\f[] followed by the year. +This is a line beginning with \f[C]Y\f[R] followed by the year. Eg: .IP .nf \f[C] -Y2009\ \ \ \ \ \ ;\ set\ default\ year\ to\ 2009 +Y2009 ; set default year to 2009 -12/15\ \ \ \ \ \ ;\ equivalent\ to\ 2009/12/15 -\ \ expenses\ \ 1 -\ \ assets +12/15 ; equivalent to 2009/12/15 + expenses 1 + assets -Y2010\ \ \ \ \ \ ;\ change\ default\ year\ to\ 2010 +Y2010 ; change default year to 2010 -2009/1/30\ \ ;\ specifies\ the\ year,\ not\ affected -\ \ expenses\ \ 1 -\ \ assets +2009/1/30 ; specifies the year, not affected + expenses 1 + assets -1/31\ \ \ \ \ \ \ ;\ equivalent\ to\ 2010/1/31 -\ \ expenses\ \ 1 -\ \ assets -\f[] +1/31 ; equivalent to 2010/1/31 + expenses 1 + assets +\f[R] .fi .SS Declaring commodities .PP -The \f[C]commodity\f[] directive declares commodities which may be used +The \f[C]commodity\f[R] directive declares commodities which may be used in the journal (though currently we do not enforce this). It may be written on a single line, like this: .IP .nf \f[C] -;\ commodity\ EXAMPLEAMOUNT +; commodity EXAMPLEAMOUNT -;\ display\ AAAA\ amounts\ with\ the\ symbol\ on\ the\ right,\ space\-separated, -;\ using\ period\ as\ decimal\ point,\ with\ four\ decimal\ places,\ and -;\ separating\ thousands\ with\ comma. -commodity\ 1,000.0000\ AAAA -\f[] +; display AAAA amounts with the symbol on the right, space-separated, +; using period as decimal point, with four decimal places, and +; separating thousands with comma. +commodity 1,000.0000 AAAA +\f[R] .fi .PP -or on multiple lines, using the "format" subdirective. +or on multiple lines, using the \[dq]format\[dq] subdirective. In this case the commodity symbol appears twice and should be the same in both places: .IP .nf \f[C] -;\ commodity\ SYMBOL -;\ \ \ format\ EXAMPLEAMOUNT +; commodity SYMBOL +; format EXAMPLEAMOUNT -;\ display\ indian\ rupees\ with\ currency\ name\ on\ the\ left, -;\ thousands,\ lakhs\ and\ crores\ comma\-separated, -;\ period\ as\ decimal\ point,\ and\ two\ decimal\ places. -commodity\ INR -\ \ format\ INR\ 9,99,99,999.00 -\f[] +; display indian rupees with currency name on the left, +; thousands, lakhs and crores comma-separated, +; period as decimal point, and two decimal places. +commodity INR + format INR 9,99,99,999.00 +\f[R] .fi .PP Commodity directives have a second purpose: they define the standard @@ -1156,40 +1159,40 @@ with a decimal point (a period or comma, followed by 0 or more decimal digits). .SS Default commodity .PP -The \f[C]D\f[] directive sets a default commodity (and display format), +The \f[C]D\f[R] directive sets a default commodity (and display format), to be used for amounts without a commodity symbol (ie, plain numbers). (Note this differs from Ledger\[aq]s default commodity directive.) The commodity and display format will be applied to all subsequent -commodity\-less amounts, or until the next \f[C]D\f[] directive. +commodity-less amounts, or until the next \f[C]D\f[R] directive. .IP .nf \f[C] -#\ commodity\-less\ amounts\ should\ be\ treated\ as\ dollars -#\ (and\ displayed\ with\ symbol\ on\ the\ left,\ thousands\ separators\ and\ two\ decimal\ places) -D\ $1,000.00 +# commodity-less amounts should be treated as dollars +# (and displayed with symbol on the left, thousands separators and two decimal places) +D $1,000.00 1/1 -\ \ a\ \ \ \ \ 5\ \ \ \ ;\ <\-\ commodity\-less\ amount,\ becomes\ $1 -\ \ b -\f[] + a 5 ; <- commodity-less amount, becomes $1 + b +\f[R] .fi .PP -As with the \f[C]commodity\f[] directive, the amount must always be +As with the \f[C]commodity\f[R] directive, the amount must always be written with a decimal point. .SS Market prices .PP -The \f[C]P\f[] directive declares a market price, which is an exchange +The \f[C]P\f[R] directive declares a market price, which is an exchange rate between 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. +(In Ledger, they are called \[dq]historical prices\[dq].) These are +often obtained from a stock exchange, cryptocurrency exchange, or the +foreign exchange market. .PP Here is the format: .IP .nf \f[C] -P\ DATE\ COMMODITYA\ COMMODITYBAMOUNT -\f[] +P DATE COMMODITYA COMMODITYBAMOUNT +\f[R] .fi .IP \[bu] 2 DATE is a simple date @@ -1204,16 +1207,16 @@ dollars during 2009, and $1.40 from 2010 onward: .IP .nf \f[C] -P\ 2009/1/1\ €\ $1.35 -P\ 2010/1/1\ €\ $1.40 -\f[] +P 2009/1/1 \[Eu] $1.35 +P 2010/1/1 \[Eu] $1.40 +\f[R] .fi .PP -The \f[C]\-V/\-\-value\f[] flag can be used to convert reported amounts -to another commodity using these prices. +The \f[C]-V/--value\f[R] flag can be used to convert reported amounts to +another commodity using these prices. .SS Declaring accounts .PP -\f[C]account\f[] directives can be used to pre\-declare accounts. +\f[C]account\f[R] directives can be used to pre-declare accounts. Though not required, they can provide several benefits: .IP \[bu] 2 They can document your intended chart of accounts, providing a @@ -1226,19 +1229,19 @@ They can help hledger know your accounts\[aq] types (asset, liability, equity, revenue, expense), useful for reports like balancesheet and incomestatement. .IP \[bu] 2 -They control account display order in reports, allowing non\-alphabetic +They control account display order in reports, allowing non-alphabetic sorting (eg Revenues to appear above Expenses). .IP \[bu] 2 -They help with account name completion in the add command, -hledger\-iadd, hledger\-web, ledger\-mode etc. +They help with account name completion in the add command, hledger-iadd, +hledger-web, ledger-mode etc. .PP -The simplest form is just the word \f[C]account\f[] followed by a -hledger\-style account name, eg: +The simplest form is just the word \f[C]account\f[R] followed by a +hledger-style account name, eg: .IP .nf \f[C] -account\ assets:bank:checking -\f[] +account assets:bank:checking +\f[R] .fi .SS Account comments .PP @@ -1248,10 +1251,10 @@ Eg: .IP .nf \f[C] -account\ assets:bank:checking\ \ ;\ a\ comment -\ \ ;\ another\ comment -\ \ ;\ acctno:12345,\ a\ tag -\f[] +account assets:bank:checking ; a comment + ; another comment + ; acctno:12345, a tag +\f[R] .fi .PP Tip: comments on the same line require hledger 1.12+. @@ -1259,53 +1262,53 @@ If you need your journal to be compatible with older hledger versions, write comments on the next line instead. .SS Account subdirectives .PP -We also allow (and ignore) Ledger\-style indented subdirectives, just -for compatibility.: +We also allow (and ignore) Ledger-style indented subdirectives, just for +compatibility.: .IP .nf \f[C] -account\ assets:bank:checking -\ \ format\ blah\ blah\ \ ;\ <\-\ subdirective,\ ignored -\f[] +account assets:bank:checking + format blah blah ; <- subdirective, ignored +\f[R] .fi .PP Here is the full syntax of account directives: .IP .nf \f[C] -account\ ACCTNAME\ \ [ACCTTYPE]\ [;COMMENT] -\ \ [;COMMENTS] -\ \ [LEDGER\-STYLE\ SUBDIRECTIVES,\ IGNORED] -\f[] +account ACCTNAME [ACCTTYPE] [;COMMENT] + [;COMMENTS] + [LEDGER-STYLE SUBDIRECTIVES, IGNORED] +\f[R] .fi .SS Account types .PP hledger recognises five types (or classes) of account: Asset, Liability, Equity, Revenue, Expense. -This is used by a few accounting\-aware reports such as balancesheet, +This is used by a few accounting-aware reports such as balancesheet, incomestatement and cashflow. -.SS Auto\-detected account types +.SS Auto-detected account types .PP -If you name your top\-level accounts with some variation of -\f[C]assets\f[], \f[C]liabilities\f[]/\f[C]debts\f[], \f[C]equity\f[], -\f[C]revenues\f[]/\f[C]income\f[], or \f[C]expenses\f[], their types are -detected automatically. +If you name your top-level accounts with some variation of +\f[C]assets\f[R], \f[C]liabilities\f[R]/\f[C]debts\f[R], +\f[C]equity\f[R], \f[C]revenues\f[R]/\f[C]income\f[R], or +\f[C]expenses\f[R], their types are detected automatically. .SS Account types declared with tags .PP More generally, you can declare an account\[aq]s type with an account -directive, by writing a \f[C]type:\f[] tag in a comment, followed by one -of the words \f[C]Asset\f[], \f[C]Liability\f[], \f[C]Equity\f[], -\f[C]Revenue\f[], \f[C]Expense\f[], or one of the letters \f[C]ALERX\f[] -(case insensitive): +directive, by writing a \f[C]type:\f[R] tag in a comment, followed by +one of the words \f[C]Asset\f[R], \f[C]Liability\f[R], \f[C]Equity\f[R], +\f[C]Revenue\f[R], \f[C]Expense\f[R], or one of the letters +\f[C]ALERX\f[R] (case insensitive): .IP .nf \f[C] -account\ assets\ \ \ \ \ \ \ ;\ type:Asset -account\ liabilities\ \ ;\ type:Liability -account\ equity\ \ \ \ \ \ \ ;\ type:Equity -account\ revenues\ \ \ \ \ ;\ type:Revenue -account\ expenses\ \ \ \ \ ;\ type:Expenses -\f[] +account assets ; type:Asset +account liabilities ; type:Liability +account equity ; type:Equity +account revenues ; type:Revenue +account expenses ; type:Expenses +\f[R] .fi .SS Account types declared with account type codes .PP @@ -1315,45 +1318,45 @@ as of hledger 1.13: .IP .nf \f[C] -account\ assets\ \ \ \ \ \ \ A -account\ liabilities\ \ L -account\ equity\ \ \ \ \ \ \ E -account\ revenues\ \ \ \ \ R -account\ expenses\ \ \ \ \ X -\f[] +account assets A +account liabilities L +account equity E +account revenues R +account expenses X +\f[R] .fi -.SS Overriding auto\-detected types +.SS Overriding auto-detected types .PP -If you ever override the types of those auto\-detected english account +If you ever override the types of those auto-detected english account names mentioned above, you might need to help the reports a bit. Eg: .IP .nf \f[C] -;\ make\ "liabilities"\ not\ have\ the\ liability\ type\ \-\ who\ knows\ why -account\ liabilities\ \ \ ;\ type:E +; make \[dq]liabilities\[dq] not have the liability type - who knows why +account liabilities ; type:E -;\ we\ need\ to\ ensure\ some\ other\ account\ has\ the\ liability\ type,\ -;\ otherwise\ balancesheet\ would\ still\ show\ "liabilities"\ under\ Liabilities\ -account\ \-\ \ \ \ \ \ \ \ \ \ \ \ \ ;\ type:L -\f[] +; we need to ensure some other account has the liability type, +; otherwise balancesheet would still show \[dq]liabilities\[dq] under Liabilities +account - ; type:L +\f[R] .fi .SS Account display order .PP Account directives also set the order in which accounts are displayed, -eg in reports, the hledger\-ui accounts screen, and the hledger\-web +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: .IP .nf \f[C] -account\ assets -account\ liabilities -account\ equity -account\ revenues -account\ expenses -\f[] +account assets +account liabilities +account equity +account revenues +account expenses +\f[R] .fi .PP you\[aq]ll see those accounts displayed in declaration order, not @@ -1361,13 +1364,13 @@ alphabetically: .IP .nf \f[C] -$\ hledger\ accounts\ \-1 +$ hledger accounts -1 assets liabilities equity revenues expenses -\f[] +\f[R] .fi .PP Undeclared accounts, if any, are displayed last, in alphabetical order. @@ -1378,18 +1381,18 @@ And currently, this directive: .IP .nf \f[C] -account\ other:zoo -\f[] +account other:zoo +\f[R] .fi .PP -would influence the position of \f[C]zoo\f[] among \f[C]other\f[]\[aq]s -subaccounts, but not the position of \f[C]other\f[] among the top\-level -accounts. -This means: \- you will sometimes declare parent accounts (eg -\f[C]account\ other\f[] above) that you don\[aq]t intend to post to, -just to customize their display order \- sibling accounts stay together -(you couldn\[aq]t display \f[C]x:y\f[] in between \f[C]a:b\f[] and -\f[C]a:c\f[]). +would influence the position of \f[C]zoo\f[R] among +\f[C]other\f[R]\[aq]s subaccounts, but not the position of +\f[C]other\f[R] among the top-level accounts. +This means: - you will sometimes declare parent accounts (eg +\f[C]account other\f[R] above) that you don\[aq]t intend to post to, +just to customize their display order - sibling accounts stay together +(you couldn\[aq]t display \f[C]x:y\f[R] in between \f[C]a:b\f[R] and +\f[C]a:c\f[R]). .SS Rewriting accounts .PP You can define account alias rules which rewrite your account names, or @@ -1408,12 +1411,12 @@ customising reports .PP Account aliases also rewrite account names in account directives. They do not affect account names being entered via hledger add or -hledger\-web. +hledger-web. .PP See also Cookbook: Rewrite account names. .SS Basic aliases .PP -To set an account alias, use the \f[C]alias\f[] directive in your +To set an account alias, use the \f[C]alias\f[R] directive in your journal file. This affects all subsequent journal entries in the current file or its included files. @@ -1421,11 +1424,11 @@ The spaces around the = are optional: .IP .nf \f[C] -alias\ OLD\ =\ NEW -\f[] +alias OLD = NEW +\f[R] .fi .PP -Or, you can use the \f[C]\-\-alias\ \[aq]OLD=NEW\[aq]\f[] option on the +Or, you can use the \f[C]--alias \[aq]OLD=NEW\[aq]\f[R] option on the command line. This affects all entries. It\[aq]s useful for trying out aliases interactively. @@ -1438,9 +1441,9 @@ Eg: .IP .nf \f[C] -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" -\f[] +alias checking = assets:bank:wells fargo:checking +# rewrites \[dq]checking\[dq] to \[dq]assets:bank:wells fargo:checking\[dq], or \[dq]checking:a\[dq] to \[dq]assets:bank:wells fargo:checking:a\[dq] +\f[R] .fi .SS Regex aliases .PP @@ -1449,13 +1452,13 @@ indicated by the forward slashes: .IP .nf \f[C] -alias\ /REGEX/\ =\ REPLACEMENT -\f[] +alias /REGEX/ = REPLACEMENT +\f[R] .fi .PP -or \f[C]\-\-alias\ \[aq]/REGEX/=REPLACEMENT\[aq]\f[]. +or \f[C]--alias \[aq]/REGEX/=REPLACEMENT\[aq]\f[R]. .PP -REGEX is a case\-insensitive regular expression. +REGEX is a case-insensitive regular expression. Anywhere it matches inside an account name, the matched part will be replaced by REPLACEMENT. If REGEX contains parenthesised match groups, these can be referenced by @@ -1464,9 +1467,9 @@ Eg: .IP .nf \f[C] -alias\ /^(.+):bank:([^:]+)(.*)/\ =\ \\1:\\2\ \\3 -#\ rewrites\ "assets:bank:wells\ fargo:checking"\ to\ \ "assets:wells\ fargo\ checking" -\f[] +alias /\[ha](.+):bank:([\[ha]:]+)(.*)/ = \[rs]1:\[rs]2 \[rs]3 +# rewrites \[dq]assets:bank:wells fargo:checking\[dq] to \[dq]assets:wells fargo checking\[dq] +\f[R] .fi .PP Also note that REPLACEMENT continues to the end of line (or on command @@ -1474,10 +1477,10 @@ line, to end of option argument), so it can contain trailing whitespace. .SS Multiple aliases .PP You can define as many aliases as you like using directives or -command\-line options. -Aliases are recursive \- each alias sees the result of applying previous +command-line options. +Aliases are recursive - each alias sees the result of applying previous ones. -(This is different from Ledger, where aliases are non\-recursive by +(This is different from Ledger, where aliases are non-recursive by default). Aliases are applied in the following order: .IP "1." 3 @@ -1485,33 +1488,33 @@ alias directives, most recently seen first (recent directives take precedence over earlier ones; directives not yet seen are ignored) .IP "2." 3 alias options, in the order they appear on the command line -.SS \f[C]end\ aliases\f[] +.SS \f[C]end aliases\f[R] .PP You can clear (forget) all currently defined aliases with the -\f[C]end\ aliases\f[] directive: +\f[C]end aliases\f[R] directive: .IP .nf \f[C] -end\ aliases -\f[] +end aliases +\f[R] .fi .SS Default parent account .PP You can specify a parent account which will be prepended to all accounts within a section of the journal. -Use the \f[C]apply\ account\f[] and \f[C]end\ apply\ account\f[] +Use the \f[C]apply account\f[R] and \f[C]end apply account\f[R] directives like so: .IP .nf \f[C] -apply\ account\ home +apply account home 2010/1/1 -\ \ \ \ food\ \ \ \ $10 -\ \ \ \ cash + food $10 + cash -end\ apply\ account -\f[] +end apply account +\f[R] .fi .PP which is equivalent to: @@ -1519,31 +1522,31 @@ which is equivalent to: .nf \f[C] 2010/01/01 -\ \ \ \ home:food\ \ \ \ \ \ \ \ \ \ \ $10 -\ \ \ \ home:cash\ \ \ \ \ \ \ \ \ \ $\-10 -\f[] + home:food $10 + home:cash $-10 +\f[R] .fi .PP -If \f[C]end\ apply\ account\f[] is omitted, the effect lasts to the end +If \f[C]end apply account\f[R] is omitted, the effect lasts to the end of the file. Included files are also affected, eg: .IP .nf \f[C] -apply\ account\ business -include\ biz.journal -end\ apply\ account -apply\ account\ personal -include\ personal.journal -\f[] +apply account business +include biz.journal +end apply account +apply account personal +include personal.journal +\f[R] .fi .PP -Prior to hledger 1.0, legacy \f[C]account\f[] and \f[C]end\f[] spellings -were also supported. +Prior to hledger 1.0, legacy \f[C]account\f[R] and \f[C]end\f[R] +spellings were also supported. .PP A default parent account also affects account directives. It does not affect account names being entered via hledger add or -hledger\-web. +hledger-web. If account aliases are present, they are applied after the default parent account. .SS Periodic transactions @@ -1551,26 +1554,27 @@ parent account. Periodic transaction rules describe transactions that recur. They allow you to generate future transactions for forecasting, without having to write them out explicitly in the journal (with -\f[C]\-\-forecast\f[]). +\f[C]--forecast\f[R]). Secondly, they also can be used to define budget goals (with -\f[C]\-\-budget\f[]). +\f[C]--budget\f[R]). .PP A periodic transaction rule looks like a normal journal entry, with the -date replaced by a tilde (\f[C]~\f[]) followed by a period expression -(mnemonic: \f[C]~\f[] looks like a recurring sine wave.): +date replaced by a tilde (\f[C]\[ti]\f[R]) followed by a period +expression (mnemonic: \f[C]\[ti]\f[R] looks like a recurring sine +wave.): .IP .nf \f[C] -~\ monthly -\ \ \ \ expenses:rent\ \ \ \ \ \ \ \ \ \ $2000 -\ \ \ \ assets:bank:checking -\f[] +\[ti] monthly + expenses:rent $2000 + assets:bank:checking +\f[R] .fi .PP There is an additional constraint on the period expression: the start date must fall on a natural boundary of the interval. -Eg \f[C]monthly\ from\ 2018/1/1\f[] is valid, but -\f[C]monthly\ from\ 2018/1/15\f[] is not. +Eg \f[C]monthly from 2018/1/1\f[R] is valid, but +\f[C]monthly from 2018/1/15\f[R] is not. .PP Partial or relative dates (M/D, D, tomorrow, last week) in the period expression can work (useful or not). @@ -1579,28 +1583,28 @@ directive is in effect, in which case they will be relative to Y/1/1. .SS Two spaces after the period expression .PP If the period expression is followed by a transaction description, these -must be separated by \f[B]two or more spaces\f[]. +must be separated by \f[B]two or more spaces\f[R]. This helps hledger know where the period expression ends, so that descriptions can not accidentally alter their meaning, as in this example: .IP .nf \f[C] -;\ 2\ or\ more\ spaces\ needed\ here,\ so\ the\ period\ is\ not\ understood\ as\ "every\ 2\ months\ in\ 2020" -;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ || -;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vv -~\ every\ 2\ months\ \ in\ 2020,\ we\ will\ review -\ \ \ \ assets:bank:checking\ \ \ $1500 -\ \ \ \ income:acme\ inc -\f[] +; 2 or more spaces needed here, so the period is not understood as \[dq]every 2 months in 2020\[dq] +; || +; vv +\[ti] every 2 months in 2020, we will review + assets:bank:checking $1500 + income:acme inc +\f[R] .fi .SS Forecasting with periodic transactions .PP -With the \f[C]\-\-forecast\f[] flag, each periodic transaction rule +With the \f[C]--forecast\f[R] flag, each periodic transaction rule generates future transactions recurring at the specified interval. These are not saved in the journal, but appear in all reports. They will look like normal transactions, but with an extra tag named -\f[C]recur\f[], whose value is the generating period expression. +\f[C]recur\f[R], whose value is the generating period expression. .PP Forecast transactions start on the first occurrence, and end on the last occurrence, of their interval within the forecast period. @@ -1609,18 +1613,18 @@ The forecast period: begins on the later of .RS 2 .IP \[bu] 2 -the report start date if specified with \-b/\-p/date: +the report start date if specified with -b/-p/date: .IP \[bu] 2 -the day after the latest normal (non\-periodic) transaction in the +the day after the latest normal (non-periodic) transaction in the journal, or today if there are no normal transactions. .RE .IP \[bu] 2 -ends on the report end date if specified with \-e/\-p/date:, or 180 days +ends on the report end date if specified with -e/-p/date:, or 180 days from today. .PP -where "today" means the current date at report time. -The "later of" rule ensures that forecast transactions do not overlap -normal transactions in time; they will begin only after normal +where \[dq]today\[dq] means the current date at report time. +The \[dq]later of\[dq] rule ensures that forecast transactions do not +overlap normal transactions in time; they will begin only after normal transactions end. .PP Forecasting can be useful for estimating balances into the future, and @@ -1630,15 +1634,15 @@ automatically replaced by normal transactions as you add those. .PP Forecasting can also help with data entry: describe most of your transactions with periodic rules, and every so often copy the output of -\f[C]print\ \-\-forecast\f[] to the journal. +\f[C]print --forecast\f[R] to the journal. .PP -You can generate one\-time transactions too: just write a period +You can generate one-time transactions too: just write a period expression specifying a date with no report interval. (You could also write a normal transaction with a future date, but remember this disables forecast transactions on previous dates.) .SS Budgeting with periodic transactions .PP -With the \f[C]\-\-budget\f[] flag, currently supported by the balance +With the \f[C]--budget\f[R] 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 @@ -1648,87 +1652,91 @@ Goals and actual performance can then be compared in budget reports. For more details, see: balance: Budget report and Cookbook: Budgeting and Forecasting. .PP -.SS Transaction modifiers +.SS Auto postings / transaction modifiers .PP -Transaction modifier rules describe changes that should be applied -automatically to certain transactions. -They can be enabled by using the \f[C]\-\-auto\f[] flag. -Currently, just one kind of change is possible: adding extra postings. -These rule\-generated postings are known as "automated postings" or -"auto postings". +Transaction modifier rules describe changes to be applied automatically +to certain matched transactions. +Currently just one kind of change is possible - adding extra postings, +which we call \[dq]automated postings\[dq] or just \[dq]auto +postings\[dq]. +These rules become active when you use the \f[C]--auto\f[R] flag. .PP -A transaction modifier rule looks quite like a normal transaction, -except the first line is an equals sign followed by a query that matches -certain postings (mnemonic: \f[C]=\f[] suggests matching). -And each "posting" is actually a posting\-generating rule: +A transaction modifier, AKA auto posting rule, looks much like a normal +transaction except the first line is an equals sign followed by a query +that matches certain postings (mnemonic: \f[C]=\f[R] suggests matching). +And each \[dq]posting\[dq] is actually a posting-generating rule: .IP .nf \f[C] -=\ QUERY -\ \ \ \ ACCT\ \ AMT -\ \ \ \ ACCT\ \ [AMT] -\ \ \ \ ... -\f[] += QUERY + ACCT AMT + ACCT [AMT] + ... +\f[R] .fi .PP -These posting rules look like normal postings, except the amount can be: +These posting-generating rules look like normal postings, except the +amount can be: .IP \[bu] 2 -a normal amount with a commodity symbol, eg \f[C]$2\f[]. -This will be used as\-is. +a normal amount with a commodity symbol, eg \f[C]$2\f[R]. +This will be used as-is. .IP \[bu] 2 -a number, eg \f[C]2\f[]. +a number, eg \f[C]2\f[R]. The commodity symbol (if any) from the matched posting will be added to this. .IP \[bu] 2 -a numeric multiplier, eg \f[C]*2\f[] (a star followed by a number N). +a numeric multiplier, eg \f[C]*2\f[R] (a star followed by a number N). The matched posting\[aq]s amount (and total price, if any) will be multiplied by N. .IP \[bu] 2 -a multiplier with a commodity symbol, eg \f[C]*$2\f[] (a star, number N, -and symbol S). +a multiplier with a commodity symbol, eg \f[C]*$2\f[R] (a star, number +N, and symbol S). The matched posting\[aq]s amount will be multiplied by N, and its commodity symbol will be replaced with S. .PP +These rules have global effect - a rule appearing anywhere in your data +can potentially affect any transaction, including transactions recorded +above it or in another file. +.PP Some examples: .IP .nf \f[C] -;\ every\ time\ I\ buy\ food,\ schedule\ a\ dollar\ donation -=\ expenses:food -\ \ \ \ (liabilities:charity)\ \ \ $\-1 +; every time I buy food, schedule a dollar donation += expenses:food + (liabilities:charity) $-1 -;\ when\ I\ buy\ a\ gift,\ also\ deduct\ that\ amount\ from\ a\ budget\ envelope\ subaccount -=\ expenses:gifts -\ \ \ \ assets:checking:gifts\ \ *\-1 -\ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ *1 +; when I buy a gift, also deduct that amount from a budget envelope subaccount += expenses:gifts + assets:checking:gifts *-1 + assets:checking *1 2017/12/1 -\ \ expenses:food\ \ \ \ $10 -\ \ assets:checking + expenses:food $10 + assets:checking 2017/12/14 -\ \ expenses:gifts\ \ \ $20 -\ \ assets:checking -\f[] + expenses:gifts $20 + assets:checking +\f[R] .fi .IP .nf \f[C] -$\ hledger\ print\ \-\-auto +$ hledger print --auto 2017/12/01 -\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ $10 -\ \ \ \ assets:checking -\ \ \ \ (liabilities:charity)\ \ \ \ \ \ $\-1 + expenses:food $10 + assets:checking + (liabilities:charity) $-1 2017/12/14 -\ \ \ \ expenses:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ $20 -\ \ \ \ assets:checking -\ \ \ \ assets:checking:gifts\ \ \ \ \ \-$20 -\ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ $20 -\f[] + expenses:gifts $20 + assets:checking + assets:checking:gifts -$20 + assets:checking $20 +\f[R] .fi -.SS Auto postings and transaction balancing / inferred amounts / balance -assertions +.SS Auto postings and transaction balancing / inferred amounts / balance assertions .PP Currently, transaction modifiers are applied / auto postings are added: .IP \[bu] 2 @@ -1746,8 +1754,8 @@ Helper modes exist for popular text editors, which make working with journal files easier. They add colour, formatting, tab completion, and helpful commands, and are quite recommended if you edit your journal with a text editor. -They include ledger\-mode or hledger\-mode for Emacs, vim\-ledger for -Vim, hledger\-vscode for Visual Studio Code, and others. +They include ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, +hledger-vscode for Visual Studio Code, and others. See the [[Cookbook]] at hledger.org for the latest information. diff --git a/hledger-lib/hledger_journal.info b/hledger-lib/hledger_journal.info index 5e31f14c0..c774cc0cd 100644 --- a/hledger-lib/hledger_journal.info +++ b/hledger-lib/hledger_journal.info @@ -4,8 +4,8 @@ stdin.  File: hledger_journal.info, Node: Top, Next: FILE FORMAT, Up: (dir) -hledger_journal(5) hledger 1.14 -******************************* +hledger_journal(5) hledger 1.14.99 +********************************** hledger's usual data source is a plain text file containing journal entries in hledger journal format. This file represents a standard @@ -82,7 +82,7 @@ File: hledger_journal.info, Node: FILE FORMAT, Next: EDITOR SUPPORT, Prev: To * Tags:: * Directives:: * Periodic transactions:: -* Transaction modifiers:: +* Auto postings / transaction modifiers::  File: hledger_journal.info, Node: Transactions, Next: Postings, Up: FILE FORMAT @@ -296,6 +296,7 @@ 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 comments. + * Menu: * Payee and note:: @@ -467,6 +468,7 @@ can protect 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. + * Menu: * Assertions and ordering:: @@ -655,6 +657,7 @@ of the commodity to that account since the last balance assertion or assignment). 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. + * Menu: * Balance assignments and prices:: @@ -914,6 +917,7 @@ typically last only until the end of their defining file. This provides more simplicity and predictability, eg reports are not changed by writing file options in a different order. It can be surprising at times though. + * Menu: * Comment blocks:: @@ -1248,6 +1252,7 @@ They do not affect account names being entered via hledger add or hledger-web. See also Cookbook: Rewrite account names. + * Menu: * Basic aliases:: @@ -1372,7 +1377,7 @@ If account aliases are present, they are applied after the default parent account.  -File: hledger_journal.info, Node: Periodic transactions, Next: Transaction modifiers, Prev: Directives, Up: FILE FORMAT +File: hledger_journal.info, Node: Periodic transactions, Next: Auto postings / transaction modifiers, Prev: Directives, Up: FILE FORMAT 1.15 Periodic transactions ========================== @@ -1398,6 +1403,7 @@ date must fall on a natural boundary of the interval. Eg 'monthly from 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. + * Menu: * Two spaces after the period expression:: @@ -1482,29 +1488,29 @@ compared in budget reports. and Forecasting.  -File: hledger_journal.info, Node: Transaction modifiers, Prev: Periodic transactions, Up: FILE FORMAT +File: hledger_journal.info, Node: Auto postings / transaction modifiers, Prev: Periodic transactions, Up: FILE FORMAT -1.16 Transaction modifiers -========================== +1.16 Auto postings / transaction modifiers +========================================== -Transaction modifier rules describe changes that should be applied -automatically to certain transactions. They can be enabled by using the -'--auto' flag. Currently, just one kind of change is possible: adding -extra postings. These rule-generated postings are known as "automated -postings" or "auto postings". +Transaction modifier rules describe changes to be applied automatically +to certain matched transactions. Currently just one kind of change is +possible - adding extra postings, which we call "automated postings" or +just "auto postings". These rules become active when you use the +'--auto' flag. - A transaction modifier rule looks quite like a normal transaction, -except the first line is an equals sign followed by a query that matches -certain postings (mnemonic: '=' suggests matching). And each "posting" -is actually a posting-generating rule: + A transaction modifier, AKA auto posting rule, looks much like a +normal transaction except the first line is an equals sign followed by a +query that matches certain postings (mnemonic: '=' suggests matching). +And each "posting" is actually a posting-generating rule: = QUERY ACCT AMT ACCT [AMT] ... - These posting rules look like normal postings, except the amount can -be: + These posting-generating rules look like normal postings, except the +amount can be: * a normal amount with a commodity symbol, eg '$2'. This will be used as-is. @@ -1517,6 +1523,10 @@ be: and symbol S). The matched posting's amount will be multiplied by N, and its commodity symbol will be replaced with S. + These rules have global effect - a rule appearing anywhere in your +data can potentially affect any transaction, including transactions +recorded above it or in another file. + Some examples: ; every time I buy food, schedule a dollar donation @@ -1553,7 +1563,7 @@ $ hledger print --auto * Auto postings and transaction balancing / inferred amounts / balance assertions::  -File: hledger_journal.info, Node: Auto postings and transaction balancing / inferred amounts / balance assertions, Up: Transaction modifiers +File: hledger_journal.info, Node: Auto postings and transaction balancing / inferred amounts / balance assertions, Up: Auto postings / transaction modifiers 1.16.1 Auto postings and transaction balancing / inferred amounts / ------------------------------------------------------------------- @@ -1585,109 +1595,109 @@ See the [[Cookbook]] at hledger.org for the latest information.  Tag Table: Node: Top76 -Node: FILE FORMAT2372 -Ref: #file-format2496 -Node: Transactions2783 -Ref: #transactions2904 -Node: Postings3588 -Ref: #postings3715 -Node: Dates4710 -Ref: #dates4825 -Node: Simple dates4890 -Ref: #simple-dates5016 -Node: Secondary dates5382 -Ref: #secondary-dates5536 -Node: Posting dates7099 -Ref: #posting-dates7228 -Node: Status8602 -Ref: #status8722 -Node: Description10430 -Ref: #description10568 -Node: Payee and note10887 -Ref: #payee-and-note11001 -Node: Account names11243 -Ref: #account-names11386 -Node: Amounts11873 -Ref: #amounts12009 -Node: Virtual Postings15026 -Ref: #virtual-postings15185 -Node: Balance Assertions16405 -Ref: #balance-assertions16580 -Node: Assertions and ordering17538 -Ref: #assertions-and-ordering17724 -Node: Assertions and included files18424 -Ref: #assertions-and-included-files18665 -Node: Assertions and multiple -f options18998 -Ref: #assertions-and-multiple--f-options19252 -Node: Assertions and commodities19384 -Ref: #assertions-and-commodities19614 -Node: Assertions and prices20770 -Ref: #assertions-and-prices20982 -Node: Assertions and subaccounts21422 -Ref: #assertions-and-subaccounts21649 -Node: Assertions and virtual postings21973 -Ref: #assertions-and-virtual-postings22213 -Node: Assertions and precision22355 -Ref: #assertions-and-precision22546 -Node: Balance Assignments22813 -Ref: #balance-assignments22994 -Node: Balance assignments and prices24158 -Ref: #balance-assignments-and-prices24330 -Node: Transaction prices24554 -Ref: #transaction-prices24723 -Node: Comments26991 -Ref: #comments27125 -Node: Tags28295 -Ref: #tags28413 -Node: Directives29815 -Ref: #directives29958 -Node: Comment blocks35565 -Ref: #comment-blocks35710 -Node: Including other files35886 -Ref: #including-other-files36066 -Node: Default year36474 -Ref: #default-year36643 -Node: Declaring commodities37066 -Ref: #declaring-commodities37249 -Node: Default commodity38476 -Ref: #default-commodity38652 -Node: Market prices39288 -Ref: #market-prices39453 -Node: Declaring accounts40294 -Ref: #declaring-accounts40470 -Node: Account comments41395 -Ref: #account-comments41558 -Node: Account subdirectives41953 -Ref: #account-subdirectives42148 -Node: Account types42461 -Ref: #account-types42645 -Node: Account display order44289 -Ref: #account-display-order44459 -Node: Rewriting accounts45588 -Ref: #rewriting-accounts45773 -Node: Basic aliases46507 -Ref: #basic-aliases46653 -Node: Regex aliases47357 -Ref: #regex-aliases47528 -Node: Multiple aliases48246 -Ref: #multiple-aliases48421 -Node: end aliases48919 -Ref: #end-aliases49066 -Node: Default parent account49167 -Ref: #default-parent-account49333 -Node: Periodic transactions50217 -Ref: #periodic-transactions50399 -Node: Two spaces after the period expression51524 -Ref: #two-spaces-after-the-period-expression51769 -Node: Forecasting with periodic transactions52254 -Ref: #forecasting-with-periodic-transactions52544 -Node: Budgeting with periodic transactions54231 -Ref: #budgeting-with-periodic-transactions54470 -Node: Transaction modifiers54929 -Ref: #transaction-modifiers55092 -Node: Auto postings and transaction balancing / inferred amounts / balance assertions57076 -Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions57377 -Node: EDITOR SUPPORT57755 -Ref: #editor-support57873 +Node: FILE FORMAT2378 +Ref: #file-format2502 +Node: Transactions2805 +Ref: #transactions2926 +Node: Postings3610 +Ref: #postings3737 +Node: Dates4732 +Ref: #dates4847 +Node: Simple dates4912 +Ref: #simple-dates5038 +Node: Secondary dates5404 +Ref: #secondary-dates5558 +Node: Posting dates7121 +Ref: #posting-dates7250 +Node: Status8624 +Ref: #status8744 +Node: Description10452 +Ref: #description10590 +Node: Payee and note10910 +Ref: #payee-and-note11024 +Node: Account names11266 +Ref: #account-names11409 +Node: Amounts11896 +Ref: #amounts12032 +Node: Virtual Postings15049 +Ref: #virtual-postings15208 +Node: Balance Assertions16428 +Ref: #balance-assertions16603 +Node: Assertions and ordering17562 +Ref: #assertions-and-ordering17748 +Node: Assertions and included files18448 +Ref: #assertions-and-included-files18689 +Node: Assertions and multiple -f options19022 +Ref: #assertions-and-multiple--f-options19276 +Node: Assertions and commodities19408 +Ref: #assertions-and-commodities19638 +Node: Assertions and prices20794 +Ref: #assertions-and-prices21006 +Node: Assertions and subaccounts21446 +Ref: #assertions-and-subaccounts21673 +Node: Assertions and virtual postings21997 +Ref: #assertions-and-virtual-postings22237 +Node: Assertions and precision22379 +Ref: #assertions-and-precision22570 +Node: Balance Assignments22837 +Ref: #balance-assignments23018 +Node: Balance assignments and prices24183 +Ref: #balance-assignments-and-prices24355 +Node: Transaction prices24579 +Ref: #transaction-prices24748 +Node: Comments27016 +Ref: #comments27150 +Node: Tags28320 +Ref: #tags28438 +Node: Directives29840 +Ref: #directives29983 +Node: Comment blocks35591 +Ref: #comment-blocks35736 +Node: Including other files35912 +Ref: #including-other-files36092 +Node: Default year36500 +Ref: #default-year36669 +Node: Declaring commodities37092 +Ref: #declaring-commodities37275 +Node: Default commodity38502 +Ref: #default-commodity38678 +Node: Market prices39314 +Ref: #market-prices39479 +Node: Declaring accounts40320 +Ref: #declaring-accounts40496 +Node: Account comments41421 +Ref: #account-comments41584 +Node: Account subdirectives41979 +Ref: #account-subdirectives42174 +Node: Account types42487 +Ref: #account-types42671 +Node: Account display order44315 +Ref: #account-display-order44485 +Node: Rewriting accounts45614 +Ref: #rewriting-accounts45799 +Node: Basic aliases46534 +Ref: #basic-aliases46680 +Node: Regex aliases47384 +Ref: #regex-aliases47555 +Node: Multiple aliases48273 +Ref: #multiple-aliases48448 +Node: end aliases48946 +Ref: #end-aliases49093 +Node: Default parent account49194 +Ref: #default-parent-account49360 +Node: Periodic transactions50244 +Ref: #periodic-transactions50442 +Node: Two spaces after the period expression51568 +Ref: #two-spaces-after-the-period-expression51813 +Node: Forecasting with periodic transactions52298 +Ref: #forecasting-with-periodic-transactions52588 +Node: Budgeting with periodic transactions54275 +Ref: #budgeting-with-periodic-transactions54514 +Node: Auto postings / transaction modifiers54973 +Ref: #auto-postings-transaction-modifiers55184 +Node: Auto postings and transaction balancing / inferred amounts / balance assertions57356 +Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions57673 +Node: EDITOR SUPPORT58051 +Ref: #editor-support58169  End Tag Table diff --git a/hledger-lib/hledger_journal.txt b/hledger-lib/hledger_journal.txt index 9ded660fd..51b687315 100644 --- a/hledger-lib/hledger_journal.txt +++ b/hledger-lib/hledger_journal.txt @@ -237,11 +237,11 @@ FILE FORMAT 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-level accounts: assets, liabilities, income, expenses, and equity. + 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. @@ -250,7 +250,7 @@ FILE FORMAT After the account name, there is usually an amount. Important: between account name and amount, there must be two or more spaces. - Amounts consist of a number and (usually) a currency symbol or commod- + Amounts consist of a number and (usually) a currency symbol or commod- ity name. Some examples: 2.00001 @@ -266,35 +266,35 @@ FILE FORMAT As you can see, the amount format is somewhat flexible: - o amounts are a number (the "quantity") and optionally a currency sym- + o amounts are a number (the "quantity") and optionally a currency sym- bol/commodity name (the "commodity"). - o the commodity is a symbol, word, or phrase, on the left or right, - with or without a separating space. If the commodity contains num- - bers, spaces or non-word punctuation it must be enclosed in double + o the commodity is a symbol, word, or phrase, on the left or right, + with or without a separating space. If the commodity contains num- + bers, spaces or non-word punctuation it must be enclosed in double quotes. o negative amounts with a commodity on the left can have the minus sign before or after it - o digit groups (thousands, or any other grouping) can be separated by - space or comma or period and should be used as separator between all + o digit groups (thousands, or any other grouping) can be separated by + space or comma or period and should be used as separator between all groups - o decimal part can be separated by comma or period and should be dif- + o decimal part can be separated by comma or period and should be dif- ferent from digit groups separator - o scientific E-notation is allowed. Be careful not to use a digit - group separator character in scientific notation, as it's not sup- + o scientific E-notation is allowed. Be careful not to use a digit + group separator character in scientific notation, as it's not sup- ported and it might get mistaken for a decimal point. (Declaring the digit group separator character explicitly with a commodity directive will prevent this.) - You can use any of these variations when recording data. However, - there is some ambiguous way of representing numbers like $1.000 and - $1,000 both may mean either one thousand or one dollar. By default - hledger will assume that this is sole delimiter is used only for deci- - mals. On the other hand commodity format declared prior to that line + You can use any of these variations when recording data. However, + there is some ambiguous way of representing numbers like $1.000 and + $1,000 both may mean either one thousand or one dollar. By default + hledger will assume that this is sole delimiter is used only for deci- + mals. On the other hand commodity format declared prior to that line will help to resolve that ambiguity differently: commodity $1,000.00 @@ -303,38 +303,38 @@ FILE FORMAT expenses:gifts $1,000 assets - Though journal may contain mixed styles to represent amount, when - hledger displays amounts, it will choose a consistent format for each - commodity. (Except for price amounts, which are always formatted as + Though journal may contain mixed styles to represent amount, when + hledger displays amounts, it will choose a consistent format for each + commodity. (Except for price amounts, which are always formatted as written). The display format is chosen as follows: o if there is a commodity directive specifying the format, that is used - o otherwise the format is inferred from the first posting amount in - that commodity in the journal, and the precision (number of decimal + o otherwise the format is inferred from the first posting amount in + that commodity in the journal, and the precision (number of decimal places) will be the maximum from all posting amounts in that commmod- ity - o or if there are no such amounts in the journal, a default format is + o or if there are no such amounts in the journal, a default format is used (like $1000.00). - Price amounts and amounts in D directives usually don't affect amount - format inference, but in some situations they can do so indirectly. - (Eg when D's default commodity is applied to a commodity-less amount, + Price amounts and amounts in D directives usually don't affect amount + format inference, but in some situations they can do so indirectly. + (Eg when D's default commodity is applied to a commodity-less amount, or when an amountless posting is balanced using a price's commodity, or - when -V is used.) If you find this causing problems, set the desired + when -V is used.) If you find this causing problems, set the desired format with a commodity directive. Virtual Postings - When you parenthesise the account name in a posting, we call that a + When you parenthesise the account name in a posting, we call that a virtual posting, which means: o it is ignored when checking that the transaction is balanced - o it is excluded from reports when the --real/-R flag is used, or the + o it is excluded from reports when the --real/-R flag is used, or the real:1 query. - You could use this, eg, to set an account's opening balance without + You could use this, eg, to set an account's opening balance without needing to use the equity:opening balances account: 1/1 special unbalanced posting to set initial balance @@ -342,8 +342,8 @@ FILE FORMAT When the account name is bracketed, we call it a balanced virtual post- ing. This is like an ordinary virtual posting except the balanced vir- - tual postings in a transaction must balance to 0, like the real post- - ings (but separately from them). Balanced virtual postings are also + tual postings in a transaction must balance to 0, like the real post- + ings (but separately from them). Balanced virtual postings are also excluded by --real/-R or real:1. 1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere @@ -353,13 +353,13 @@ FILE FORMAT [assets:checking:budget:food] $-10 Virtual postings have some legitimate uses, but those are few. You can - usually find an equivalent journal entry using real postings, which is + usually find an equivalent journal entry using real postings, which is more correct and provides better error checking. 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 @@ -371,31 +371,31 @@ FILE FORMAT b $-1 =$-2 After reading a journal file, hledger will check all balance assertions - and report an error if any of them fail. Balance assertions can pro- - tect you from, eg, inadvertently disrupting reconciled balances while - cleaning up old entries. You can disable them temporarily with the + and report an error if any of them fail. Balance assertions can pro- + tect you from, eg, inadvertently disrupting reconciled balances while + cleaning up old entries. You can disable them temporarily with the -I/--ignore-assertions flag, which can be useful for troubleshooting or for reading Ledger files. 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 differ- - ently-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 con- - trol over the order of postings and assertions within a day, so you can - assert intra-day balances. + 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. + 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 @@ -403,8 +403,8 @@ FILE FORMAT -f options. Use include or concatenate the files instead. Assertions and commodities - The asserted balance must be a simple single-commodity amount, and in - fact the assertion checks only this commodity's balance within the + 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 "par- tial" balance assertion. @@ -412,55 +412,55 @@ FILE FORMAT 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). 2013/1/1 a $1 - a 1 + a 1EUR b $-1 - c -1 + c -1EUR 2013/1/2 ; These assertions succeed a 0 = $1 - a 0 = 1 + a 0 = 1EUR b 0 == $-1 - c 0 == -1 + c 0 == -1EUR - 2013/1/3 ; This assertion fails as 'a' also contains 1 + 2013/1/3 ; This assertion fails as 'a' also contains 1EUR 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 a:usd $1 - a:euro 1 + a:euro 1EUR b 2013/1/2 a 0 == 0 a:usd 0 == $1 - a:euro 0 == 1 + 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 @ 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 @@ -474,16 +474,16 @@ FILE FORMAT tual. They are not affected by the --real/-R flag or real: query. Assertions and precision - Balance assertions compare the exactly calculated amounts, which are - not always what is shown by reports. Eg a commodity directive may - limit the display precision, but this will not affect balance asser- + Balance assertions compare the exactly calculated amounts, which are + not always what is shown by reports. Eg a commodity directive may + limit the display precision, but this will not affect balance asser- tions. Balance assertion failure messages show exact amounts. Balance Assignments - Ledger-style balance assignments are also supported. These are like - balance assertions, but with no posting amount on the left side of the - equals sign; instead it is calculated automatically so as to satisfy - the assertion. This can be a convenience during data entry, eg when + Ledger-style balance assignments are also supported. These are like + balance assertions, but with no posting amount on the left side of the + equals sign; instead it is calculated automatically so as to satisfy + the assertion. This can be a convenience during data entry, eg when setting opening balances: ; starting a new journal, set asset account balances @@ -501,28 +501,28 @@ FILE FORMAT expenses:misc The calculated amount depends on the account's balance in the commodity - at that point (which depends on the previously-dated postings of the - commodity to that account since the last balance assertion or assign- + at that point (which depends on the previously-dated postings of the + commodity to that account since the last balance assertion or assign- ment). Note that using balance assignments makes your journal a little less explicit; to know the exact amount posted, you have to run hledger or do the calculations yourself, instead of just reading it. Balance assignments and prices - A transaction price in a balance assignment will cause the calculated + A transaction price in a balance assignment will cause the calculated amount to have that price attached: 2019/1/1 - (a) = $1 @ 2 + (a) = $1 @ EUR2 $ hledger print --explicit 2019/01/01 - (a) $1 @ 2 = $1 @ 2 + (a) $1 @ EUR2 = $1 @ EUR2 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. @@ -532,59 +532,59 @@ FILE FORMAT 1. Write the price per unit, as @ UNITPRICE after the amount: 2009/1/1 - assets:euros 100 @ $1.35 ; one hundred euros purchased at $1.35 each + assets:euros EUR100 @ $1.35 ; one hundred euros purchased at $1.35 each assets:dollars ; balancing amount is -$135.00 2. Write the total price, as @@ TOTALPRICE after the amount: 2009/1/1 - assets:euros 100 @@ $135 ; one hundred euros purchased at $135 for the lot + assets:euros EUR100 @@ $135 ; one hundred euros purchased at $135 for the lot assets:dollars 3. Specify amounts for all postings, using exactly two commodities, and let hledger infer the price that balances the transaction: 2009/1/1 - assets:euros 100 ; one hundred euros purchased + assets:euros EUR100 ; one hundred euros purchased assets:dollars $-135 ; for $135 (Ledger users: Ledger uses a different syntax for fixed prices, {=UNIT- PRICE}, which hledger currently ignores). - 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: $ hledger bal -N --flat $-135 assets:dollars - 100 assets:euros + EUR100 assets:euros $ hledger bal -N --flat -B $-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: 2009/1/1 assets:dollars $-135 ; 135 dollars sold - assets:euros 100 ; for 100 euros + assets:euros EUR100 ; for 100 euros $ hledger bal -N --flat -B - -100 assets:dollars # <- the dollars' selling price - 100 assets:euros + EUR-100 assets:dollars # <- the dollars' selling price + EUR100 assets:euros 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 - description and/or indented on the following lines (before the post- - ings). Similarly, you can attach comments to an individual posting by - writing them after the amount and/or indented on the following lines. + You can attach comments to a transaction by writing them after the + description and/or indented on the following lines (before the post- + ings). Similarly, you can attach comments to an individual posting by + writing them after the amount and/or indented on the following lines. Transaction and posting comments must begin with a semicolon (;). Some examples: @@ -608,24 +608,24 @@ FILE 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 comment directives. + 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: @@ -639,93 +639,93 @@ FILE 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-tag) and the posting has four (those plus posting-tag): + 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. 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 + here is a table summarising the directives and their effects, with links to more detailed docs. - direc- end subdi- purpose can affect (as of - tive directive rec- 2018/06) - tives - ------------------------------------------------------------------------------------------------- - account any document account names, all entries in all - text declare account types & dis- files, before or - play order after + direc- end subdi- purpose can affect (as of + tive directive rec- 2018/06) + tives + ------------------------------------------------------------------------------------ + account any document account names, all entries in all + text declare account types & dis- files, before or + play order after - alias end aliases rewrite account names following - inline/included - entries until end - of current file or - end directive - apply account end apply account prepend a common parent to following - account names inline/included - entries until end - of current file or - end directive - comment end comment ignore part of journal following - inline/included - entries until end - of current file or - end directive - commodity format declare a commodity and its number notation: - 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, number commodity: all com- - notation & display style for modityless entries - commodityless amounts in all files; num- - ber notation: fol- - lowing commodity- - less entries and - entries in that - commodity in all - files; display - 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 - reports, when -V is - used - Y declare a year for yearless following - dates inline/included - entries until end - of current file + alias end rewrite account names following + aliases inline/included + entries until end + of current file or + end directive + apply end apply prepend a common parent to following + account account account names inline/included + entries until end + of current file or + end directive + comment end com- ignore part of journal following + ment inline/included + entries until end + of current file or + end directive + 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, number commodity: all com- + notation & display style for modityless entries + commodityless amounts in all files; num- + ber notation: fol- + lowing commodity- + less entries and + entries in that + commodity in all + files; display + 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 + reports, when -V is + used + Y declare a year for yearless following + dates inline/included + entries until end + of current file And some definitions: subdirec- optional indented directive line immediately following a par- tive ent directive - number how to interpret numbers when parsing journal entries (the - notation identity of the decimal separator character). (Currently - each commodity can have its own notation, even in the same + number how to interpret numbers when parsing journal entries (the + notation identity of the decimal separator character). (Currently + each commodity can have its own notation, even in the same file.) display how to display amounts of a commodity in reports (symbol side style and spacing, digit groups, decimal separator, decimal places) @@ -733,37 +733,37 @@ FILE FORMAT scope are affected by a directive As you can see, directives vary in which journal entries and files they - affect, and whether they are focussed on input (parsing) or output + affect, and whether they are focussed on input (parsing) or output (reports). Some directives have multiple effects. - If you have a journal made up of multiple files, or pass multiple -f - options on the command line, note that directives which affect input - typically last only until the end of their defining file. This pro- + If you have a journal made up of multiple files, or pass multiple -f + options on the command line, note that directives which affect input + typically last only until the end of their defining file. This pro- vides more simplicity and predictability, eg reports are not changed by - writing file options in a different order. It can be surprising at + writing file options in a different order. It can be surprising at times though. 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 path/to/file.journal - If the path does not begin with a slash, it is relative to the current - file. The include file path may contain common glob patterns (e.g. + If the path does not begin with a slash, it is relative to the current + file. The include file path may contain common glob patterns (e.g. *). - The include directive can only be used in journal files. It can + The include directive can only be used in journal files. It can include journal, timeclock or timedot files, but not CSV files. 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 @@ -783,8 +783,8 @@ FILE FORMAT assets Declaring commodities - The commodity directive declares commodities which may be used in the - journal (though currently we do not enforce this). It may be written + The commodity directive declares commodities which may be used in the + journal (though currently we do not enforce this). It may be written on a single line, like this: ; commodity EXAMPLEAMOUNT @@ -794,8 +794,8 @@ FILE FORMAT ; separating thousands with comma. commodity 1,000.0000 AAAA - or on multiple lines, using the "format" subdirective. In this case - the commodity symbol appears twice and should be the same in both + or on multiple lines, using the "format" subdirective. In this case + the commodity symbol appears twice and should be the same in both places: ; commodity SYMBOL @@ -807,19 +807,19 @@ FILE FORMAT commodity INR format INR 9,99,99,999.00 - Commodity directives have a second purpose: they define the standard + Commodity directives have a second purpose: they define the standard display format for amounts in the commodity. Normally the display for- - mat is inferred from journal entries, but this can be unpredictable; - declaring it with a commodity directive overrides this and removes - ambiguity. Towards this end, amounts in commodity directives must - always be written with a decimal point (a period or comma, followed by + mat is inferred from journal entries, but this can be unpredictable; + declaring it with a commodity directive overrides this and removes + ambiguity. Towards this end, amounts in commodity directives must + always be written with a decimal point (a period or comma, followed by 0 or more decimal digits). Default commodity - The D directive sets a default commodity (and display format), to be + The D directive sets a default commodity (and display format), to be used for amounts without a commodity symbol (ie, plain numbers). (Note - this differs from Ledger's default commodity directive.) The commodity - and display format will be applied to all subsequent commodity-less + this differs from Ledger's default commodity directive.) The commodity + and display format will be applied to all subsequent commodity-less amounts, or until the next D directive. # commodity-less amounts should be treated as dollars @@ -834,9 +834,9 @@ FILE FORMAT a decimal point. Market prices - The P directive declares a market price, which is an exchange rate + The P directive declares a market price, which is an exchange rate between two commodities on a certain date. (In Ledger, they are called - "historical prices".) These are often obtained from a stock exchange, + "historical prices".) These are often obtained from a stock exchange, cryptocurrency exchange, or the foreign exchange market. Here is the format: @@ -847,39 +847,39 @@ FILE FORMAT o COMMODITYA is the symbol of the commodity being priced - o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com- + o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com- modity, giving the price in commodity B of one unit of commodity A. - These two market price directives say that one euro was worth 1.35 US + These two market price directives say that one euro was worth 1.35 US dollars during 2009, and $1.40 from 2010 onward: - P 2009/1/1 $1.35 - P 2010/1/1 $1.40 + P 2009/1/1 EUR $1.35 + P 2010/1/1 EUR $1.40 - The -V/--value flag can be used to convert reported amounts to another + The -V/--value flag can be used to convert reported amounts to another commodity using these prices. Declaring accounts - account directives can be used to pre-declare accounts. Though not + account directives can be used to pre-declare accounts. Though not required, they can provide several benefits: o They can document your intended chart of accounts, providing a refer- ence. - o They can store extra information about accounts (account numbers, + o They can store extra information about accounts (account numbers, notes, etc.) - o They can help hledger know your accounts' types (asset, liability, - equity, revenue, expense), useful for reports like balancesheet and + o They can help hledger know your accounts' types (asset, liability, + equity, revenue, expense), useful for reports like balancesheet and incomestatement. - o They control account display order in reports, allowing non-alpha- + o They control account display order in reports, allowing non-alpha- betic sorting (eg Revenues to appear above Expenses). - o They help with account name completion in the add command, - hledger-iadd, hledger-web, ledger-mode etc. + o They help with account name completion in the add command, hledger- + iadd, hledger-web, ledger-mode etc. - The simplest form is just the word account followed by a hledger-style + The simplest form is just the word account followed by a hledger-style account name, eg: account assets:bank:checking @@ -897,7 +897,7 @@ FILE FORMAT the next line instead. 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 @@ -910,18 +910,18 @@ FILE FORMAT [LEDGER-STYLE SUBDIRECTIVES, IGNORED] Account types - hledger recognises five types (or classes) of account: Asset, Liabil- - ity, Equity, Revenue, Expense. This is used by a few accounting-aware + hledger recognises five types (or classes) of account: Asset, Liabil- + ity, Equity, Revenue, Expense. This is used by a few accounting-aware reports such as balancesheet, incomestatement and cashflow. Auto-detected account types If you name your top-level accounts with some variation of assets, lia- - bilities/debts, equity, revenues/income, or expenses, their types are + bilities/debts, equity, revenues/income, or expenses, their types are detected automatically. Account types declared with tags - More generally, you can declare an account's type with an account - directive, by writing a type: tag in a comment, followed by one of the + More generally, you can declare an account's type with an account + directive, by writing a type: tag in a comment, followed by one of the words Asset, Liability, Equity, Revenue, Expense, or one of the letters ALERX (case insensitive): @@ -932,8 +932,8 @@ FILE FORMAT account expenses ; type:Expenses Account types declared with account type codes - Or, you can write one of those letters separated from the account name - by two or more spaces, but this should probably be considered depre- + Or, you can write one of those letters separated from the account name + by two or more spaces, but this should probably be considered depre- cated as of hledger 1.13: account assets A @@ -943,7 +943,7 @@ FILE FORMAT account expenses X Overriding auto-detected types - If you ever override the types of those auto-detected english account + If you ever override the types of those auto-detected english account names mentioned above, you might need to help the reports a bit. Eg: ; make "liabilities" not have the liability type - who knows why @@ -954,8 +954,8 @@ FILE FORMAT account - ; type:L 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: @@ -977,16 +977,16 @@ FILE FORMAT Undeclared accounts, if any, are displayed last, in alphabetical order. - Note that sorting is done at each level of the account tree (within - each group of sibling accounts under the same parent). And currently, + Note that sorting is done at each level of the account tree (within + each group of sibling accounts under the same parent). And currently, this directive: account other:zoo - would influence the position of zoo among other's subaccounts, but not - the position of other among the top-level accounts. This means: - you - will sometimes declare parent accounts (eg account other above) that - you don't intend to post to, just to customize their display order - + would influence the position of zoo among other's subaccounts, but not + the position of other among the top-level accounts. This means: - you + will sometimes declare parent accounts (eg account other above) that + you don't intend to post to, just to customize their display order - sibling accounts stay together (you couldn't display x:y in between a:b and a:c). @@ -1005,14 +1005,14 @@ FILE FORMAT o customising reports Account aliases also rewrite account names in account directives. They - do not affect account names being entered via hledger add or - hledger-web. + do not affect account names being entered via hledger add or hledger- + web. See also Cookbook: 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 @@ -1020,54 +1020,54 @@ FILE FORMAT Or, you can use the --alias 'OLD=NEW' option on the command line. This affects all entries. It's useful for trying out aliases interactively. - OLD and NEW are case sensitive full account names. hledger will - replace any occurrence of the old account name with the new one. Sub- + OLD and NEW are case sensitive full account names. hledger will + replace any occurrence of the old account name with the new one. Sub- accounts 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. Multiple aliases - You can define as many aliases as you like using directives or com- - mand-line options. Aliases are recursive - each alias sees the result - of applying previous ones. (This is different from Ledger, where - aliases are non-recursive by default). Aliases are applied in the fol- - lowing order: + You can define as many aliases as you like using directives or command- + line options. Aliases are recursive - each alias sees the result of + applying previous ones. (This is different from Ledger, where aliases + are non-recursive by default). Aliases are applied in the following + order: - 1. alias directives, most recently seen first (recent directives take + 1. alias directives, most recently seen first (recent directives take precedence over earlier ones; directives not yet seen are ignored) 2. alias options, in the order they appear on the command line end aliases - You can clear (forget) all currently defined aliases with the - end aliases directive: + 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 - accounts within a section of the journal. Use the apply account and + You can specify a parent account which will be prepended to all + accounts within a section of the journal. Use the apply account and end apply account directives like so: apply account home @@ -1084,7 +1084,7 @@ FILE FORMAT home:food $10 home:cash $-10 - If end apply account is omitted, the effect lasts to the end of the + If end apply account is omitted, the effect lasts to the end of the file. Included files are also affected, eg: apply account business @@ -1093,18 +1093,18 @@ FILE FORMAT apply account personal include personal.journal - Prior to hledger 1.0, legacy account and end spellings were also sup- + Prior to hledger 1.0, legacy account and end spellings were also sup- ported. - A default parent account also affects account directives. It does not - affect account names being entered via hledger add or hledger-web. If - account aliases are present, they are applied after the default parent + A default parent account also affects account directives. It does not + affect account names being entered via hledger add or hledger-web. If + account aliases are present, they are applied after the default parent account. Periodic transactions - Periodic transaction rules describe transactions that recur. They + Periodic transaction rules describe transactions that recur. They allow you to generate future transactions for forecasting, without hav- - ing to write them out explicitly in the journal (with --forecast). + ing to write them out explicitly in the journal (with --forecast). Secondly, they also can be used to define budget goals (with --budget). A periodic transaction rule looks like a normal journal entry, with the @@ -1115,17 +1115,17 @@ FILE FORMAT expenses:rent $2000 assets:bank:checking - There is an additional constraint on the period expression: the start - date must fall on a natural boundary of the interval. Eg - monthly from 2018/1/1 is valid, but monthly from 2018/1/15 is not. + 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 after the period expression - 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: @@ -1138,90 +1138,94 @@ FILE FORMAT income:acme inc Forecasting with periodic transactions - With the --forecast flag, each periodic transaction rule generates + With the --forecast flag, each periodic transaction rule generates future transactions recurring at the specified interval. These are not - saved in the journal, but appear in all reports. They will look like - normal transactions, but with an extra tag named recur, whose value is + saved in the journal, but appear in all reports. They will look like + normal transactions, but with an extra tag named recur, whose value is the generating period expression. - Forecast transactions start on the first occurrence, and end on the - last occurrence, of their interval within the forecast period. The + Forecast transactions start on the first occurrence, and end on the + last occurrence, of their interval within the forecast period. The forecast period: 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 180 + o ends on the report end date if specified with -e/-p/date:, or 180 days from today. - where "today" means the current date at report time. The "later of" - rule ensures that forecast transactions do not overlap normal transac- + where "today" means the current date at report time. The "later of" + rule ensures that forecast transactions do not overlap normal transac- tions in time; they will begin only after normal transactions end. - Forecasting can be useful for estimating balances into the future, and - experimenting with different scenarios. Note the start date logic + Forecasting can be useful for estimating balances into the future, and + experimenting with different scenarios. Note the start date logic means that forecasted transactions are automatically replaced by normal transactions as you add those. Forecasting can also help with data entry: describe most of your trans- - actions with periodic rules, and every so often copy the output of + actions with periodic rules, and every so often copy the output of print --forecast to the journal. You can generate one-time transactions too: just write a period expres- - sion specifying a date with no report interval. (You could also write - a normal transaction with a future date, but remember this disables + sion specifying a date with no report interval. (You could also write + a normal transaction with a future date, but remember this disables forecast transactions on previous dates.) 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. - For more details, see: balance: Budget report and Cookbook: Budgeting + For more details, see: balance: Budget report and Cookbook: Budgeting and Forecasting. - Transaction modifiers - Transaction modifier rules describe changes that should be applied - automatically to certain transactions. They can be enabled by using - the --auto flag. Currently, just one kind of change is possible: - adding extra postings. These rule-generated postings are known as - "automated postings" or "auto postings". + Auto postings / transaction modifiers + Transaction modifier rules describe changes to be applied automatically + to certain matched transactions. Currently just one kind of change is + possible - adding extra postings, which we call "automated postings" or + just "auto postings". These rules become active when you use the + --auto flag. - A transaction modifier rule looks quite like a normal transaction, - except the first line is an equals sign followed by a query that - matches certain postings (mnemonic: = suggests matching). And each - "posting" is actually a posting-generating rule: + A transaction modifier, AKA auto posting rule, looks much like a normal + transaction except the first line is an equals sign followed by a query + that matches certain postings (mnemonic: = suggests matching). And + each "posting" is actually a posting-generating rule: = QUERY ACCT AMT ACCT [AMT] ... - These posting rules look like normal postings, except the amount can - be: + These posting-generating rules look like normal postings, except the + amount 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. + These rules have global effect - a rule appearing anywhere in your data + can potentially affect any transaction, including transactions recorded + above it or in another file. + Some examples: ; every time I buy food, schedule a dollar donation @@ -1253,9 +1257,8 @@ FILE FORMAT assets:checking:gifts -$20 assets:checking $20 - Auto postings and transaction balancing / inferred amounts / balance - assertions - + Auto postings and transaction balancing / inferred amounts / balance asser- + tions Currently, transaction modifiers are applied / auto postings are added: o after missing amounts are inferred, and transactions are checked for @@ -1301,4 +1304,4 @@ SEE ALSO -hledger 1.14 March 2019 hledger_journal(5) +hledger 1.14.99 March 2019 hledger_journal(5) diff --git a/hledger-lib/hledger_timeclock.5 b/hledger-lib/hledger_timeclock.5 index 33c6e5281..892ab9daa 100644 --- a/hledger-lib/hledger_timeclock.5 +++ b/hledger-lib/hledger_timeclock.5 @@ -1,74 +1,74 @@ -.TH "hledger_timeclock" "5" "March 2019" "hledger 1.14" "hledger User Manuals" +.TH "hledger_timeclock" "5" "March 2019" "hledger 1.14.99" "hledger User Manuals" .SH NAME .PP -Timeclock \- the time logging format of timeclock.el, as read by hledger +Timeclock - the time logging format of timeclock.el, as read by hledger .SH DESCRIPTION .PP hledger can read timeclock files. As with Ledger, these are (a subset of) timeclock.el\[aq]s format, -containing clock\-in and clock\-out entries as in the example below. +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]. +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). .IP .nf \f[C] -i\ 2015/03/30\ 09:00:00\ some:account\ name\ \ optional\ description\ after\ two\ spaces -o\ 2015/03/30\ 09:20:00 -i\ 2015/03/31\ 22:21:45\ another\ account -o\ 2015/04/01\ 02:00:34 -\f[] +i 2015/03/30 09:00:00 some:account name optional description after two spaces +o 2015/03/30 09:20:00 +i 2015/03/31 22:21:45 another account +o 2015/04/01 02:00:34 +\f[R] .fi .PP -hledger treats each clock\-in/clock\-out pair as a transaction posting +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, \f[C]hledger\ print\f[] generates these journal +For the above time log, \f[C]hledger print\f[R] generates these journal entries: .IP .nf \f[C] -$\ hledger\ \-f\ t.timeclock\ print -2015/03/30\ *\ optional\ description\ after\ two\ spaces -\ \ \ \ (some:account\ name)\ \ \ \ \ \ \ \ \ 0.33h +$ hledger -f t.timeclock print +2015/03/30 * optional description after two spaces + (some:account name) 0.33h -2015/03/31\ *\ 22:21\-23:59 -\ \ \ \ (another\ account)\ \ \ \ \ \ \ \ \ 1.64h +2015/03/31 * 22:21-23:59 + (another account) 1.64h -2015/04/01\ *\ 00:00\-02:00 -\ \ \ \ (another\ account)\ \ \ \ \ \ \ \ \ 2.01h -\f[] +2015/04/01 * 00:00-02:00 + (another account) 2.01h +\f[R] .fi .PP Here is a sample.timeclock to download and some queries to try: .IP .nf \f[C] -$\ hledger\ \-f\ sample.timeclock\ balance\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ current\ time\ balances -$\ hledger\ \-f\ sample.timeclock\ register\ \-p\ 2009/3\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ sessions\ in\ march\ 2009 -$\ hledger\ \-f\ sample.timeclock\ register\ \-p\ weekly\ \-\-depth\ 1\ \-\-empty\ \ #\ time\ summary\ by\ week -\f[] +$ hledger -f sample.timeclock balance # current time balances +$ hledger -f sample.timeclock register -p 2009/3 # sessions in march 2009 +$ hledger -f sample.timeclock register -p weekly --depth 1 --empty # time summary by week +\f[R] .fi .PP To generate time logs, ie to clock in and clock out, you could: .IP \[bu] 2 -use emacs and the built\-in timeclock.el, or the extended -timeclock\-x.el and perhaps the extras in ledgerutils.el +use emacs and the built-in timeclock.el, or the extended timeclock-x.el +and perhaps the extras in ledgerutils.el .IP \[bu] 2 at the command line, use these bash aliases: -\f[C]shell\ \ \ alias\ ti="echo\ i\ `date\ \[aq]+%Y\-%m\-%d\ %H:%M:%S\[aq]`\ \\$*\ >>$TIMELOG"\ \ \ alias\ to="echo\ o\ `date\ \[aq]+%Y\-%m\-%d\ %H:%M:%S\[aq]`\ >>$TIMELOG"\f[] +\f[C]shell alias ti=\[dq]echo i \[ga]date \[aq]+%Y-%m-%d %H:%M:%S\[aq]\[ga] \[rs]$* >>$TIMELOG\[dq] alias to=\[dq]echo o \[ga]date \[aq]+%Y-%m-%d %H:%M:%S\[aq]\[ga] >>$TIMELOG\[dq]\f[R] .IP \[bu] 2 -or use the old \f[C]ti\f[] and \f[C]to\f[] scripts in the ledger 2.x +or use the old \f[C]ti\f[R] and \f[C]to\f[R] scripts in the ledger 2.x repository. -These rely on a "timeclock" executable which I think is just the ledger -2 executable renamed. +These rely on a \[dq]timeclock\[dq] executable which I think is just the +ledger 2 executable renamed. .SH "REPORTING BUGS" diff --git a/hledger-lib/hledger_timeclock.info b/hledger-lib/hledger_timeclock.info index 1af0e670b..65a9be7e9 100644 --- a/hledger-lib/hledger_timeclock.info +++ b/hledger-lib/hledger_timeclock.info @@ -4,8 +4,8 @@ stdin.  File: hledger_timeclock.info, Node: Top, Up: (dir) -hledger_timeclock(5) hledger 1.14 -********************************* +hledger_timeclock(5) hledger 1.14.99 +************************************ hledger can read timeclock files. As with Ledger, these are (a subset of) timeclock.el's format, containing clock-in and clock-out entries as @@ -48,6 +48,7 @@ $ hledger -f sample.timeclock register -p weekly --depth 1 --empty # time summa * 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 `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG"' + * 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 executable renamed. diff --git a/hledger-lib/hledger_timeclock.txt b/hledger-lib/hledger_timeclock.txt index 0689e4493..27a9770f3 100644 --- a/hledger-lib/hledger_timeclock.txt +++ b/hledger-lib/hledger_timeclock.txt @@ -42,11 +42,12 @@ DESCRIPTION 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 time- - clock-x.el and perhaps the extras in ledgerutils.el + 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 `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG" + 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 `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 @@ -77,4 +78,4 @@ SEE ALSO -hledger 1.14 March 2019 hledger_timeclock(5) +hledger 1.14.99 March 2019 hledger_timeclock(5) diff --git a/hledger-lib/hledger_timedot.5 b/hledger-lib/hledger_timedot.5 index e0ee3cdeb..c4b464c02 100644 --- a/hledger-lib/hledger_timedot.5 +++ b/hledger-lib/hledger_timedot.5 @@ -1,32 +1,32 @@ -.TH "hledger_timedot" "5" "March 2019" "hledger 1.14" "hledger User Manuals" +.TH "hledger_timedot" "5" "March 2019" "hledger 1.14.99" "hledger User Manuals" .SH NAME .PP -Timedot \- hledger\[aq]s human\-friendly time logging format +Timedot - hledger\[aq]s human-friendly time logging format .SH DESCRIPTION .PP Timedot is a plain text format for logging dated, categorised quantities (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 interruptive. +the real-time clock-in/out required with a timeclock file is too precise +or too interruptive. It can be formatted like a bar chart, making clear at a glance where time was spent. .PP -Though called "timedot", this format is read by hledger as commodityless -quantities, so it could be used to represent dated quantities other than -time. +Though called \[dq]timedot\[dq], this format is read by hledger as +commodityless quantities, so it could be used to represent dated +quantities other than time. In the docs below we\[aq]ll assume it\[aq]s time. .SH FILE FORMAT .PP A timedot file contains a series of day entries. A day entry begins with a date, and is followed by category/quantity pairs, one per line. -Dates are hledger\-style simple dates (see hledger_journal(5)). -Categories are hledger\-style account names, optionally indented. +Dates are hledger-style simple dates (see hledger_journal(5)). +Categories are hledger-style account names, optionally indented. As in a hledger journal, there must be at least two spaces between the category (account name) and the quantity. .PP @@ -41,9 +41,9 @@ an integral or decimal number, representing hours. Eg: 1.5 .IP \[bu] 2 an integral or decimal number immediately followed by a unit symbol -\f[C]s\f[], \f[C]m\f[], \f[C]h\f[], \f[C]d\f[], \f[C]w\f[], \f[C]mo\f[], -or \f[C]y\f[], representing seconds, minutes, hours, days weeks, months -or years respectively. +\f[C]s\f[R], \f[C]m\f[R], \f[C]h\f[R], \f[C]d\f[R], \f[C]w\f[R], +\f[C]mo\f[R], or \f[C]y\f[R], representing seconds, minutes, hours, days +weeks, months or years respectively. Eg: 90m. The following equivalencies are assumed, currently: 1m = 60s, 1h = 60m, 1d = 24h, 1w = 7d, 1mo = 30d, 1y=365d. @@ -53,16 +53,16 @@ An example: .IP .nf \f[C] -#\ on\ this\ day,\ 6h\ was\ spent\ on\ client\ work,\ 1.5h\ on\ haskell\ FOSS\ work,\ etc. +# on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc. 2016/2/1 -inc:client1\ \ \ ....\ ....\ ....\ ....\ ....\ .... -fos:haskell\ \ \ ....\ ..\ -biz:research\ \ . +inc:client1 .... .... .... .... .... .... +fos:haskell .... .. +biz:research . 2016/2/2 -inc:client1\ \ \ ....\ .... -biz:research\ \ . -\f[] +inc:client1 .... .... +biz:research . +\f[R] .fi .PP Or with numbers: @@ -70,42 +70,42 @@ Or with numbers: .nf \f[C] 2016/2/3 -inc:client1\ \ \ 4 -fos:hledger\ \ \ 3 -biz:research\ \ 1 -\f[] +inc:client1 4 +fos:hledger 3 +biz:research 1 +\f[R] .fi .PP Reporting: .IP .nf \f[C] -$\ hledger\ \-f\ t.timedot\ print\ date:2016/2/2 -2016/02/02\ * -\ \ \ \ (inc:client1)\ \ \ \ \ \ \ \ \ \ 2.00 +$ hledger -f t.timedot print date:2016/2/2 +2016/02/02 * + (inc:client1) 2.00 -2016/02/02\ * -\ \ \ \ (biz:research)\ \ \ \ \ \ \ \ \ \ 0.25 -\f[] +2016/02/02 * + (biz:research) 0.25 +\f[R] .fi .IP .nf \f[C] -$\ hledger\ \-f\ t.timedot\ bal\ \-\-daily\ \-\-tree -Balance\ changes\ in\ 2016/02/01\-2016/02/03: +$ hledger -f t.timedot bal --daily --tree +Balance changes in 2016/02/01-2016/02/03: -\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2016/02/01d\ \ 2016/02/02d\ \ 2016/02/03d\ + || 2016/02/01d 2016/02/02d 2016/02/03d ============++======================================== -\ biz\ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 1.00\ -\ \ \ research\ ||\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 1.00\ -\ fos\ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 1.50\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ 3.00\ -\ \ \ haskell\ \ ||\ \ \ \ \ \ \ \ \ 1.50\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ 0\ -\ \ \ hledger\ \ ||\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ 3.00\ -\ inc\ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 6.00\ \ \ \ \ \ \ \ \ 2.00\ \ \ \ \ \ \ \ \ 4.00\ -\ \ \ client1\ \ ||\ \ \ \ \ \ \ \ \ 6.00\ \ \ \ \ \ \ \ \ 2.00\ \ \ \ \ \ \ \ \ 4.00\ -\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 7.75\ \ \ \ \ \ \ \ \ 2.25\ \ \ \ \ \ \ \ \ 8.00\ -\f[] + biz || 0.25 0.25 1.00 + research || 0.25 0.25 1.00 + fos || 1.50 0 3.00 + haskell || 1.50 0 0 + hledger || 0 0 3.00 + inc || 6.00 2.00 4.00 + client1 || 6.00 2.00 4.00 +------------++---------------------------------------- + || 7.75 2.25 8.00 +\f[R] .fi .PP I prefer to use period for separating account components. @@ -114,20 +114,20 @@ We can make this work with an account alias: .nf \f[C] 2016/2/4 -fos.hledger.timedot\ \ 4 -fos.ledger\ \ \ \ \ \ \ \ \ \ \ .. -\f[] +fos.hledger.timedot 4 +fos.ledger .. +\f[R] .fi .IP .nf \f[C] -$\ hledger\ \-f\ t.timedot\ \-\-alias\ /\\\\./=:\ bal\ date:2016/2/4 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4.50\ \ fos -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4.00\ \ \ \ hledger:timedot -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0.50\ \ \ \ ledger -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4.50 -\f[] +$ hledger -f t.timedot --alias /\[rs]\[rs]./=: bal date:2016/2/4 + 4.50 fos + 4.00 hledger:timedot + 0.50 ledger +-------------------- + 4.50 +\f[R] .fi .PP Here is a sample.timedot. diff --git a/hledger-lib/hledger_timedot.info b/hledger-lib/hledger_timedot.info index 3eb0e2aa8..7b53de8ea 100644 --- a/hledger-lib/hledger_timedot.info +++ b/hledger-lib/hledger_timedot.info @@ -4,8 +4,8 @@ stdin.  File: hledger_timedot.info, Node: Top, Next: FILE FORMAT, Up: (dir) -hledger_timedot(5) hledger 1.14 -******************************* +hledger_timedot(5) hledger 1.14.99 +********************************** Timedot is a plain text format for logging dated, categorised quantities (of time, usually), supported by hledger. It is convenient for @@ -17,6 +17,7 @@ glance where time was spent. Though called "timedot", this format is read by hledger as commodityless quantities, so it could be used to represent dated quantities other than time. In the docs below we'll assume it's time. + * Menu: * FILE FORMAT:: @@ -110,7 +111,7 @@ $ hledger -f t.timedot --alias /\\./=: bal date:2016/2/4  Tag Table: Node: Top76 -Node: FILE FORMAT807 -Ref: #file-format908 +Node: FILE FORMAT814 +Ref: #file-format915  End Tag Table diff --git a/hledger-lib/hledger_timedot.txt b/hledger-lib/hledger_timedot.txt index 99851f3c6..15ebb0c9c 100644 --- a/hledger-lib/hledger_timedot.txt +++ b/hledger-lib/hledger_timedot.txt @@ -9,10 +9,10 @@ NAME DESCRIPTION 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 - interruptive. It can be formatted like a bar chart, making clear at a - glance where time was spent. + 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 @@ -124,4 +124,4 @@ SEE ALSO -hledger 1.14 March 2019 hledger_timedot(5) +hledger 1.14.99 March 2019 hledger_timedot(5) diff --git a/hledger-ui/hledger-ui.1 b/hledger-ui/hledger-ui.1 index cddadc414..cc5b81e84 100644 --- a/hledger-ui/hledger-ui.1 +++ b/hledger-ui/hledger-ui.1 @@ -1,227 +1,161 @@ -.TH "hledger\-ui" "1" "March 2019" "hledger\-ui 1.14" "hledger User Manuals" +.TH "hledger-ui" "1" "March 2019" "hledger-ui 1.14.99" "hledger User Manuals" .SH NAME .PP -hledger\-ui \- curses\-style interface for the hledger accounting tool +hledger-ui - curses-style interface for the hledger accounting tool .SH SYNOPSIS .PP -\f[C]hledger\-ui\ [OPTIONS]\ [QUERYARGS]\f[] +\f[C]hledger-ui [OPTIONS] [QUERYARGS]\f[R] .PD 0 .P .PD -\f[C]hledger\ ui\ \-\-\ [OPTIONS]\ [QUERYARGS]\f[] +\f[C]hledger ui -- [OPTIONS] [QUERYARGS]\f[R] .SH DESCRIPTION .PP -hledger is a cross\-platform program for tracking money, time, or any -other commodity, using double\-entry accounting and a simple, editable +hledger is a cross-platform program 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). .PP -hledger\-ui is hledger\[aq]s curses\-style interface, providing an -efficient full\-window text UI for viewing accounts and transactions, -and some limited data entry capability. -It is easier than hledger\[aq]s command\-line interface, and sometimes +hledger-ui is hledger\[aq]s curses-style interface, providing an +efficient full-window text UI for viewing accounts and transactions, and +some limited data entry capability. +It is easier than hledger\[aq]s command-line interface, and sometimes quicker and more convenient than the web interface. .PP -Note hledger\-ui has some different defaults (experimental): +Note hledger-ui has some different defaults (experimental): .IP \[bu] 2 -it generates rule\-based transactions and postings by default -(\-\-forecast and \-\-auto are always on). +it generates rule-based transactions and postings by default (--forecast +and --auto are always on). .IP \[bu] 2 it hides transactions dated in the future by default (change this with -\-\-future or the F key). +--future or the F key). .PP Like hledger, it reads data from one or more files in hledger journal, -timeclock, timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). +timeclock, timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). For more about this see hledger(1), hledger_journal(5) etc. .SH OPTIONS .PP -Note: if invoking hledger\-ui as a hledger subcommand, write -\f[C]\-\-\f[] before options as shown above. +Note: if invoking hledger-ui as a hledger subcommand, write \f[C]--\f[R] +before options as shown above. .PP Any QUERYARGS are interpreted as a hledger search query which filters the data. .TP -.B \f[C]\-\-watch\f[] +.B \f[C]--watch\f[R] watch for data and date changes and reload automatically -.RS -.RE .TP -.B \f[C]\-\-theme=default|terminal|greenterm\f[] +.B \f[C]--theme=default|terminal|greenterm\f[R] use this custom display theme -.RS -.RE .TP -.B \f[C]\-\-register=ACCTREGEX\f[] +.B \f[C]--register=ACCTREGEX\f[R] start in the (first) matched account\[aq]s register screen -.RS -.RE .TP -.B \f[C]\-\-change\f[] +.B \f[C]--change\f[R] show period balances (changes) at startup instead of historical balances -.RS -.RE .TP -.B \f[C]\-F\ \-\-flat\f[] +.B \f[C]-F --flat\f[R] show accounts as a list (default) -.RS -.RE .TP -.B \f[C]\-T\ \-\-tree\f[] +.B \f[C]-T --tree\f[R] show accounts as a tree -.RS -.RE .TP -.B \f[C]\-\-future\f[] +.B \f[C]--future\f[R] show transactions dated later than today (normally hidden) -.RS -.RE .PP hledger input options: .TP -.B \f[C]\-f\ FILE\ \-\-file=FILE\f[] +.B \f[C]-f FILE --file=FILE\f[R] use a different input file. -For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or -\f[C]$HOME/.hledger.journal\f[]) -.RS -.RE +For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or +\f[C]$HOME/.hledger.journal\f[R]) .TP -.B \f[C]\-\-rules\-file=RULESFILE\f[] +.B \f[C]--rules-file=RULESFILE\f[R] Conversion rules file to use when reading CSV (default: FILE.rules) -.RS -.RE .TP -.B \f[C]\-\-separator=CHAR\f[] +.B \f[C]--separator=CHAR\f[R] Field separator to expect when reading CSV (default: \[aq],\[aq]) -.RS -.RE .TP -.B \f[C]\-\-alias=OLD=NEW\f[] +.B \f[C]--alias=OLD=NEW\f[R] rename accounts named OLD to NEW -.RS -.RE .TP -.B \f[C]\-\-anon\f[] +.B \f[C]--anon\f[R] anonymize accounts and payees -.RS -.RE .TP -.B \f[C]\-\-pivot\ FIELDNAME\f[] +.B \f[C]--pivot FIELDNAME\f[R] use some other field or tag for the account name -.RS -.RE .TP -.B \f[C]\-I\ \-\-ignore\-assertions\f[] +.B \f[C]-I --ignore-assertions\f[R] ignore any failing balance assertions -.RS -.RE .PP hledger reporting options: .TP -.B \f[C]\-b\ \-\-begin=DATE\f[] +.B \f[C]-b --begin=DATE\f[R] include postings/txns on or after this date -.RS -.RE .TP -.B \f[C]\-e\ \-\-end=DATE\f[] +.B \f[C]-e --end=DATE\f[R] include postings/txns before this date -.RS -.RE .TP -.B \f[C]\-D\ \-\-daily\f[] +.B \f[C]-D --daily\f[R] multiperiod/multicolumn report by day -.RS -.RE .TP -.B \f[C]\-W\ \-\-weekly\f[] +.B \f[C]-W --weekly\f[R] multiperiod/multicolumn report by week -.RS -.RE .TP -.B \f[C]\-M\ \-\-monthly\f[] +.B \f[C]-M --monthly\f[R] multiperiod/multicolumn report by month -.RS -.RE .TP -.B \f[C]\-Q\ \-\-quarterly\f[] +.B \f[C]-Q --quarterly\f[R] multiperiod/multicolumn report by quarter -.RS -.RE .TP -.B \f[C]\-Y\ \-\-yearly\f[] +.B \f[C]-Y --yearly\f[R] multiperiod/multicolumn report by year -.RS -.RE .TP -.B \f[C]\-p\ \-\-period=PERIODEXP\f[] +.B \f[C]-p --period=PERIODEXP\f[R] set start date, end date, and/or reporting interval all at once using period expressions syntax (overrides the flags above) -.RS -.RE .TP -.B \f[C]\-\-date2\f[] +.B \f[C]--date2\f[R] match the secondary date instead (see command help for other effects) -.RS -.RE .TP -.B \f[C]\-U\ \-\-unmarked\f[] -include only unmarked postings/txns (can combine with \-P or \-C) -.RS -.RE +.B \f[C]-U --unmarked\f[R] +include only unmarked postings/txns (can combine with -P or -C) .TP -.B \f[C]\-P\ \-\-pending\f[] +.B \f[C]-P --pending\f[R] include only pending postings/txns -.RS -.RE .TP -.B \f[C]\-C\ \-\-cleared\f[] +.B \f[C]-C --cleared\f[R] include only cleared postings/txns -.RS -.RE .TP -.B \f[C]\-R\ \-\-real\f[] -include only non\-virtual postings -.RS -.RE +.B \f[C]-R --real\f[R] +include only non-virtual postings .TP -.B \f[C]\-NUM\ \-\-depth=NUM\f[] +.B \f[C]-NUM --depth=NUM\f[R] hide/aggregate accounts or postings more than NUM levels deep -.RS -.RE .TP -.B \f[C]\-E\ \-\-empty\f[] -show items with zero amount, normally hidden (and vice\-versa in -hledger\-ui/hledger\-web) -.RS -.RE +.B \f[C]-E --empty\f[R] +show items with zero amount, normally hidden (and vice-versa in +hledger-ui/hledger-web) .TP -.B \f[C]\-B\ \-\-cost\f[] +.B \f[C]-B --cost\f[R] convert amounts to their cost at transaction time (using the transaction price, if any) -.RS -.RE .TP -.B \f[C]\-V\ \-\-value\f[] +.B \f[C]-V --value\f[R] convert amounts to their market value on the report end date (using the most recent applicable market price, if any) -.RS -.RE .TP -.B \f[C]\-\-auto\f[] +.B \f[C]--auto\f[R] apply automated posting rules to modify transactions. -.RS -.RE .TP -.B \f[C]\-\-forecast\f[] +.B \f[C]--forecast\f[R] apply periodic transaction rules to generate future transactions, to 6 months from now or report end date. -.RS -.RE .PP When a reporting option appears more than once in the command line, the last one takes precedence. @@ -230,38 +164,33 @@ Some reporting options can also be written as query arguments. .PP hledger help options: .TP -.B \f[C]\-h\ \-\-help\f[] +.B \f[C]-h --help\f[R] show general usage (or after COMMAND, command usage) -.RS -.RE .TP -.B \f[C]\-\-version\f[] +.B \f[C]--version\f[R] show version -.RS -.RE .TP -.B \f[C]\-\-debug[=N]\f[] -show debug output (levels 1\-9, default: 1) -.RS -.RE +.B \f[C]--debug[=N]\f[R] +show debug output (levels 1-9, default: 1) .PP -A \@FILE argument will be expanded to the contents of FILE, which should -contain one command line option/argument per line. -(To prevent this, insert a \f[C]\-\-\f[] argument before.) +A \[at]FILE argument will be expanded to the contents of FILE, which +should contain one command line option/argument per line. +(To prevent this, insert a \f[C]--\f[R] argument before.) .SH KEYS .PP -\f[C]?\f[] shows a help dialog listing all keys. +\f[C]?\f[R] shows a help dialog listing all keys. (Some of these also appear in the quick help at the bottom of each -screen.) Press \f[C]?\f[] again (or \f[C]ESCAPE\f[], or \f[C]LEFT\f[]) -to close it. +screen.) Press \f[C]?\f[R] again (or \f[C]ESCAPE\f[R], or +\f[C]LEFT\f[R]) to close it. The following keys work on most screens: .PP -The cursor keys navigate: \f[C]right\f[] (or \f[C]enter\f[]) goes -deeper, \f[C]left\f[] returns to the previous screen, -\f[C]up\f[]/\f[C]down\f[]/\f[C]page\ up\f[]/\f[C]page\ down\f[]/\f[C]home\f[]/\f[C]end\f[] +The cursor keys navigate: \f[C]right\f[R] (or \f[C]enter\f[R]) goes +deeper, \f[C]left\f[R] returns to the previous screen, +\f[C]up\f[R]/\f[C]down\f[R]/\f[C]page up\f[R]/\f[C]page down\f[R]/\f[C]home\f[R]/\f[C]end\f[R] move up and down through lists. -Vi\-style (\f[C]h\f[]/\f[C]j\f[]/\f[C]k\f[]/\f[C]l\f[]) and Emacs\-style -(\f[C]CTRL\-p\f[]/\f[C]CTRL\-n\f[]/\f[C]CTRL\-f\f[]/\f[C]CTRL\-b\f[]) +Vi-style (\f[C]h\f[R]/\f[C]j\f[R]/\f[C]k\f[R]/\f[C]l\f[R]) and +Emacs-style +(\f[C]CTRL-p\f[R]/\f[C]CTRL-n\f[R]/\f[C]CTRL-f\f[R]/\f[C]CTRL-b\f[R]) movement keys are also supported. A tip: movement speed is limited by your keyboard repeat rate, to move faster you may want to adjust it. @@ -269,67 +198,67 @@ faster you may want to adjust it. .PP With shift pressed, the cursor keys adjust the report period, limiting the transactions to be shown (by default, all are shown). -\f[C]shift\-down/up\f[] steps downward and upward through these standard +\f[C]shift-down/up\f[R] steps downward and upward through these standard report period durations: year, quarter, month, week, day. -Then, \f[C]shift\-left/right\f[] moves to the previous/next period. -\f[C]t\f[] sets the report period to today. -With the \f[C]\-\-watch\f[] option, when viewing a "current" period (the -current day, week, month, quarter, or year), the period will move -automatically to track the current date. -To set a non\-standard period, you can use \f[C]/\f[] and a -\f[C]date:\f[] query. +Then, \f[C]shift-left/right\f[R] moves to the previous/next period. +\f[C]t\f[R] sets the report period to today. +With the \f[C]--watch\f[R] option, when viewing a \[dq]current\[dq] +period (the current day, week, month, quarter, or year), the period will +move automatically to track the current date. +To set a non-standard period, you can use \f[C]/\f[R] and a +\f[C]date:\f[R] query. .PP -\f[C]/\f[] lets you set a general filter query limiting the data shown, -using the same query terms as in hledger and hledger\-web. -While editing the query, you can use CTRL\-a/e/d/k, BS, cursor keys; -press \f[C]ENTER\f[] to set it, or \f[C]ESCAPE\f[]to cancel. +\f[C]/\f[R] lets you set a general filter query limiting the data shown, +using the same query terms as in hledger and hledger-web. +While editing the query, you can use CTRL-a/e/d/k, BS, cursor keys; +press \f[C]ENTER\f[R] to set it, or \f[C]ESCAPE\f[R]to cancel. There are also keys for quickly adjusting some common filters like account depth and transaction status (see below). -\f[C]BACKSPACE\f[] or \f[C]DELETE\f[] removes all filters, showing all +\f[C]BACKSPACE\f[R] or \f[C]DELETE\f[R] removes all filters, showing all transactions. .PP -As mentioned above, hledger\-ui shows auto\-generated periodic -transactions, and hides future transactions (auto\-generated or not) by +As mentioned above, hledger-ui shows auto-generated periodic +transactions, and hides future transactions (auto-generated or not) by default. -\f[C]F\f[] toggles showing and hiding these future transactions. -This is similar to using a query like \f[C]date:\-tomorrow\f[], but more +\f[C]F\f[R] toggles showing and hiding these future transactions. +This is similar to using a query like \f[C]date:-tomorrow\f[R], but more convenient. (experimental) .PP -\f[C]ESCAPE\f[] removes all filters and jumps back to the top screen. +\f[C]ESCAPE\f[R] removes all filters and jumps back to the top screen. Or, it cancels a minibuffer edit or help dialog in progress. .PP -\f[C]CTRL\-l\f[] redraws the screen and centers the selection if +\f[C]CTRL-l\f[R] redraws the screen and centers the selection if possible (selections near the top won\[aq]t be centered, since we don\[aq]t scroll above the top). .PP -\f[C]g\f[] reloads from the data file(s) and updates the current screen +\f[C]g\f[R] reloads from the data file(s) and updates the current screen and any previous screens. (With large files, this could cause a noticeable pause.) .PP -\f[C]I\f[] toggles balance assertion checking. +\f[C]I\f[R] toggles balance assertion checking. Disabling balance assertions temporarily can be useful for troubleshooting. .PP -\f[C]a\f[] runs command\-line hledger\[aq]s add command, and reloads the +\f[C]a\f[R] runs command-line hledger\[aq]s add command, and reloads the updated file. This allows some basic data entry. .PP -\f[C]A\f[] is like \f[C]a\f[], but runs the hledger\-iadd tool, which -provides a curses\-style interface. -This key will be available if \f[C]hledger\-iadd\f[] is installed in +\f[C]A\f[R] is like \f[C]a\f[R], but runs the hledger-iadd tool, which +provides a curses-style interface. +This key will be available if \f[C]hledger-iadd\f[R] is installed in $PATH. .PP -\f[C]E\f[] runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default -(\f[C]emacsclient\ \-a\ ""\ \-nw\f[]) on the journal file. +\f[C]E\f[R] runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default +(\f[C]emacsclient -a \[dq]\[dq] -nw\f[R]) on the journal file. With some editors (emacs, vi), the cursor will be positioned at the current transaction when invoked from the register and transaction screens, and at the error location (if possible) when invoked from the error screen. .PP -\f[C]q\f[] quits the application. +\f[C]q\f[R] quits the application. .PP -Additional screen\-specific keys are described below. +Additional screen-specific keys are described below. .SH SCREENS .SS Accounts screen .PP @@ -342,21 +271,21 @@ if you specify a query on the command line, it shows just the matched accounts and the balances from matched transactions. .PP Account names are shown as a flat list by default. -Press \f[C]T\f[] to toggle tree mode. +Press \f[C]T\f[R] to toggle tree mode. In flat mode, account balances are exclusive of subaccounts, except where subaccounts are hidden by a depth limit (see below). In tree mode, all account balances are inclusive of subaccounts. .PP -To see less detail, press a number key, \f[C]1\f[] to \f[C]9\f[], to set -a depth limit. -Or use \f[C]\-\f[] to decrease and \f[C]+\f[]/\f[C]=\f[] to increase the -depth limit. -\f[C]0\f[] shows even less detail, collapsing all accounts to a single +To see less detail, press a number key, \f[C]1\f[R] to \f[C]9\f[R], to +set a depth limit. +Or use \f[C]-\f[R] to decrease and \f[C]+\f[R]/\f[C]=\f[R] to increase +the depth limit. +\f[C]0\f[R] shows even less detail, collapsing all accounts to a single total. To remove the depth limit, set it higher than the maximum account depth, -or press \f[C]ESCAPE\f[]. +or press \f[C]ESCAPE\f[R]. .PP -\f[C]H\f[] toggles between showing historical balances or period +\f[C]H\f[R] toggles between showing historical balances or period balances. Historical balances (the default) are ending balances at the end of the report period, taking into account all transactions before that date @@ -368,21 +297,21 @@ Period balances ignore transactions before the report start date, so they show the change in balance during the report period. They are more useful eg when viewing a time log. .PP -\f[C]U\f[] toggles filtering by unmarked status, including or excluding +\f[C]U\f[R] toggles filtering by unmarked status, including or excluding unmarked postings in the balances. -Similarly, \f[C]P\f[] toggles pending postings, and \f[C]C\f[] toggles +Similarly, \f[C]P\f[R] toggles pending postings, and \f[C]C\f[R] toggles cleared postings. (By default, balances include all postings; if you activate one or two status filters, only those postings are included; and if you activate all three, the filter is removed.) .PP -\f[C]R\f[] toggles real mode, in which virtual postings are ignored. +\f[C]R\f[R] toggles real mode, in which virtual postings are ignored. .PP -\f[C]Z\f[] toggles nonzero mode, in which only accounts with nonzero -balances are shown (hledger\-ui shows zero items by default, unlike -command\-line hledger). +\f[C]Z\f[R] toggles nonzero mode, in which only accounts with nonzero +balances are shown (hledger-ui shows zero items by default, unlike +command-line hledger). .PP -Press \f[C]right\f[] or \f[C]enter\f[] to view an account\[aq]s +Press \f[C]right\f[R] or \f[C]enter\f[R] to view an account\[aq]s transactions register. .SS Register screen .PP @@ -399,7 +328,7 @@ inflow to this account, negative for an outflow. .IP \[bu] 2 the running historical total or period total for the current account, after the transaction. -This can be toggled with \f[C]H\f[]. +This can be toggled with \f[C]H\f[R]. Similar to the accounts screen, the historical total is affected by transactions (filtered by the filter query) before the report start date, while the period total is not. @@ -416,23 +345,23 @@ to the balance shown on the accounts screen. .PD 0 .P .PD -Tree mode/flat mode can be toggled with \f[C]T\f[] here also. +Tree mode/flat mode can be toggled with \f[C]T\f[R] here also. .PP -\f[C]U\f[] toggles filtering by unmarked status, showing or hiding +\f[C]U\f[R] toggles filtering by unmarked status, showing or hiding unmarked transactions. -Similarly, \f[C]P\f[] toggles pending transactions, and \f[C]C\f[] +Similarly, \f[C]P\f[R] toggles pending transactions, and \f[C]C\f[R] toggles cleared transactions. (By default, transactions with all statuses are shown; if you activate one or two status filters, only those transactions are shown; and if you activate all three, the filter is removed.) .PP -\f[C]R\f[] toggles real mode, in which virtual postings are ignored. +\f[C]R\f[R] toggles real mode, in which virtual postings are ignored. .PP -\f[C]Z\f[] toggles nonzero mode, in which only transactions posting a -nonzero change are shown (hledger\-ui shows zero items by default, -unlike command\-line hledger). +\f[C]Z\f[R] toggles nonzero mode, in which only transactions posting a +nonzero change are shown (hledger-ui shows zero items by default, unlike +command-line hledger). .PP -Press \f[C]right\f[] (or \f[C]enter\f[]) to view the selected +Press \f[C]right\f[R] (or \f[C]enter\f[R]) to view the selected transaction in detail. .SS Transaction screen .PP @@ -445,8 +374,8 @@ description, comments, along with all of its account postings are shown. Simple transactions have two postings, but there can be more (or in certain cases, fewer). .PP -\f[C]up\f[] and \f[C]down\f[] will step through all transactions listed -in the previous account register screen. +\f[C]up\f[R] and \f[C]down\f[R] will step through all transactions +listed in the previous account register screen. In the title bar, the numbers in parentheses show your position within that account register. They will vary depending on which account register you came from @@ -463,39 +392,39 @@ normal operation. (Or, you can press escape to cancel the reload attempt.) .SH ENVIRONMENT .PP -\f[B]COLUMNS\f[] The screen width to use. +\f[B]COLUMNS\f[R] The screen width to use. Default: the full terminal width. .PP -\f[B]LEDGER_FILE\f[] The journal file path when not specified with -\f[C]\-f\f[]. -Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps -\f[C]C:/Users/USER/.hledger.journal\f[]). +\f[B]LEDGER_FILE\f[R] The journal file path when not specified with +\f[C]-f\f[R]. +Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps +\f[C]C:/Users/USER/.hledger.journal\f[R]). .SH FILES .PP Reads data from one or more files in hledger journal, timeclock, -timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). +timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). .SH BUGS .PP -The need to precede options with \f[C]\-\-\f[] when invoked from hledger +The need to precede options with \f[C]--\f[R] when invoked from hledger is awkward. .PP -\f[C]\-f\-\f[] doesn\[aq]t work (hledger\-ui can\[aq]t read from stdin). +\f[C]-f-\f[R] doesn\[aq]t work (hledger-ui can\[aq]t read from stdin). .PP -\f[C]\-V\f[] affects only the accounts screen. +\f[C]-V\f[R] affects only the accounts screen. .PP -When you press \f[C]g\f[], the current and all previous screens are +When you press \f[C]g\f[R], the current and all previous screens are regenerated, which may cause a noticeable pause with large files. Also there is no visual indication that this is in progress. .PP -\f[C]\-\-watch\f[] is not yet fully robust. +\f[C]--watch\f[R] is not yet fully robust. It works well for normal usage, but many file changes in a short time (eg saving the file thousands of times with an editor macro) can cause problems at least on OSX. Symptoms include: unresponsive UI, periodic resetting of the cursor position, momentary display of parse errors, high CPU usage eventually -subsiding, and possibly a small but persistent build\-up of CPU usage +subsiding, and possibly a small but persistent build-up of CPU usage until the program is restarted. diff --git a/hledger-ui/hledger-ui.info b/hledger-ui/hledger-ui.info index 2dc82fcd8..d8f39ea79 100644 --- a/hledger-ui/hledger-ui.info +++ b/hledger-ui/hledger-ui.info @@ -3,8 +3,8 @@ This is hledger-ui.info, produced by makeinfo version 6.5 from stdin.  File: hledger-ui.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-ui(1) hledger-ui 1.14 -***************************** +hledger-ui(1) hledger-ui 1.14.99 +******************************** hledger-ui is hledger's curses-style interface, providing an efficient full-window text UI for viewing accounts and transactions, and some @@ -24,6 +24,7 @@ journal, timeclock, timedot, or CSV format specified with '-f', or '$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps 'C:/Users/USER/.hledger.journal'). For more about this see hledger(1), hledger_journal(5) etc. + * Menu: * OPTIONS:: @@ -398,19 +399,19 @@ to cancel the reload attempt.)  Tag Table: Node: Top71 -Node: OPTIONS1100 -Ref: #options1197 -Node: KEYS4616 -Ref: #keys4711 -Node: SCREENS7967 -Ref: #screens8052 -Node: Accounts screen8142 -Ref: #accounts-screen8270 -Node: Register screen10486 -Ref: #register-screen10641 -Node: Transaction screen12637 -Ref: #transaction-screen12795 -Node: Error screen13665 -Ref: #error-screen13787 +Node: OPTIONS1107 +Ref: #options1204 +Node: KEYS4623 +Ref: #keys4718 +Node: SCREENS7974 +Ref: #screens8059 +Node: Accounts screen8149 +Ref: #accounts-screen8277 +Node: Register screen10493 +Ref: #register-screen10648 +Node: Transaction screen12644 +Ref: #transaction-screen12802 +Node: Error screen13672 +Ref: #error-screen13794  End Tag Table diff --git a/hledger-ui/hledger-ui.txt b/hledger-ui/hledger-ui.txt index 9c9492f2a..067ddbf47 100644 --- a/hledger-ui/hledger-ui.txt +++ b/hledger-ui/hledger-ui.txt @@ -18,9 +18,9 @@ DESCRIPTION hledger-ui is hledger's curses-style interface, providing an efficient full-window text UI for viewing accounts and transactions, and some - limited data entry capability. It is easier than hledger's com- - mand-line interface, and sometimes quicker and more convenient than the - web interface. + limited data entry capability. It is easier than hledger's command- + line interface, and sometimes quicker and more convenient than the web + interface. Note hledger-ui has some different defaults (experimental): @@ -179,22 +179,22 @@ KEYS or LEFT) to close it. The following keys work on most screens: The cursor keys navigate: right (or enter) goes deeper, left returns to - the previous screen, up/down/page up/page down/home/end move up and - down through lists. Vi-style (h/j/k/l) and Emacs-style - (CTRL-p/CTRL-n/CTRL-f/CTRL-b) movement keys are also supported. A tip: - movement speed is limited by your keyboard repeat rate, to move faster - you may want to adjust it. (If you're on a mac, the Karabiner app is - one way to do that.) + the previous screen, up/down/page up/page down/home/end move up and + down through lists. Vi-style (h/j/k/l) and Emacs-style (CTRL-p/CTRL- + n/CTRL-f/CTRL-b) movement keys are also supported. A tip: movement + speed is limited by your keyboard repeat rate, to move faster you may + want to adjust it. (If you're on a mac, the Karabiner app is one way + to do that.) With shift pressed, the cursor keys adjust the report period, limiting - the transactions to be shown (by default, all are shown). - shift-down/up steps downward and upward through these standard report - period durations: year, quarter, month, week, day. Then, - shift-left/right moves to the previous/next period. t sets the report - period to today. With the --watch option, when viewing a "current" - period (the current day, week, month, quarter, or year), the period - will move automatically to track the current date. To set a non-stan- - dard period, you can use / and a date: query. + the transactions to be shown (by default, all are shown). shift- + down/up steps downward and upward through these standard report period + durations: year, quarter, month, week, day. Then, shift-left/right + moves to the previous/next period. t sets the report period to today. + With the --watch option, when viewing a "current" period (the current + day, week, month, quarter, or year), the period will move automatically + to track the current date. To set a non-standard period, you can use / + and a date: query. / lets you set a general filter query limiting the data shown, using the same query terms as in hledger and hledger-web. While editing the @@ -226,15 +226,15 @@ KEYS a runs command-line hledger's add command, and reloads the updated file. This allows some basic data entry. - A is like a, but runs the hledger-iadd tool, which provides a - curses-style interface. This key will be available if hledger-iadd is + A is like a, but runs the hledger-iadd tool, which provides a curses- + style interface. This key will be available if hledger-iadd is installed in $PATH. - E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac- - sclient -a "" -nw) on the journal file. With some editors (emacs, vi), - the cursor will be positioned at the current transaction when invoked - from the register and transaction screens, and at the error location - (if possible) when invoked from the error screen. + E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emacsclient -a "" + -nw) on the journal file. With some editors (emacs, vi), the cursor + will be positioned at the current transaction when invoked from the + register and transaction screens, and at the error location (if possi- + ble) when invoked from the error screen. q quits the application. @@ -406,4 +406,4 @@ SEE ALSO -hledger-ui 1.14 March 2019 hledger-ui(1) +hledger-ui 1.14.99 March 2019 hledger-ui(1) diff --git a/hledger-web/hledger-web.1 b/hledger-web/hledger-web.1 index 99625a8f9..e63f4ad1e 100644 --- a/hledger-web/hledger-web.1 +++ b/hledger-web/hledger-web.1 @@ -1,34 +1,34 @@ -.TH "hledger\-web" "1" "March 2019" "hledger\-web 1.14" "hledger User Manuals" +.TH "hledger-web" "1" "March 2019" "hledger-web 1.14.99" "hledger User Manuals" .SH NAME .PP -hledger\-web \- web interface for the hledger accounting tool +hledger-web - web interface for the hledger accounting tool .SH SYNOPSIS .PP -\f[C]hledger\-web\ [OPTIONS]\f[] +\f[C]hledger-web [OPTIONS]\f[R] .PD 0 .P .PD -\f[C]hledger\ web\ \-\-\ [OPTIONS]\f[] +\f[C]hledger web -- [OPTIONS]\f[R] .SH DESCRIPTION .PP -hledger is a cross\-platform program for tracking money, time, or any -other commodity, using double\-entry accounting and a simple, editable +hledger is a cross-platform program 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). .PP -hledger\-web is hledger\[aq]s web interface. +hledger-web is hledger\[aq]s web interface. It starts a simple web application for browsing and adding transactions, and optionally opens it in a web browser window if possible. -It provides a more user\-friendly UI than the hledger CLI or hledger\-ui +It provides a more user-friendly UI than the hledger CLI or hledger-ui interface, showing more at once (accounts, the current account register, -balance charts) and allowing history\-aware data entry, interactive +balance charts) and allowing history-aware data entry, interactive searching, and bookmarking. .PP -hledger\-web also lets you share a ledger with multiple users, or even +hledger-web also lets you share a ledger with multiple users, or even the public web. There is no access control, so if you need that you should put it behind a suitable web proxy. @@ -37,201 +37,135 @@ instance, it writes a numbered backup of the main journal file (only ?) on every edit. .PP Like hledger, it reads data from one or more files in hledger journal, -timeclock, timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). +timeclock, timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). For more about this see hledger(1), hledger_journal(5) etc. .SH OPTIONS .PP -Command\-line options and arguments may be used to set an initial filter +Command-line options and arguments may be used to set an initial filter on the data. These filter options are not shown in the web UI, but it will be applied in addition to any search query entered there. .PP -Note: if invoking hledger\-web as a hledger subcommand, write -\f[C]\-\-\f[] before options, as shown in the synopsis above. +Note: if invoking hledger-web as a hledger subcommand, write +\f[C]--\f[R] before options, as shown in the synopsis above. .TP -.B \f[C]\-\-serve\f[] -serve and log requests, don\[aq]t browse or auto\-exit -.RS -.RE +.B \f[C]--serve\f[R] +serve and log requests, don\[aq]t browse or auto-exit .TP -.B \f[C]\-\-host=IPADDR\f[] +.B \f[C]--host=IPADDR\f[R] listen on this IP address (default: 127.0.0.1) -.RS -.RE .TP -.B \f[C]\-\-port=PORT\f[] +.B \f[C]--port=PORT\f[R] listen on this TCP port (default: 5000) -.RS -.RE .TP -.B \f[C]\-\-base\-url=URL\f[] +.B \f[C]--base-url=URL\f[R] set the base url (default: http://IPADDR:PORT). You would change this when sharing over the network, or integrating within a larger website. -.RS -.RE .TP -.B \f[C]\-\-file\-url=URL\f[] +.B \f[C]--file-url=URL\f[R] set the static files url (default: BASEURL/static). -hledger\-web normally serves static files itself, but if you wanted to +hledger-web normally serves static files itself, but if you wanted to serve them from another server for efficiency, you would set the url with this. -.RS -.RE .TP -.B \f[C]\-\-capabilities=CAP[,CAP..]\f[] +.B \f[C]--capabilities=CAP[,CAP..]\f[R] enable the view, add, and/or manage capabilities (default: view,add) -.RS -.RE .TP -.B \f[C]\-\-capabilities\-header=HTTPHEADER\f[] +.B \f[C]--capabilities-header=HTTPHEADER\f[R] read capabilities to enable from a HTTP header, like -X\-Sandstorm\-Permissions (default: disabled) -.RS -.RE +X-Sandstorm-Permissions (default: disabled) .PP hledger input options: .TP -.B \f[C]\-f\ FILE\ \-\-file=FILE\f[] +.B \f[C]-f FILE --file=FILE\f[R] use a different input file. -For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or -\f[C]$HOME/.hledger.journal\f[]) -.RS -.RE +For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or +\f[C]$HOME/.hledger.journal\f[R]) .TP -.B \f[C]\-\-rules\-file=RULESFILE\f[] +.B \f[C]--rules-file=RULESFILE\f[R] Conversion rules file to use when reading CSV (default: FILE.rules) -.RS -.RE .TP -.B \f[C]\-\-separator=CHAR\f[] +.B \f[C]--separator=CHAR\f[R] Field separator to expect when reading CSV (default: \[aq],\[aq]) -.RS -.RE .TP -.B \f[C]\-\-alias=OLD=NEW\f[] +.B \f[C]--alias=OLD=NEW\f[R] rename accounts named OLD to NEW -.RS -.RE .TP -.B \f[C]\-\-anon\f[] +.B \f[C]--anon\f[R] anonymize accounts and payees -.RS -.RE .TP -.B \f[C]\-\-pivot\ FIELDNAME\f[] +.B \f[C]--pivot FIELDNAME\f[R] use some other field or tag for the account name -.RS -.RE .TP -.B \f[C]\-I\ \-\-ignore\-assertions\f[] +.B \f[C]-I --ignore-assertions\f[R] ignore any failing balance assertions -.RS -.RE .PP hledger reporting options: .TP -.B \f[C]\-b\ \-\-begin=DATE\f[] +.B \f[C]-b --begin=DATE\f[R] include postings/txns on or after this date -.RS -.RE .TP -.B \f[C]\-e\ \-\-end=DATE\f[] +.B \f[C]-e --end=DATE\f[R] include postings/txns before this date -.RS -.RE .TP -.B \f[C]\-D\ \-\-daily\f[] +.B \f[C]-D --daily\f[R] multiperiod/multicolumn report by day -.RS -.RE .TP -.B \f[C]\-W\ \-\-weekly\f[] +.B \f[C]-W --weekly\f[R] multiperiod/multicolumn report by week -.RS -.RE .TP -.B \f[C]\-M\ \-\-monthly\f[] +.B \f[C]-M --monthly\f[R] multiperiod/multicolumn report by month -.RS -.RE .TP -.B \f[C]\-Q\ \-\-quarterly\f[] +.B \f[C]-Q --quarterly\f[R] multiperiod/multicolumn report by quarter -.RS -.RE .TP -.B \f[C]\-Y\ \-\-yearly\f[] +.B \f[C]-Y --yearly\f[R] multiperiod/multicolumn report by year -.RS -.RE .TP -.B \f[C]\-p\ \-\-period=PERIODEXP\f[] +.B \f[C]-p --period=PERIODEXP\f[R] set start date, end date, and/or reporting interval all at once using period expressions syntax (overrides the flags above) -.RS -.RE .TP -.B \f[C]\-\-date2\f[] +.B \f[C]--date2\f[R] match the secondary date instead (see command help for other effects) -.RS -.RE .TP -.B \f[C]\-U\ \-\-unmarked\f[] -include only unmarked postings/txns (can combine with \-P or \-C) -.RS -.RE +.B \f[C]-U --unmarked\f[R] +include only unmarked postings/txns (can combine with -P or -C) .TP -.B \f[C]\-P\ \-\-pending\f[] +.B \f[C]-P --pending\f[R] include only pending postings/txns -.RS -.RE .TP -.B \f[C]\-C\ \-\-cleared\f[] +.B \f[C]-C --cleared\f[R] include only cleared postings/txns -.RS -.RE .TP -.B \f[C]\-R\ \-\-real\f[] -include only non\-virtual postings -.RS -.RE +.B \f[C]-R --real\f[R] +include only non-virtual postings .TP -.B \f[C]\-NUM\ \-\-depth=NUM\f[] +.B \f[C]-NUM --depth=NUM\f[R] hide/aggregate accounts or postings more than NUM levels deep -.RS -.RE .TP -.B \f[C]\-E\ \-\-empty\f[] -show items with zero amount, normally hidden (and vice\-versa in -hledger\-ui/hledger\-web) -.RS -.RE +.B \f[C]-E --empty\f[R] +show items with zero amount, normally hidden (and vice-versa in +hledger-ui/hledger-web) .TP -.B \f[C]\-B\ \-\-cost\f[] +.B \f[C]-B --cost\f[R] convert amounts to their cost at transaction time (using the transaction price, if any) -.RS -.RE .TP -.B \f[C]\-V\ \-\-value\f[] +.B \f[C]-V --value\f[R] convert amounts to their market value on the report end date (using the most recent applicable market price, if any) -.RS -.RE .TP -.B \f[C]\-\-auto\f[] +.B \f[C]--auto\f[R] apply automated posting rules to modify transactions. -.RS -.RE .TP -.B \f[C]\-\-forecast\f[] +.B \f[C]--forecast\f[R] apply periodic transaction rules to generate future transactions, to 6 months from now or report end date. -.RS -.RE .PP When a reporting option appears more than once in the command line, the last one takes precedence. @@ -240,59 +174,53 @@ Some reporting options can also be written as query arguments. .PP hledger help options: .TP -.B \f[C]\-h\ \-\-help\f[] +.B \f[C]-h --help\f[R] show general usage (or after COMMAND, command usage) -.RS -.RE .TP -.B \f[C]\-\-version\f[] +.B \f[C]--version\f[R] show version -.RS -.RE .TP -.B \f[C]\-\-debug[=N]\f[] -show debug output (levels 1\-9, default: 1) -.RS -.RE +.B \f[C]--debug[=N]\f[R] +show debug output (levels 1-9, default: 1) .PP -A \@FILE argument will be expanded to the contents of FILE, which should -contain one command line option/argument per line. -(To prevent this, insert a \f[C]\-\-\f[] argument before.) +A \[at]FILE argument will be expanded to the contents of FILE, which +should contain one command line option/argument per line. +(To prevent this, insert a \f[C]--\f[R] argument before.) .PP -By default, hledger\-web starts the web app in "transient mode" and also -opens it in your default web browser if possible. +By default, hledger-web starts the web app in \[dq]transient mode\[dq] +and also opens it in your default web browser if possible. In this mode the web app will keep running for as long as you have it open in a browser window, and will exit after two minutes of inactivity (no requests and no browser windows viewing it). -With \f[C]\-\-serve\f[], it just runs the web app without exiting, and +With \f[C]--serve\f[R], it just runs the web app without exiting, and logs requests to the console. .PP By default the server listens on IP address 127.0.0.1, accessible only to local requests. -You can use \f[C]\-\-host\f[] to change this, eg -\f[C]\-\-host\ 0.0.0.0\f[] to listen on all configured addresses. +You can use \f[C]--host\f[R] to change this, eg \f[C]--host 0.0.0.0\f[R] +to listen on all configured addresses. .PP -Similarly, use \f[C]\-\-port\f[] to set a TCP port other than 5000, eg -if you are running multiple hledger\-web instances. +Similarly, use \f[C]--port\f[R] to set a TCP port other than 5000, eg if +you are running multiple hledger-web instances. .PP -You can use \f[C]\-\-base\-url\f[] to change the protocol, hostname, -port and path that appear in hyperlinks, useful eg for integrating -hledger\-web within a larger website. -The default is \f[C]http://HOST:PORT/\f[] using the server\[aq]s -configured host address and TCP port (or \f[C]http://HOST\f[] if PORT is -80). +You can use \f[C]--base-url\f[R] to change the protocol, hostname, port +and path that appear in hyperlinks, useful eg for integrating +hledger-web within a larger website. +The default is \f[C]http://HOST:PORT/\f[R] using the server\[aq]s +configured host address and TCP port (or \f[C]http://HOST\f[R] if PORT +is 80). .PP -With \f[C]\-\-file\-url\f[] you can set a different base url for static -files, eg for better caching or cookie\-less serving on high performance +With \f[C]--file-url\f[R] you can set a different base url for static +files, eg for better caching or cookie-less serving on high performance websites. .SH PERMISSIONS .PP -By default, hledger\-web allows anyone who can reach it to view the +By default, hledger-web allows anyone who can reach it to view the journal and to add new transactions, but not to change existing data. .PP You can restrict who can reach it by .IP \[bu] 2 -setting the IP address it listens on (see \f[C]\-\-host\f[] above). +setting the IP address it listens on (see \f[C]--host\f[R] above). By default it listens on 127.0.0.1, accessible to all users on the local machine. .IP \[bu] 2 @@ -302,56 +230,59 @@ custom firewall rules .PP You can restrict what the users who reach it can do, by .IP \[bu] 2 -using the \f[C]\-\-capabilities=CAP[,CAP..]\f[] flag when you start it, +using the \f[C]--capabilities=CAP[,CAP..]\f[R] flag when you start it, enabling one or more of the following capabilities. -The default value is \f[C]view,add\f[]: +The default value is \f[C]view,add\f[R]: .RS 2 .IP \[bu] 2 -\f[C]view\f[] \- allows viewing the journal file and all included files +\f[C]view\f[R] - allows viewing the journal file and all included files .IP \[bu] 2 -\f[C]add\f[] \- allows adding new transactions to the main journal file +\f[C]add\f[R] - allows adding new transactions to the main journal file .IP \[bu] 2 -\f[C]manage\f[] \- allows editing, uploading or downloading the main or +\f[C]manage\f[R] - allows editing, uploading or downloading the main or included files .RE .IP \[bu] 2 -using the \f[C]\-\-capabilities\-header=HTTPHEADER\f[] flag to specify a +using the \f[C]--capabilities-header=HTTPHEADER\f[R] flag to specify a HTTP header from which it will read capabilities to enable. -hledger\-web on Sandstorm uses the X\-Sandstorm\-Permissions header to +hledger-web on Sandstorm uses the X-Sandstorm-Permissions header to integrate with Sandstorm\[aq]s permissions. This is disabled by default. .SH EDITING, UPLOADING, DOWNLOADING .PP -If you enable the \f[C]manage\f[] capability mentioned above, you\[aq]ll -see a new "spanner" button to the right of the search form. +If you enable the \f[C]manage\f[R] capability mentioned above, +you\[aq]ll see a new \[dq]spanner\[dq] button to the right of the search +form. Clicking this will let you edit, upload, or download the journal file or any files it includes. .PP Note, unlike any other hledger command, in this mode you (or any visitor) can alter or wipe the data files. .PP -Normally whenever a file is changed in this way, hledger\-web saves a +Normally whenever a file is changed in this way, hledger-web saves a numbered backup (assuming file permissions allow it, the disk is not -full, etc.) hledger\-web is not aware of version control systems, +full, etc.) hledger-web is not aware of version control systems, currently; if you use one, you\[aq]ll have to arrange to commit the changes yourself (eg with a cron job or a file watcher like entr). .PP -Changes which would leave the journal file(s) unparseable or non\-valid +Changes which would leave the journal file(s) unparseable or non-valid (eg with failing balance assertions) are prevented. (Probably. -This needs re\-testing.) +This needs re-testing.) .SH RELOADING .PP -hledger\-web detects changes made to the files by other means (eg if you -edit it directly, outside of hledger\-web), and it will show the new -data when you reload the page or navigate to a new page. -If a change makes a file unparseable, hledger\-web will display an error +hledger-web detects changes made to the files by other means (eg if you +edit it directly, outside of hledger-web), and it will show the new data +when you reload the page or navigate to a new page. +If a change makes a file unparseable, hledger-web will display an error message until the file has been fixed. .SH JSON API .PP -In addition to the web UI, hledger\-web provides some JSON API routes. -These are similar to the API provided by the hledger\-api tool, but it -may be convenient to have them in hledger\-web also. +In addition to the web UI, hledger-web provides some API routes that +serve JSON in response to GET requests. +Currently these are same ones provided by the hledger-api tool, but +hledger-web will likely receive more attention than hledger-api in +future: .IP .nf \f[C] @@ -361,31 +292,65 @@ may be convenient to have them in hledger\-web also. /commodities /accounts /accounttransactions/#AccountName -\f[] +\f[R] +.fi +.PP +Also, you can append a new transaction to the journal by sending a PUT +request to \f[C]/add\f[R] (hledger-web only). +As with the web UI\[aq]s add form, hledger-web must be started with the +\f[C]add\f[R] capability for this (enabled by default). +.PP +The payload should be a valid hledger transaction as JSON, similar to +what you get from \f[C]/transactions\f[R] or +\f[C]/accounttransactions\f[R]. +.PP +Another way to generate test data is with the +\f[C]readJsonFile\f[R]/\f[C]writeJsonFile\f[R] helpers in +Hledger.Web.Json, which read or write any of hledger\[aq]s JSON-capable +types from or to a file. +Eg here we write the first transaction of a sample journal: +.IP +.nf +\f[C] +$ make ghci-web +>>> :m +*Hledger.Web.Json +>>> writeJsonFile \[dq]txn.json\[dq] (head $ jtxns samplejournal) +>>> :q +$ python -m json.tool txn.pretty.json # optional: make human-readable +\f[R] +.fi +.PP +(sample output & discussion) +.PP +And here\[aq]s how to test adding that with curl: +.IP +.nf +\f[C] +$ curl -s http://127.0.0.1:5000/add -X PUT -H \[aq]Content-Type: application/json\[aq] --data-binary \[at]txn.pretty.json; echo +\f[R] .fi .SH ENVIRONMENT .PP -\f[B]LEDGER_FILE\f[] The journal file path when not specified with -\f[C]\-f\f[]. -Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps -\f[C]C:/Users/USER/.hledger.journal\f[]). +\f[B]LEDGER_FILE\f[R] The journal file path when not specified with +\f[C]-f\f[R]. +Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps +\f[C]C:/Users/USER/.hledger.journal\f[R]). .SH FILES .PP Reads data from one or more files in hledger journal, timeclock, -timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). +timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). .SH BUGS .PP -The need to precede options with \f[C]\-\-\f[] when invoked from hledger +The need to precede options with \f[C]--\f[R] when invoked from hledger is awkward. .PP -\f[C]\-f\-\f[] doesn\[aq]t work (hledger\-web can\[aq]t read from -stdin). +\f[C]-f-\f[R] doesn\[aq]t work (hledger-web can\[aq]t read from stdin). .PP Query arguments and some hledger options are ignored. .PP -Does not work in text\-mode browsers. +Does not work in text-mode browsers. .PP Does not work well on small screens. diff --git a/hledger-web/hledger-web.info b/hledger-web/hledger-web.info index 4e977ec09..5921982b1 100644 --- a/hledger-web/hledger-web.info +++ b/hledger-web/hledger-web.info @@ -3,8 +3,8 @@ This is hledger-web.info, produced by makeinfo version 6.5 from stdin.  File: hledger-web.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-web(1) hledger-web 1.14 -******************************* +hledger-web(1) hledger-web 1.14.99 +********************************** hledger-web is hledger's web interface. It starts a simple web application for browsing and adding transactions, and optionally opens @@ -25,6 +25,7 @@ journal, timeclock, timedot, or CSV format specified with '-f', or '$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps 'C:/Users/USER/.hledger.journal'). For more about this see hledger(1), hledger_journal(5) etc. + * Menu: * OPTIONS:: @@ -287,9 +288,10 @@ File: hledger-web.info, Node: JSON API, Prev: RELOADING, Up: Top 5 JSON API ********** -In addition to the web UI, hledger-web provides some JSON API routes. -These are similar to the API provided by the hledger-api tool, but it -may be convenient to have them in hledger-web also. +In addition to the web UI, hledger-web provides some API routes that +serve JSON in response to GET requests. Currently these are same ones +provided by the hledger-api tool, but hledger-web will likely receive +more attention than hledger-api in future: /accountnames /transactions @@ -298,18 +300,43 @@ may be convenient to have them in hledger-web also. /accounts /accounttransactions/#AccountName + Also, you can append a new transaction to the journal by sending a +PUT request to '/add' (hledger-web only). As with the web UI's add +form, hledger-web must be started with the 'add' capability for this +(enabled by default). + + The payload should be a valid hledger transaction as JSON, similar to +what you get from '/transactions' or '/accounttransactions'. + + Another way to generate test data is with the +'readJsonFile'/'writeJsonFile' helpers in Hledger.Web.Json, which read +or write any of hledger's JSON-capable types from or to a file. Eg here +we write the first transaction of a sample journal: + +$ make ghci-web +>>> :m +*Hledger.Web.Json +>>> writeJsonFile "txn.json" (head $ jtxns samplejournal) +>>> :q +$ python -m json.tool txn.pretty.json # optional: make human-readable + + (sample output & discussion) + + And here's how to test adding that with curl: + +$ curl -s http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.pretty.json; echo +  Tag Table: Node: Top72 -Node: OPTIONS1354 -Ref: #options1459 -Node: PERMISSIONS6549 -Ref: #permissions6688 -Node: EDITING UPLOADING DOWNLOADING7900 -Ref: #editing-uploading-downloading8081 -Node: RELOADING8915 -Ref: #reloading9049 -Node: JSON API9359 -Ref: #json-api9453 +Node: OPTIONS1361 +Ref: #options1466 +Node: PERMISSIONS6556 +Ref: #permissions6695 +Node: EDITING UPLOADING DOWNLOADING7907 +Ref: #editing-uploading-downloading8088 +Node: RELOADING8922 +Ref: #reloading9056 +Node: JSON API9366 +Ref: #json-api9460  End Tag Table diff --git a/hledger-web/hledger-web.txt b/hledger-web/hledger-web.txt index 944073bac..87b8537d8 100644 --- a/hledger-web/hledger-web.txt +++ b/hledger-web/hledger-web.txt @@ -187,8 +187,8 @@ OPTIONS without exiting, and logs requests to the console. By default the server listens on IP address 127.0.0.1, accessible only - to local requests. You can use --host to change this, eg - --host 0.0.0.0 to listen on all configured addresses. + to local requests. You can use --host to change this, eg --host + 0.0.0.0 to listen on all configured addresses. Similarly, use --port to set a TCP port other than 5000, eg if you are running multiple hledger-web instances. @@ -260,9 +260,10 @@ RELOADING until the file has been fixed. JSON API - In addition to the web UI, hledger-web provides some JSON API routes. - These are similar to the API provided by the hledger-api tool, but it - may be convenient to have them in hledger-web also. + In addition to the web UI, hledger-web provides some API routes that + serve JSON in response to GET requests. Currently these are same ones + provided by the hledger-api tool, but hledger-web will likely receive + more attention than hledger-api in future: /accountnames /transactions @@ -271,6 +272,31 @@ JSON API /accounts /accounttransactions/#AccountName + Also, you can append a new transaction to the journal by sending a PUT + request to /add (hledger-web only). As with the web UI's add form, + hledger-web must be started with the add capability for this (enabled + by default). + + The payload should be a valid hledger transaction as JSON, similar to + what you get from /transactions or /accounttransactions. + + Another way to generate test data is with the readJsonFile/writeJson- + File helpers in Hledger.Web.Json, which read or write any of hledger's + JSON-capable types from or to a file. Eg here we write the first + transaction of a sample journal: + + $ make ghci-web + >>> :m +*Hledger.Web.Json + >>> writeJsonFile "txn.json" (head $ jtxns samplejournal) + >>> :q + $ python -m json.tool txn.pretty.json # optional: make human-readable + + (sample output & discussion) + + And here's how to test adding that with curl: + + $ curl -s http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.pretty.json; echo + ENVIRONMENT LEDGER_FILE The journal file path when not specified with -f. Default: ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- @@ -319,4 +345,4 @@ SEE ALSO -hledger-web 1.14 March 2019 hledger-web(1) +hledger-web 1.14.99 March 2019 hledger-web(1) diff --git a/hledger/hledger.1 b/hledger/hledger.1 index 36a17aff8..5845d14e4 100644 --- a/hledger/hledger.1 +++ b/hledger/hledger.1 @@ -1,27 +1,27 @@ .\"t -.TH "hledger" "1" "March 2019" "hledger 1.14.1" "hledger User Manuals" +.TH "hledger" "1" "March 2019" "hledger 1.14.99" "hledger User Manuals" .SH NAME .PP -hledger \- a command\-line accounting tool +hledger - a command-line accounting tool .SH SYNOPSIS .PP -\f[C]hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [ARGS]\f[] +\f[C]hledger [-f FILE] COMMAND [OPTIONS] [ARGS]\f[R] .PD 0 .P .PD -\f[C]hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [ARGS]\f[] +\f[C]hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]\f[R] .PD 0 .P .PD -\f[C]hledger\f[] +\f[C]hledger\f[R] .SH DESCRIPTION .PP -hledger is a cross\-platform program for tracking money, time, or any -other commodity, using double\-entry accounting and a simple, editable +hledger is a cross-platform program 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). .PD 0 @@ -30,290 +30,232 @@ hledger is inspired by and largely compatible with ledger(1). Tested on unix, mac, windows, hledger aims to be a reliable, practical tool for daily use. .PP -This is hledger's command\-line interface (there are also curses and web -interfaces). +This is hledger\[cq]s command-line interface (there are also curses 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. 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 -user's $PATH and can invoke them as subcommands. +Additionally, hledger lists other hledger-* executables found in the +user\[cq]s $PATH and can invoke them as subcommands. .PP hledger reads data from one or more files in hledger journal, timeclock, -timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). -If using \f[C]$LEDGER_FILE\f[], note this must be a real environment +timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). +If using \f[C]$LEDGER_FILE\f[R], note this must be a real environment variable, not a shell variable. -You can specify standard input with \f[C]\-f\-\f[]. +You can specify standard input with \f[C]-f-\f[R]. .PP Transactions are dated movements of money between two (or more) named accounts, and are recorded with journal entries like this: .IP .nf \f[C] -2015/10/16\ bought\ food -\ expenses:food\ \ \ \ \ \ \ \ \ \ $10 -\ assets:cash -\f[] +2015/10/16 bought food + expenses:food $10 + assets:cash +\f[R] .fi .PP For more about this format, see hledger_journal(5). .PP Most users use a text editor to edit the journal, usually with an editor -mode such as ledger\-mode for added convenience. -hledger's interactive add command is another way to record new +mode such as ledger-mode for added convenience. +hledger\[cq]s interactive add command is another way to record new transactions. hledger never changes existing transactions. .PP To get started, you can either save some entries like the above in -\f[C]~/.hledger.journal\f[], or run \f[C]hledger\ add\f[] and follow the -prompts. -Then try some commands like \f[C]hledger\ print\f[] or -\f[C]hledger\ balance\f[]. -Run \f[C]hledger\f[] with no arguments for a list of commands. +\f[C]\[ti]/.hledger.journal\f[R], or run \f[C]hledger add\f[R] and +follow the prompts. +Then try some commands like \f[C]hledger print\f[R] or +\f[C]hledger balance\f[R]. +Run \f[C]hledger\f[R] with no arguments for a list of commands. .SH EXAMPLES .PP Two simple transactions in hledger journal format: .IP .nf \f[C] -2015/9/30\ gift\ received -\ \ assets:cash\ \ \ $20 -\ \ income:gifts +2015/9/30 gift received + assets:cash $20 + income:gifts -2015/10/16\ farmers\ market -\ \ expenses:food\ \ \ \ $10 -\ \ assets:cash -\f[] +2015/10/16 farmers market + expenses:food $10 + assets:cash +\f[R] .fi .PP Some basic reports: .IP .nf \f[C] -$\ hledger\ print -2015/09/30\ gift\ received -\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ $20 -\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ $\-20 +$ hledger print +2015/09/30 gift received + assets:cash $20 + income:gifts $-20 -2015/10/16\ farmers\ market -\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ $10 -\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ $\-10 -\f[] +2015/10/16 farmers market + expenses:food $10 + assets:cash $-10 +\f[R] .fi .IP .nf \f[C] -$\ hledger\ accounts\ \-\-tree +$ hledger accounts --tree assets -\ \ cash + cash expenses -\ \ food + food income -\ \ gifts -\f[] + gifts +\f[R] .fi .IP .nf \f[C] -$\ hledger\ balance -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ assets:cash -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ expenses:food -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-20\ \ income:gifts -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +$ hledger balance + $10 assets:cash + $10 expenses:food + $-20 income:gifts +-------------------- + 0 +\f[R] .fi .IP .nf \f[C] -$\ hledger\ register\ cash -2015/09/30\ gift\ received\ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ $20 -2015/10/16\ farmers\ market\ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ \ \ $10 -\f[] +$ hledger register cash +2015/09/30 gift received assets:cash $20 $20 +2015/10/16 farmers market assets:cash $-10 $10 +\f[R] .fi .PP More commands: .IP .nf \f[C] -$\ hledger\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ available\ commands -$\ hledger\ add\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ add\ more\ transactions\ to\ the\ journal\ file -$\ hledger\ balance\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ all\ accounts\ with\ aggregated\ balances -$\ hledger\ balance\ \-\-help\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ detailed\ help\ for\ balance\ command -$\ hledger\ balance\ \-\-depth\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ only\ top\-level\ accounts -$\ hledger\ register\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ account\ postings,\ with\ running\ total -$\ hledger\ reg\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ postings\ to/from\ income\ accounts -$\ hledger\ reg\ \[aq]assets:some\ bank:checking\[aq]\ #\ show\ postings\ to/from\ this\ checking\ account -$\ hledger\ print\ desc:shop\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ transactions\ with\ shop\ in\ the\ description -$\ hledger\ activity\ \-W\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ transaction\ counts\ per\ week\ as\ a\ bar\ chart -\f[] +$ hledger # show available commands +$ hledger add # add more transactions to the journal file +$ hledger balance # all accounts with aggregated balances +$ hledger balance --help # show detailed help for balance command +$ hledger balance --depth 1 # only top-level accounts +$ hledger register # show account postings, with running total +$ hledger reg income # show postings to/from income accounts +$ hledger reg \[aq]assets:some bank:checking\[aq] # show postings to/from this checking account +$ hledger print desc:shop # show transactions with shop in the description +$ hledger activity -W # show transaction counts per week as a bar chart +\f[R] .fi .SH OPTIONS .SS General options .PP To see general usage help, including general options which are supported -by most hledger commands, run \f[C]hledger\ \-h\f[]. +by most hledger commands, run \f[C]hledger -h\f[R]. .PP General help options: .TP -.B \f[C]\-h\ \-\-help\f[] +.B \f[C]-h --help\f[R] show general usage (or after COMMAND, command usage) -.RS -.RE .TP -.B \f[C]\-\-version\f[] +.B \f[C]--version\f[R] show version -.RS -.RE .TP -.B \f[C]\-\-debug[=N]\f[] -show debug output (levels 1\-9, default: 1) -.RS -.RE +.B \f[C]--debug[=N]\f[R] +show debug output (levels 1-9, default: 1) .PP General input options: .TP -.B \f[C]\-f\ FILE\ \-\-file=FILE\f[] +.B \f[C]-f FILE --file=FILE\f[R] use a different input file. -For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or -\f[C]$HOME/.hledger.journal\f[]) -.RS -.RE +For stdin, use - (default: \f[C]$LEDGER_FILE\f[R] or +\f[C]$HOME/.hledger.journal\f[R]) .TP -.B \f[C]\-\-rules\-file=RULESFILE\f[] +.B \f[C]--rules-file=RULESFILE\f[R] Conversion rules file to use when reading CSV (default: FILE.rules) -.RS -.RE .TP -.B \f[C]\-\-separator=CHAR\f[] +.B \f[C]--separator=CHAR\f[R] Field separator to expect when reading CSV (default: \[aq],\[aq]) -.RS -.RE .TP -.B \f[C]\-\-alias=OLD=NEW\f[] +.B \f[C]--alias=OLD=NEW\f[R] rename accounts named OLD to NEW -.RS -.RE .TP -.B \f[C]\-\-anon\f[] +.B \f[C]--anon\f[R] anonymize accounts and payees -.RS -.RE .TP -.B \f[C]\-\-pivot\ FIELDNAME\f[] +.B \f[C]--pivot FIELDNAME\f[R] use some other field or tag for the account name -.RS -.RE .TP -.B \f[C]\-I\ \-\-ignore\-assertions\f[] +.B \f[C]-I --ignore-assertions\f[R] ignore any failing balance assertions -.RS -.RE .PP General reporting options: .TP -.B \f[C]\-b\ \-\-begin=DATE\f[] +.B \f[C]-b --begin=DATE\f[R] include postings/txns on or after this date -.RS -.RE .TP -.B \f[C]\-e\ \-\-end=DATE\f[] +.B \f[C]-e --end=DATE\f[R] include postings/txns before this date -.RS -.RE .TP -.B \f[C]\-D\ \-\-daily\f[] +.B \f[C]-D --daily\f[R] multiperiod/multicolumn report by day -.RS -.RE .TP -.B \f[C]\-W\ \-\-weekly\f[] +.B \f[C]-W --weekly\f[R] multiperiod/multicolumn report by week -.RS -.RE .TP -.B \f[C]\-M\ \-\-monthly\f[] +.B \f[C]-M --monthly\f[R] multiperiod/multicolumn report by month -.RS -.RE .TP -.B \f[C]\-Q\ \-\-quarterly\f[] +.B \f[C]-Q --quarterly\f[R] multiperiod/multicolumn report by quarter -.RS -.RE .TP -.B \f[C]\-Y\ \-\-yearly\f[] +.B \f[C]-Y --yearly\f[R] multiperiod/multicolumn report by year -.RS -.RE .TP -.B \f[C]\-p\ \-\-period=PERIODEXP\f[] +.B \f[C]-p --period=PERIODEXP\f[R] set start date, end date, and/or reporting interval all at once using period expressions syntax (overrides the flags above) -.RS -.RE .TP -.B \f[C]\-\-date2\f[] +.B \f[C]--date2\f[R] match the secondary date instead (see command help for other effects) -.RS -.RE .TP -.B \f[C]\-U\ \-\-unmarked\f[] -include only unmarked postings/txns (can combine with \-P or \-C) -.RS -.RE +.B \f[C]-U --unmarked\f[R] +include only unmarked postings/txns (can combine with -P or -C) .TP -.B \f[C]\-P\ \-\-pending\f[] +.B \f[C]-P --pending\f[R] include only pending postings/txns -.RS -.RE .TP -.B \f[C]\-C\ \-\-cleared\f[] +.B \f[C]-C --cleared\f[R] include only cleared postings/txns -.RS -.RE .TP -.B \f[C]\-R\ \-\-real\f[] -include only non\-virtual postings -.RS -.RE +.B \f[C]-R --real\f[R] +include only non-virtual postings .TP -.B \f[C]\-NUM\ \-\-depth=NUM\f[] +.B \f[C]-NUM --depth=NUM\f[R] hide/aggregate accounts or postings more than NUM levels deep -.RS -.RE .TP -.B \f[C]\-E\ \-\-empty\f[] -show items with zero amount, normally hidden (and vice\-versa in -hledger\-ui/hledger\-web) -.RS -.RE +.B \f[C]-E --empty\f[R] +show items with zero amount, normally hidden (and vice-versa in +hledger-ui/hledger-web) .TP -.B \f[C]\-B\ \-\-cost\f[] +.B \f[C]-B --cost\f[R] convert amounts to their cost at transaction time (using the transaction price, if any) -.RS -.RE .TP -.B \f[C]\-V\ \-\-value\f[] +.B \f[C]-V --value\f[R] convert amounts to their market value on the report end date (using the most recent applicable market price, if any) -.RS -.RE .TP -.B \f[C]\-\-auto\f[] +.B \f[C]--auto\f[R] apply automated posting rules to modify transactions. -.RS -.RE .TP -.B \f[C]\-\-forecast\f[] +.B \f[C]--forecast\f[R] apply periodic transaction rules to generate future transactions, to 6 months from now or report end date. -.RS -.RE .PP When a reporting option appears more than once in the command line, the last one takes precedence. @@ -321,17 +263,16 @@ last one takes precedence. Some reporting options can also be written as query arguments. .SS Command options .PP -To see options for a particular command, including command\-specific -options, run: \f[C]hledger\ COMMAND\ \-h\f[]. +To see options for a particular command, including command-specific +options, run: \f[C]hledger COMMAND -h\f[R]. .PP -Command\-specific options must be written after the command name, eg: -\f[C]hledger\ print\ \-x\f[]. +Command-specific options must be written after the command name, eg: +\f[C]hledger print -x\f[R]. .PP Additionally, if the command is an addon, you may need to put its -options after a double\-hyphen, eg: -\f[C]hledger\ ui\ \-\-\ \-\-watch\f[]. +options after a double-hyphen, eg: \f[C]hledger ui -- --watch\f[R]. Or, you can run the addon executable directly: -\f[C]hledger\-ui\ \-\-watch\f[]. +\f[C]hledger-ui --watch\f[R]. .SS Command arguments .PP Most hledger commands accept arguments after the command name, which are @@ -339,21 +280,21 @@ often a query, filtering the data in some way. .SS Argument files .PP You can save a set of command line options/arguments in a file, one per -line, and then reuse them by writing \f[C]\@FILENAME\f[] in a command -line. -To prevent this expansion of \f[C]\@\f[]\-arguments, precede them with a -\f[C]\-\-\f[] argument. +line, and then reuse them by writing \f[C]\[at]FILENAME\f[R] in a +command line. +To prevent this expansion of \f[C]\[at]\f[R]-arguments, precede them +with a \f[C]--\f[R] argument. For more, see Save frequently used options. .SS Special characters in arguments and queries .PP In shell command lines, option and argument values which contain -"problematic" characters, ie spaces, and also characters significant to -your shell such as \f[C]<\f[], \f[C]>\f[], \f[C](\f[], \f[C])\f[], -\f[C]|\f[] and \f[C]$\f[], should be escaped by enclosing them in quotes -or by writing backslashes before the characters. +\[dq]problematic\[dq] characters, ie spaces, and also characters +significant to your shell such as \f[C]<\f[R], \f[C]>\f[R], \f[C](\f[R], +\f[C])\f[R], \f[C]|\f[R] and \f[C]$\f[R], should be escaped by enclosing +them in quotes or by writing backslashes before the characters. Eg: .PP -\f[C]hledger\ register\ \-p\ \[aq]last\ year\[aq]\ "accounts\ receivable\ (receivable|payable)"\ amt:\\>100\f[]. +\f[C]hledger register -p \[aq]last year\[aq] \[dq]accounts receivable (receivable|payable)\[dq] amt:\[rs]>100\f[R]. .SS More escaping .PP Characters significant both to the shell and in regular expressions may @@ -361,26 +302,26 @@ need one extra level of escaping. These include parentheses, the pipe symbol and the dollar sign. Eg, to match the dollar symbol, bash users should do: .PP -\f[C]hledger\ balance\ cur:\[aq]\\$\[aq]\f[] +\f[C]hledger balance cur:\[aq]\[rs]$\[aq]\f[R] .PP or: .PP -\f[C]hledger\ balance\ cur:\\\\$\f[] +\f[C]hledger balance cur:\[rs]\[rs]$\f[R] .SS Even more escaping .PP -When hledger runs an addon executable (eg you type \f[C]hledger\ ui\f[], -hledger runs \f[C]hledger\-ui\f[]), it de\-escapes command\-line options -and arguments once, so you might need to \f[I]triple\f[]\-escape. +When hledger runs an addon executable (eg you type \f[C]hledger ui\f[R], +hledger runs \f[C]hledger-ui\f[R]), it de-escapes command-line options +and arguments once, so you might need to \f[I]triple\f[R]-escape. Eg in bash, running the ui command and matching the dollar sign, it\[aq]s: .PP -\f[C]hledger\ ui\ cur:\[aq]\\\\$\[aq]\f[] +\f[C]hledger ui cur:\[aq]\[rs]\[rs]$\[aq]\f[R] .PP or: .PP -\f[C]hledger\ ui\ cur:\\\\\\\\$\f[] +\f[C]hledger ui cur:\[rs]\[rs]\[rs]\[rs]$\f[R] .PP -If you asked why \f[I]four\f[] slashes above, this may help: +If you asked why \f[I]four\f[R] slashes above, this may help: .PP .TS tab(@); @@ -388,22 +329,22 @@ l l. T{ unescaped: T}@T{ -\f[C]$\f[] +\f[C]$\f[R] T} T{ escaped: T}@T{ -\f[C]\\$\f[] +\f[C]\[rs]$\f[R] T} T{ -double\-escaped: +double-escaped: T}@T{ -\f[C]\\\\$\f[] +\f[C]\[rs]\[rs]$\f[R] T} T{ -triple\-escaped: +triple-escaped: T}@T{ -\f[C]\\\\\\\\$\f[] +\f[C]\[rs]\[rs]\[rs]\[rs]$\f[R] T} .TE .PP @@ -413,93 +354,104 @@ reader.) You can always avoid the extra escaping for addons by running the addon directly: .PP -\f[C]hledger\-ui\ cur:\\\\$\f[] +\f[C]hledger-ui cur:\[rs]\[rs]$\f[R] .SS Less escaping .PP -Inside an argument file, or in the search field of hledger\-ui or -hledger\-web, or at a GHCI prompt, you need one less level of escaping +Inside an argument file, or in the search field of hledger-ui or +hledger-web, or at a GHCI prompt, you need one less level of escaping than at the command line. And backslashes may work better than quotes. Eg: .PP -\f[C]ghci>\ :main\ balance\ cur:\\$\f[] +\f[C]ghci> :main balance cur:\[rs]$\f[R] .SS Command line tips .PP If in doubt, keep things simple: .IP \[bu] 2 -write options after the command (\f[C]hledger\ CMD\ \-OPTIONS\ ARGS\f[]) +write options after the command (\f[C]hledger CMD -OPTIONS ARGS\f[R]) .IP \[bu] 2 -run add\-on executables directly (\f[C]hledger\-ui\ \-OPTIONS\ ARGS\f[]) +run add-on executables directly (\f[C]hledger-ui -OPTIONS ARGS\f[R]) .IP \[bu] 2 enclose problematic args in single quotes .IP \[bu] 2 if needed, also add a backslash to escape regexp metacharacters .PP To find out exactly how a command line is being parsed, add -\f[C]\-\-debug=2\f[] to troubleshoot. +\f[C]--debug=2\f[R] to troubleshoot. .SS Unicode characters .PP -hledger is expected to handle unicode (non\-ascii) characters, but this -requires a well\-configured environment. -.PP -To handle unicode characters in the command line or input data, a system -locale that can decode them must be configured (POSIX\[aq]s default -\f[C]C\f[] locale will not work). -Eg in bash, you could do: -.IP -.nf -\f[C] -export\ LANG=en_US.UTF\-8 -\f[] -.fi -.PP -See Troubleshooting for more about this. -.PP -Unicode characters should appear correctly in hledger\[aq]s output. -For the hledger and hledger\-ui tools, this requires that +hledger is expected to handle non-ascii characters correctly: .IP \[bu] 2 -your terminal supports unicode +they should be parsed correctly in input files and on the command line, +by all hledger tools (add, iadd, hledger-web\[aq]s search/add/edit +forms, etc.) .IP \[bu] 2 -the terminal\[aq]s font includes the required unicode glyphs +they should be displayed correctly by all hledger tools, and on-screen +alignment should be preserved. +.PP +This requires a well-configured environment. +Here are some tips: .IP \[bu] 2 -the terminal is configured to display "wide" characters as double width -(otherwise report alignment will be off) +A system locale must be configured, and it must be one that can decode +the characters being used. +In bash, you can set a locale like this: +\f[C]export LANG=en_US.UTF-8\f[R]. +There are some more details in Troubleshooting. +This step is essential - without it, hledger will quit on encountering a +non-ascii character (as with all GHC-compiled programs). +.IP \[bu] 2 +your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) must +support unicode +.IP \[bu] 2 +the terminal must be using a font which includes the required unicode +glyphs +.IP \[bu] 2 +the terminal should be configured to display wide characters as double +width (for report alignment) +.IP \[bu] 2 +on Windows, for best results you should run hledger in the same kind of +environment in which it was built. +Eg hledger built in the standard CMD.EXE environment (like the binaries +on our download page) might show display problems when run in a cygwin +or msys terminal, and vice versa. +(See eg #961). .SS Input files .PP hledger reads transactions from a data file (and the add command writes to it). -By default this file is \f[C]$HOME/.hledger.journal\f[] (or on Windows, -something like \f[C]C:/Users/USER/.hledger.journal\f[]). -You can override this with the \f[C]$LEDGER_FILE\f[] environment +By default this file is \f[C]$HOME/.hledger.journal\f[R] (or on Windows, +something like \f[C]C:/Users/USER/.hledger.journal\f[R]). +You can override this with the \f[C]$LEDGER_FILE\f[R] environment variable: .IP .nf \f[C] -$\ setenv\ LEDGER_FILE\ ~/finance/2016.journal -$\ hledger\ stats -\f[] +$ setenv LEDGER_FILE \[ti]/finance/2016.journal +$ hledger stats +\f[R] .fi .PP -or with the \f[C]\-f/\-\-file\f[] option: +or with the \f[C]-f/--file\f[R] option: .IP .nf \f[C] -$\ hledger\ \-f\ /some/file\ stats -\f[] +$ hledger -f /some/file stats +\f[R] .fi .PP -The file name \f[C]\-\f[] (hyphen) means standard input: +The file name \f[C]-\f[R] (hyphen) means standard input: .IP .nf \f[C] -$\ cat\ some.journal\ |\ hledger\ \-f\- -\f[] +$ cat some.journal | hledger -f- +\f[R] .fi .PP Usually the data file is in hledger\[aq]s journal format, but it can also be one of several other formats, listed below. hledger detects the format automatically based on the file extension, or -if that is not recognised, by trying each built\-in "reader" in turn: +if that is not recognised, by trying each built-in \[dq]reader\[dq] in +turn: .PP .TS tab(@); @@ -513,48 +465,48 @@ Used for file extensions: T} _ T{ -\f[C]journal\f[] +\f[C]journal\f[R] T}@T{ hledger\[aq]s journal format, also some Ledger journals T}@T{ -\f[C]\&.journal\f[] \f[C]\&.j\f[] \f[C]\&.hledger\f[] \f[C]\&.ledger\f[] +\f[C].journal\f[R] \f[C].j\f[R] \f[C].hledger\f[R] \f[C].ledger\f[R] T} T{ -\f[C]timeclock\f[] +\f[C]timeclock\f[R] T}@T{ timeclock files (precise time logging) T}@T{ -\f[C]\&.timeclock\f[] +\f[C].timeclock\f[R] T} T{ -\f[C]timedot\f[] +\f[C]timedot\f[R] T}@T{ timedot files (approximate time logging) T}@T{ -\f[C]\&.timedot\f[] +\f[C].timedot\f[R] T} T{ -\f[C]csv\f[] +\f[C]csv\f[R] T}@T{ -comma\-separated values (data interchange) +comma-separated values (data interchange) T}@T{ -\f[C]\&.csv\f[] +\f[C].csv\f[R] T} .TE .PP If needed (eg to ensure correct error messages when a file has the -"wrong" extension), you can force a specific reader/format by prepending -it to the file path with a colon. +\[dq]wrong\[dq] extension), you can force a specific reader/format by +prepending it to the file path with a colon. Examples: .IP .nf \f[C] -$\ hledger\ \-f\ csv:/some/csv\-file.dat\ stats -$\ echo\ \[aq]i\ 2009/13/1\ 08:00:00\[aq]\ |\ hledger\ print\ \-ftimeclock:\- -\f[] +$ hledger -f csv:/some/csv-file.dat stats +$ echo \[aq]i 2009/13/1 08:00:00\[aq] | hledger print -ftimeclock:- +\f[R] .fi .PP -You can also specify multiple \f[C]\-f\f[] options, to read multiple +You can also specify multiple \f[C]-f\f[R] options, to read multiple files as one big journal. There are some limitations with this: .IP \[bu] 2 @@ -563,13 +515,13 @@ directives in one file will not affect the other files balance assertions will not see any account balances from previous files .PP If you need those, either use the include directive, or concatenate the -files, eg: \f[C]cat\ a.journal\ b.journal\ |\ hledger\ \-f\-\ CMD\f[]. +files, eg: \f[C]cat a.journal b.journal | hledger -f- CMD\f[R]. .SS Smart dates .PP -hledger\[aq]s user interfaces accept a flexible "smart date" syntax -(unlike dates in the journal file). +hledger\[aq]s user interfaces accept a flexible \[dq]smart date\[dq] +syntax (unlike dates in the journal file). Smart dates allow some english words, can be relative to today\[aq]s -date, and can have less\-significant date parts omitted (defaulting to +date, and can have less-significant date parts omitted (defaulting to 1). .PP Examples: @@ -578,81 +530,81 @@ Examples: tab(@); l l. T{ -\f[C]2004/10/1\f[], \f[C]2004\-01\-01\f[], \f[C]2004.9.1\f[] +\f[C]2004/10/1\f[R], \f[C]2004-01-01\f[R], \f[C]2004.9.1\f[R] T}@T{ exact date, several separators allowed. -Year is 4+ digits, month is 1\-12, day is 1\-31 +Year is 4+ digits, month is 1-12, day is 1-31 T} T{ -\f[C]2004\f[] +\f[C]2004\f[R] T}@T{ start of year T} T{ -\f[C]2004/10\f[] +\f[C]2004/10\f[R] T}@T{ start of month T} T{ -\f[C]10/1\f[] +\f[C]10/1\f[R] T}@T{ month and day in current year T} T{ -\f[C]21\f[] +\f[C]21\f[R] T}@T{ day in current month T} T{ -\f[C]october,\ oct\f[] +\f[C]october, oct\f[R] T}@T{ start of month in current year T} T{ -\f[C]yesterday,\ today,\ tomorrow\f[] +\f[C]yesterday, today, tomorrow\f[R] T}@T{ -\-1, 0, 1 days from today +-1, 0, 1 days from today T} T{ -\f[C]last/this/next\ day/week/month/quarter/year\f[] +\f[C]last/this/next day/week/month/quarter/year\f[R] T}@T{ -\-1, 0, 1 periods from the current period +-1, 0, 1 periods from the current period T} T{ -\f[C]20181201\f[] +\f[C]20181201\f[R] T}@T{ 8 digit YYYYMMDD with valid year month and day T} T{ -\f[C]201812\f[] +\f[C]201812\f[R] T}@T{ 6 digit YYYYMM with valid year and month T} .TE .PP -Counterexamples \- malformed digit sequences might give surprising +Counterexamples - malformed digit sequences might give surprising results: .PP .TS tab(@); l l. T{ -\f[C]201813\f[] +\f[C]201813\f[R] T}@T{ -6 digits with an invalid month is parsed as start of 6\-digit year +6 digits with an invalid month is parsed as start of 6-digit year T} T{ -\f[C]20181301\f[] +\f[C]20181301\f[R] T}@T{ -8 digits with an invalid month is parsed as start of 8\-digit year +8 digits with an invalid month is parsed as start of 8-digit year T} T{ -\f[C]20181232\f[] +\f[C]20181232\f[R] T}@T{ 8 digits with an invalid day gives an error T} T{ -\f[C]201801012\f[] +\f[C]201801012\f[R] T}@T{ 9+ digits beginning with a valid YYYYMMDD gives an error T} @@ -666,13 +618,13 @@ latest transaction or posting dates found in the journal. .PP Often you will want to see a shorter time span, such as the current month. -You can specify a start and/or end date using \f[C]\-b/\-\-begin\f[], -\f[C]\-e/\-\-end\f[], \f[C]\-p/\-\-period\f[] or a \f[C]date:\f[] query +You can specify a start and/or end date using \f[C]-b/--begin\f[R], +\f[C]-e/--end\f[R], \f[C]-p/--period\f[R] or a \f[C]date:\f[R] query (described below). All of these accept the smart date syntax. One important thing to be aware of when specifying end dates: as in Ledger, end dates are exclusive, so you need to write the date -\f[I]after\f[] the last day you want to include. +\f[I]after\f[R] the last day you want to include. .PP Examples: .PP @@ -680,42 +632,42 @@ Examples: tab(@); l l. T{ -\f[C]\-b\ 2016/3/17\f[] +\f[C]-b 2016/3/17\f[R] T}@T{ begin on St. Patrick\[aq]s day 2016 T} T{ -\f[C]\-e\ 12/1\f[] +\f[C]-e 12/1\f[R] T}@T{ end at the start of december 1st of the current year (11/30 will be the last date included) T} T{ -\f[C]\-b\ thismonth\f[] +\f[C]-b thismonth\f[R] T}@T{ all transactions on or after the 1st of the current month T} T{ -\f[C]\-p\ thismonth\f[] +\f[C]-p thismonth\f[R] T}@T{ all transactions in the current month T} T{ -\f[C]date:2016/3/17\-\f[] +\f[C]date:2016/3/17-\f[R] T}@T{ the above written as queries instead T} T{ -\f[C]date:\-12/1\f[] +\f[C]date:-12/1\f[R] T}@T{ T} T{ -\f[C]date:thismonth\-\f[] +\f[C]date:thismonth-\f[R] T}@T{ T} T{ -\f[C]date:thismonth\f[] +\f[C]date:thismonth\f[R] T}@T{ T} .TE @@ -723,40 +675,40 @@ T} .PP A report interval can be specified so that commands like register, balance and activity will divide their reports into multiple subperiods. -The basic intervals can be selected with one of \f[C]\-D/\-\-daily\f[], -\f[C]\-W/\-\-weekly\f[], \f[C]\-M/\-\-monthly\f[], -\f[C]\-Q/\-\-quarterly\f[], or \f[C]\-Y/\-\-yearly\f[]. +The basic intervals can be selected with one of \f[C]-D/--daily\f[R], +\f[C]-W/--weekly\f[R], \f[C]-M/--monthly\f[R], \f[C]-Q/--quarterly\f[R], +or \f[C]-Y/--yearly\f[R]. More complex intervals may be specified with a period expression. Report intervals can not be specified with a query, currently. .SS Period expressions .PP -The \f[C]\-p/\-\-period\f[] option accepts period expressions, a -shorthand way of expressing a start date, end date, and/or report -interval all at once. +The \f[C]-p/--period\f[R] option accepts period expressions, a shorthand +way of expressing a start date, end date, and/or report interval all at +once. .PP Here\[aq]s a basic period expression specifying the first quarter of 2009. Note, hledger always treats start dates as inclusive and end dates as exclusive: .PP -\f[C]\-p\ "from\ 2009/1/1\ to\ 2009/4/1"\f[] +\f[C]-p \[dq]from 2009/1/1 to 2009/4/1\[dq]\f[R] .PP -Keywords like "from" and "to" are optional, and so are the spaces, as -long as you don\[aq]t run two dates together. -"to" can also be written as "\-". +Keywords like \[dq]from\[dq] and \[dq]to\[dq] are optional, and so are +the spaces, as long as you don\[aq]t run two dates together. +\[dq]to\[dq] can also be written as \[dq]-\[dq]. These are equivalent to the above: .PP .TS tab(@); l. T{ -\f[C]\-p\ "2009/1/1\ 2009/4/1"\f[] +\f[C]-p \[dq]2009/1/1 2009/4/1\[dq]\f[R] T} T{ -\f[C]\-p2009/1/1to2009/4/1\f[] +\f[C]-p2009/1/1to2009/4/1\f[R] T} T{ -\f[C]\-p2009/1/1\-2009/4/1\f[] +\f[C]-p2009/1/1-2009/4/1\f[R] T} .TE .PP @@ -767,13 +719,13 @@ also be written as: tab(@); l. T{ -\f[C]\-p\ "1/1\ 4/1"\f[] +\f[C]-p \[dq]1/1 4/1\[dq]\f[R] T} T{ -\f[C]\-p\ "january\-apr"\f[] +\f[C]-p \[dq]january-apr\[dq]\f[R] T} T{ -\f[C]\-p\ "this\ year\ to\ 4/1"\f[] +\f[C]-p \[dq]this year to 4/1\[dq]\f[R] T} .TE .PP @@ -784,76 +736,77 @@ earliest or latest transaction in your journal: tab(@); l l. T{ -\f[C]\-p\ "from\ 2009/1/1"\f[] +\f[C]-p \[dq]from 2009/1/1\[dq]\f[R] T}@T{ everything after january 1, 2009 T} T{ -\f[C]\-p\ "from\ 2009/1"\f[] +\f[C]-p \[dq]from 2009/1\[dq]\f[R] T}@T{ the same T} T{ -\f[C]\-p\ "from\ 2009"\f[] +\f[C]-p \[dq]from 2009\[dq]\f[R] T}@T{ the same T} T{ -\f[C]\-p\ "to\ 2009"\f[] +\f[C]-p \[dq]to 2009\[dq]\f[R] T}@T{ everything before january 1, 2009 T} .TE .PP -A single date with no "from" or "to" defines both the start and end date -like so: +A single date with no \[dq]from\[dq] or \[dq]to\[dq] defines both the +start and end date like so: .PP .TS tab(@); l l. T{ -\f[C]\-p\ "2009"\f[] +\f[C]-p \[dq]2009\[dq]\f[R] T}@T{ -the year 2009; equivalent to "2009/1/1 to 2010/1/1" +the year 2009; equivalent to \[dq]2009/1/1 to 2010/1/1\[dq] T} T{ -\f[C]\-p\ "2009/1"\f[] +\f[C]-p \[dq]2009/1\[dq]\f[R] T}@T{ -the month of jan; equivalent to "2009/1/1 to 2009/2/1" +the month of jan; equivalent to \[dq]2009/1/1 to 2009/2/1\[dq] T} T{ -\f[C]\-p\ "2009/1/1"\f[] +\f[C]-p \[dq]2009/1/1\[dq]\f[R] T}@T{ -just that day; equivalent to "2009/1/1 to 2009/1/2" +just that day; equivalent to \[dq]2009/1/1 to 2009/1/2\[dq] T} .TE .PP -The argument of \f[C]\-p\f[] can also begin with, or be, a report +The argument of \f[C]-p\f[R] can also begin with, or be, a report interval expression. -The basic report intervals are \f[C]daily\f[], \f[C]weekly\f[], -\f[C]monthly\f[], \f[C]quarterly\f[], or \f[C]yearly\f[], which have the -same effect as the \f[C]\-D\f[],\f[C]\-W\f[],\f[C]\-M\f[],\f[C]\-Q\f[], -or \f[C]\-Y\f[] flags. +The basic report intervals are \f[C]daily\f[R], \f[C]weekly\f[R], +\f[C]monthly\f[R], \f[C]quarterly\f[R], or \f[C]yearly\f[R], which have +the same effect as the +\f[C]-D\f[R],\f[C]-W\f[R],\f[C]-M\f[R],\f[C]-Q\f[R], or \f[C]-Y\f[R] +flags. Between report interval and start/end dates (if any), the word -\f[C]in\f[] is optional. +\f[C]in\f[R] is optional. Examples: .PP .TS tab(@); l. T{ -\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[] +\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R] T} T{ -\f[C]\-p\ "monthly\ in\ 2008"\f[] +\f[C]-p \[dq]monthly in 2008\[dq]\f[R] T} T{ -\f[C]\-p\ "quarterly"\f[] +\f[C]-p \[dq]quarterly\[dq]\f[R] T} .TE .PP -Note that \f[C]weekly\f[], \f[C]monthly\f[], \f[C]quarterly\f[] and -\f[C]yearly\f[] intervals will always start on the first day on week, +Note that \f[C]weekly\f[R], \f[C]monthly\f[R], \f[C]quarterly\f[R] and +\f[C]yearly\f[R] intervals will always start on the first day on week, month, quarter or year accordingly, and will end on the last day of same period, even if associated period expression specifies different explicit start and end date. @@ -864,27 +817,27 @@ For example: tab(@); l. T{ -\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[] \-\- starts on +\f[C]-p \[dq]weekly from 2009/1/1 to 2009/4/1\[dq]\f[R] -- starts on 2008/12/29, closest preceeding Monday T} T{ -\f[C]\-p\ "monthly\ in\ 2008/11/25"\f[] \-\- starts on 2018/11/01 +\f[C]-p \[dq]monthly in 2008/11/25\[dq]\f[R] -- starts on 2018/11/01 T} T{ -\f[C]\-p\ "quarterly\ from\ 2009\-05\-05\ to\ 2009\-06\-01"\f[] \- -starts on 2009/04/01, ends on 2009/06/30, which are first and last days -of Q2 2009 +\f[C]-p \[dq]quarterly from 2009-05-05 to 2009-06-01\[dq]\f[R] - starts +on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2 +2009 T} T{ -\f[C]\-p\ "yearly\ from\ 2009\-12\-29"\f[] \- starts on 2009/01/01, +\f[C]-p \[dq]yearly from 2009-12-29\[dq]\f[R] - starts on 2009/01/01, first day of 2009 T} .TE .PP The following more complex report intervals are also supported: -\f[C]biweekly\f[], \f[C]bimonthly\f[], -\f[C]every\ day|week|month|quarter|year\f[], -\f[C]every\ N\ days|weeks|months|quarters|years\f[]. +\f[C]biweekly\f[R], \f[C]bimonthly\f[R], +\f[C]every day|week|month|quarter|year\f[R], +\f[C]every N days|weeks|months|quarters|years\f[R]. .PP All of these will start on the first day of the requested period and end on the last one, as described above. @@ -895,14 +848,15 @@ Examples: tab(@); l. T{ -\f[C]\-p\ "bimonthly\ from\ 2008"\f[] \-\- periods will have boundaries -on 2008/01/01, 2008/03/01, ... +\f[C]-p \[dq]bimonthly from 2008\[dq]\f[R] -- periods will have +boundaries on 2008/01/01, 2008/03/01, ... T} T{ -\f[C]\-p\ "every\ 2\ weeks"\f[] \-\- starts on closest preceeding Monday +\f[C]-p \[dq]every 2 weeks\[dq]\f[R] -- starts on closest preceeding +Monday T} T{ -\f[C]\-p\ "every\ 5\ month\ from\ 2009/03"\f[] \-\- periods will have +\f[C]-p \[dq]every 5 month from 2009/03\[dq]\f[R] -- periods will have boundaries on 2009/03/01, 2009/08/01, ... T} .TE @@ -910,11 +864,10 @@ T} If you want intervals that start on arbitrary day of your choosing and span a week, month or year, you need to use any of the following: .PP -\f[C]every\ Nth\ day\ of\ week\f[], \f[C]every\ \f[], -\f[C]every\ Nth\ day\ [of\ month]\f[], -\f[C]every\ Nth\ weekday\ [of\ month]\f[], -\f[C]every\ MM/DD\ [of\ year]\f[], \f[C]every\ Nth\ MMM\ [of\ year]\f[], -\f[C]every\ MMM\ Nth\ [of\ year]\f[]. +\f[C]every Nth day of week\f[R], \f[C]every \f[R], +\f[C]every Nth day [of month]\f[R], +\f[C]every Nth weekday [of month]\f[R], \f[C]every MM/DD [of year]\f[R], +\f[C]every Nth MMM [of year]\f[R], \f[C]every MMM Nth [of year]\f[R]. .PP Examples: .PP @@ -922,62 +875,62 @@ Examples: tab(@); l. T{ -\f[C]\-p\ "every\ 2nd\ day\ of\ week"\f[] \-\- periods will go from Tue +\f[C]-p \[dq]every 2nd day of week\[dq]\f[R] -- periods will go from Tue to Tue T} T{ -\f[C]\-p\ "every\ Tue"\f[] \-\- same +\f[C]-p \[dq]every Tue\[dq]\f[R] -- same T} T{ -\f[C]\-p\ "every\ 15th\ day"\f[] \-\- period boundaries will be on 15th -of each month +\f[C]-p \[dq]every 15th day\[dq]\f[R] -- period boundaries will be on +15th of each month T} T{ -\f[C]\-p\ "every\ 2nd\ Monday"\f[] \-\- period boundaries will be on +\f[C]-p \[dq]every 2nd Monday\[dq]\f[R] -- period boundaries will be on second Monday of each month T} T{ -\f[C]\-p\ "every\ 11/05"\f[] \-\- yearly periods with boundaries on 5th -of Nov +\f[C]-p \[dq]every 11/05\[dq]\f[R] -- yearly periods with boundaries on +5th of Nov T} T{ -\f[C]\-p\ "every\ 5th\ Nov"\f[] \-\- same +\f[C]-p \[dq]every 5th Nov\[dq]\f[R] -- same T} T{ -\f[C]\-p\ "every\ Nov\ 5th"\f[] \-\- same +\f[C]-p \[dq]every Nov 5th\[dq]\f[R] -- same T} .TE .PP Show historical balances at end of 15th each month (N is exclusive end date): .PP -\f[C]hledger\ balance\ \-H\ \-p\ "every\ 16th\ day"\f[] +\f[C]hledger balance -H -p \[dq]every 16th day\[dq]\f[R] .PP Group postings from start of wednesday to end of next tuesday (N is start date and exclusive end date): .PP -\f[C]hledger\ register\ checking\ \-p\ "every\ 3rd\ day\ of\ week"\f[] +\f[C]hledger register checking -p \[dq]every 3rd day of week\[dq]\f[R] .SS Depth limiting .PP -With the \f[C]\-\-depth\ N\f[] option (short form: \f[C]\-N\f[]), -commands like account, balance and register will show only the uppermost -accounts in the account tree, down to level N. +With the \f[C]--depth N\f[R] option (short form: \f[C]-N\f[R]), commands +like account, balance and register will show only the uppermost accounts +in the account tree, down to level N. Use this when you want a summary with less detail. -This flag has the same effect as a \f[C]depth:\f[] query argument (so -\f[C]\-2\f[], \f[C]\-\-depth=2\f[] or \f[C]depth:2\f[] are basically +This flag has the same effect as a \f[C]depth:\f[R] query argument (so +\f[C]-2\f[R], \f[C]--depth=2\f[R] or \f[C]depth:2\f[R] are basically equivalent). .SS Pivoting .PP Normally hledger sums amounts, and organizes them in a hierarchy, based on account name. -The \f[C]\-\-pivot\ FIELD\f[] option causes it to sum and organize +The \f[C]--pivot FIELD\f[R] option causes it to sum and organize hierarchy based on the value of some other field instead. -FIELD can be: \f[C]code\f[], \f[C]description\f[], \f[C]payee\f[], -\f[C]note\f[], or the full name (case insensitive) of any tag. -As with account names, values containing \f[C]colon:separated:parts\f[] +FIELD can be: \f[C]code\f[R], \f[C]description\f[R], \f[C]payee\f[R], +\f[C]note\f[R], or the full name (case insensitive) of any tag. +As with account names, values containing \f[C]colon:separated:parts\f[R] will be displayed hierarchically in reports. .PP -\f[C]\-\-pivot\f[] is a general option affecting all reports; you can +\f[C]--pivot\f[R] is a general option affecting all reports; you can think of hledger transforming the journal before any other processing, replacing every posting\[aq]s account name with the value of the specified field on that posting, inheriting it from the transaction or @@ -987,34 +940,34 @@ An example: .IP .nf \f[C] -2016/02/16\ Member\ Fee\ Payment -\ \ \ \ assets:bank\ account\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR -\ \ \ \ income:member\ fees\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ ;\ member:\ John\ Doe -\f[] +2016/02/16 Member Fee Payment + assets:bank account 2 EUR + income:member fees -2 EUR ; member: John Doe +\f[R] .fi .PP Normal balance report showing account names: .IP .nf \f[C] -$\ hledger\ balance -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR\ \ assets:bank\ account -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ income:member\ fees -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +$ hledger balance + 2 EUR assets:bank account + -2 EUR income:member fees +-------------------- + 0 +\f[R] .fi .PP Pivoted balance report, using member: tag values instead: .IP .nf \f[C] -$\ hledger\ balance\ \-\-pivot\ member -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +$ hledger balance --pivot member + 2 EUR + -2 EUR John Doe +-------------------- + 0 +\f[R] .fi .PP One way to show only amounts with a member: value (using a query, @@ -1022,76 +975,68 @@ described below): .IP .nf \f[C] -$\ hledger\ balance\ \-\-pivot\ member\ tag:member=. -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR -\f[] +$ hledger balance --pivot member tag:member=. + -2 EUR John Doe +-------------------- + -2 EUR +\f[R] .fi .PP -Another way (the acct: query matches against the pivoted "account -name"): +Another way (the acct: query matches against the pivoted \[dq]account +name\[dq]): .IP .nf \f[C] -$\ hledger\ balance\ \-\-pivot\ member\ acct:. -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR -\f[] +$ hledger balance --pivot member acct:. + -2 EUR John Doe +-------------------- + -2 EUR +\f[R] .fi .SS Cost .PP -The \f[C]\-B/\-\-cost\f[] flag converts amounts to their cost at +The \f[C]-B/--cost\f[R] flag converts amounts to their cost at transaction time, if they have a transaction price specified. .SS Market value .PP -The \f[C]\-V/\-\-value\f[] flag converts reported amounts to their -current market value. -.PD 0 -.P -.PD -Specifically, when there is a market price (P directive) for the -amount\[aq]s commodity, dated on or before today\[aq]s date (or the -report end date if specified), the amount will be converted to the -price\[aq]s commodity. -.PP -When there are multiple applicable P directives, \-V chooses the most -recent one, or in case of equal dates, the last\-parsed one. -.PP +The \f[C]-V/--market\f[R] flag converts reported amounts to their market +value in another commodity. +It uses the commodity referenced in the latest market price (P +directive) dated on or before the valuation date. +The default valuation date is today. For example: .IP .nf \f[C] -#\ one\ euro\ is\ worth\ this\ many\ dollars\ from\ nov\ 1 -P\ 2016/11/01\ €\ $1.10 +# one euro is worth this many dollars from nov 1 +P 2016/11/01 \[Eu] $1.10 -#\ purchase\ some\ euros\ on\ nov\ 3 +# purchase some euros on nov 3 2016/11/3 -\ \ \ \ assets:euros\ \ \ \ \ \ \ \ €100 -\ \ \ \ assets:checking + assets:euros \[Eu]100 + assets:checking -#\ the\ euro\ is\ worth\ fewer\ dollars\ by\ dec\ 21 -P\ 2016/12/21\ €\ $1.03 -\f[] +# the euro is worth fewer dollars by dec 21 +P 2016/12/21 \[Eu] $1.03 +\f[R] .fi .PP How many euros do I have ? .IP .nf \f[C] -$\ hledger\ \-f\ t.j\ bal\ \-N\ euros -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros -\f[] +$ hledger -f t.j bal -N euros + \[Eu]100 assets:euros +\f[R] .fi .PP What are they worth at end of nov 3 ? .IP .nf \f[C] -$\ hledger\ \-f\ t.j\ bal\ \-N\ euros\ \-V\ \-e\ 2016/11/4 -\ \ \ \ \ \ \ \ \ \ \ \ \ $110.00\ \ assets:euros -\f[] +$ hledger -f t.j bal -N euros -V -e 2016/11/4 + $110.00 assets:euros +\f[R] .fi .PP What are they worth after 2016/12/21 ? @@ -1099,64 +1044,371 @@ What are they worth after 2016/12/21 ? .IP .nf \f[C] -$\ hledger\ \-f\ t.j\ bal\ \-N\ euros\ \-V -\ \ \ \ \ \ \ \ \ \ \ \ \ $103.00\ \ assets:euros -\f[] +$ hledger -f t.j bal -N euros -V + $103.00 assets:euros +\f[R] .fi .PP -Currently, hledger\[aq]s \-V only uses market prices recorded with P -directives, not transaction prices (unlike Ledger). +Ledger users: Ledger\[aq]s -V also infers market prices from journal +entries, but we don\[aq]t do that. +hledger\[aq]s -V uses only market prices declared explicitly, with P +directives. +(Mnemonic: -B/--cost uses transaction prices, -V/--market uses market +prices.) +.SS More control over valuation .PP -Currently, \-V has a limitation in multicolumn balance reports: it uses -the market prices on the report end date for all columns. -(Instead of the prices on each column\[aq]s end date.) -.SS Combining \-B and \-V +\f[I](experimental, added 201905)\f[R] .PP -Using \-B/\-\-cost and \-V/\-\-value together is currently allowed, but -the results are probably not meaningful. -Let us know if you find a use for this. +You can control valuation more precisely with the \f[C]--value\f[R] +option. +.IP +.nf +\f[C] + --value=TYPE which type of valuation should be done ? cost|end|now|YYYY-MM-DD +\f[R] +.fi +.PP +The argument is one of the keywords shown, or their first letter, or a +custom date. +The precise effect of the keywords is command-specific, but here is +their general meaning: +.TP +.B \f[C]--value=cost\f[R] (or \f[C]c\f[R]) +Convert amounts to cost, using the prices recorded in transactions. +\f[C]-B\f[R]/\f[C]--cost\f[R] does this. +.TP +.B \f[C]--value=end\f[R] (or \f[C]e\f[R]) +Convert amounts to their value in default valuation commodity using +market prices on the last day of the report period (or of each subperiod +in a multiperiod report). +When no report period is specified, uses the journal\[aq]s last +transaction date. +.TP +.B \f[C]--value=now\f[R] (or \f[C]n\f[R]) +Convert amounts to their value in default valuation commodity using +current market prices (as of when report is generated). +\f[C]-V\f[R]/\f[C]--market\f[R] does this. +.TP +.B \f[C]--value=YYYY-MM-DD\f[R] +Convert amounts to their value in default valuation commodity using +market prices on the given date (which must be 8 digits with \f[C]-\f[R] +or \f[C]/\f[R] or \f[C].\f[R] separators). +Eg \f[C]--value=2019-04-25\f[R]. +.PP +Here are the effects of \f[C]--value\f[R] as seen with \f[C]print\f[R]: +.IP +.nf +\f[C] +P 2000-01-01 A 1 B +P 2000-02-01 A 2 B +P 2000-03-01 A 3 B +P 2000-04-01 A 4 B + +2000-01-01 + (a) 1 A \[at] 5 B + +2000-02-01 + (a) 1 A \[at] 6 B + +2000-03-01 + (a) 1 A \[at] 7 B +\f[R] +.fi +.PP +Show the cost of each posting: +.IP +.nf +\f[C] +$ hledger -f- print --value=cost +2000/01/01 + (a) 5 B + +2000/02/01 + (a) 6 B + +2000/03/01 + (a) 7 B +\f[R] +.fi +.PP +Show the value as of the last day of the report period (2000-02-29): +.IP +.nf +\f[C] +$ hledger -f- print --value=end date:2000/01-2000/03 +2000-01-01 + (a) 2 B + +2000-02-01 + (a) 2 B +\f[R] +.fi +.PP +With no report period specified, that shows the value as of the last day +of the journal (2000-03-01): +.IP +.nf +\f[C] +$ hledger -f- print --value=end +2000/01/01 + (a) 3 B + +2000/02/01 + (a) 3 B + +2000/03/01 + (a) 3 B +\f[R] +.fi +.PP +Show the current value (the 2000-04-01 price is still in effect today): +.IP +.nf +\f[C] +$ hledger -f- print --value=now +2000-01-01 + (a) 4 B + +2000-02-01 + (a) 4 B + +2000-03-01 + (a) 4 B +\f[R] +.fi +.PP +Show the value on 2000/01/15: +.IP +.nf +\f[C] +$ hledger -f- print --value=2000-01-15 +2000/01/01 + (a) 1 B + +2000/02/01 + (a) 1 B + +2000/03/01 + (a) 1 B +\f[R] +.fi +.SS Effect of --value on reports +.PP +Below is how \f[C]--value\f[R] affects each of hledger\[aq]s reports, +currently. +You\[aq]re not expected to remember all this, but when troubleshooting a +report, look here. +If you find problems - useless reports, misbehaving reports, or error +messages being printed - please report them (with reproducible examples) +eg at #329. +.PP +.TS +tab(@); +lw(12.5n) lw(13.6n) lw(25.4n) lw(18.4n). +T{ +Report type +T}@T{ +\f[C]--value\f[R] \f[C]cost\f[R]\ +T}@T{ +\f[C]--value\f[R] \f[C]end\f[R]\ +T}@T{ +\f[C]--value\f[R] \f[C]DATE\f[R]/\f[C]now\f[R]\ +T} +_ +T{ +\f[B]print\f[R] +T}@T{ +T}@T{ +T}@T{ +T} +T{ +posting amounts +T}@T{ +cost, as recorded in transaction +T}@T{ +market value at report end +T}@T{ +market value at DATE +T} +T{ +balance assertions/assignments +T}@T{ +show unvalued +T}@T{ +show unvalued +T}@T{ +show unvalued +T} +T{ +\f[B]register\f[R] +T}@T{ +T}@T{ +T}@T{ +T} +T{ +starting balance with -H +T}@T{ +cost of starting balance +T}@T{ +market value at day before report start +T}@T{ +market value at DATE +T} +T{ +posting amounts +T}@T{ +cost +T}@T{ +market value at report end +T}@T{ +market value at DATE +T} +T{ +posting amounts, multiperiod +T}@T{ +summarised cost +T}@T{ +market value each summary posting at period end +T}@T{ +market value each summary posting at DATE +T} +T{ +running total/average +T}@T{ +sum/average of the displayed values +T}@T{ +sum/average of the displayed values +T}@T{ +sum/average of the displayed values +T} +T{ +\f[B]balance (bs, cf, is..)\f[R] +T}@T{ +T}@T{ +T}@T{ +T} +T{ +starting balances with -H +T}@T{ +costs of starting balances +T}@T{ +market value at day before report start of sum of previous postings +T}@T{ +market value at DATE of sum of previous postings +T} +T{ +balances, simple balance report +T}@T{ +summed costs +T}@T{ +market value at period end of sum of postings +T}@T{ +market value at DATE of sum of postings +T} +T{ +balances, multiperiod report +T}@T{ +summed costs +T}@T{ +market value at period end of sum of postings +T}@T{ +market value at DATE of sum of postings +T} +T{ +budget amounts with --budget +T}@T{ +costs of budget amounts +T}@T{ +budget-setting periodic txns are valued at period end +T}@T{ +budget-setting periodic txns are valued at DATE +T} +T{ +column/row/grand totals/averages +T}@T{ +sum/average of the displayed values +T}@T{ +market value at period end of sum/average of postings +T}@T{ +market value at DATE of sum/average of postings +T} +.TE +.SS Some useful value reports +.PP +Here are some probably useful reports - please send suggestions if you +find out more: +.PP +.TS +tab(@); +lw(15.9n) lw(27.6n) lw(26.5n). +T{ +Command: +T}@T{ +Description of report: +T}@T{ +Could answer: +T} +_ +T{ +\f[C]hledger bs -M --value=p\f[R] +T}@T{ +Monthly historical value of assets/liabilities +T}@T{ +How are my investments performing ? +T} +T{ +\f[C]hledger is -M --value=t\f[R] +T}@T{ +Monthly contemporaneous value of revenues/expenses +T}@T{ +How much foreign currency have I been spending ? +T} +.TE +.SS Combining -B, -V, --value +.PP +The rightmost of these flags wins. .SS Output destination .PP Some commands (print, register, stats, the balance commands) can write their output to a destination other than the console. -This is controlled by the \f[C]\-o/\-\-output\-file\f[] option. +This is controlled by the \f[C]-o/--output-file\f[R] option. .IP .nf \f[C] -$\ hledger\ balance\ \-o\ \-\ \ \ \ \ #\ write\ to\ stdout\ (the\ default) -$\ hledger\ balance\ \-o\ FILE\ \ #\ write\ to\ FILE -\f[] +$ hledger balance -o - # write to stdout (the default) +$ hledger balance -o FILE # write to FILE +\f[R] .fi .SS Output format .PP Some commands can write their output in other formats. Eg print and register can output CSV, and the balance commands can output CSV or HTML. -This is controlled by the \f[C]\-O/\-\-output\-format\f[] option, or by -specifying a \f[C]\&.csv\f[] or \f[C]\&.html\f[] file extension with -\f[C]\-o/\-\-output\-file\f[]. +This is controlled by the \f[C]-O/--output-format\f[R] option, or by +specifying a \f[C].csv\f[R] or \f[C].html\f[R] file extension with +\f[C]-o/--output-file\f[R]. .IP .nf \f[C] -$\ hledger\ balance\ \-O\ csv\ \ \ \ \ \ \ #\ write\ CSV\ to\ stdout -$\ hledger\ balance\ \-o\ FILE.csv\ \ #\ write\ CSV\ to\ FILE.csv -\f[] +$ hledger balance -O csv # write CSV to stdout +$ hledger balance -o FILE.csv # write CSV to FILE.csv +\f[R] .fi .SS Regular expressions .PP hledger uses regular expressions in a number of places: .IP \[bu] 2 -query terms, on the command line and in the hledger\-web search form: -\f[C]REGEX\f[], \f[C]desc:REGEX\f[], \f[C]cur:REGEX\f[], -\f[C]tag:...=REGEX\f[] +query terms, on the command line and in the hledger-web search form: +\f[C]REGEX\f[R], \f[C]desc:REGEX\f[R], \f[C]cur:REGEX\f[R], +\f[C]tag:...=REGEX\f[R] .IP \[bu] 2 -CSV rules conditional blocks: \f[C]if\ REGEX\ ...\f[] +CSV rules conditional blocks: \f[C]if REGEX ...\f[R] .IP \[bu] 2 account alias directives and options: -\f[C]alias\ /REGEX/\ =\ REPLACEMENT\f[], -\f[C]\-\-alias\ /REGEX/=REPLACEMENT\f[] +\f[C]alias /REGEX/ = REPLACEMENT\f[R], +\f[C]--alias /REGEX/=REPLACEMENT\f[R] .PP -hledger\[aq]s regular expressions come from the regex\-tdfa library. +hledger\[aq]s regular expressions come from the regex-tdfa library. In general they: .IP \[bu] 2 are case insensitive @@ -1165,7 +1417,7 @@ are infix matching (do not need to match the entire thing being matched) .IP \[bu] 2 are POSIX extended regular expressions .IP \[bu] 2 -also support GNU word boundaries (\\<, \\>, \\b, \\B) +also support GNU word boundaries (\[rs]<, \[rs]>, \[rs]b, \[rs]B) .IP \[bu] 2 and parenthesised capturing groups and numeric backreferences in replacement strings @@ -1174,16 +1426,16 @@ do not support mode modifiers like (?s) .PP Some things to note: .IP \[bu] 2 -In the \f[C]alias\f[] directive and \f[C]\-\-alias\f[] option, regular -expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[]). +In the \f[C]alias\f[R] directive and \f[C]--alias\f[R] option, regular +expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[R]). Elsewhere in hledger, these are not required. .IP \[bu] 2 -In queries, to match a regular expression metacharacter like \f[C]$\f[] +In queries, to match a regular expression metacharacter like \f[C]$\f[R] as a literal character, prepend a backslash. -Eg to search for amounts with the dollar sign in hledger\-web, write -\f[C]cur:\\$\f[]. +Eg to search for amounts with the dollar sign in hledger-web, write +\f[C]cur:\[rs]$\f[R]. .IP \[bu] 2 -On the command line, some metacharacters like \f[C]$\f[] have a special +On the command line, some metacharacters like \f[C]$\f[R] have a special meaning to the shell and so must be escaped at least once more. See Special characters. .SH QUERIES @@ -1193,7 +1445,7 @@ precise subsets of your data. Most commands accept an optional query expression, written as arguments after the command name, to filter the data by date, account name or other criteria. -The syntax is similar to a web search: one or more space\-separated +The syntax is similar to a web search: one or more space-separated search terms, quotes to enclose whitespace, prefixes to match specific fields, a not: prefix to negate the match. .PP @@ -1220,134 +1472,104 @@ have no postings matching any of the negative account terms AND match all the other terms. .PP The following kinds of search terms can be used. -Remember these can also be prefixed with \f[B]\f[BC]not:\f[B]\f[], eg to -exclude a particular subaccount. +Remember these can also be prefixed with \f[B]\f[CB]not:\f[B]\f[R], eg +to exclude a particular subaccount. .TP -.B \f[B]\f[BC]REGEX\f[B], \f[BC]acct:REGEX\f[B]\f[] +.B \f[B]\f[CB]REGEX\f[B], \f[CB]acct:REGEX\f[B]\f[R] match account names by this regular expression. -(With no prefix, \f[C]acct:\f[] is assumed.) -.RS -.RE +(With no prefix, \f[C]acct:\f[R] is assumed.) same as above -.RS -.RE .TP -.B \f[B]\f[BC]amt:N,\ amt:N,\ amt:>=N\f[B]\f[] -match postings with a single\-commodity amount that is equal to, less +.B \f[B]\f[CB]amt:N, amt:N, amt:>=N\f[B]\f[R] +match postings with a single-commodity amount that is equal to, less than, or greater than N. -(Multi\-commodity amounts are not tested, and will always match.) The -comparison has two modes: if N is preceded by a + or \- sign (or is 0), +(Multi-commodity amounts are not tested, and will always match.) The +comparison has two modes: if N is preceded by a + or - sign (or is 0), the two signed numbers are compared. Otherwise, the absolute magnitudes are compared, ignoring sign. -.RS -.RE .TP -.B \f[B]\f[BC]code:REGEX\f[B]\f[] +.B \f[B]\f[CB]code:REGEX\f[B]\f[R] match by transaction code (eg check number) -.RS -.RE .TP -.B \f[B]\f[BC]cur:REGEX\f[B]\f[] +.B \f[B]\f[CB]cur:REGEX\f[B]\f[R] match postings or transactions including any amounts whose currency/commodity symbol is fully matched by REGEX. -(For a partial match, use \f[C]\&.*REGEX.*\f[]). -Note, to match characters which are regex\-significant, like the dollar -sign (\f[C]$\f[]), you need to prepend \f[C]\\\f[]. +(For a partial match, use \f[C].*REGEX.*\f[R]). +Note, to match characters which are regex-significant, like the dollar +sign (\f[C]$\f[R]), you need to prepend \f[C]\[rs]\f[R]. And when using the command line you need to add one more level of quoting to hide it from the shell, so eg do: -\f[C]hledger\ print\ cur:\[aq]\\$\[aq]\f[] or -\f[C]hledger\ print\ cur:\\\\$\f[]. -.RS -.RE +\f[C]hledger print cur:\[aq]\[rs]$\[aq]\f[R] or +\f[C]hledger print cur:\[rs]\[rs]$\f[R]. .TP -.B \f[B]\f[BC]desc:REGEX\f[B]\f[] +.B \f[B]\f[CB]desc:REGEX\f[B]\f[R] match transaction descriptions. -.RS -.RE .TP -.B \f[B]\f[BC]date:PERIODEXPR\f[B]\f[] +.B \f[B]\f[CB]date:PERIODEXPR\f[B]\f[R] match dates within the specified period. PERIODEXPR is a period expression (with no report interval). -Examples: \f[C]date:2016\f[], \f[C]date:thismonth\f[], -\f[C]date:2000/2/1\-2/15\f[], \f[C]date:lastweek\-\f[]. -If the \f[C]\-\-date2\f[] command line flag is present, this matches +Examples: \f[C]date:2016\f[R], \f[C]date:thismonth\f[R], +\f[C]date:2000/2/1-2/15\f[R], \f[C]date:lastweek-\f[R]. +If the \f[C]--date2\f[R] command line flag is present, this matches secondary dates instead. -.RS -.RE .TP -.B \f[B]\f[BC]date2:PERIODEXPR\f[B]\f[] +.B \f[B]\f[CB]date2:PERIODEXPR\f[B]\f[R] match secondary dates within the specified period. -.RS -.RE .TP -.B \f[B]\f[BC]depth:N\f[B]\f[] +.B \f[B]\f[CB]depth:N\f[B]\f[R] match (or display, depending on command) accounts at or above this depth -.RS -.RE .TP -.B \f[B]\f[BC]note:REGEX\f[B]\f[] -match transaction notes (part of description right of \f[C]|\f[], or -whole description when there\[aq]s no \f[C]|\f[]) -.RS -.RE +.B \f[B]\f[CB]note:REGEX\f[B]\f[R] +match transaction notes (part of description right of \f[C]|\f[R], or +whole description when there\[aq]s no \f[C]|\f[R]) .TP -.B \f[B]\f[BC]payee:REGEX\f[B]\f[] +.B \f[B]\f[CB]payee:REGEX\f[B]\f[R] match transaction payee/payer names (part of description left of -\f[C]|\f[], or whole description when there\[aq]s no \f[C]|\f[]) -.RS -.RE +\f[C]|\f[R], or whole description when there\[aq]s no \f[C]|\f[R]) .TP -.B \f[B]\f[BC]real:,\ real:0\f[B]\f[] +.B \f[B]\f[CB]real:, real:0\f[B]\f[R] match real or virtual postings respectively -.RS -.RE .TP -.B \f[B]\f[BC]status:,\ status:!,\ status:*\f[B]\f[] +.B \f[B]\f[CB]status:, status:!, status:*\f[B]\f[R] match unmarked, pending, or cleared transactions respectively -.RS -.RE .TP -.B \f[B]\f[BC]tag:REGEX[=REGEX]\f[B]\f[] +.B \f[B]\f[CB]tag:REGEX[=REGEX]\f[B]\f[R] match by tag name, and optionally also by tag value. Note a tag: query is considered to match a transaction if it matches any of the postings. Also remember that postings inherit the tags of their parent transaction. -.RS -.RE .PP -The following special search term is used automatically in hledger\-web, +The following special search term is used automatically in hledger-web, only: .TP -.B \f[B]\f[BC]inacct:ACCTNAME\f[B]\f[] -tells hledger\-web to show the transaction register for this account. -Can be filtered further with \f[C]acct\f[] etc. -.RS -.RE +.B \f[B]\f[CB]inacct:ACCTNAME\f[B]\f[R] +tells hledger-web to show the transaction register for this account. +Can be filtered further with \f[C]acct\f[R] etc. .PP -Some of these can also be expressed as command\-line options (eg -\f[C]depth:2\f[] is equivalent to \f[C]\-\-depth\ 2\f[]). +Some of these can also be expressed as command-line options (eg +\f[C]depth:2\f[R] is equivalent to \f[C]--depth 2\f[R]). Generally you can mix options and query arguments, and the resulting query will be their intersection (perhaps excluding the -\f[C]\-p/\-\-period\f[] option). +\f[C]-p/--period\f[R] option). .SH COMMANDS .PP -hledger provides a number of subcommands; \f[C]hledger\f[] with no +hledger provides a number of subcommands; \f[C]hledger\f[R] with no arguments shows a list. .PP -If you install additional \f[C]hledger\-*\f[] packages, or if you put -programs or scripts named \f[C]hledger\-NAME\f[] in your PATH, these +If you install additional \f[C]hledger-*\f[R] packages, or if you put +programs or scripts named \f[C]hledger-NAME\f[R] in your PATH, these will also be listed as subcommands. .PP Run a subcommand by writing its name as first argument (eg -\f[C]hledger\ incomestatement\f[]). +\f[C]hledger incomestatement\f[R]). You can also write one of the standard short aliases displayed in -parentheses in the command list (\f[C]hledger\ b\f[]), or any any -unambiguous prefix of a command name (\f[C]hledger\ inc\f[]). +parentheses in the command list (\f[C]hledger b\f[R]), or any any +unambiguous prefix of a command name (\f[C]hledger inc\f[R]). .PP Here are all the builtin commands in alphabetical order. -See also \f[C]hledger\f[] for a more organised command list, and -\f[C]hledger\ CMD\ \-h\f[] for detailed command help. +See also \f[C]hledger\f[R] for a more organised command list, and +\f[C]hledger CMD -h\f[R] for detailed command help. .SS accounts .PP accounts, a @@ -1357,22 +1579,22 @@ accounts, a Show account names. .PP This command lists account names, either declared with account -directives (\-\-declared), posted to (\-\-used), or both (the default). +directives (--declared), posted to (--used), or both (the default). With query arguments, only matched account names and account names referenced by matched postings are shown. It shows a flat list by default. -With \f[C]\-\-tree\f[], it uses indentation to show the account +With \f[C]--tree\f[R], it uses indentation to show the account hierarchy. -In flat mode you can add \f[C]\-\-drop\ N\f[] to omit the first few +In flat mode you can add \f[C]--drop N\f[R] to omit the first few account name components. -Account names can be depth\-clipped with \f[C]depth:N\f[] or -\f[C]\-\-depth\ N\f[] or \f[C]\-N\f[]. +Account names can be depth-clipped with \f[C]depth:N\f[R] or +\f[C]--depth N\f[R] or \f[C]-N\f[R]. .PP Examples: .IP .nf \f[C] -$\ hledger\ accounts +$ hledger accounts assets:bank:checking assets:bank:saving assets:cash @@ -1381,7 +1603,7 @@ expenses:supplies income:gifts income:salary liabilities:debts -\f[] +\f[R] .fi .SS activity .PP @@ -1400,12 +1622,12 @@ Examples: .IP .nf \f[C] -$\ hledger\ activity\ \-\-quarterly -2008\-01\-01\ ** -2008\-04\-01\ ******* -2008\-07\-01\ -2008\-10\-01\ ** -\f[] +$ hledger activity --quarterly +2008-01-01 ** +2008-04-01 ******* +2008-07-01 +2008-10-01 ** +\f[R] .fi .SS add .PP @@ -1417,16 +1639,16 @@ Prompt for transactions and add them to the journal. .PP Many hledger users edit their journals directly with a text editor, or generate them from CSV. -For more interactive data entry, there is the \f[C]add\f[] command, +For more interactive data entry, there is the \f[C]add\f[R] command, which prompts interactively on the console for new transactions, and appends them to the journal file (if there are multiple -\f[C]\-f\ FILE\f[] options, the first file is used.) Existing +\f[C]-f FILE\f[R] options, the first file is used.) Existing transactions are not changed. This is the only hledger command that writes to the journal file. .PP -To use it, just run \f[C]hledger\ add\f[] and follow the prompts. +To use it, just run \f[C]hledger add\f[R] and follow the prompts. You can add as many transactions as you like; when you are finished, -enter \f[C]\&.\f[] or press control\-d or control\-c to exit. +enter \f[C].\f[R] or press control-d or control-c to exit. .PP Features: .IP \[bu] 2 @@ -1436,11 +1658,11 @@ template. .IP \[bu] 2 You can also set the initial defaults with command line arguments. .IP \[bu] 2 -Readline\-style edit keys can be used during data entry. +Readline-style edit keys can be used during data entry. .IP \[bu] 2 -The tab key will auto\-complete whenever possible \- accounts, -descriptions, dates (\f[C]yesterday\f[], \f[C]today\f[], -\f[C]tomorrow\f[]). +The tab key will auto-complete whenever possible - accounts, +descriptions, dates (\f[C]yesterday\f[R], \f[C]today\f[R], +\f[C]tomorrow\f[R]). If the input area is empty, it will insert the default value. .IP \[bu] 2 If the journal defines a default commodity, it will be added to any bare @@ -1450,7 +1672,7 @@ A parenthesised transaction code may be entered following a date. .IP \[bu] 2 Comments and tags may be entered following a description or amount. .IP \[bu] 2 -If you make a mistake, enter \f[C]<\f[] at any prompt to restart the +If you make a mistake, enter \f[C]<\f[R] at any prompt to restart the transaction. .IP \[bu] 2 Input prompts are displayed in a different colour when the terminal @@ -1460,31 +1682,31 @@ Example (see the tutorial for a detailed explanation): .IP .nf \f[C] -$\ hledger\ add -Adding\ transactions\ to\ journal\ file\ /src/hledger/examples/sample.journal -Any\ command\ line\ arguments\ will\ be\ used\ as\ defaults. -Use\ tab\ key\ to\ complete,\ readline\ keys\ to\ edit,\ enter\ to\ accept\ defaults. -An\ optional\ (CODE)\ may\ follow\ transaction\ dates. -An\ optional\ ;\ COMMENT\ may\ follow\ descriptions\ or\ amounts. -If\ you\ make\ a\ mistake,\ enter\ <\ at\ any\ prompt\ to\ restart\ the\ transaction. -To\ end\ a\ transaction,\ enter\ .\ when\ prompted. -To\ quit,\ enter\ .\ at\ a\ date\ prompt\ or\ press\ control\-d\ or\ control\-c. -Date\ [2015/05/22]:\ -Description:\ supermarket -Account\ 1:\ expenses:food -Amount\ \ 1:\ $10 -Account\ 2:\ assets:checking -Amount\ \ 2\ [$\-10.0]:\ -Account\ 3\ (or\ .\ or\ enter\ to\ finish\ this\ transaction):\ . -2015/05/22\ supermarket -\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ $10 -\ \ \ \ assets:checking\ \ \ \ \ \ \ \ $\-10.0 +$ hledger add +Adding transactions to journal file /src/hledger/examples/sample.journal +Any command line arguments will be used as defaults. +Use tab key to complete, readline keys to edit, enter to accept defaults. +An optional (CODE) may follow transaction dates. +An optional ; COMMENT may follow descriptions or amounts. +If you make a mistake, enter < at any prompt to restart the transaction. +To end a transaction, enter . when prompted. +To quit, enter . at a date prompt or press control-d or control-c. +Date [2015/05/22]: +Description: supermarket +Account 1: expenses:food +Amount 1: $10 +Account 2: assets:checking +Amount 2 [$-10.0]: +Account 3 (or . or enter to finish this transaction): . +2015/05/22 supermarket + expenses:food $10 + assets:checking $-10.0 -Save\ this\ transaction\ to\ the\ journal\ ?\ [y]:\ +Save this transaction to the journal ? [y]: Saved. -Starting\ the\ next\ transaction\ (.\ or\ ctrl\-D/ctrl\-C\ to\ quit) -Date\ [2015/05/22]:\ \ $ -\f[] +Starting the next transaction (. or ctrl-D/ctrl-C to quit) +Date [2015/05/22]: $ +\f[R] .fi .SS balance .PP @@ -1495,8 +1717,8 @@ balance, bal, b Show accounts and their balances. .PP The balance command is hledger\[aq]s most versatile command. -Note, despite the name, it is not always used for showing real\-world -account balances; the more accounting\-aware balancesheet and +Note, despite the name, it is not always used for showing real-world +account balances; the more accounting-aware balancesheet and incomestatement may be more convenient for that. .PP By default, it displays all accounts, and each account\[aq]s change in @@ -1510,12 +1732,12 @@ transactions, etc. If you include an account\[aq]s complete history of postings in the report, the balance change is equivalent to the account\[aq]s current ending balance. -For a real\-world account, typically you won\[aq]t have all transactions +For a real-world account, typically you won\[aq]t have all transactions in the journal; instead you\[aq]ll have all transactions after a certain -date, and an "opening balances" transaction setting the correct starting -balance on that date. -Then the balance command will show real\-world account balances. -In some cases the \-H/\-\-historical flag is used to ensure this (more +date, and an \[dq]opening balances\[dq] transaction setting the correct +starting balance on that date. +Then the balance command will show real-world account balances. +In some cases the -H/--historical flag is used to ensure this (more below). .PP The balance command can produce several styles of report: @@ -1526,80 +1748,80 @@ It usually looks like this: .IP .nf \f[C] -$\ hledger\ balance -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ gifts -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ salary -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +$ hledger balance + $-1 assets + $1 bank:saving + $-2 cash + $2 expenses + $1 food + $1 supplies + $-2 income + $-1 gifts + $-1 salary + $1 liabilities:debts +-------------------- + 0 +\f[R] .fi .PP By default, accounts are displayed hierarchically, with subaccounts indented below their parent. At each level of the tree, accounts are sorted by account code if any, then by account name. -Or with \f[C]\-S/\-\-sort\-amount\f[], by their balance amount. +Or with \f[C]-S/--sort-amount\f[R], by their balance amount. .PP -"Boring" accounts, which contain a single interesting subaccount and no -balance of their own, are elided into the following line for more +\[dq]Boring\[dq] accounts, which contain a single interesting subaccount +and no balance of their own, are elided into the following line for more compact output. -(Eg above, the "liabilities" account.) Use \f[C]\-\-no\-elide\f[] to -prevent this. +(Eg above, the \[dq]liabilities\[dq] account.) Use \f[C]--no-elide\f[R] +to prevent this. .PP -Account balances are "inclusive" \- they include the balances of any -subaccounts. +Account balances are \[dq]inclusive\[dq] - they include the balances of +any subaccounts. .PP -Accounts which have zero balance (and no non\-zero subaccounts) are +Accounts which have zero balance (and no non-zero subaccounts) are omitted. -Use \f[C]\-E/\-\-empty\f[] to show them. +Use \f[C]-E/--empty\f[R] to show them. .PP -A final total is displayed by default; use \f[C]\-N/\-\-no\-total\f[] to +A final total is displayed by default; use \f[C]-N/--no-total\f[R] to suppress it, eg: .IP .nf \f[C] -$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-\-no\-total -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies -\f[] +$ hledger balance -p 2008/6 expenses --no-total + $2 expenses + $1 food + $1 supplies +\f[R] .fi .SS Customising the classic balance report .PP You can customise the layout of classic balance reports with -\f[C]\-\-format\ FMT\f[]: +\f[C]--format FMT\f[R]: .IP .nf \f[C] -$\ hledger\ balance\ \-\-format\ "%20(account)\ %12(total)" -\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ $\-1 -\ \ \ \ \ \ \ \ \ bank:saving\ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cash\ \ \ \ \ \ \ \ \ \ $\-2 -\ \ \ \ \ \ \ \ \ \ \ \ expenses\ \ \ \ \ \ \ \ \ \ \ $2 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ food\ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ \ \ \ \ \ \ \ \ supplies\ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ income\ \ \ \ \ \ \ \ \ \ $\-2 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ gifts\ \ \ \ \ \ \ \ \ \ $\-1 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ salary\ \ \ \ \ \ \ \ \ \ $\-1 -\ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ $1 -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +$ hledger balance --format \[dq]%20(account) %12(total)\[dq] + assets $-1 + bank:saving $1 + cash $-2 + expenses $2 + food $1 + supplies $1 + income $-2 + gifts $-1 + salary $-1 + liabilities:debts $1 +--------------------------------- + 0 +\f[R] .fi .PP The FMT format string (plus a newline) specifies the formatting applied to each account/balance pair. It may contain any suitable text, with data fields interpolated like so: .PP -\f[C]%[MIN][.MAX](FIELDNAME)\f[] +\f[C]%[MIN][.MAX](FIELDNAME)\f[R] .IP \[bu] 2 MIN pads with spaces to at least this width (optional) .IP \[bu] 2 @@ -1608,83 +1830,83 @@ MAX truncates at this width (optional) FIELDNAME must be enclosed in parentheses, and can be one of: .RS 2 .IP \[bu] 2 -\f[C]depth_spacer\f[] \- a number of spaces equal to the account\[aq]s +\f[C]depth_spacer\f[R] - a number of spaces equal to the account\[aq]s depth, or if MIN is specified, MIN * depth spaces. .IP \[bu] 2 -\f[C]account\f[] \- the account\[aq]s name +\f[C]account\f[R] - the account\[aq]s name .IP \[bu] 2 -\f[C]total\f[] \- the account\[aq]s balance/posted total, right +\f[C]total\f[R] - the account\[aq]s balance/posted total, right justified .RE .PP Also, FMT can begin with an optional prefix to control how -multi\-commodity amounts are rendered: +multi-commodity amounts are rendered: .IP \[bu] 2 -\f[C]%_\f[] \- render on multiple lines, bottom\-aligned (the default) +\f[C]%_\f[R] - render on multiple lines, bottom-aligned (the default) .IP \[bu] 2 -\f[C]%^\f[] \- render on multiple lines, top\-aligned +\f[C]%\[ha]\f[R] - render on multiple lines, top-aligned .IP \[bu] 2 -\f[C]%,\f[] \- render on one line, comma\-separated +\f[C]%,\f[R] - render on one line, comma-separated .PP There are some quirks. -Eg in one\-line mode, \f[C]%(depth_spacer)\f[] has no effect, instead -\f[C]%(account)\f[] has indentation built in. - Experimentation may be needed to get pleasing results. +Eg in one-line mode, \f[C]%(depth_spacer)\f[R] has no effect, instead +\f[C]%(account)\f[R] has indentation built in. +Experimentation may be needed to get pleasing results. .PP Some example formats: .IP \[bu] 2 -\f[C]%(total)\f[] \- the account\[aq]s total +\f[C]%(total)\f[R] - the account\[aq]s total .IP \[bu] 2 -\f[C]%\-20.20(account)\f[] \- the account\[aq]s name, left justified, +\f[C]%-20.20(account)\f[R] - the account\[aq]s name, left justified, padded to 20 characters and clipped at 20 characters .IP \[bu] 2 -\f[C]%,%\-50(account)\ \ %25(total)\f[] \- account name padded to 50 +\f[C]%,%-50(account) %25(total)\f[R] - account name padded to 50 characters, total padded to 20 characters, with multiple commodities rendered on one line .IP \[bu] 2 -\f[C]%20(total)\ \ %2(depth_spacer)%\-(account)\f[] \- the default -format for the single\-column balance report +\f[C]%20(total) %2(depth_spacer)%-(account)\f[R] - the default format +for the single-column balance report .SS Colour support .PP The balance command shows negative amounts in red, if: .IP \[bu] 2 -the \f[C]TERM\f[] environment variable is not set to \f[C]dumb\f[] +the \f[C]TERM\f[R] environment variable is not set to \f[C]dumb\f[R] .IP \[bu] 2 the output is not being redirected or piped anywhere .SS Flat mode .PP To see a flat list instead of the default hierarchical display, use -\f[C]\-\-flat\f[]. -In this mode, accounts (unless depth\-clipped) show their full names and -"exclusive" balance, excluding any subaccount balances. -In this mode, you can also use \f[C]\-\-drop\ N\f[] to omit the first -few account name components. +\f[C]--flat\f[R]. +In this mode, accounts (unless depth-clipped) show their full names and +\[dq]exclusive\[dq] balance, excluding any subaccount balances. +In this mode, you can also use \f[C]--drop N\f[R] to omit the first few +account name components. .IP .nf \f[C] -$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-N\ \-\-flat\ \-\-drop\ 1 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ food -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ supplies -\f[] +$ hledger balance -p 2008/6 expenses -N --flat --drop 1 + $1 food + $1 supplies +\f[R] .fi .SS Depth limited balance reports .PP -With \f[C]\-\-depth\ N\f[] or \f[C]depth:N\f[] or just \f[C]\-N\f[], +With \f[C]--depth N\f[R] or \f[C]depth:N\f[R] or just \f[C]-N\f[R], balance reports show accounts only to the specified numeric depth. This is very useful to summarise a complex set of accounts and get an overview. .IP .nf \f[C] -$\ hledger\ balance\ \-N\ \-1 -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities -\f[] +$ hledger balance -N -1 + $-1 assets + $2 expenses + $-2 income + $1 liabilities +\f[R] .fi .PP -Flat\-mode balance reports, which normally show exclusive balances, show +Flat-mode balance reports, which normally show exclusive balances, show inclusive balances at the depth limit. .SS Multicolumn balance report .PP @@ -1704,117 +1926,120 @@ This is useful eg for a monthly income statement: .IP .nf \f[C] -$\ hledger\ balance\ \-\-quarterly\ income\ expenses\ \-E -Balance\ changes\ in\ 2008: +$ hledger balance --quarterly income expenses -E +Balance changes in 2008: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008q1\ \ 2008q2\ \ 2008q3\ \ 2008q4\ + || 2008q1 2008q2 2008q3 2008q4 ===================++================================= -\ expenses:food\ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ expenses:supplies\ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ income:gifts\ \ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ income:salary\ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\f[] + expenses:food || 0 $1 0 0 + expenses:supplies || 0 $1 0 0 + income:gifts || 0 $-1 0 0 + income:salary || $-1 0 0 0 +-------------------++--------------------------------- + || $-1 $1 0 0 +\f[R] .fi .RE .IP "2." 3 -With \f[C]\-\-cumulative\f[]: each column shows the ending balance for +With \f[C]--cumulative\f[R]: each column shows the ending balance for that period, accumulating the changes across periods, starting from 0 at the report start date: .RS 4 .IP .nf \f[C] -$\ hledger\ balance\ \-\-quarterly\ income\ expenses\ \-E\ \-\-cumulative -Ending\ balances\ (cumulative)\ in\ 2008: +$ hledger balance --quarterly income expenses -E --cumulative +Ending balances (cumulative) in 2008: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008/03/31\ \ 2008/06/30\ \ 2008/09/30\ \ 2008/12/31\ + || 2008/03/31 2008/06/30 2008/09/30 2008/12/31 ===================++================================================= -\ expenses:food\ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ expenses:supplies\ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ income:gifts\ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ -\ income:salary\ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ -\f[] + expenses:food || 0 $1 $1 $1 + expenses:supplies || 0 $1 $1 $1 + income:gifts || 0 $-1 $-1 $-1 + income:salary || $-1 $-1 $-1 $-1 +-------------------++------------------------------------------------- + || $-1 0 0 0 +\f[R] .fi .RE .IP "3." 3 -With \f[C]\-\-historical/\-H\f[]: each column shows the actual -historical ending balance for that period, accumulating the changes -across periods, starting from the actual balance at the report start -date. -This is useful eg for a multi\-period balance sheet, and when you are +With \f[C]--historical/-H\f[R]: each column shows the actual historical +ending balance for that period, accumulating the changes across periods, +starting from the actual balance at the report start date. +This is useful eg for a multi-period balance sheet, and when you are showing only the data after a certain start date: .RS 4 .IP .nf \f[C] -$\ hledger\ balance\ ^assets\ ^liabilities\ \-\-quarterly\ \-\-historical\ \-\-begin\ 2008/4/1 -Ending\ balances\ (historical)\ in\ 2008/04/01\-2008/12/31: +$ hledger balance \[ha]assets \[ha]liabilities --quarterly --historical --begin 2008/4/1 +Ending balances (historical) in 2008/04/01-2008/12/31: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008/06/30\ \ 2008/09/30\ \ 2008/12/31\ + || 2008/06/30 2008/09/30 2008/12/31 ======================++===================================== -\ assets:bank:checking\ ||\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ 0\ -\ assets:bank:saving\ \ \ ||\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ assets:cash\ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-2\ \ \ \ \ \ \ \ \ $\-2\ \ \ \ \ \ \ \ \ $\-2\ -\ liabilities:debts\ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ -\f[] + assets:bank:checking || $1 $1 0 + assets:bank:saving || $1 $1 $1 + assets:cash || $-2 $-2 $-2 + liabilities:debts || 0 0 $1 +----------------------++------------------------------------- + || 0 0 0 +\f[R] .fi .RE .PP +Note that \f[C]--cumulative\f[R] or \f[C]--historical/-H\f[R] disable +\f[C]--row-total/-T\f[R], since summing end balances generally does not +make sense. +.PP Multicolumn balance reports display accounts in flat mode by default; to -see the hierarchy, use \f[C]\-\-tree\f[]. +see the hierarchy, use \f[C]--tree\f[R]. .PP -With a reporting interval (like \f[C]\-\-quarterly\f[] above), the -report start/end dates will be adjusted if necessary so that they -encompass the displayed report periods. -This is so that the first and last periods will be "full" and comparable -to the others. +With a reporting interval (like \f[C]--quarterly\f[R] above), the report +start/end dates will be adjusted if necessary so that they encompass the +displayed report periods. +This is so that the first and last periods will be \[dq]full\[dq] and +comparable to the others. .PP -The \f[C]\-E/\-\-empty\f[] flag does two things in multicolumn balance +The \f[C]-E/--empty\f[R] flag does two things in multicolumn balance reports: first, the report will show all columns within the specified -report period (without \-E, leading and trailing columns with all zeroes +report period (without -E, leading and trailing columns with all zeroes are not shown). Second, all accounts which existed at the report start date will be considered, not just the ones with activity during the report period -(use \-E to include low\-activity accounts which would otherwise would -be omitted). +(use -E to include low-activity accounts which would otherwise would be +omitted). .PP -The \f[C]\-T/\-\-row\-total\f[] flag adds an additional column showing -the total for each row. +The \f[C]-T/--row-total\f[R] flag adds an additional column showing the +total for each row. .PP -The \f[C]\-A/\-\-average\f[] flag adds a column showing the average -value in each row. +The \f[C]-A/--average\f[R] flag adds a column showing the average value +in each row. .PP Here\[aq]s an example of all three: .IP .nf \f[C] -$\ hledger\ balance\ \-Q\ income\ expenses\ \-\-tree\ \-ETA -Balance\ changes\ in\ 2008: +$ hledger balance -Q income expenses --tree -ETA +Balance changes in 2008: -\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008q1\ \ 2008q2\ \ 2008q3\ \ 2008q4\ \ \ \ Total\ \ Average\ + || 2008q1 2008q2 2008q3 2008q4 Total Average ============++=================================================== -\ expenses\ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $2\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $2\ \ \ \ \ \ \ $1\ -\ \ \ food\ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ 0\ -\ \ \ supplies\ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ 0\ -\ income\ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-2\ \ \ \ \ \ $\-1\ -\ \ \ gifts\ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ 0\ -\ \ \ salary\ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ 0\ -\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ 0\ + expenses || 0 $2 0 0 $2 $1 + food || 0 $1 0 0 $1 0 + supplies || 0 $1 0 0 $1 0 + income || $-1 $-1 0 0 $-2 $-1 + gifts || 0 $-1 0 0 $-1 0 + salary || $-1 0 0 0 $-1 0 +------------++--------------------------------------------------- + || $-1 $1 0 0 0 0 -#\ Average\ is\ rounded\ to\ the\ dollar\ here\ since\ all\ journal\ amounts\ are -\f[] +# Average is rounded to the dollar here since all journal amounts are +\f[R] .fi .PP Limitations: .PP -In multicolumn reports the \f[C]\-V/\-\-value\f[] flag uses the market +In multicolumn reports the \f[C]-V/--value\f[R] flag uses the market price on the report end date, for all columns (not the price on each column\[aq]s end date). .PP @@ -1822,64 +2047,64 @@ Eliding of boring parent accounts in tree mode, as in the classic balance report, is not yet supported in multicolumn reports. .SS Budget report .PP -With \f[C]\-\-budget\f[], extra columns are displayed showing budget +With \f[C]--budget\f[R], extra columns are displayed showing budget goals for each account and period, if any. Budget goals are defined by periodic transactions. This is very useful for comparing planned and actual income, expenses, time usage, etc. -\-\-budget is most often combined with a report interval. +--budget is most often combined with a report interval. .PP For example, you can take average monthly expenses in the common expense categories to construct a minimal monthly budget: .IP .nf \f[C] -;;\ Budget -~\ monthly -\ \ income\ \ $2000 -\ \ expenses:food\ \ \ \ $400 -\ \ expenses:bus\ \ \ \ \ $50 -\ \ expenses:movies\ \ $30 -\ \ assets:bank:checking +;; Budget +\[ti] monthly + income $2000 + expenses:food $400 + expenses:bus $50 + expenses:movies $30 + assets:bank:checking -;;\ Two\ months\ worth\ of\ expenses -2017\-11\-01 -\ \ income\ \ $1950 -\ \ expenses:food\ \ \ \ $396 -\ \ expenses:bus\ \ \ \ \ $49 -\ \ expenses:movies\ \ $30 -\ \ expenses:supplies\ \ $20 -\ \ assets:bank:checking +;; Two months worth of expenses +2017-11-01 + income $1950 + expenses:food $396 + expenses:bus $49 + expenses:movies $30 + expenses:supplies $20 + assets:bank:checking -2017\-12\-01 -\ \ income\ \ $2100 -\ \ expenses:food\ \ \ \ $412 -\ \ expenses:bus\ \ \ \ \ $53 -\ \ expenses:gifts\ \ \ $100 -\ \ assets:bank:checking -\f[] +2017-12-01 + income $2100 + expenses:food $412 + expenses:bus $53 + expenses:gifts $100 + assets:bank:checking +\f[R] .fi .PP You can now see a monthly budget report: .IP .nf \f[C] -$\ hledger\ balance\ \-M\ \-\-budget -Budget\ performance\ in\ 2017/11/01\-2017/12/31: +$ hledger balance -M --budget +Budget performance in 2017/11/01-2017/12/31: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ + || Nov Dec ======================++==================================================== -\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ \ $565\ [\ 118%\ of\ \ \ $480]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ \ $53\ [\ 106%\ of\ \ \ \ $50]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $412\ [\ 103%\ of\ \ \ $400]\ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ \ \ 0\ [\ \ \ 0%\ of\ \ \ \ $30]\ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $2100\ [\ 105%\ of\ \ $2000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[] + assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + expenses || $495 [ 103% of $480] $565 [ 118% of $480] + expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] + expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] + expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] + income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] +----------------------++---------------------------------------------------- + || 0 [ 0] 0 [ 0] +\f[R] .fi .PP Note this is different from a normal balance report in several ways: @@ -1897,60 +2122,60 @@ Amounts always include all subaccounts, budgeted or unbudgeted, even in flat mode. .PP This means that the numbers displayed will not always add up! Eg above, -the \f[C]expenses\f[] actual amount includes the gifts and supplies -transactions, but the \f[C]expenses:gifts\f[] and -\f[C]expenses:supplies\f[] accounts are not shown, as they have no +the \f[C]expenses\f[R] actual amount includes the gifts and supplies +transactions, but the \f[C]expenses:gifts\f[R] and +\f[C]expenses:supplies\f[R] accounts are not shown, as they have no budget amounts declared. .PP This can be confusing. -When you need to make things clearer, use the \f[C]\-E/\-\-empty\f[] -flag, which will reveal all accounts including unbudgeted ones, giving -the full picture. +When you need to make things clearer, use the \f[C]-E/--empty\f[R] flag, +which will reveal all accounts including unbudgeted ones, giving the +full picture. Eg: .IP .nf \f[C] -$\ hledger\ balance\ \-M\ \-\-budget\ \-\-empty -Budget\ performance\ in\ 2017/11/01\-2017/12/31: +$ hledger balance -M --budget --empty +Budget performance in 2017/11/01-2017/12/31: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ + || Nov Dec ======================++==================================================== -\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ \ $565\ [\ 118%\ of\ \ \ $480]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ \ $53\ [\ 106%\ of\ \ \ \ $50]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $412\ [\ 103%\ of\ \ \ $400]\ -\ expenses:gifts\ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ \ \ 0\ [\ \ \ 0%\ of\ \ \ \ $30]\ -\ expenses:supplies\ \ \ \ ||\ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $2100\ [\ 105%\ of\ \ $2000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[] + assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] + expenses || $495 [ 103% of $480] $565 [ 118% of $480] + expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] + expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] + expenses:gifts || 0 $100 + expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] + expenses:supplies || $20 0 + income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] +----------------------++---------------------------------------------------- + || 0 [ 0] 0 [ 0] +\f[R] .fi .PP You can roll over unspent budgets to next period with -\f[C]\-\-cumulative\f[]: +\f[C]--cumulative\f[R]: .IP .nf \f[C] -$\ hledger\ balance\ \-M\ \-\-budget\ \-\-cumulative -Budget\ performance\ in\ 2017/11/01\-2017/12/31: +$ hledger balance -M --budget --cumulative +Budget performance in 2017/11/01-2017/12/31: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ + || Nov Dec ======================++==================================================== -\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ $1060\ [\ 110%\ of\ \ \ $960]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ $102\ [\ 102%\ of\ \ \ $100]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $808\ [\ 101%\ of\ \ \ $800]\ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ $30\ [\ \ 50%\ of\ \ \ \ $60]\ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $4050\ [\ 101%\ of\ \ $4000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[] + assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] + assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] + assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] + expenses || $495 [ 103% of $480] $1060 [ 110% of $960] + expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100] + expenses:food || $396 [ 99% of $400] $808 [ 101% of $800] + expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60] + income || $1950 [ 98% of $2000] $4050 [ 101% of $4000] +----------------------++---------------------------------------------------- + || 0 [ 0] 0 [ 0] +\f[R] .fi .PP For more examples, see Budgeting and Forecasting. @@ -1968,93 +2193,93 @@ To illustrate this, consider the following budget: .IP .nf \f[C] -~\ monthly\ from\ 2019/01 -\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ $1,000.00 -\ \ \ \ expenses:personal:electronics\ \ \ \ $100.00 -\ \ \ \ liabilities -\f[] +\[ti] monthly from 2019/01 + expenses:personal $1,000.00 + expenses:personal:electronics $100.00 + liabilities +\f[R] .fi .PP With this, monthly budget for electronics is defined to be $100 and budget for personal expenses is an additional $1000, which implicity -means that budget for both \f[C]expenses:personal\f[] and -\f[C]expenses\f[] is $1100. +means that budget for both \f[C]expenses:personal\f[R] and +\f[C]expenses\f[R] is $1100. .PP -Transactions in \f[C]expenses:personal:electronics\f[] will be counted -both towards its $100 budget and $1100 of \f[C]expenses:personal\f[] , -and transactions in any other subaccount of \f[C]expenses:personal\f[] +Transactions in \f[C]expenses:personal:electronics\f[R] will be counted +both towards its $100 budget and $1100 of \f[C]expenses:personal\f[R] , +and transactions in any other subaccount of \f[C]expenses:personal\f[R] would be counted towards only towards the budget of -\f[C]expenses:personal\f[]. +\f[C]expenses:personal\f[R]. .PP For example, let\[aq]s consider these transactions: .IP .nf \f[C] -~\ monthly\ from\ 2019/01 -\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ $1,000.00 -\ \ \ \ expenses:personal:electronics\ \ \ \ $100.00 -\ \ \ \ liabilities +\[ti] monthly from 2019/01 + expenses:personal $1,000.00 + expenses:personal:electronics $100.00 + liabilities -2019/01/01\ Google\ home\ hub -\ \ \ \ expenses:personal:electronics\ \ \ \ \ \ \ \ \ \ $90.00 -\ \ \ \ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-90.00 +2019/01/01 Google home hub + expenses:personal:electronics $90.00 + liabilities $-90.00 -2019/01/02\ Phone\ screen\ protector -\ \ \ \ expenses:personal:electronics:upgrades\ \ \ \ \ \ \ \ \ \ $10.00 -\ \ \ \ liabilities +2019/01/02 Phone screen protector + expenses:personal:electronics:upgrades $10.00 + liabilities -2019/01/02\ Weekly\ train\ ticket -\ \ \ \ expenses:personal:train\ tickets\ \ \ \ \ \ \ $153.00 -\ \ \ \ liabilities +2019/01/02 Weekly train ticket + expenses:personal:train tickets $153.00 + liabilities -2019/01/03\ Flowers -\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ $30.00 -\ \ \ \ liabilities -\f[] +2019/01/03 Flowers + expenses:personal $30.00 + liabilities +\f[R] .fi .PP As you can see, we have transactions in -\f[C]expenses:personal:electronics:upgrades\f[] and -\f[C]expenses:personal:train\ tickets\f[], and since both of these +\f[C]expenses:personal:electronics:upgrades\f[R] and +\f[C]expenses:personal:train tickets\f[R], and since both of these accounts are without explicitly defined budget, these transactions would -be counted towards budgets of \f[C]expenses:personal:electronics\f[] and -\f[C]expenses:personal\f[] accordingly: +be counted towards budgets of \f[C]expenses:personal:electronics\f[R] +and \f[C]expenses:personal\f[R] accordingly: .IP .nf \f[C] -$\ hledger\ balance\ \-\-budget\ \-M -Budget\ performance\ in\ 2019/01: +$ hledger balance --budget -M +Budget performance in 2019/01: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Jan\ + || Jan ===============================++=============================== -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal:electronics\ ||\ \ $100.00\ [\ 100%\ of\ \ \ $100.00]\ -\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-283.00\ [\ \ 26%\ of\ $\-1100.00]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[] + expenses || $283.00 [ 26% of $1100.00] + expenses:personal || $283.00 [ 26% of $1100.00] + expenses:personal:electronics || $100.00 [ 100% of $100.00] + liabilities || $-283.00 [ 26% of $-1100.00] +-------------------------------++------------------------------- + || 0 [ 0] +\f[R] .fi .PP -And with \f[C]\-\-empty\f[], we can get a better picture of budget +And with \f[C]--empty\f[R], we can get a better picture of budget allocation and consumption: .IP .nf \f[C] -$\ hledger\ balance\ \-\-budget\ \-M\ \-\-empty -Budget\ performance\ in\ 2019/01: +$ hledger balance --budget -M --empty +Budget performance in 2019/01: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Jan\ + || Jan ========================================++=============================== -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal:electronics\ \ \ \ \ \ \ \ \ \ ||\ \ $100.00\ [\ 100%\ of\ \ \ $100.00]\ -\ expenses:personal:electronics:upgrades\ ||\ \ \ $10.00\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ expenses:personal:train\ tickets\ \ \ \ \ \ \ \ ||\ \ $153.00\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-283.00\ [\ \ 26%\ of\ $\-1100.00]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[] + expenses || $283.00 [ 26% of $1100.00] + expenses:personal || $283.00 [ 26% of $1100.00] + expenses:personal:electronics || $100.00 [ 100% of $100.00] + expenses:personal:electronics:upgrades || $10.00 + expenses:personal:train tickets || $153.00 + liabilities || $-283.00 [ 26% of $-1100.00] +----------------------------------------++------------------------------- + || 0 [ 0] +\f[R] .fi .SS Output format .PP @@ -2069,8 +2294,8 @@ balancesheet, bs This command displays a simple balance sheet, showing historical ending balances of asset and liability accounts (ignoring any report begin date). -It assumes that these accounts are under a top\-level \f[C]asset\f[] or -\f[C]liability\f[] account (case insensitive, plural forms also +It assumes that these accounts are under a top-level \f[C]asset\f[R] or +\f[C]liability\f[R] account (case insensitive, plural forms also allowed). .PP Note this report shows all account balances with normal positive sign @@ -2081,34 +2306,35 @@ Example: .IP .nf \f[C] -$\ hledger\ balancesheet -Balance\ Sheet +$ hledger balancesheet +Balance Sheet Assets: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1 + $-1 assets + $1 bank:saving + $-2 cash +-------------------- + $-1 Liabilities: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1 + $1 liabilities:debts +-------------------- + $1 Total: -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +-------------------- + 0 +\f[R] .fi .PP With a reporting interval, multiple columns will be shown, one for each report period. As with multicolumn balance reports, you can alter the report mode with -\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[]. +\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R]. Normally balancesheet shows historical ending balances, which is what you need for a balance sheet; note this means it ignores report begin -dates. +dates (and \f[C]-T/--row-total\f[R], since summing end balances +generally does not make sense). .PP This command also supports output destination and output format selection. @@ -2119,36 +2345,36 @@ balancesheetequity, bse .P .PD Just like balancesheet, but also reports Equity (which it assumes is -under a top\-level \f[C]equity\f[] account). +under a top-level \f[C]equity\f[R] account). .PP Example: .IP .nf \f[C] -$\ hledger\ balancesheetequity -Balance\ Sheet\ With\ Equity +$ hledger balancesheetequity +Balance Sheet With Equity Assets: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ assets -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-3\ \ \ \ cash -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2 + $-2 assets + $1 bank:saving + $-3 cash +-------------------- + $-2 Liabilities: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1 + $1 liabilities:debts +-------------------- + $1 Equity: -\ \ \ \ \ \ \ \ \ \ $1\ \ equity:owner -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ $1 + $1 equity:owner +-------------------- + $1 Total: -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +-------------------- + 0 +\f[R] .fi .SS cashflow .PP @@ -2157,10 +2383,10 @@ cashflow, cf .P .PD This command displays a simple cashflow statement, showing changes in -"cash" accounts. -It assumes that these accounts are under a top\-level \f[C]asset\f[] +\[dq]cash\[dq] accounts. +It assumes that these accounts are under a top-level \f[C]asset\f[R] account (case insensitive, plural forms also allowed) and do not contain -\f[C]receivable\f[] or \f[C]A/R\f[] in their name. +\f[C]receivable\f[R] or \f[C]A/R\f[R] in their name. Note this report shows all account balances with normal positive sign (like conventional financial statements, unlike balance/print/register) (experimental). @@ -2169,44 +2395,44 @@ Example: .IP .nf \f[C] -$\ hledger\ cashflow -Cashflow\ Statement +$ hledger cashflow +Cashflow Statement -Cash\ flows: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1 +Cash flows: + $-1 assets + $1 bank:saving + $-2 cash +-------------------- + $-1 Total: -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1 -\f[] +-------------------- + $-1 +\f[R] .fi .PP With a reporting interval, multiple columns will be shown, one for each report period. Normally cashflow shows changes in assets per period, though as with multicolumn balance reports you can alter the report mode with -\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[]. +\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R]. .PP This command also supports output destination and output format selection. -.SS check\-dates +.SS check-dates .PP -check\-dates +check-dates .PD 0 .P .PD Check that transactions are sorted by increasing date. -With \-\-date2, checks secondary dates instead. -With \-\-strict, dates must also be unique. +With --date2, checks secondary dates instead. +With --strict, dates must also be unique. With a query, only matched transactions\[aq] dates are checked. -Reads the default journal file, or another specified with \-f. -.SS check\-dupes +Reads the default journal file, or another specified with -f. +.SS check-dupes .PP -check\-dupes +check-dupes .PD 0 .P .PD @@ -2214,24 +2440,26 @@ Reports account names having the same leaf but different prefixes. In other words, two or more leaves that are categorized differently. Reads the default journal file, or another specified as an argument. .PP -An example: http://stefanorodighiero.net/software/hledger\-dupes.html +An example: http://stefanorodighiero.net/software/hledger-dupes.html .SS close .PP close, equity .PD 0 .P .PD -Prints a "closing balances" transaction and an "opening balances" -transaction that bring account balances to and from zero, respectively. +Prints a \[dq]closing balances\[dq] transaction and an \[dq]opening +balances\[dq] transaction that bring account balances to and from zero, +respectively. Useful for bringing asset/liability balances forward into a new journal file, or for closing out revenues/expenses to retained earnings at the end of a period. .PP -The closing transaction transfers balances to "equity:closing balances". -The opening transaction transfers balances from "equity:opening -balances". -You can chose to print just one of the transactions by using the -\f[C]\-\-opening\f[] or \f[C]\-\-closing\f[] flag. +The closing transaction transfers balances to \[dq]equity:closing +balances\[dq]. +The opening transaction transfers balances from \[dq]equity:opening +balances\[dq]. +You can choose to print just one of the transactions by using the +\f[C]--opening\f[R] or \f[C]--closing\f[R] flag. .PP If you split your journal files by time (eg yearly), you will typically run this command at the end of the year, and save the closing @@ -2244,30 +2472,30 @@ or if you load several files, the redundant closing/opening transactions cancel each other out. (They will show up in print or register reports; you can exclude them with a query like -\f[C]not:desc:\[aq](opening|closing)\ balances\[aq]\f[].) +\f[C]not:desc:\[aq](opening|closing) balances\[aq]\f[R].) .PP If you\[aq]re running a business, you might also use this command to -"close the books" at the end of an accounting period, transferring -income statement account balances to retained earnings. +\[dq]close the books\[dq] at the end of an accounting period, +transferring income statement account balances to retained earnings. (You may want to change the equity account name to something like -"equity:retained earnings".) +\[dq]equity:retained earnings\[dq].) .PP By default, the closing transaction is dated yesterday, the balances are calculated as of end of yesterday, and the opening transaction is dated today. To close on some other date, use: -\f[C]hledger\ close\ \-e\ OPENINGDATE\f[]. -Eg, to close/open on the 2018/2019 boundary, use \f[C]\-e\ 2019\f[]. -You can also use \-p or \f[C]date:PERIOD\f[] (any starting date is +\f[C]hledger close -e OPENINGDATE\f[R]. +Eg, to close/open on the 2018/2019 boundary, use \f[C]-e 2019\f[R]. +You can also use -p or \f[C]date:PERIOD\f[R] (any starting date is ignored). .PP Both transactions will include balance assertions for the closed/reopened accounts. -You probably shouldn\[aq]t use status or realness filters (like \-C or -\-R or \f[C]status:\f[]) with this command, or the generated balance +You probably shouldn\[aq]t use status or realness filters (like -C or -R +or \f[C]status:\f[R]) with this command, or the generated balance assertions will depend on these flags. -Likewise, if you run this command with \-\-auto, the balance assertions -will probably always require \-\-auto. +Likewise, if you run this command with --auto, the balance assertions +will probably always require --auto. .PP Examples: .PP @@ -2275,23 +2503,23 @@ Carrying asset/liability balances into a new file for 2019, all from command line: .PP \f[I]Warning: we use \f[CI]>>\f[I] here to append; be careful not to -type a single \f[CI]>\f[I] which would wipe your journal!\f[] +type a single \f[CI]>\f[I] which would wipe your journal!\f[R] .IP .nf \f[C] -$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-opening\ >>2019.journal -$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-closing\ >>2018.journal -\f[] +$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal +$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal +\f[R] .fi .PP Now: .IP .nf \f[C] -$\ hledger\ bs\ \-f\ 2019.journal\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ one\ file\ \-\ balances\ are\ correct -$\ hledger\ bs\ \-f\ 2018.journal\ \-f\ 2019.journal\ \ \ #\ two\ files\ \-\ balances\ still\ correct -$\ hledger\ bs\ \-f\ 2018.journal\ not:desc:closing\ \ #\ to\ see\ year\-end\ balances,\ must\ exclude\ closing\ txn -\f[] +$ hledger bs -f 2019.journal # one file - balances are correct +$ hledger bs -f 2018.journal -f 2019.journal # two files - balances still correct +$ hledger bs -f 2018.journal not:desc:closing # to see year-end balances, must exclude closing txn +\f[R] .fi .PP Transactions spanning the closing date can complicate matters, breaking @@ -2299,26 +2527,26 @@ balance assertions: .IP .nf \f[C] -2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year -\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5 -\ \ \ \ assets:bank:checking\ \ \-5\ \ ;\ [2019/1/2] -\f[] +2018/12/30 a purchase made in 2018, clearing the following year + expenses:food 5 + assets:bank:checking -5 ; [2019/1/2] +\f[R] .fi .PP Here\[aq]s one way to resolve that: .IP .nf \f[C] -;\ in\ 2018.journal: -2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year -\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5 -\ \ \ \ liabilities:pending +; in 2018.journal: +2018/12/30 a purchase made in 2018, clearing the following year + expenses:food 5 + liabilities:pending -;\ in\ 2019.journal: -2019/1/2\ clearance\ of\ last\ year\[aq]s\ pending\ transactions -\ \ \ \ liabilities:pending\ \ \ \ 5\ =\ 0 -\ \ \ \ assets:checking -\f[] +; in 2019.journal: +2019/1/2 clearance of last year\[aq]s pending transactions + liabilities:pending 5 = 0 + assets:checking +\f[R] .fi .SS files .PP @@ -2337,45 +2565,45 @@ help .PD Show any of the hledger manuals. .PP -The \f[C]help\f[] command displays any of the main hledger manuals, in +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. .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[], -\f[C]\-\-man\f[], \f[C]\-\-pager\f[], \f[C]\-\-cat\f[] flags. +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\ "hledger\ help\ MANUAL"\ (a\ substring\ is\ ok). -Manuals:\ hledger\ hledger\-ui\ hledger\-web\ hledger\-api\ journal\ csv\ timeclock\ timedot -\f[] +$ hledger help +Please choose a manual by typing \[dq]hledger help MANUAL\[dq] (a substring is ok). +Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot +\f[R] .fi .IP .nf \f[C] -$\ hledger\ help\ h\ \-\-man +$ hledger help h --man -hledger(1)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger\ User\ Manuals\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger(1) +hledger(1) hledger User Manuals hledger(1) NAME -\ \ \ \ \ \ \ hledger\ \-\ a\ command\-line\ accounting\ tool + hledger - a command-line accounting tool SYNOPSIS -\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [ARGS] -\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [ARGS] -\ \ \ \ \ \ \ hledger + 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 + hledger is a cross-platform program for tracking money, time, or any \&... -\f[] +\f[R] .fi .SS import .PP @@ -2385,25 +2613,45 @@ import .PD 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 transactions that would be added. +Or with --dry-run, just print the transactions that would be added. .PP -The input files are specified as arguments \- no need to write \-f -before each one. +The input files are specified as arguments - no need to write -f before +each one. So eg to add new transactions from all CSV files to the main journal, -it\[aq]s just: \f[C]hledger\ import\ *.csv\f[] +it\[aq]s just: \f[C]hledger import *.csv\f[R] .PP -New transactions are detected in the same way as print \-\-new: by +New transactions are detected in the same way as print --new: by assuming transactions are always added to the input files in increasing -date order, and by saving \f[C]\&.latest.FILE\f[] state files. +date order, and by saving \f[C].latest.FILE\f[R] state files. .PP -The \-\-dry\-run output is in journal format, so you can filter it, eg -to see only uncategorised transactions: +The --dry-run output is in journal format, so you can filter it, eg to +see only uncategorised transactions: .IP .nf \f[C] -$\ hledger\ import\ \-\-dry\ ...\ |\ hledger\ \-f\-\ print\ unknown\ \-\-ignore\-assertions -\f[] +$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions +\f[R] .fi +.SS Importing balance assignments +.PP +Entries added by import will have their posting amounts made explicit +(like \f[C]hledger print -x\f[R]). +This means that any balance assignments in imported files must be +evaluated; but, imported files don\[aq]t get to see the main file\[aq]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 amounts. +To avoid this problem, use print instead of import: +.IP +.nf +\f[C] +$ hledger print IMPORTFILE [--new] >> $LEDGER_FILE +\f[R] +.fi +.PP +(If you think import should leave amounts implicit like print does, +please test it and send a pull request.) .SS incomestatement .PP incomestatement, is @@ -2412,48 +2660,48 @@ incomestatement, is .PD This command displays a simple income statement, showing revenues and expenses during a period. -It assumes that these accounts are under a top\-level \f[C]revenue\f[] -or \f[C]income\f[] or \f[C]expense\f[] account (case insensitive, plural -forms also allowed). +It assumes that these accounts are under a top-level \f[C]revenue\f[R] +or \f[C]income\f[R] or \f[C]expense\f[R] account (case insensitive, +plural forms also allowed). Note this report shows all account balances with normal positive sign (like conventional financial statements, unlike balance/print/register) (experimental). .PP This command displays a simple income statement. -It currently assumes that you have top\-level accounts named -\f[C]income\f[] (or \f[C]revenue\f[]) and \f[C]expense\f[] (plural forms -also allowed.) +It currently assumes that you have top-level accounts named +\f[C]income\f[R] (or \f[C]revenue\f[R]) and \f[C]expense\f[R] (plural +forms also allowed.) .IP .nf \f[C] -$\ hledger\ incomestatement -Income\ Statement +$ hledger incomestatement +Income Statement Revenues: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ gifts -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ salary -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2 + $-2 income + $-1 gifts + $-1 salary +-------------------- + $-2 Expenses: -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2 + $2 expenses + $1 food + $1 supplies +-------------------- + $2 Total: -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +-------------------- + 0 +\f[R] .fi .PP 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 -\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[]. +\f[C]--change\f[R]/\f[C]--cumulative\f[R]/\f[C]--historical\f[R]. .PP This command also supports output destination and output format selection. @@ -2464,9 +2712,9 @@ prices .P .PD Print market price directives from the journal. -With \-\-costs, also print synthetic market prices based on transaction +With --costs, also print synthetic market prices based on transaction prices. -With \-\-inverted\-costs, also print inverse prices based on transaction +With --inverted-costs, also print inverse prices based on transaction prices. Prices (and postings providing prices) can be filtered by a query. .SS print @@ -2479,78 +2727,78 @@ Show transaction journal entries, sorted by date. .PP The print command displays full journal entries (transactions) from the journal file in date order, tidily formatted. -With \-\-date2, transactions are sorted by secondary date instead. +With --date2, transactions are sorted by secondary date instead. .PP print\[aq]s output is always a valid hledger journal. .PD 0 .P .PD It preserves all transaction information, but it does not preserve -directives or inter\-transaction comments +directives or inter-transaction comments .IP .nf \f[C] -$\ hledger\ print -2008/01/01\ income -\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1 +$ hledger print +2008/01/01 income + assets:bank:checking $1 + income:salary $-1 -2008/06/01\ gift -\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1 +2008/06/01 gift + assets:bank:checking $1 + income:gifts $-1 -2008/06/02\ save -\ \ \ \ assets:bank:saving\ \ \ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1 +2008/06/02 save + assets:bank:saving $1 + assets:bank:checking $-1 -2008/06/03\ *\ eat\ &\ shop -\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ expenses:supplies\ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2 +2008/06/03 * eat & shop + expenses:food $1 + expenses:supplies $1 + assets:cash $-2 -2008/12/31\ *\ pay\ off -\ \ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1 -\f[] +2008/12/31 * pay off + liabilities:debts $1 + assets:bank:checking $-1 +\f[R] .fi .PP Normally, the journal entry\[aq]s explicit or implicit amount style is preserved. Ie when an amount is omitted in the journal, it will be omitted in the output. -You can use the \f[C]\-x\f[]/\f[C]\-\-explicit\f[] flag to make all +You can use the \f[C]-x\f[R]/\f[C]--explicit\f[R] flag to make all amounts explicit, which can be useful for troubleshooting or for making your journal more readable and robust against data entry errors. -Note, \f[C]\-x\f[] will cause postings with a multi\-commodity amount -(these can arise when a multi\-commodity transaction has an implicit -amount) will be split into multiple single\-commodity postings, for -valid journal output. +Note, \f[C]-x\f[R] will cause postings with a multi-commodity amount +(these can arise when a multi-commodity transaction has an implicit +amount) will be split into multiple single-commodity postings, for valid +journal output. .PP -With \f[C]\-B\f[]/\f[C]\-\-cost\f[], amounts with transaction prices are +With \f[C]-B\f[R]/\f[C]--cost\f[R], amounts with transaction prices are converted to cost using that price. This can be used for troubleshooting. .PP -With \f[C]\-m\f[]/\f[C]\-\-match\f[] and a STR argument, print will show +With \f[C]-m\f[R]/\f[C]--match\f[R] and a STR argument, print will show at most one transaction: 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. +If there is no similar-enough match, no transaction will be shown. .PP -With \f[C]\-\-new\f[], for each FILE being read, hledger reads (and -writes) a special state file (\f[C]\&.latest.FILE\f[] in the same +With \f[C]--new\f[R], for each FILE being read, hledger reads (and +writes) a special state file (\f[C].latest.FILE\f[R] 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 ignoring already\-seen entries in import data, such -as downloaded CSV files. +This is useful for ignoring already-seen entries in import data, such as +downloaded CSV files. Eg: .IP .nf \f[C] -$\ hledger\ \-f\ bank1.csv\ print\ \-\-new -#\ shows\ transactions\ added\ since\ last\ print\ \-\-new\ on\ this\ file -\f[] +$ hledger -f bank1.csv print --new +# shows transactions added since last print --new on this file +\f[R] .fi .PP This assumes that transactions added to FILE always have same or @@ -2564,59 +2812,59 @@ Here\[aq]s an example of print\[aq]s CSV output: .IP .nf \f[C] -$\ hledger\ print\ \-Ocsv -"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting\-status","posting\-comment" -"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","","" -"1","2008/01/01","","","","income","","income:salary","\-1","$","1","","","" -"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","","" -"2","2008/06/01","","","","gift","","income:gifts","\-1","$","1","","","" -"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","","" -"3","2008/06/02","","","","save","","assets:bank:checking","\-1","$","1","","","" -"4","2008/06/03","","*","","eat\ &\ shop","","expenses:food","1","$","","1","","" -"4","2008/06/03","","*","","eat\ &\ shop","","expenses:supplies","1","$","","1","","" -"4","2008/06/03","","*","","eat\ &\ shop","","assets:cash","\-2","$","2","","","" -"5","2008/12/31","","*","","pay\ off","","liabilities:debts","1","$","","1","","" -"5","2008/12/31","","*","","pay\ off","","assets:bank:checking","\-1","$","1","","","" -\f[] +$ hledger print -Ocsv +\[dq]txnidx\[dq],\[dq]date\[dq],\[dq]date2\[dq],\[dq]status\[dq],\[dq]code\[dq],\[dq]description\[dq],\[dq]comment\[dq],\[dq]account\[dq],\[dq]amount\[dq],\[dq]commodity\[dq],\[dq]credit\[dq],\[dq]debit\[dq],\[dq]posting-status\[dq],\[dq]posting-comment\[dq] +\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]1\[dq],\[dq]2008/01/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]income\[dq],\[dq]\[dq],\[dq]income:salary\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]2\[dq],\[dq]2008/06/01\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]gift\[dq],\[dq]\[dq],\[dq]income:gifts\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:saving\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]3\[dq],\[dq]2008/06/02\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]save\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:food\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]expenses:supplies\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]4\[dq],\[dq]2008/06/03\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]eat & shop\[dq],\[dq]\[dq],\[dq]assets:cash\[dq],\[dq]-2\[dq],\[dq]$\[dq],\[dq]2\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]liabilities:debts\[dq],\[dq]1\[dq],\[dq]$\[dq],\[dq]\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq] +\[dq]5\[dq],\[dq]2008/12/31\[dq],\[dq]\[dq],\[dq]*\[dq],\[dq]\[dq],\[dq]pay off\[dq],\[dq]\[dq],\[dq]assets:bank:checking\[dq],\[dq]-1\[dq],\[dq]$\[dq],\[dq]1\[dq],\[dq]\[dq],\[dq]\[dq],\[dq]\[dq] +\f[R] .fi .IP \[bu] 2 There is one CSV record per posting, with the parent transaction\[aq]s fields repeated. .IP \[bu] 2 -The "txnidx" (transaction index) field shows which postings belong to -the same transaction. +The \[dq]txnidx\[dq] (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 order, etc.) .IP \[bu] 2 -The amount is separated into "commodity" (the symbol) and "amount" -(numeric quantity) fields. +The amount is separated into \[dq]commodity\[dq] (the symbol) and +\[dq]amount\[dq] (numeric quantity) fields. .IP \[bu] 2 -The numeric amount is repeated in either the "credit" or "debit" column, -for convenience. +The numeric amount is repeated in either the \[dq]credit\[dq] or +\[dq]debit\[dq] column, for convenience. (Those names are not accurate in the accounting sense; it just puts negative amounts under credit and zero or greater amounts under debit.) -.SS print\-unique +.SS print-unique .PP -print\-unique +print-unique .PD 0 .P .PD -Print transactions which do not reuse an already\-seen description. +Print transactions which do not reuse an already-seen description. .PP Example: .IP .nf \f[C] -$\ cat\ unique.journal -1/1\ test -\ (acct:one)\ \ 1 -2/2\ test -\ (acct:two)\ \ 2 -$\ LEDGER_FILE=unique.journal\ hledger\ print\-unique -(\-f\ option\ not\ supported) -2015/01/01\ test -\ \ \ \ (acct:one)\ \ \ \ \ \ \ \ \ \ \ \ \ 1 -\f[] +$ cat unique.journal +1/1 test + (acct:one) 1 +2/2 test + (acct:two) 2 +$ LEDGER_FILE=unique.journal hledger print-unique +(-f option not supported) +2015/01/01 test + (acct:one) 1 +\f[R] .fi .SS register .PP @@ -2633,45 +2881,45 @@ see that account\[aq]s activity: .IP .nf \f[C] -$\ hledger\ register\ checking -2008/01/01\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $1 -2008/06/01\ gift\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $2 -2008/06/02\ save\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ $1 -2008/12/31\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +$ hledger register checking +2008/01/01 income assets:bank:checking $1 $1 +2008/06/01 gift assets:bank:checking $1 $2 +2008/06/02 save assets:bank:checking $-1 $1 +2008/12/31 pay off assets:bank:checking $-1 0 +\f[R] .fi .PP -With \-\-date2, it shows and sorts by secondary date instead. +With --date2, it shows and sorts by secondary date instead. .PP -The \f[C]\-\-historical\f[]/\f[C]\-H\f[] flag adds the balance from any +The \f[C]--historical\f[R]/\f[C]-H\f[R] 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: .IP .nf \f[C] -$\ hledger\ register\ checking\ \-b\ 2008/6\ \-\-historical -2008/06/01\ gift\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $2 -2008/06/02\ save\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ $1 -2008/12/31\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +$ hledger register checking -b 2008/6 --historical +2008/06/01 gift assets:bank:checking $1 $2 +2008/06/02 save assets:bank:checking $-1 $1 +2008/12/31 pay off assets:bank:checking $-1 0 +\f[R] .fi .PP -The \f[C]\-\-depth\f[] option limits the amount of sub\-account detail +The \f[C]--depth\f[R] option limits the amount of sub-account detail displayed. .PP -The \f[C]\-\-average\f[]/\f[C]\-A\f[] flag shows the running average +The \f[C]--average\f[R]/\f[C]-A\f[R] 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 \f[C]\-\-empty\f[] (see below). -It is affected by \f[C]\-\-historical\f[]. +This flag implies \f[C]--empty\f[R] (see below). +It is affected by \f[C]--historical\f[R]. It works best when showing just one account and one commodity. .PP -The \f[C]\-\-related\f[]/\f[C]\-r\f[] flag shows the \f[I]other\f[] +The \f[C]--related\f[R]/\f[C]-r\f[R] flag shows the \f[I]other\f[R] postings in the transactions of the postings which would normally be shown. .PP -The \f[C]\-\-invert\f[] flag negates all amounts. +The \f[C]--invert\f[R] flag negates all amounts. For example, it can be used on an income account where amounts are normally displayed as negative numbers. It\[aq]s also useful to show postings on the checking account together @@ -2679,8 +2927,8 @@ with the related account: .IP .nf \f[C] -$\ hledger\ register\ \-\-related\ \-\-invert\ assets:checking -\f[] +$ hledger register --related --invert assets:checking +\f[R] .fi .PP With a reporting interval, register shows summary postings, one per @@ -2688,45 +2936,45 @@ interval, aggregating the postings to each account: .IP .nf \f[C] -$\ hledger\ register\ \-\-monthly\ income -2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1 -2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-2 -\f[] +$ hledger register --monthly income +2008/01 income:salary $-1 $-1 +2008/06 income:gifts $-1 $-2 +\f[R] .fi .PP Periods with no activity, and summary postings with a zero amount, are -not shown by default; use the \f[C]\-\-empty\f[]/\f[C]\-E\f[] flag to -see them: +not shown by default; use the \f[C]--empty\f[R]/\f[C]-E\f[R] flag to see +them: .IP .nf \f[C] -$\ hledger\ register\ \-\-monthly\ income\ \-E -2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1 -2008/02\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1 -2008/03\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1 -2008/04\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1 -2008/05\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1 -2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-2 -2008/07\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2 -2008/08\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2 -2008/09\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2 -2008/10\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2 -2008/11\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2 -2008/12\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2 -\f[] +$ hledger register --monthly income -E +2008/01 income:salary $-1 $-1 +2008/02 0 $-1 +2008/03 0 $-1 +2008/04 0 $-1 +2008/05 0 $-1 +2008/06 income:gifts $-1 $-2 +2008/07 0 $-2 +2008/08 0 $-2 +2008/09 0 $-2 +2008/10 0 $-2 +2008/11 0 $-2 +2008/12 0 $-2 +\f[R] .fi .PP Often, you\[aq]ll want to see just one line per interval. -The \f[C]\-\-depth\f[] option helps with this, causing subaccounts to be +The \f[C]--depth\f[R] option helps with this, causing subaccounts to be aggregated: .IP .nf \f[C] -$\ hledger\ register\ \-\-monthly\ assets\ \-\-depth\ 1h -2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $1 -2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0 -2008/12\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1 -\f[] +$ hledger register --monthly assets --depth 1h +2008/01 assets $1 $1 +2008/06 assets $-1 0 +2008/12 assets $-1 $-1 +\f[R] .fi .PP Note when using report intervals, if you specify start/end dates these @@ -2737,42 +2985,42 @@ comparable to the others in the report. .SS Custom register output .PP register uses the full terminal width by default, except on windows. -You can override this by setting the \f[C]COLUMNS\f[] environment +You can override this by setting the \f[C]COLUMNS\f[R] environment variable (not a bash shell variable) or by using the -\f[C]\-\-width\f[]/\f[C]\-w\f[] option. +\f[C]--width\f[R]/\f[C]-w\f[R] option. .PP The description and account columns normally share the space equally -(about half of (width \- 40) each). +(about half of (width - 40) each). You can adjust this by adding a description width as part of -\-\-width\[aq]s argument, comma\-separated: \f[C]\-\-width\ W,D\f[] . -Here\[aq]s a diagram (won\[aq]t display correctly in \-\-help): +--width\[aq]s argument, comma-separated: \f[C]--width W,D\f[R] . +Here\[aq]s a diagram (won\[aq]t display correctly in --help): .IP .nf \f[C] -<\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\ width\ (W)\ \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-> -date\ (10)\ \ description\ (D)\ \ \ \ \ \ \ account\ (W\-41\-D)\ \ \ \ \ amount\ (12)\ \ \ balance\ (12) -DDDDDDDDDD\ dddddddddddddddddddd\ \ aaaaaaaaaaaaaaaaaaa\ \ AAAAAAAAAAAA\ \ AAAAAAAAAAAA -\f[] +<--------------------------------- width (W) ----------------------------------> +date (10) description (D) account (W-41-D) amount (12) balance (12) +DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA +\f[R] .fi .PP and some examples: .IP .nf \f[C] -$\ hledger\ reg\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ use\ terminal\ width\ (or\ 80\ on\ windows) -$\ hledger\ reg\ \-w\ 100\ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ use\ width\ 100 -$\ COLUMNS=100\ hledger\ reg\ \ \ \ \ \ \ \ \ #\ set\ with\ one\-time\ environment\ variable -$\ export\ COLUMNS=100;\ hledger\ reg\ #\ set\ till\ session\ end\ (or\ window\ resize) -$\ hledger\ reg\ \-w\ 100,40\ \ \ \ \ \ \ \ \ \ \ #\ set\ overall\ width\ 100,\ description\ width\ 40 -$\ hledger\ reg\ \-w\ $COLUMNS,40\ \ \ \ \ \ #\ use\ terminal\ width,\ &\ description\ width\ 40 -\f[] +$ hledger reg # use terminal width (or 80 on windows) +$ hledger reg -w 100 # use width 100 +$ COLUMNS=100 hledger reg # set with one-time environment variable +$ export COLUMNS=100; hledger reg # set till session end (or window resize) +$ hledger reg -w 100,40 # set overall width 100, description width 40 +$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 +\f[R] .fi .PP This command also supports output destination and output format selection. -.SS register\-match +.SS register-match .PP -register\-match +register-match .PD 0 .P .PD @@ -2781,7 +3029,7 @@ 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\-autosync detect already\-seen transactions when importing. +Helps ledger-autosync detect already-seen transactions when importing. .SS rewrite .PP rewrite @@ -2790,7 +3038,7 @@ rewrite .PD Print all transactions, rewriting the postings of matched transactions. For now the only rewrite available is adding new postings, like print -\-\-auto. +--auto. .PP This is a start at a generic rewriter of transaction entries. It reads the default journal and prints the transactions, like print, @@ -2803,21 +3051,21 @@ Examples: .IP .nf \f[C] -hledger\-rewrite.hs\ ^income\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\ \ ;\ income\ tax\[aq]\ \-\-add\-posting\ \[aq](reserve:gifts)\ \ $100\[aq] -hledger\-rewrite.hs\ expenses:gifts\ \-\-add\-posting\ \[aq](reserve:gifts)\ \ *\-1"\[aq] -hledger\-rewrite.hs\ \-f\ rewrites.hledger -\f[] +$ hledger-rewrite.hs \[ha]income --add-posting \[aq](liabilities:tax) *.33 ; income tax\[aq] --add-posting \[aq](reserve:gifts) $100\[aq] +$ hledger-rewrite.hs expenses:gifts --add-posting \[aq](reserve:gifts) *-1\[dq]\[aq] +$ hledger-rewrite.hs -f rewrites.hledger +\f[R] .fi .PP rewrites.hledger may consist of entries like: .IP .nf \f[C] -=\ ^income\ amt:<0\ date:2017 -\ \ (liabilities:tax)\ \ *0.33\ \ ;\ tax\ on\ income -\ \ (reserve:grocery)\ \ *0.25\ \ ;\ reserve\ 25%\ for\ grocery -\ \ (reserve:)\ \ *0.25\ \ ;\ reserve\ 25%\ for\ grocery -\f[] += \[ha]income amt:<0 date:2017 + (liabilities:tax) *0.33 ; tax on income + (reserve:grocery) *0.25 ; reserve 25% for grocery + (reserve:) *0.25 ; reserve 25% for grocery +\f[R] .fi .PP Note the single quotes to protect the dollar sign from bash, and the two @@ -2827,72 +3075,72 @@ More: .IP .nf \f[C] -$\ hledger\ rewrite\ \-\-\ [QUERY]\ \ \ \ \ \ \ \ \-\-add\-posting\ "ACCT\ \ AMTEXPR"\ ... -$\ hledger\ rewrite\ \-\-\ ^income\ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq] -$\ hledger\ rewrite\ \-\-\ expenses:gifts\ \-\-add\-posting\ \[aq](budget:gifts)\ \ *\-1"\[aq] -$\ hledger\ rewrite\ \-\-\ ^income\ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq](budget:foreign\ currency)\ \ *0.25\ JPY;\ diversify\[aq] -\f[] +$ hledger rewrite -- [QUERY] --add-posting \[dq]ACCT AMTEXPR\[dq] ... +$ hledger rewrite -- \[ha]income --add-posting \[aq](liabilities:tax) *.33\[aq] +$ hledger rewrite -- expenses:gifts --add-posting \[aq](budget:gifts) *-1\[dq]\[aq] +$ hledger rewrite -- \[ha]income --add-posting \[aq](budget:foreign currency) *0.25 JPY; diversify\[aq] +\f[R] .fi .PP -Argument for \f[C]\-\-add\-posting\f[] option is a usual posting of +Argument for \f[C]--add-posting\f[R] option is a usual posting of transaction with an exception for amount specification. -More precisely, you can use \f[C]\[aq]*\[aq]\f[] (star symbol) before +More precisely, you can use \f[C]\[aq]*\[aq]\f[R] (star symbol) before the amount to indicate that that this is a factor for an amount of original matched posting. If the amount includes a commodity name, the new posting amount will be in the new commodity; otherwise, it will be in the matched posting amount\[aq]s commodity. -.SS Re\-write rules in a file +.SS Re-write rules in a file .PP -During the run this tool will execute so called "Automated Transactions" -found in any journal it process. +During the run this tool will execute so called \[dq]Automated +Transactions\[dq] found in any journal it process. I.e instead of specifying this operations in command line you can put them in a journal file. .IP .nf \f[C] -$\ rewrite\-rules.journal -\f[] +$ rewrite-rules.journal +\f[R] .fi .PP Make contents look like this: .IP .nf \f[C] -=\ ^income -\ \ \ \ (liabilities:tax)\ \ *.33 += \[ha]income + (liabilities:tax) *.33 -=\ expenses:gifts -\ \ \ \ budget:gifts\ \ *\-1 -\ \ \ \ assets:budget\ \ *1 -\f[] += expenses:gifts + budget:gifts *-1 + assets:budget *1 +\f[R] .fi .PP -Note that \f[C]\[aq]=\[aq]\f[] (equality symbol) that is used instead of -date in transactions you usually write. +Note that \f[C]\[aq]=\[aq]\f[R] (equality symbol) that is used instead +of date in transactions you usually write. It indicates the query by which you want to match the posting to add new ones. .IP .nf \f[C] -$\ hledger\ rewrite\ \-\-\ \-f\ input.journal\ \-f\ rewrite\-rules.journal\ >\ rewritten\-tidy\-output.journal -\f[] +$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal +\f[R] .fi .PP This is something similar to the commands pipeline: .IP .nf \f[C] -$\ hledger\ rewrite\ \-\-\ \-f\ input.journal\ \[aq]^income\[aq]\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]\ \\ -\ \ |\ hledger\ rewrite\ \-\-\ \-f\ \-\ expenses:gifts\ \ \ \ \ \ \-\-add\-posting\ \[aq]budget:gifts\ \ *\-1\[aq]\ \ \ \ \ \ \ \\ -\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq]assets:budget\ \ *1\[aq]\ \ \ \ \ \ \ \\ -\ \ >\ rewritten\-tidy\-output.journal -\f[] +$ hledger rewrite -- -f input.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax) *.33\[aq] \[rs] + | hledger rewrite -- -f - expenses:gifts --add-posting \[aq]budget:gifts *-1\[aq] \[rs] + --add-posting \[aq]assets:budget *1\[aq] \[rs] + > rewritten-tidy-output.journal +\f[R] .fi .PP It is important to understand that relative order of such entries in journal is important. -You can re\-use result of previously added postings. +You can re-use result of previously added postings. .SS Diff output format .PP To use this tool for batch modification of your journal files you may @@ -2900,68 +3148,68 @@ find useful output in form of unified diff. .IP .nf \f[C] -$\ hledger\ rewrite\ \-\-\ \-\-diff\ \-f\ examples/sample.journal\ \[aq]^income\[aq]\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq] -\f[] +$ hledger rewrite -- --diff -f examples/sample.journal \[aq]\[ha]income\[aq] --add-posting \[aq](liabilities:tax) *.33\[aq] +\f[R] .fi .PP Output might look like: .IP .nf \f[C] -\-\-\-\ /tmp/examples/sample.journal -+++\ /tmp/examples/sample.journal -\@\@\ \-18,3\ +18,4\ \@\@ -\ 2008/01/01\ income -\-\ \ \ \ assets:bank:checking\ \ $1 -+\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ \ income:salary -+\ \ \ \ (liabilities:tax)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\@\@\ \-22,3\ +23,4\ \@\@ -\ 2008/06/01\ gift -\-\ \ \ \ assets:bank:checking\ \ $1 -+\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1 -\ \ \ \ \ income:gifts -+\ \ \ \ (liabilities:tax)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0 -\f[] +--- /tmp/examples/sample.journal ++++ /tmp/examples/sample.journal +\[at]\[at] -18,3 +18,4 \[at]\[at] + 2008/01/01 income +- assets:bank:checking $1 ++ assets:bank:checking $1 + income:salary ++ (liabilities:tax) 0 +\[at]\[at] -22,3 +23,4 \[at]\[at] + 2008/06/01 gift +- assets:bank:checking $1 ++ assets:bank:checking $1 + income:gifts ++ (liabilities:tax) 0 +\f[R] .fi .PP -If you\[aq]ll pass this through \f[C]patch\f[] tool you\[aq]ll get +If you\[aq]ll pass this through \f[C]patch\f[R] tool you\[aq]ll get transactions containing the posting that matches your query be updated. Note that multiple files might be update according to list of input -files specified via \f[C]\-\-file\f[] options and \f[C]include\f[] +files specified via \f[C]--file\f[R] options and \f[C]include\f[R] directives inside of these files. .PP Be careful. -Whole transaction being re\-formatted in a style of output from -\f[C]hledger\ print\f[]. +Whole transaction being re-formatted in a style of output from +\f[C]hledger print\f[R]. .PP See also: .PP https://github.com/simonmichael/hledger/issues/99 -.SS rewrite vs. print \-\-auto +.SS rewrite vs. print --auto .PP -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: .IP \[bu] 2 with multiple files, rewrite lets rules in any file affect all other files. -print \-\-auto uses standard directive scoping; rules affect only child +print --auto uses standard directive scoping; rules affect only child files. .IP \[bu] 2 rewrite\[aq]s query limits which transactions can be rewritten; all are printed. -print \-\-auto\[aq]s query limits which transactions are printed. +print --auto\[aq]s query limits which transactions are printed. .IP \[bu] 2 rewrite applies rules specified on command line or in the journal. -print \-\-auto applies rules specified in the journal. +print --auto applies rules specified in the journal. .SS roi .PP roi .PD 0 .P .PD -Shows the time\-weighted (TWR) and money\-weighted (IRR) rate of return -on your investments. +Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on +your investments. .PP This command assumes that you have account(s) that hold nothing but your investments and whenever you record current appraisal/valuation of these @@ -2973,12 +3221,11 @@ originating from unrealized profit and loss account(s) are assumed to be your investments or withdrawals. .PP At a minimum, you need to supply a query (which could be just an account -name) to select your investments with \f[C]\-\-inv\f[], and another -query to identify your profit and loss transactions with -\f[C]\-\-pnl\f[]. +name) to select your investments with \f[C]--inv\f[R], and another query +to identify your profit and loss transactions with \f[C]--pnl\f[R]. .PP It will compute and display the internalized rate of return (IRR) and -time\-weighted rate of return (TWR) for your investments for the time +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. @@ -2998,18 +3245,18 @@ Example: .IP .nf \f[C] -$\ hledger\ stats -Main\ journal\ file\ \ \ \ \ \ \ \ :\ /src/hledger/examples/sample.journal -Included\ journal\ files\ \ \ :\ -Transactions\ span\ \ \ \ \ \ \ \ :\ 2008\-01\-01\ to\ 2009\-01\-01\ (366\ days) -Last\ transaction\ \ \ \ \ \ \ \ \ :\ 2008\-12\-31\ (2333\ days\ ago) -Transactions\ \ \ \ \ \ \ \ \ \ \ \ \ :\ 5\ (0.0\ per\ day) -Transactions\ last\ 30\ days:\ 0\ (0.0\ per\ day) -Transactions\ last\ 7\ days\ :\ 0\ (0.0\ per\ day) -Payees/descriptions\ \ \ \ \ \ :\ 5 -Accounts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ 8\ (depth\ 3) -Commodities\ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ 1\ ($) -\f[] +$ hledger stats +Main journal file : /src/hledger/examples/sample.journal +Included journal files : +Transactions span : 2008-01-01 to 2009-01-01 (366 days) +Last transaction : 2008-12-31 (2333 days ago) +Transactions : 5 (0.0 per day) +Transactions last 30 days: 0 (0.0 per day) +Transactions last 7 days : 0 (0.0 per day) +Payees/descriptions : 5 +Accounts : 8 (depth 3) +Commodities : 1 ($) +\f[R] .fi .PP This command also supports output destination and output format @@ -3031,11 +3278,11 @@ test .PD 0 .P .PD -Run built\-in unit tests. +Run built-in unit tests. .PP -This command runs the unit tests built in to hledger\-lib and hledger, +This command runs the unit tests built in to hledger-lib and hledger, printing test names and results on stdout. -If any test fails, the exit code will be non\-zero. +If any test fails, the exit code will be non-zero. .PP Test names include a group prefix. If a (exact, case sensitive) group prefix, or a full test name is @@ -3046,119 +3293,122 @@ seed, for repeatable results from tests using randomness (currently none of them). .PP This is mainly used by developers, but it\[aq]s nice to be able to -sanity\-check your installed hledger executable at any time. -All tests are expected to pass \- if you ever see otherwise, something +sanity-check your installed hledger executable at any time. +All tests are expected to pass - if you ever see otherwise, something has gone wrong, please report a bug! -.SH ADD\-ON COMMANDS +.SH ADD-ON COMMANDS .PP -hledger also searches for external add\-on commands, and will include +hledger also searches for external add-on commands, and will include these in the commands list. These are programs or scripts in your PATH whose name starts with -\f[C]hledger\-\f[] and ends with a recognised file extension (currently: -no extension, \f[C]bat\f[],\f[C]com\f[],\f[C]exe\f[], -\f[C]hs\f[],\f[C]lhs\f[],\f[C]pl\f[],\f[C]py\f[],\f[C]rb\f[],\f[C]rkt\f[],\f[C]sh\f[]). +\f[C]hledger-\f[R] and ends with a recognised file extension (currently: +no extension, \f[C]bat\f[R],\f[C]com\f[R],\f[C]exe\f[R], +\f[C]hs\f[R],\f[C]lhs\f[R],\f[C]pl\f[R],\f[C]py\f[R],\f[C]rb\f[R],\f[C]rkt\f[R],\f[C]sh\f[R]). .PP -Add\-ons can be invoked like any hledger command, but there are a few +Add-ons can be invoked like any hledger command, but there are a few things to be aware of. -Eg if the \f[C]hledger\-web\f[] add\-on is installed, +Eg if the \f[C]hledger-web\f[R] add-on is installed, .IP \[bu] 2 -\f[C]hledger\ \-h\ web\f[] shows hledger\[aq]s help, while -\f[C]hledger\ web\ \-h\f[] shows hledger\-web\[aq]s help. +\f[C]hledger -h web\f[R] shows hledger\[aq]s help, while +\f[C]hledger web -h\f[R] shows hledger-web\[aq]s help. .IP \[bu] 2 -Flags specific to the add\-on must have a preceding \f[C]\-\-\f[] to -hide them from hledger. -So \f[C]hledger\ web\ \-\-serve\ \-\-port\ 9000\f[] will be rejected; -you must use \f[C]hledger\ web\ \-\-\ \-\-serve\ \-\-port\ 9000\f[]. +Flags specific to the add-on must have a preceding \f[C]--\f[R] to hide +them from hledger. +So \f[C]hledger web --serve --port 9000\f[R] will be rejected; you must +use \f[C]hledger web -- --serve --port 9000\f[R]. .IP \[bu] 2 -You can always run add\-ons directly if preferred: -\f[C]hledger\-web\ \-\-serve\ \-\-port\ 9000\f[]. +You can always run add-ons directly if preferred: +\f[C]hledger-web --serve --port 9000\f[R]. .PP -Add\-ons are a relatively easy way to add local features or experiment +Add-ons are a relatively easy way to add local features or experiment with new ideas. They can be written in any language, but haskell scripts have a big advantage: they can use the same hledger (and haskell) library functions -that built\-in commands do, for command\-line options, journal parsing, +that built-in commands do, for command-line options, journal parsing, reporting, etc. .PP -Here are some hledger add\-ons available: -.SS Official add\-ons +Here are some hledger add-ons available: +.SS Official add-ons .PP These are maintained and released along with hledger. .SS api .PP -hledger\-api serves hledger data as a JSON web API. +hledger-api serves hledger data as a JSON web API. .SS ui .PP -hledger\-ui provides an efficient curses\-style interface. +hledger-ui provides an efficient curses-style interface. .SS web .PP -hledger\-web provides a simple web interface. -.SS Third party add\-ons +hledger-web provides a simple web interface. +.SS Third party add-ons .PP These are maintained separately, and usually updated shortly after a hledger release. .SS diff .PP -hledger\-diff shows differences in an account\[aq]s transactions between +hledger-diff shows differences in an account\[aq]s transactions between one journal file and another. .SS iadd .PP -hledger\-iadd is a curses\-style, more interactive replacement for the -add command. +hledger-iadd is a curses-style, more interactive replacement for the add +command. .SS interest .PP -hledger\-interest generates interest transactions for an account +hledger-interest generates interest transactions for an account according to various schemes. .SS irr .PP -hledger\-irr calculates the internal rate of return of an investment -account, but it\[aq]s superseded now by the built\-in roi command. -.SS Experimental add\-ons +hledger-irr calculates the internal rate of return of an investment +account, but it\[aq]s superseded now by the built-in roi command. +.SS Experimental add-ons .PP These are available in source form in the hledger repo\[aq]s bin/ directory; installing them is pretty easy. -They may be less mature and documented than built\-in commands. +They may be less mature and documented than built-in commands. Reading and tweaking these is a good way to start making your own! .SS autosync .PP -hledger\-autosync is a symbolic link for easily running -ledger\-autosync, if installed. -ledger\-autosync does deduplicating conversion of OFX data and some CSV +hledger-autosync is a symbolic link for easily running ledger-autosync, +if installed. +ledger-autosync does deduplicating conversion of OFX data and some CSV formats, and can also download the data if your bank offers OFX Direct Connect. .SS chart .PP -hledger\-chart.hs is an old pie chart generator, in need of some love. +hledger-chart.hs is an old pie chart generator, in need of some love. .SS check .PP -hledger\-check.hs checks more powerful account balance assertions. +hledger-check.hs checks more powerful account balance assertions. .SH ENVIRONMENT .PP -\f[B]COLUMNS\f[] The screen width used by the register command. +\f[B]COLUMNS\f[R] The screen width used by the register command. Default: the full terminal width. .PP -\f[B]LEDGER_FILE\f[] The journal file path when not specified with -\f[C]\-f\f[]. -Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps -\f[C]C:/Users/USER/.hledger.journal\f[]). +\f[B]LEDGER_FILE\f[R] The journal file path when not specified with +\f[C]-f\f[R]. +Default: \f[C]\[ti]/.hledger.journal\f[R] (on windows, perhaps +\f[C]C:/Users/USER/.hledger.journal\f[R]). .SH FILES .PP Reads data from one or more files in hledger journal, timeclock, -timedot, or CSV format specified with \f[C]\-f\f[], or -\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows, -perhaps \f[C]C:/Users/USER/.hledger.journal\f[]). -.SH BUGS +timedot, or CSV format specified with \f[C]-f\f[R], or +\f[C]$LEDGER_FILE\f[R], or \f[C]$HOME/.hledger.journal\f[R] (on windows, +perhaps \f[C]C:/Users/USER/.hledger.journal\f[R]). +.SH LIMITATIONS .PP -The need to precede addon command options with \f[C]\-\-\f[] when -invoked from hledger is awkward. +The need to precede addon command options with \f[C]--\f[R] when invoked +from hledger is awkward. .PP -When input data contains non\-ascii characters, a suitable system locale +When input data contains non-ascii characters, a suitable system locale must be configured (or there will be an unhelpful error). Eg on POSIX, set LANG to something other than C. .PP -In a Microsoft Windows CMD window, non\-ascii characters and colours are +In a Microsoft Windows CMD window, non-ascii characters and colours are not supported. .PP +On Windows, non-ascii characters may not display correctly when running +a hledger built in CMD in MSYS/CYGWIN, or vice-versa. +.PP In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger add. .PP @@ -3172,37 +3422,37 @@ Here are some issues you might encounter when you run hledger (and remember you can also seek help from the IRC channel, mail list or bug tracker): .PP -\f[B]Successfully installed, but "No command \[aq]hledger\[aq] -found"\f[] +\f[B]Successfully installed, but \[dq]No command \[aq]hledger\[aq] +found\[dq]\f[R] .PD 0 .P .PD stack and cabal install binaries into a special directory, which should be added to your PATH environment variable. -Eg on unix\-like systems, that is ~/.local/bin and ~/.cabal/bin +Eg on unix-like systems, that is \[ti]/.local/bin and \[ti]/.cabal/bin respectively. .PP \f[B]I set a custom LEDGER_FILE, but hledger is still using the default -file\f[] +file\f[R] .PD 0 .P .PD -\f[C]LEDGER_FILE\f[] should be a real environment variable, not just a +\f[C]LEDGER_FILE\f[R] should be a real environment variable, not just a shell variable. -The command \f[C]env\ |\ grep\ LEDGER_FILE\f[] should show it. -You may need to use \f[C]export\f[]. +The command \f[C]env | grep LEDGER_FILE\f[R] should show it. +You may need to use \f[C]export\f[R]. Here\[aq]s an explanation. .PP -\f[B]"Illegal byte sequence" or "Invalid or incomplete multibyte or wide -character" errors\f[] +\f[B]\[dq]Illegal byte sequence\[dq] or \[dq]Invalid or incomplete +multibyte or wide character\[dq] errors\f[R] .PD 0 .P .PD -In order to handle non\-ascii letters and symbols (like £), hledger +In order to handle non-ascii letters and symbols (like \[Po]), hledger needs an appropriate locale. -This is usually configured system\-wide; you can also configure it +This is usually configured system-wide; you can also configure it temporarily. -The locale may need to be one that supports UTF\-8, if you built hledger +The locale may need to be one that supports UTF-8, if you built hledger with GHC < 7.2 (or possibly always, I\[aq]m not sure yet). .PP Here\[aq]s an example of setting the locale temporarily, on ubuntu @@ -3210,14 +3460,14 @@ gnu/linux: .IP .nf \f[C] -$\ file\ my.journal -my.journal:\ UTF\-8\ Unicode\ text\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ <\-\ the\ file\ is\ UTF8\-encoded -$\ locale\ \-a +$ file my.journal +my.journal: UTF-8 Unicode text # <- the file is UTF8-encoded +$ locale -a C -en_US.utf8\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ <\-\ a\ UTF8\-aware\ locale\ is\ available +en_US.utf8 # <- a UTF8-aware locale is available POSIX -$\ LANG=en_US.utf8\ hledger\ \-f\ my.journal\ print\ \ \ #\ <\-\ use\ it\ for\ this\ command -\f[] +$ LANG=en_US.utf8 hledger -f my.journal print # <- use it for this command +\f[R] .fi .PP Here\[aq]s one way to set it permanently, there are probably better @@ -3225,18 +3475,18 @@ ways: .IP .nf \f[C] -$\ echo\ "export\ LANG=en_US.UTF\-8"\ >>~/.bash_profile -$\ bash\ \-\-login -\f[] +$ echo \[dq]export LANG=en_US.UTF-8\[dq] >>\[ti]/.bash_profile +$ bash --login +\f[R] .fi .PP -If we preferred to use eg \f[C]fr_FR.utf8\f[], we might have to install +If we preferred to use eg \f[C]fr_FR.utf8\f[R], we might have to install that first: .IP .nf \f[C] -$\ apt\-get\ install\ language\-pack\-fr -$\ locale\ \-a +$ apt-get install language-pack-fr +$ locale -a C en_US.utf8 fr_BE.utf8 @@ -3245,13 +3495,13 @@ fr_CH.utf8 fr_FR.utf8 fr_LU.utf8 POSIX -$\ LANG=fr_FR.utf8\ hledger\ \-f\ my.journal\ print -\f[] +$ LANG=fr_FR.utf8 hledger -f my.journal print +\f[R] .fi .PP Note some platforms allow variant locale spellings, but not all (ubuntu -accepts \f[C]fr_FR.UTF8\f[], mac osx requires exactly -\f[C]fr_FR.UTF\-8\f[]). +accepts \f[C]fr_FR.UTF8\f[R], mac osx requires exactly +\f[C]fr_FR.UTF-8\f[R]). .SH "REPORTING BUGS" diff --git a/hledger/hledger.info b/hledger/hledger.info index 696121c2b..65a770cf3 100644 --- a/hledger/hledger.info +++ b/hledger/hledger.info @@ -3,8 +3,8 @@ This is hledger.info, produced by makeinfo version 6.5 from stdin.  File: hledger.info, Node: Top, Next: EXAMPLES, Up: (dir) -hledger(1) hledger 1.14.1 -************************* +hledger(1) hledger 1.14.99 +************************** This is hledger's command-line interface (there are also curses and web interfaces). Its basic function is to read a plain text file describing @@ -40,6 +40,7 @@ hledger never changes existing transactions. '~/.hledger.journal', or run 'hledger add' and follow the prompts. Then try some commands like 'hledger print' or 'hledger balance'. Run 'hledger' with no arguments for a list of commands. + * Menu: * EXAMPLES:: @@ -131,7 +132,7 @@ File: hledger.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top * Pivoting:: * Cost:: * Market value:: -* Combining -B and -V:: +* Combining -B -V --value:: * Output destination:: * Output format:: * Regular expressions:: @@ -303,6 +304,7 @@ characters. Eg: 'hledger register -p 'last year' "accounts receivable (receivable|payable)" amt:\>100'. + * Menu: * More escaping:: @@ -393,24 +395,38 @@ File: hledger.info, Node: Unicode characters, Next: Input files, Prev: Comman 2.7 Unicode characters ====================== -hledger is expected to handle unicode (non-ascii) characters, but this -requires a well-configured environment. +hledger is expected to handle non-ascii characters correctly: - To handle unicode characters in the command line or input data, a -system locale that can decode them must be configured (POSIX's default -'C' locale will not work). Eg in bash, you could do: + * they should be parsed correctly in input files and on the command + line, by all hledger tools (add, iadd, hledger-web's + search/add/edit forms, etc.) -export LANG=en_US.UTF-8 + * they should be displayed correctly by all hledger tools, and + on-screen alignment should be preserved. - See Troubleshooting for more about this. + This requires a well-configured environment. Here are some tips: - Unicode characters should appear correctly in hledger's output. For -the hledger and hledger-ui tools, this requires that + * A system locale must be configured, and it must be one that can + decode the characters being used. In bash, you can set a locale + like this: 'export LANG=en_US.UTF-8'. There are some more details + in Troubleshooting. This step is essential - without it, hledger + will quit on encountering a non-ascii character (as with all + GHC-compiled programs). - * your terminal supports unicode - * the terminal's font includes the required unicode glyphs - * the terminal is configured to display "wide" characters as double - width (otherwise report alignment will be off) + * your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) + must support unicode + + * the terminal must be using a font which includes the required + unicode glyphs + + * the terminal should be configured to display wide characters as + double width (for report alignment) + + * on Windows, for best results you should run hledger in the same + kind of environment in which it was built. Eg hledger built in the + standard CMD.EXE environment (like the binaries on our download + page) might show display problems when run in a cygwin or msys + terminal, and vice versa. (See eg #961).  File: hledger.info, Node: Input files, Next: Smart dates, Prev: Unicode characters, Up: OPTIONS @@ -729,22 +745,15 @@ The '-B/--cost' flag converts amounts to their cost at transaction time, if they have a transaction price specified.  -File: hledger.info, Node: Market value, Next: Combining -B and -V, Prev: Cost, Up: OPTIONS +File: hledger.info, Node: Market value, Next: Combining -B -V --value, Prev: Cost, Up: OPTIONS 2.16 Market value ================= -The '-V/--value' flag converts reported amounts to their current market -value. -Specifically, when there is a market price (P directive) for the -amount's commodity, dated on or before today's date (or the report end -date if specified), the amount will be converted to the price's -commodity. - - When there are multiple applicable P directives, -V chooses the most -recent one, or in case of equal dates, the last-parsed one. - - For example: +The '-V/--market' flag converts reported amounts to their market value +in another commodity. It uses the commodity referenced in the latest +market price (P directive) dated on or before the valuation date. The +default valuation date is today. For example: # one euro is worth this many dollars from nov 1 P 2016/11/01 € $1.10 @@ -773,25 +782,211 @@ specified, defaults to today) $ hledger -f t.j bal -N euros -V $103.00 assets:euros - Currently, hledger's -V only uses market prices recorded with P -directives, not transaction prices (unlike Ledger). + Ledger users: Ledger's -V also infers market prices from journal +entries, but we don't do that. hledger's -V uses only market prices +declared explicitly, with P directives. (Mnemonic: -B/-cost uses +transaction prices, -V/-market uses market prices.) - Currently, -V has a limitation in multicolumn balance reports: it -uses the market prices on the report end date for all columns. (Instead -of the prices on each column's end date.) +* Menu: + +* More control over valuation:: +* Effect of --value on reports:: +* Some useful value reports::  -File: hledger.info, Node: Combining -B and -V, Next: Output destination, Prev: Market value, Up: OPTIONS +File: hledger.info, Node: More control over valuation, Next: Effect of --value on reports, Up: Market value -2.17 Combining -B and -V -======================== +2.16.1 More control over valuation +---------------------------------- -Using -B/-cost and -V/-value together is currently allowed, but the -results are probably not meaningful. Let us know if you find a use for -this. +_(experimental, added 201905)_ + + You can control valuation more precisely with the '--value' option. + + --value=TYPE which type of valuation should be done ? cost|end|now|YYYY-MM-DD + + The argument is one of the keywords shown, or their first letter, or +a custom date. The precise effect of the keywords is command-specific, +but here is their general meaning: + +'--value=cost' (or 'c') + + Convert amounts to cost, using the prices recorded in transactions. + '-B'/'--cost' does this. +'--value=end' (or 'e') + + Convert amounts to their value in default valuation commodity using + market prices on the last day of the report period (or of each + subperiod in a multiperiod report). When no report period is + specified, uses the journal's last transaction date. +'--value=now' (or 'n') + + Convert amounts to their value in default valuation commodity using + current market prices (as of when report is generated). + '-V'/'--market' does this. +'--value=YYYY-MM-DD' + + Convert amounts to their value in default valuation commodity using + market prices on the given date (which must be 8 digits with '-' or + '/' or '.' separators). Eg '--value=2019-04-25'. + + Here are the effects of '--value' as seen with 'print': + +P 2000-01-01 A 1 B +P 2000-02-01 A 2 B +P 2000-03-01 A 3 B +P 2000-04-01 A 4 B + +2000-01-01 + (a) 1 A @ 5 B + +2000-02-01 + (a) 1 A @ 6 B + +2000-03-01 + (a) 1 A @ 7 B + + Show the cost of each posting: + +$ hledger -f- print --value=cost +2000/01/01 + (a) 5 B + +2000/02/01 + (a) 6 B + +2000/03/01 + (a) 7 B + + Show the value as of the last day of the report period (2000-02-29): + +$ hledger -f- print --value=end date:2000/01-2000/03 +2000-01-01 + (a) 2 B + +2000-02-01 + (a) 2 B + + With no report period specified, that shows the value as of the last +day of the journal (2000-03-01): + +$ hledger -f- print --value=end +2000/01/01 + (a) 3 B + +2000/02/01 + (a) 3 B + +2000/03/01 + (a) 3 B + + Show the current value (the 2000-04-01 price is still in effect +today): + +$ hledger -f- print --value=now +2000-01-01 + (a) 4 B + +2000-02-01 + (a) 4 B + +2000-03-01 + (a) 4 B + + Show the value on 2000/01/15: + +$ hledger -f- print --value=2000-01-15 +2000/01/01 + (a) 1 B + +2000/02/01 + (a) 1 B + +2000/03/01 + (a) 1 B  -File: hledger.info, Node: Output destination, Next: Output format, Prev: Combining -B and -V, Up: OPTIONS +File: hledger.info, Node: Effect of --value on reports, Next: Some useful value reports, Prev: More control over valuation, Up: Market value + +2.16.2 Effect of -value on reports +---------------------------------- + +Below is how '--value' affects each of hledger's reports, currently. +You're not expected to remember all this, but when troubleshooting a +report, look here. If you find problems - useless reports, misbehaving +reports, or error messages being printed - please report them (with +reproducible examples) eg at #329. + +Report type '--value' '--value' 'end' '--value' + 'cost' 'DATE'/'now' +---------------------------------------------------------------------------- +*print* +posting cost, as market value at report market value at +amounts recorded in end DATE + transaction +balance show show unvalued show unvalued +assertions/assignmentsunvalued +*register* +starting cost of market value at day market value at +balance starting before report start DATE +with -H balance +posting cost market value at report market value at +amounts end DATE +posting summarised market value each market value each +amounts, cost summary posting at summary posting +multiperiod period end at DATE +running sum/average sum/average of the sum/average of +total/average of the displayed values the displayed + displayed values + values +*balance +(bs, cf, +is..)* +starting costs of market value at day market value at +balances starting before report start of DATE of sum of +with -H balances sum of previous postings previous postings +balances, summed costs market value at period market value at +simple end of sum of postings DATE of sum of +balance postings +report +balances, summed costs market value at period market value at +multiperiod end of sum of postings DATE of sum of +report postings +budget costs of budget-setting periodic budget-setting +amounts budget txns are valued at periodic txns are +with amounts period end valued at DATE +-budget +column/row/grandsum/average market value at period market value at +totals/averagesof the end of sum/average of DATE of + displayed postings sum/average of + values postings + + +File: hledger.info, Node: Some useful value reports, Prev: Effect of --value on reports, Up: Market value + +2.16.3 Some useful value reports +-------------------------------- + +Here are some probably useful reports - please send suggestions if you +find out more: + +Command: Description of report: Could answer: +--------------------------------------------------------------------------- +'hledger bs -M Monthly historical value How are my investments +--value=p' of assets/liabilities performing ? +'hledger is -M Monthly contemporaneous How much foreign currency +--value=t' value of revenues/expenses have I been spending ? + + +File: hledger.info, Node: Combining -B -V --value, Next: Output destination, Prev: Market value, Up: OPTIONS + +2.17 Combining -B, -V, -value +============================= + +The rightmost of these flags wins. + + +File: hledger.info, Node: Output destination, Next: Output format, Prev: Combining -B -V --value, Up: OPTIONS 2.18 Output destination ======================= @@ -987,6 +1182,7 @@ unambiguous prefix of a command name ('hledger inc'). Here are all the builtin commands in alphabetical order. See also 'hledger' for a more organised command list, and 'hledger CMD -h' for detailed command help. + * Menu: * accounts:: @@ -1162,6 +1358,7 @@ show real-world account balances. In some cases the -H/-historical flag is used to ensure this (more below). The balance command can produce several styles of report: + * Menu: * Classic balance report:: @@ -1250,7 +1447,9 @@ with data fields interpolated like so: '%[MIN][.MAX](FIELDNAME)' * MIN pads with spaces to at least this width (optional) + * MAX truncates at this width (optional) + * FIELDNAME must be enclosed in parentheses, and can be one of: * 'depth_spacer' - a number of spaces equal to the account's @@ -1390,6 +1589,10 @@ different information: ----------------------++------------------------------------- || 0 0 0 + Note that '--cumulative' or '--historical/-H' disable +'--row-total/-T', since summing end balances generally does not make +sense. + Multicolumn balance reports display accounts in flat mode by default; to see the hierarchy, use '--tree'. @@ -1557,6 +1760,7 @@ Budget performance in 2017/11/01-2017/12/31: || 0 [ 0] 0 [ 0] For more examples, see Budgeting and Forecasting. + * Menu: * Nested budgets:: @@ -1696,7 +1900,9 @@ Total: each report period. As with multicolumn balance reports, you can alter the report mode with '--change'/'--cumulative'/'--historical'. Normally balancesheet shows historical ending balances, which is what you need -for a balance sheet; note this means it ignores report begin dates. +for a balance sheet; note this means it ignores report begin dates (and +'-T/--row-total', since summing end balances generally does not make +sense). This command also supports output destination and output format selection. @@ -1815,7 +2021,7 @@ end of a period. The closing transaction transfers balances to "equity:closing balances". The opening transaction transfers balances from -"equity:opening balances". You can chose to print just one of the +"equity:opening balances". You can choose to print just one of the transactions by using the '--opening' or '--closing' flag. If you split your journal files by time (eg yearly), you will @@ -1959,6 +2165,29 @@ see only uncategorised transactions: $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions +* Menu: + +* Importing balance assignments:: + + +File: hledger.info, Node: Importing balance assignments, Up: import + +4.13.1 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 +balance assignments (eg from an institution that provides only balances +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, +please test it and send a pull request.) +  File: hledger.info, Node: incomestatement, Next: prices, Prev: import, Up: COMMANDS @@ -2225,6 +2454,7 @@ $ hledger register --monthly assets --depth 1h these will be adjusted outward if necessary to contain a whole number of intervals. This ensures that the first and last intervals are full length and comparable to the others in the report. + * Menu: * Custom register output:: @@ -2292,9 +2522,9 @@ transaction's first posting amount. Examples: -hledger-rewrite.hs ^income --add-posting '(liabilities:tax) *.33 ; income tax' --add-posting '(reserve:gifts) $100' -hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts) *-1"' -hledger-rewrite.hs -f rewrites.hledger +$ hledger-rewrite.hs ^income --add-posting '(liabilities:tax) *.33 ; income tax' --add-posting '(reserve:gifts) $100' +$ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts) *-1"' +$ hledger-rewrite.hs -f rewrites.hledger rewrites.hledger may consist of entries like: @@ -2557,6 +2787,7 @@ haskell) library functions that built-in commands do, for command-line options, journal parsing, reporting, etc. Here are some hledger add-ons available: + * Menu: * Official add-ons:: @@ -2570,6 +2801,7 @@ File: hledger.info, Node: Official add-ons, Next: Third party add-ons, Up: AD ==================== These are maintained and released along with hledger. + * Menu: * api:: @@ -2608,6 +2840,7 @@ File: hledger.info, Node: Third party add-ons, Next: Experimental add-ons, Pr These are maintained separately, and usually updated shortly after a hledger release. + * Menu: * diff:: @@ -2661,6 +2894,7 @@ These are available in source form in the hledger repo's bin/ directory; installing them is pretty easy. They may be less mature and documented than built-in commands. Reading and tweaking these is a good way to start making your own! + * Menu: * autosync:: @@ -2697,160 +2931,168 @@ hledger-check.hs checks more powerful account balance assertions.  Tag Table: Node: Top68 -Node: EXAMPLES1888 -Ref: #examples1988 -Node: OPTIONS3634 -Ref: #options3736 -Node: General options4171 -Ref: #general-options4296 -Node: Command options6978 -Ref: #command-options7129 -Node: Command arguments7527 -Ref: #command-arguments7681 -Node: Argument files7802 -Ref: #argument-files7978 -Node: Special characters in arguments and queries8244 -Ref: #special-characters-in-arguments-and-queries8478 -Node: More escaping8928 -Ref: #more-escaping9090 -Node: Even more escaping9386 -Ref: #even-more-escaping9580 -Node: Less escaping10251 -Ref: #less-escaping10413 -Node: Command line tips10658 -Ref: #command-line-tips10844 -Node: Unicode characters11221 -Ref: #unicode-characters11377 -Node: Input files12102 -Ref: #input-files12238 -Node: Smart dates14208 -Ref: #smart-dates14349 -Node: Report start & end date15755 -Ref: #report-start-end-date15927 -Node: Report intervals16993 -Ref: #report-intervals17158 -Node: Period expressions17559 -Ref: #period-expressions17719 -Node: Depth limiting21676 -Ref: #depth-limiting21820 -Node: Pivoting22162 -Ref: #pivoting22280 -Node: Cost23956 -Ref: #cost24064 -Node: Market value24182 -Ref: #market-value24317 -Node: Combining -B and -V25683 -Ref: #combining--b-and--v25846 -Node: Output destination25993 -Ref: #output-destination26155 -Node: Output format26438 -Ref: #output-format26590 -Node: Regular expressions26975 -Ref: #regular-expressions27112 -Node: QUERIES28473 -Ref: #queries28575 -Node: COMMANDS32537 -Ref: #commands32649 -Node: accounts33649 -Ref: #accounts33747 -Node: activity34446 -Ref: #activity34556 -Node: add34939 -Ref: #add35038 -Node: balance37625 -Ref: #balance37736 -Node: Classic balance report39177 -Ref: #classic-balance-report39350 -Node: Customising the classic balance report40719 -Ref: #customising-the-classic-balance-report40947 -Node: Colour support43021 -Ref: #colour-support43188 -Node: Flat mode43361 -Ref: #flat-mode43509 -Node: Depth limited balance reports43922 -Ref: #depth-limited-balance-reports44122 -Node: Multicolumn balance report44578 -Ref: #multicolumn-balance-report44776 -Node: Budget report49956 -Ref: #budget-report50099 -Node: Nested budgets55300 -Ref: #nested-budgets55412 -Ref: #output-format-158892 -Node: balancesheet58970 -Ref: #balancesheet59106 -Node: balancesheetequity60340 -Ref: #balancesheetequity60489 -Node: cashflow61050 -Ref: #cashflow61178 -Node: check-dates62206 -Ref: #check-dates62333 -Node: check-dupes62612 -Ref: #check-dupes62736 -Node: close63029 -Ref: #close63137 -Node: files66550 -Ref: #files66651 -Node: help66798 -Ref: #help66898 -Node: import67991 -Ref: #import68105 -Node: incomestatement68849 -Ref: #incomestatement68983 -Node: prices70319 -Ref: #prices70434 -Node: print70713 -Ref: #print70823 -Node: print-unique75316 -Ref: #print-unique75442 -Node: register75727 -Ref: #register75854 -Node: Custom register output80025 -Ref: #custom-register-output80154 -Node: register-match81416 -Ref: #register-match81550 -Node: rewrite81901 -Ref: #rewrite82016 -Node: Re-write rules in a file83865 -Ref: #re-write-rules-in-a-file83999 -Node: Diff output format85209 -Ref: #diff-output-format85378 -Node: rewrite vs print --auto86470 -Ref: #rewrite-vs.-print---auto86649 -Node: roi87205 -Ref: #roi87303 -Node: stats88315 -Ref: #stats88414 -Node: tags89168 -Ref: #tags89266 -Node: test89496 -Ref: #test89580 -Node: ADD-ON COMMANDS90341 -Ref: #add-on-commands90451 -Node: Official add-ons91738 -Ref: #official-add-ons91878 -Node: api91965 -Ref: #api92054 -Node: ui92106 -Ref: #ui92205 -Node: web92263 -Ref: #web92352 -Node: Third party add-ons92398 -Ref: #third-party-add-ons92573 -Node: diff92708 -Ref: #diff92805 -Node: iadd92904 -Ref: #iadd93018 -Node: interest93101 -Ref: #interest93222 -Node: irr93317 -Ref: #irr93415 -Node: Experimental add-ons93546 -Ref: #experimental-add-ons93698 -Node: autosync93978 -Ref: #autosync94089 -Node: chart94328 -Ref: #chart94447 -Node: check94518 -Ref: #check94620 +Node: EXAMPLES1891 +Ref: #examples1991 +Node: OPTIONS3637 +Ref: #options3739 +Node: General options4178 +Ref: #general-options4303 +Node: Command options6985 +Ref: #command-options7136 +Node: Command arguments7534 +Ref: #command-arguments7688 +Node: Argument files7809 +Ref: #argument-files7985 +Node: Special characters in arguments and queries8251 +Ref: #special-characters-in-arguments-and-queries8485 +Node: More escaping8936 +Ref: #more-escaping9098 +Node: Even more escaping9394 +Ref: #even-more-escaping9588 +Node: Less escaping10259 +Ref: #less-escaping10421 +Node: Command line tips10666 +Ref: #command-line-tips10852 +Node: Unicode characters11229 +Ref: #unicode-characters11385 +Node: Input files12797 +Ref: #input-files12933 +Node: Smart dates14903 +Ref: #smart-dates15044 +Node: Report start & end date16450 +Ref: #report-start-end-date16622 +Node: Report intervals17688 +Ref: #report-intervals17853 +Node: Period expressions18254 +Ref: #period-expressions18414 +Node: Depth limiting22371 +Ref: #depth-limiting22515 +Node: Pivoting22857 +Ref: #pivoting22975 +Node: Cost24651 +Ref: #cost24759 +Node: Market value24877 +Ref: #market-value25016 +Node: More control over valuation26257 +Ref: #more-control-over-valuation26442 +Node: Effect of --value on reports28897 +Ref: #effect-of---value-on-reports29116 +Node: Some useful value reports31807 +Ref: #some-useful-value-reports31986 +Node: Combining -B -V --value32484 +Ref: #combining--b--v---value32661 +Node: Output destination32697 +Ref: #output-destination32863 +Node: Output format33146 +Ref: #output-format33298 +Node: Regular expressions33683 +Ref: #regular-expressions33820 +Node: QUERIES35181 +Ref: #queries35283 +Node: COMMANDS39245 +Ref: #commands39357 +Node: accounts40358 +Ref: #accounts40456 +Node: activity41155 +Ref: #activity41265 +Node: add41648 +Ref: #add41747 +Node: balance44334 +Ref: #balance44445 +Node: Classic balance report45887 +Ref: #classic-balance-report46060 +Node: Customising the classic balance report47429 +Ref: #customising-the-classic-balance-report47657 +Node: Colour support49733 +Ref: #colour-support49900 +Node: Flat mode50073 +Ref: #flat-mode50221 +Node: Depth limited balance reports50634 +Ref: #depth-limited-balance-reports50834 +Node: Multicolumn balance report51290 +Ref: #multicolumn-balance-report51488 +Node: Budget report56802 +Ref: #budget-report56945 +Node: Nested budgets62147 +Ref: #nested-budgets62259 +Ref: #output-format-165739 +Node: balancesheet65817 +Ref: #balancesheet65953 +Node: balancesheetequity67268 +Ref: #balancesheetequity67417 +Node: cashflow67978 +Ref: #cashflow68106 +Node: check-dates69134 +Ref: #check-dates69261 +Node: check-dupes69540 +Ref: #check-dupes69664 +Node: close69957 +Ref: #close70065 +Node: files73479 +Ref: #files73580 +Node: help73727 +Ref: #help73827 +Node: import74920 +Ref: #import75034 +Node: Importing balance assignments75822 +Ref: #importing-balance-assignments75970 +Node: incomestatement76619 +Ref: #incomestatement76753 +Node: prices78089 +Ref: #prices78204 +Node: print78483 +Ref: #print78593 +Node: print-unique83086 +Ref: #print-unique83212 +Node: register83497 +Ref: #register83624 +Node: Custom register output87796 +Ref: #custom-register-output87925 +Node: register-match89187 +Ref: #register-match89321 +Node: rewrite89672 +Ref: #rewrite89787 +Node: Re-write rules in a file91642 +Ref: #re-write-rules-in-a-file91776 +Node: Diff output format92986 +Ref: #diff-output-format93155 +Node: rewrite vs print --auto94247 +Ref: #rewrite-vs.-print---auto94426 +Node: roi94982 +Ref: #roi95080 +Node: stats96092 +Ref: #stats96191 +Node: tags96945 +Ref: #tags97043 +Node: test97273 +Ref: #test97357 +Node: ADD-ON COMMANDS98118 +Ref: #add-on-commands98228 +Node: Official add-ons99516 +Ref: #official-add-ons99656 +Node: api99744 +Ref: #api99833 +Node: ui99885 +Ref: #ui99984 +Node: web100042 +Ref: #web100131 +Node: Third party add-ons100177 +Ref: #third-party-add-ons100352 +Node: diff100488 +Ref: #diff100585 +Node: iadd100684 +Ref: #iadd100798 +Node: interest100881 +Ref: #interest101002 +Node: irr101097 +Ref: #irr101195 +Node: Experimental add-ons101326 +Ref: #experimental-add-ons101478 +Node: autosync101759 +Ref: #autosync101870 +Node: chart102109 +Ref: #chart102228 +Node: check102299 +Ref: #check102401  End Tag Table diff --git a/hledger/hledger.txt b/hledger/hledger.txt index 0d0de872b..6f3dbda59 100644 --- a/hledger/hledger.txt +++ b/hledger/hledger.txt @@ -244,7 +244,7 @@ OPTIONS shell such as <, >, (, ), | and $, should be escaped by enclosing them in quotes or by writing backslashes before the characters. Eg: - hledger register -p 'last year' "accounts receivable (receiv- + hledger register -p 'last year' "accounts receivable (receiv- able|payable)" amt:\>100. More escaping @@ -310,26 +310,38 @@ OPTIONS to troubleshoot. Unicode characters - hledger is expected to handle unicode (non-ascii) characters, but this - requires a well-configured environment. + hledger is expected to handle non-ascii characters correctly: - To handle unicode characters in the command line or input data, a sys- - tem locale that can decode them must be configured (POSIX's default C - locale will not work). Eg in bash, you could do: + o they should be parsed correctly in input files and on the command + line, by all hledger tools (add, iadd, hledger-web's search/add/edit + forms, etc.) - export LANG=en_US.UTF-8 + o they should be displayed correctly by all hledger tools, and on- + screen alignment should be preserved. - See Troubleshooting for more about this. + This requires a well-configured environment. Here are some tips: - Unicode characters should appear correctly in hledger's output. For - the hledger and hledger-ui tools, this requires that + o A system locale must be configured, and it must be one that can + decode the characters being used. In bash, you can set a locale like + this: export LANG=en_US.UTF-8. There are some more details in Trou- + bleshooting. This step is essential - without it, hledger will quit + on encountering a non-ascii character (as with all GHC-compiled pro- + grams). - o your terminal supports unicode + o your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) + must support unicode - o the terminal's font includes the required unicode glyphs + o the terminal must be using a font which includes the required unicode + glyphs - o the terminal is configured to display "wide" characters as double - width (otherwise report alignment will be off) + o the terminal should be configured to display wide characters as dou- + ble width (for report alignment) + + o on Windows, for best results you should run hledger in the same kind + of environment in which it was built. Eg hledger built in the stan- + dard CMD.EXE environment (like the binaries on our download page) + might show display problems when run in a cygwin or msys terminal, + and vice versa. (See eg #961). Input files hledger reads transactions from a data file (and the add command writes @@ -392,53 +404,53 @@ OPTIONS Examples: - 2004/10/1, 2004-01-01, exact date, several sepa- - 2004.9.1 rators allowed. Year is - 4+ digits, month is 1-12, - day is 1-31 - 2004 start of year + 2004/10/1, 2004-01-01, exact date, several sepa- + 2004.9.1 rators allowed. Year is + 4+ digits, month is 1-12, + day is 1-31 + 2004 start of year + 2004/10 start of month + 10/1 month and day in current + year + 21 day in current month + october, oct start of month in current + year + yesterday, today, tomorrow -1, 0, 1 days from today + last/this/next -1, 0, 1 periods from the + day/week/month/quar- current period + ter/year + 20181201 8 digit YYYYMMDD with + valid year month and day + 201812 6 digit YYYYMM with valid + year and month - 2004/10 start of month - 10/1 month and day in current - year - 21 day in current month - october, oct start of month in current - year - yesterday, today, tomorrow -1, 0, 1 days from today - last/this/next day/week/month/quar- -1, 0, 1 periods from the - ter/year current period - 20181201 8 digit YYYYMMDD with - valid year month and day - 201812 6 digit YYYYMM with valid - year and month - - Counterexamples - malformed digit sequences might give surprising + Counterexamples - malformed digit sequences might give surprising results: - 201813 6 digits with an invalid - month is parsed as start + 201813 6 digits with an invalid + month is parsed as start of 6-digit year - 20181301 8 digits with an invalid - month is parsed as start + 20181301 8 digits with an invalid + month is parsed as start of 8-digit year - 20181232 8 digits with an invalid + 20181232 8 digits with an invalid day gives an error 201801012 9+ digits beginning with a valid YYYYMMDD gives an error Report start & end date - Most hledger reports show the full span of time represented by the + Most hledger reports show the full span of time represented by the journal data, by default. So, the effective report start and end dates - will be the earliest and latest transaction or posting dates found in + will be the earliest and latest transaction or posting dates found in the journal. - Often you will want to see a shorter time span, such as the current - month. You can specify a start and/or end date using -b/--begin, + Often you will want to see a shorter time span, such as the current + month. You can specify a start and/or end date using -b/--begin, -e/--end, -p/--period or a date: query (described below). All of these - accept the smart date syntax. One important thing to be aware of when - specifying end dates: as in Ledger, end dates are exclusive, so you + accept the smart date syntax. One important thing to be aware of when + specifying end dates: as in Ledger, end dates are exclusive, so you need to write the date after the last day you want to include. Examples: @@ -448,10 +460,13 @@ OPTIONS day 2016 -e 12/1 end at the start of decem- ber 1st of the current - year (11/30 will be the + year (11/30 will be the last date included) - -b thismonth all transactions on or - after the 1st of the cur- + + + + -b thismonth all transactions on or + after the 1st of the cur- rent month -p thismonth all transactions in the current month @@ -463,24 +478,24 @@ OPTIONS Report intervals A report interval can be specified so that commands like register, bal- - ance and activity will divide their reports into multiple subperiods. - The basic intervals can be selected with one of -D/--daily, - -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly. More com- - plex intervals may be specified with a period expression. Report + ance and activity will divide their reports into multiple subperiods. + The basic intervals can be selected with one of -D/--daily, + -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly. More com- + plex intervals may be specified with a period expression. Report intervals can not be specified with a query, currently. Period expressions - The -p/--period option accepts period expressions, a shorthand way of - expressing a start date, end date, and/or report interval all at once. + The -p/--period option accepts period expressions, a shorthand way of + expressing a start date, end date, and/or report interval all at once. - Here's a basic period expression specifying the first quarter of 2009. - Note, hledger always treats start dates as inclusive and end dates as + Here's a basic period expression specifying the first quarter of 2009. + Note, hledger always treats start dates as inclusive and end dates as exclusive: -p "from 2009/1/1 to 2009/4/1" - Keywords like "from" and "to" are optional, and so are the spaces, as - long as you don't run two dates together. "to" can also be written as + Keywords like "from" and "to" are optional, and so are the spaces, as + long as you don't run two dates together. "to" can also be written as "-". These are equivalent to the above: @@ -488,7 +503,7 @@ OPTIONS -p2009/1/1to2009/4/1 -p2009/1/1-2009/4/1 - Dates are smart dates, so if the current year is 2009, the above can + Dates are smart dates, so if the current year is 2009, the above can also be written as: @@ -504,25 +519,26 @@ OPTIONS 1, 2009 -p "from 2009/1" the same -p "from 2009" the same - -p "to 2009" everything before january + -p "to 2009" everything before january 1, 2009 - A single date with no "from" or "to" defines both the start and end + A single date with no "from" or "to" defines both the start and end date like so: - -p "2009" the year 2009; equivalent + -p "2009" the year 2009; equivalent to "2009/1/1 to 2010/1/1" - -p "2009/1" the month of jan; equiva- + -p "2009/1" the month of jan; equiva- lent to "2009/1/1 to 2009/2/1" - -p "2009/1/1" just that day; equivalent + + -p "2009/1/1" just that day; equivalent to "2009/1/1 to 2009/1/2" - The argument of -p can also begin with, or be, a report interval - expression. The basic report intervals are daily, weekly, monthly, + The argument of -p can also begin with, or be, a report interval + expression. The basic report intervals are daily, weekly, monthly, quarterly, or yearly, which have the same effect as the -D,-W,-M,-Q, or - -Y flags. Between report interval and start/end dates (if any), the + -Y flags. Between report interval and start/end dates (if any), the word in is optional. Examples: @@ -530,30 +546,29 @@ OPTIONS -p "monthly in 2008" -p "quarterly" - Note that weekly, monthly, quarterly and yearly intervals will always + Note that weekly, monthly, quarterly and yearly intervals will always start on the first day on week, month, quarter or year accordingly, and - will end on the last day of same period, even if associated period + will end on the last day of same period, even if associated period expression specifies different explicit start and end date. For example: - -p "weekly from 2009/1/1 to 2009/4/1" - -- starts on 2008/12/29, closest pre- + -p "weekly from 2009/1/1 to 2009/4/1" + -- starts on 2008/12/29, closest pre- ceeding Monday -p "monthly in 2008/11/25" -- starts on 2018/11/01 - -p "quar- - terly from 2009-05-05 to 2009-06-01" - - starts on 2009/04/01, ends on - 2009/06/30, which are first and last - days of Q2 2009 + -p "quarterly from 2009-05-05 to + 2009-06-01" - starts on 2009/04/01, + ends on 2009/06/30, which are first and + last days of Q2 2009 -p "yearly from 2009-12-29" - starts on 2009/01/01, first day of 2009 The following more complex report intervals are also supported: - biweekly, bimonthly, every day|week|month|quarter|year, - every N days|weeks|months|quarters|years. + biweekly, bimonthly, every day|week|month|quarter|year, every N + days|weeks|months|quarters|years. All of these will start on the first day of the requested period and end on the last one, as described above. @@ -561,31 +576,32 @@ OPTIONS Examples: - -p "bimonthly from 2008" -- periods + -p "bimonthly from 2008" -- periods will have boundaries on 2008/01/01, 2008/03/01, ... -p "every 2 weeks" -- starts on closest preceeding Monday - -p "every 5 month from 2009/03" -- + -p "every 5 month from 2009/03" -- periods will have boundaries on 2009/03/01, 2009/08/01, ... If you want intervals that start on arbitrary day of your choosing and span a week, month or year, you need to use any of the following: - every Nth day of week, every , every Nth day [of month], - every Nth weekday [of month], every MM/DD [of year], - every Nth MMM [of year], every MMM Nth [of year]. + every Nth day of week, every , every Nth day [of month], every + Nth weekday [of month], every MM/DD [of year], every Nth MMM [of year], + every MMM Nth [of year]. Examples: - -p "every 2nd day of week" -- periods + -p "every 2nd day of week" -- periods will go from Tue to Tue -p "every Tue" -- same + -p "every 15th day" -- period bound- aries will be on 15th of each month - -p "every 2nd Monday" -- period bound- + -p "every 2nd Monday" -- period bound- aries will be on second Monday of each month -p "every 11/05" -- yearly periods with @@ -667,33 +683,26 @@ OPTIONS if they have a transaction price specified. Market value - The -V/--value flag converts reported amounts to their current market - value. - Specifically, when there is a market price (P directive) for the - amount's commodity, dated on or before today's date (or the report end - date if specified), the amount will be converted to the price's commod- - ity. - - When there are multiple applicable P directives, -V chooses the most - recent one, or in case of equal dates, the last-parsed one. - - For example: + The -V/--market flag converts reported amounts to their market value in + another commodity. It uses the commodity referenced in the latest mar- + ket price (P directive) dated on or before the valuation date. The + default valuation date is today. For example: # one euro is worth this many dollars from nov 1 - P 2016/11/01 $1.10 + P 2016/11/01 EUR $1.10 # purchase some euros on nov 3 2016/11/3 - assets:euros 100 + assets:euros EUR100 assets:checking # the euro is worth fewer dollars by dec 21 - P 2016/12/21 $1.03 + P 2016/12/21 EUR $1.03 How many euros do I have ? $ hledger -f t.j bal -N euros - 100 assets:euros + EUR100 assets:euros What are they worth at end of nov 3 ? @@ -706,29 +715,193 @@ OPTIONS $ hledger -f t.j bal -N euros -V $103.00 assets:euros - Currently, hledger's -V only uses market prices recorded with P direc- - tives, not transaction prices (unlike Ledger). + Ledger users: Ledger's -V also infers market prices from journal + entries, but we don't do that. hledger's -V uses only market prices + declared explicitly, with P directives. (Mnemonic: -B/--cost uses + transaction prices, -V/--market uses market prices.) - Currently, -V has a limitation in multicolumn balance reports: it uses - the market prices on the report end date for all columns. (Instead of - the prices on each column's end date.) + More control over valuation + (experimental, added 201905) - Combining -B and -V - Using -B/--cost and -V/--value together is currently allowed, but the - results are probably not meaningful. Let us know if you find a use for - this. + You can control valuation more precisely with the --value option. + + --value=TYPE which type of valuation should be done ? cost|end|now|YYYY-MM-DD + + The argument is one of the keywords shown, or their first letter, or a + custom date. The precise effect of the keywords is command-specific, + but here is their general meaning: + + --value=cost (or c) + Convert amounts to cost, using the prices recorded in transac- + tions. -B/--cost does this. + + --value=end (or e) + Convert amounts to their value in default valuation commodity + using market prices on the last day of the report period (or of + each subperiod in a multiperiod report). When no report period + is specified, uses the journal's last transaction date. + + --value=now (or n) + Convert amounts to their value in default valuation commodity + using current market prices (as of when report is generated). + -V/--market does this. + + --value=YYYY-MM-DD + Convert amounts to their value in default valuation commodity + using market prices on the given date (which must be 8 digits + with - or / or . separators). Eg --value=2019-04-25. + + Here are the effects of --value as seen with print: + + P 2000-01-01 A 1 B + P 2000-02-01 A 2 B + P 2000-03-01 A 3 B + P 2000-04-01 A 4 B + + 2000-01-01 + (a) 1 A @ 5 B + + 2000-02-01 + (a) 1 A @ 6 B + + 2000-03-01 + (a) 1 A @ 7 B + + Show the cost of each posting: + + $ hledger -f- print --value=cost + 2000/01/01 + (a) 5 B + + 2000/02/01 + (a) 6 B + + 2000/03/01 + (a) 7 B + + Show the value as of the last day of the report period (2000-02-29): + + $ hledger -f- print --value=end date:2000/01-2000/03 + 2000-01-01 + (a) 2 B + + 2000-02-01 + (a) 2 B + + With no report period specified, that shows the value as of the last + day of the journal (2000-03-01): + + $ hledger -f- print --value=end + 2000/01/01 + (a) 3 B + + 2000/02/01 + (a) 3 B + + 2000/03/01 + (a) 3 B + + Show the current value (the 2000-04-01 price is still in effect today): + + $ hledger -f- print --value=now + 2000-01-01 + (a) 4 B + + 2000-02-01 + (a) 4 B + + 2000-03-01 + (a) 4 B + + Show the value on 2000/01/15: + + $ hledger -f- print --value=2000-01-15 + 2000/01/01 + (a) 1 B + + 2000/02/01 + (a) 1 B + + 2000/03/01 + (a) 1 B + + Effect of --value on reports + Below is how --value affects each of hledger's reports, currently. + You're not expected to remember all this, but when troubleshooting a + report, look here. If you find problems - useless reports, misbehaving + reports, or error messages being printed - please report them (with + reproducible examples) eg at #329. + + + Report type --value cost --value end --value DATE/now + --------------------------------------------------------------------------------- + print + posting cost, as market value at report market value at + amounts recorded in end DATE + transaction + balance show unvalued show unvalued show unvalued + asser- + tions/assign- + ments + register + starting bal- cost of start- market value at day market value at + ance with -H ing balance before report start DATE + posting cost market value at report market value at + amounts end DATE + posting summarised market value each summary market value each + amounts, mul- cost posting at period end summary posting at + tiperiod DATE + running sum/average of sum/average of the dis- sum/average of the + total/average the displayed played values displayed values + values + balance (bs, + cf, is..) + starting bal- costs of market value at day market value at + ances with -H starting bal- before report start of DATE of sum of + ances sum of previous postings previous postings + balances, summed costs market value at period market value at + simple bal- end of sum of postings DATE of sum of + ance report postings + balances, summed costs market value at period market value at + multiperiod end of sum of postings DATE of sum of + report postings + budget costs of bud- budget-setting periodic budget-setting + amounts with get amounts txns are valued at period periodic txns are + --budget end valued at DATE + + + + col- sum/average of market value at period market value at + umn/row/grand the displayed end of sum/average of DATE of sum/aver- + totals/aver- values postings age of postings + ages + + Some useful value reports + Here are some probably useful reports - please send suggestions if you + find out more: + + + Command: Description of report: Could answer: + ----------------------------------------------------------------------------- + hledger bs -M Monthly historical value of How are my investments + --value=p assets/liabilities performing ? + hledger is -M Monthly contemporaneous How much foreign currency + --value=t value of revenues/expenses have I been spending ? + + Combining -B, -V, --value + The rightmost of these flags wins. Output destination - Some commands (print, register, stats, the balance commands) can write - their output to a destination other than the console. This is con- + Some commands (print, register, stats, the balance commands) can write + their output to a destination other than the console. This is con- trolled by the -o/--output-file option. $ hledger balance -o - # write to stdout (the default) $ hledger balance -o FILE # write to FILE Output format - Some commands can write their output in other formats. Eg print and - register can output CSV, and the balance commands can output CSV or + Some commands can write their output in other formats. Eg print and + register can output CSV, and the balance commands can output CSV or HTML. This is controlled by the -O/--output-format option, or by spec- ifying a .csv or .html file extension with -o/--output-file. @@ -738,56 +911,56 @@ OPTIONS Regular expressions hledger uses regular expressions in a number of places: - o query terms, on the command line and in the hledger-web search form: + o query terms, on the command line and in the hledger-web search form: REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX o CSV rules conditional blocks: if REGEX ... - o account alias directives and options: alias /REGEX/ = REPLACEMENT, + o account alias directives and options: alias /REGEX/ = REPLACEMENT, --alias /REGEX/=REPLACEMENT - hledger's regular expressions come from the regex-tdfa library. In + hledger's regular expressions come from the regex-tdfa library. In general they: o are case insensitive - o are infix matching (do not need to match the entire thing being + o are infix matching (do not need to match the entire thing being matched) o are POSIX extended regular expressions o also support GNU word boundaries (\<, \>, \b, \B) - o and parenthesised capturing groups and numeric backreferences in + o and parenthesised capturing groups and numeric backreferences in replacement strings o do not support mode modifiers like (?s) Some things to note: - o In the alias directive and --alias option, regular expressions must - be enclosed in forward slashes (/REGEX/). Elsewhere in hledger, + o In the alias directive and --alias option, regular expressions must + be enclosed in forward slashes (/REGEX/). Elsewhere in hledger, these are not required. - o In queries, to match a regular expression metacharacter like $ as a - literal character, prepend a backslash. Eg to search for amounts + o In queries, to match a regular expression metacharacter like $ as a + literal character, prepend a backslash. Eg to search for amounts with the dollar sign in hledger-web, write cur:\$. - o On the command line, some metacharacters like $ have a special mean- + o On the command line, some metacharacters like $ have a special mean- ing to the shell and so must be escaped at least once more. See Spe- cial characters. QUERIES - One of hledger's strengths is being able to quickly report on precise - subsets of your data. Most commands accept an optional query expres- - sion, written as arguments after the command name, to filter the data - by date, account name or other criteria. The syntax is similar to a + One of hledger's strengths is being able to quickly report on precise + subsets of your data. Most commands accept an optional query expres- + sion, written as arguments after the command name, to filter the data + by date, account name or other criteria. The syntax is similar to a web search: one or more space-separated search terms, quotes to enclose - whitespace, prefixes to match specific fields, a not: prefix to negate + whitespace, prefixes to match specific fields, a not: prefix to negate the match. - We do not yet support arbitrary boolean combinations of search terms; - instead most commands show transactions/postings/accounts which match + We do not yet support arbitrary boolean combinations of search terms; + instead most commands show transactions/postings/accounts which match (or negatively match): o any of the description terms AND @@ -808,53 +981,52 @@ QUERIES o match all the other terms. - The following kinds of search terms can be used. Remember these can + The following kinds of search terms can be used. Remember these can also be prefixed with not:, eg to exclude a particular subaccount. REGEX, acct:REGEX - match account names by this regular expression. (With no pre- - fix, acct: is assumed.) - same as above + match account names by this regular expression. (With no pre- + fix, acct: is assumed.) same as above amt:N, amt:N, amt:>=N - match postings with a single-commodity amount that is equal to, - less than, or greater than N. (Multi-commodity amounts are not + match postings with a single-commodity amount that is equal to, + less than, or greater than N. (Multi-commodity amounts are not tested, and will always match.) The comparison has two modes: if N is preceded by a + or - sign (or is 0), the two signed numbers - are compared. Otherwise, the absolute magnitudes are compared, + are compared. Otherwise, the absolute magnitudes are compared, ignoring sign. code:REGEX match by transaction code (eg check number) cur:REGEX - match postings or transactions including any amounts whose cur- - rency/commodity symbol is fully matched by REGEX. (For a par- + match postings or transactions including any amounts whose cur- + rency/commodity symbol is fully matched by REGEX. (For a par- tial match, use .*REGEX.*). Note, to match characters which are regex-significant, like the dollar sign ($), you need to prepend - \. And when using the command line you need to add one more - level of quoting to hide it from the shell, so eg do: - hledger print cur:'\$' or hledger print cur:\\$. + \. And when using the command line you need to add one more + level of quoting to hide it from the shell, so eg do: hledger + print cur:'\$' or hledger print cur:\\$. desc:REGEX match transaction descriptions. date:PERIODEXPR match dates within the specified period. PERIODEXPR is a period - expression (with no report interval). Examples: date:2016, - date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the - --date2 command line flag is present, this matches secondary + expression (with no report interval). Examples: date:2016, + date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the + --date2 command line flag is present, this matches secondary dates instead. date2:PERIODEXPR match secondary dates within the specified period. depth:N - match (or display, depending on command) accounts at or above + match (or display, depending on command) accounts at or above this depth note:REGEX - match transaction notes (part of description right of |, or + match transaction notes (part of description right of |, or whole description when there's no |) payee:REGEX @@ -868,51 +1040,51 @@ QUERIES match unmarked, pending, or cleared transactions respectively tag:REGEX[=REGEX] - match by tag name, and optionally also by tag value. Note a - tag: query is considered to match a transaction if it matches - any of the postings. Also remember that postings inherit the + match by tag name, and optionally also by tag value. Note a + tag: query is considered to match a transaction if it matches + any of the postings. Also remember that postings inherit the tags of their parent transaction. The following special search term is used automatically in hledger-web, only: inacct:ACCTNAME - tells hledger-web to show the transaction register for this + tells hledger-web to show the transaction register for this account. Can be filtered further with acct etc. Some of these can also be expressed as command-line options (eg depth:2 - is equivalent to --depth 2). Generally you can mix options and query - arguments, and the resulting query will be their intersection (perhaps + is equivalent to --depth 2). Generally you can mix options and query + arguments, and the resulting query will be their intersection (perhaps excluding the -p/--period option). COMMANDS - hledger provides a number of subcommands; hledger with no arguments + hledger provides a number of subcommands; hledger with no arguments shows a list. If you install additional hledger-* packages, or if you put programs or - scripts named hledger-NAME in your PATH, these will also be listed as + scripts named hledger-NAME in your PATH, these will also be listed as subcommands. - Run a subcommand by writing its name as first argument (eg - hledger incomestatement). You can also write one of the standard short - aliases displayed in parentheses in the command list (hledger b), or - any any unambiguous prefix of a command name (hledger inc). + Run a subcommand by writing its name as first argument (eg hledger + incomestatement). You can also write one of the standard short aliases + displayed in parentheses in the command list (hledger b), or any any + unambiguous prefix of a command name (hledger inc). - Here are all the builtin commands in alphabetical order. See also - hledger for a more organised command list, and hledger CMD -h for + Here are all the builtin commands in alphabetical order. See also + hledger for a more organised command list, and hledger CMD -h for detailed command help. accounts accounts, a Show account names. - This command lists account names, either declared with account direc- - tives (--declared), posted to (--used), or both (the default). With - query arguments, only matched account names and account names refer- - enced by matched postings are shown. It shows a flat list by default. - With --tree, it uses indentation to show the account hierarchy. In - flat mode you can add --drop N to omit the first few account name com- - ponents. Account names can be depth-clipped with depth:N or --depth N + This command lists account names, either declared with account direc- + tives (--declared), posted to (--used), or both (the default). With + query arguments, only matched account names and account names refer- + enced by matched postings are shown. It shows a flat list by default. + With --tree, it uses indentation to show the account hierarchy. In + flat mode you can add --drop N to omit the first few account name com- + ponents. Account names can be depth-clipped with depth:N or --depth N or -N. Examples: @@ -931,8 +1103,8 @@ COMMANDS activity Show an ascii barchart of posting counts per interval. - The activity command displays an ascii histogram showing transaction - counts by day, week, month or other reporting interval (by day is the + The activity command displays an ascii histogram showing transaction + counts by day, week, month or other reporting interval (by day is the default). With query arguments, it counts only matched transactions. Examples: @@ -947,22 +1119,22 @@ COMMANDS add Prompt for transactions and add them to the journal. - Many hledger users edit their journals directly with a text editor, or - generate them from CSV. For more interactive data entry, there is the - add command, which prompts interactively on the console for new trans- - actions, and appends them to the journal file (if there are multiple - -f FILE options, the first file is used.) Existing transactions are not - changed. This is the only hledger command that writes to the journal + Many hledger users edit their journals directly with a text editor, or + generate them from CSV. For more interactive data entry, there is the + add command, which prompts interactively on the console for new trans- + actions, and appends them to the journal file (if there are multiple -f + FILE options, the first file is used.) Existing transactions are not + changed. This is the only hledger command that writes to the journal file. To use it, just run hledger add and follow the prompts. You can add as - many transactions as you like; when you are finished, enter . or press + many transactions as you like; when you are finished, enter . or press control-d or control-c to exit. Features: - o add tries to provide useful defaults, using the most similar (by - description) recent transaction (filtered by the query, if any) as a + o add tries to provide useful defaults, using the most similar (by + description) recent transaction (filtered by the query, if any) as a template. o You can also set the initial defaults with command line arguments. @@ -970,20 +1142,20 @@ COMMANDS o Readline-style edit keys can be used during data entry. o The tab key will auto-complete whenever possible - accounts, descrip- - tions, dates (yesterday, today, tomorrow). If the input area is + tions, dates (yesterday, today, tomorrow). If the input area is empty, it will insert the default value. - o If the journal defines a default commodity, it will be added to any + o If the journal defines a default commodity, it will be added to any bare numbers entered. o A parenthesised transaction code may be entered following a date. o Comments and tags may be entered following a description or amount. - o If you make a mistake, enter < at any prompt to restart the transac- + o If you make a mistake, enter < at any prompt to restart the transac- tion. - o Input prompts are displayed in a different colour when the terminal + o Input prompts are displayed in a different colour when the terminal supports it. Example (see the tutorial for a detailed explanation): @@ -1018,29 +1190,29 @@ COMMANDS Show accounts and their balances. The balance command is hledger's most versatile command. Note, despite - the name, it is not always used for showing real-world account bal- - ances; the more accounting-aware balancesheet and incomestatement may + the name, it is not always used for showing real-world account bal- + ances; the more accounting-aware balancesheet and incomestatement may be more convenient for that. By default, it displays all accounts, and each account's change in bal- ance during the entire period of the journal. Balance changes are cal- - culated by adding up the postings in each account. You can limit the - postings matched, by a query, to see fewer accounts, changes over a + culated by adding up the postings in each account. You can limit the + postings matched, by a query, to see fewer accounts, changes over a different time period, changes from only cleared transactions, etc. If you include an account's complete history of postings in the report, - the balance change is equivalent to the account's current ending bal- - ance. For a real-world account, typically you won't have all transac- + the balance change is equivalent to the account's current ending bal- + ance. For a real-world account, typically you won't have all transac- tions in the journal; instead you'll have all transactions after a cer- - tain date, and an "opening balances" transaction setting the correct - starting balance on that date. Then the balance command will show + tain date, and an "opening balances" transaction setting the correct + starting balance on that date. Then the balance command will show real-world account balances. In some cases the -H/--historical flag is used to ensure this (more below). The balance command can produce several styles of report: Classic balance report - This is the original balance report, as found in Ledger. It usually + This is the original balance report, as found in Ledger. It usually looks like this: $ hledger balance @@ -1057,23 +1229,23 @@ COMMANDS -------------------- 0 - By default, accounts are displayed hierarchically, with subaccounts - indented below their parent. At each level of the tree, accounts are - sorted by account code if any, then by account name. Or with + By default, accounts are displayed hierarchically, with subaccounts + indented below their parent. At each level of the tree, accounts are + sorted by account code if any, then by account name. Or with -S/--sort-amount, by their balance amount. "Boring" accounts, which contain a single interesting subaccount and no - balance of their own, are elided into the following line for more com- - pact output. (Eg above, the "liabilities" account.) Use --no-elide to + balance of their own, are elided into the following line for more com- + pact output. (Eg above, the "liabilities" account.) Use --no-elide to prevent this. - Account balances are "inclusive" - they include the balances of any + Account balances are "inclusive" - they include the balances of any subaccounts. - Accounts which have zero balance (and no non-zero subaccounts) are + Accounts which have zero balance (and no non-zero subaccounts) are omitted. Use -E/--empty to show them. - A final total is displayed by default; use -N/--no-total to suppress + A final total is displayed by default; use -N/--no-total to suppress it, eg: $ hledger balance -p 2008/6 expenses --no-total @@ -1082,8 +1254,8 @@ COMMANDS $1 supplies Customising the classic balance report - You can customise the layout of classic balance reports with --for- - mat FMT: + You can customise the layout of classic balance reports with --format + FMT: $ hledger balance --format "%20(account) %12(total)" assets $-1 @@ -1100,7 +1272,7 @@ COMMANDS 0 The FMT format string (plus a newline) specifies the formatting applied - to each account/balance pair. It may contain any suitable text, with + to each account/balance pair. It may contain any suitable text, with data fields interpolated like so: %[MIN][.MAX](FIELDNAME) @@ -1111,14 +1283,14 @@ COMMANDS o FIELDNAME must be enclosed in parentheses, and can be one of: - o depth_spacer - a number of spaces equal to the account's depth, or + o depth_spacer - a number of spaces equal to the account's depth, or if MIN is specified, MIN * depth spaces. o account - the account's name o total - the account's balance/posted total, right justified - Also, FMT can begin with an optional prefix to control how multi-com- + Also, FMT can begin with an optional prefix to control how multi-com- modity amounts are rendered: o %_ - render on multiple lines, bottom-aligned (the default) @@ -1127,9 +1299,9 @@ COMMANDS o %, - render on one line, comma-separated - There are some quirks. Eg in one-line mode, %(depth_spacer) has no - effect, instead %(account) has indentation built in. - Experimentation may be needed to get pleasing results. + There are some quirks. Eg in one-line mode, %(depth_spacer) has no + effect, instead %(account) has indentation built in. Experimentation + may be needed to get pleasing results. Some example formats: @@ -1164,7 +1336,7 @@ COMMANDS $1 supplies Depth limited balance reports - With --depth N or depth:N or just -N, balance reports show accounts + With --depth N or depth:N or just -N, balance reports show accounts only to the specified numeric depth. This is very useful to summarise a complex set of accounts and get an overview. @@ -1237,26 +1409,29 @@ COMMANDS ----------------------++------------------------------------- || 0 0 0 - Multicolumn balance reports display accounts in flat mode by default; + Note that --cumulative or --historical/-H disable --row-total/-T, since + summing end balances generally does not make sense. + + Multicolumn balance reports display accounts in flat mode by default; to see the hierarchy, use --tree. - With a reporting interval (like --quarterly above), the report - start/end dates will be adjusted if necessary so that they encompass + With a reporting interval (like --quarterly above), the report + start/end dates will be adjusted if necessary so that they encompass the displayed report periods. This is so that the first and last peri- ods will be "full" and comparable to the others. - The -E/--empty flag does two things in multicolumn balance reports: - first, the report will show all columns within the specified report - period (without -E, leading and trailing columns with all zeroes are - not shown). Second, all accounts which existed at the report start - date will be considered, not just the ones with activity during the + The -E/--empty flag does two things in multicolumn balance reports: + first, the report will show all columns within the specified report + period (without -E, leading and trailing columns with all zeroes are + not shown). Second, all accounts which existed at the report start + date will be considered, not just the ones with activity during the report period (use -E to include low-activity accounts which would oth- erwise would be omitted). The -T/--row-total flag adds an additional column showing the total for each row. - The -A/--average flag adds a column showing the average value in each + The -A/--average flag adds a column showing the average value in each row. Here's an example of all three: @@ -1280,20 +1455,20 @@ COMMANDS Limitations: In multicolumn reports the -V/--value flag uses the market price on the - report end date, for all columns (not the price on each column's end + report end date, for all columns (not the price on each column's end date). - Eliding of boring parent accounts in tree mode, as in the classic bal- + Eliding of boring parent accounts in tree mode, as in the classic bal- ance report, is not yet supported in multicolumn reports. Budget report - With --budget, extra columns are displayed showing budget goals for - each account and period, if any. Budget goals are defined by periodic - transactions. This is very useful for comparing planned and actual - income, expenses, time usage, etc. --budget is most often combined + With --budget, extra columns are displayed showing budget goals for + each account and period, if any. Budget goals are defined by periodic + transactions. This is very useful for comparing planned and actual + income, expenses, time usage, etc. --budget is most often combined with a report interval. - For example, you can take average monthly expenses in the common + For example, you can take average monthly expenses in the common expense categories to construct a minimal monthly budget: ;; Budget @@ -1340,25 +1515,25 @@ COMMANDS Note this is different from a normal balance report in several ways: - o Only accounts with budget goals during the report period are shown, + o Only accounts with budget goals during the report period are shown, by default. - o In each column, in square brackets after the actual amount, budgeted + o In each column, in square brackets after the actual amount, budgeted amounts are shown, along with the percentage of budget used. - o All parent accounts are always shown, even in flat mode. Eg assets, + o All parent accounts are always shown, even in flat mode. Eg assets, assets:bank, and expenses above. - o Amounts always include all subaccounts, budgeted or unbudgeted, even + o Amounts always include all subaccounts, budgeted or unbudgeted, even in flat mode. This means that the numbers displayed will not always add up! Eg above, - the expenses actual amount includes the gifts and supplies transac- - tions, but the expenses:gifts and expenses:supplies accounts are not + the expenses actual amount includes the gifts and supplies transac- + tions, but the expenses:gifts and expenses:supplies accounts are not shown, as they have no budget amounts declared. - This can be confusing. When you need to make things clearer, use the - -E/--empty flag, which will reveal all accounts including unbudgeted + This can be confusing. When you need to make things clearer, use the + -E/--empty flag, which will reveal all accounts including unbudgeted ones, giving the full picture. Eg: $ hledger balance -M --budget --empty @@ -1400,12 +1575,12 @@ COMMANDS For more examples, see Budgeting and Forecasting. Nested budgets - You can add budgets to any account in your account hierarchy. If you + You can add budgets to any account in your account hierarchy. If you have budgets on both parent account and some of its children, then bud- - get(s) of the child account(s) would be added to the budget of their + get(s) of the child account(s) would be added to the budget of their parent, much like account balances behave. - In the most simple case this means that once you add a budget to any + In the most simple case this means that once you add a budget to any account, all its parents would have budget as well. To illustrate this, consider the following budget: @@ -1415,13 +1590,13 @@ COMMANDS expenses:personal:electronics $100.00 liabilities - With this, monthly budget for electronics is defined to be $100 and - budget for personal expenses is an additional $1000, which implicity + With this, monthly budget for electronics is defined to be $100 and + budget for personal expenses is an additional $1000, which implicity means that budget for both expenses:personal and expenses is $1100. - Transactions in expenses:personal:electronics will be counted both - towards its $100 budget and $1100 of expenses:personal , and transac- - tions in any other subaccount of expenses:personal would be counted + Transactions in expenses:personal:electronics will be counted both + towards its $100 budget and $1100 of expenses:personal , and transac- + tions in any other subaccount of expenses:personal would be counted towards only towards the budget of expenses:personal. For example, let's consider these transactions: @@ -1447,9 +1622,9 @@ COMMANDS expenses:personal $30.00 liabilities - As you can see, we have transactions in expenses:personal:electron- - ics:upgrades and expenses:personal:train tickets, and since both of - these accounts are without explicitly defined budget, these transac- + As you can see, we have transactions in expenses:personal:electron- + ics:upgrades and expenses:personal:train tickets, and since both of + these accounts are without explicitly defined budget, these transac- tions would be counted towards budgets of expenses:personal:electronics and expenses:personal accordingly: @@ -1465,7 +1640,7 @@ COMMANDS -------------------------------++------------------------------- || 0 [ 0] - And with --empty, we can get a better picture of budget allocation and + And with --empty, we can get a better picture of budget allocation and consumption: $ hledger balance --budget -M --empty @@ -1483,17 +1658,17 @@ COMMANDS || 0 [ 0] Output format - The balance command supports output destination and output format + The balance command supports output destination and output format selection. balancesheet balancesheet, bs This command displays a simple balance sheet, showing historical ending - balances of asset and liability accounts (ignoring any report begin - date). It assumes that these accounts are under a top-level asset or + balances of asset and liability accounts (ignoring any report begin + date). It assumes that these accounts are under a top-level asset or liability account (case insensitive, plural forms also allowed). - Note this report shows all account balances with normal positive sign + Note this report shows all account balances with normal positive sign (like conventional financial statements, unlike balance/print/register) (experimental). @@ -1519,17 +1694,19 @@ COMMANDS 0 With a reporting interval, multiple columns will be shown, one for each - report period. As with multicolumn balance reports, you can alter the - report mode with --change/--cumulative/--historical. Normally bal- - ancesheet shows historical ending balances, which is what you need for - a balance sheet; note this means it ignores report begin dates. + report period. As with multicolumn balance reports, you can alter the + report mode with --change/--cumulative/--historical. Normally bal- + ancesheet shows historical ending balances, which is what you need for + a balance sheet; note this means it ignores report begin dates (and + -T/--row-total, since summing end balances generally does not make + sense). - This command also supports output destination and output format selec- + This command also supports output destination and output format selec- tion. balancesheetequity balancesheetequity, bse - Just like balancesheet, but also reports Equity (which it assumes is + Just like balancesheet, but also reports Equity (which it assumes is under a top-level equity account). Example: @@ -1560,10 +1737,10 @@ COMMANDS cashflow cashflow, cf - This command displays a simple cashflow statement, showing changes in - "cash" accounts. It assumes that these accounts are under a top-level - asset account (case insensitive, plural forms also allowed) and do not - contain receivable or A/R in their name. Note this report shows all + This command displays a simple cashflow statement, showing changes in + "cash" accounts. It assumes that these accounts are under a top-level + asset account (case insensitive, plural forms also allowed) and do not + contain receivable or A/R in their name. Note this report shows all account balances with normal positive sign (like conventional financial statements, unlike balance/print/register) (experimental). @@ -1584,77 +1761,77 @@ COMMANDS $-1 With a reporting interval, multiple columns will be shown, one for each - report period. Normally cashflow shows changes in assets per period, - though as with multicolumn balance reports you can alter the report + report period. Normally cashflow shows changes in assets per period, + though as with multicolumn balance reports you can alter the report mode with --change/--cumulative/--historical. - This command also supports output destination and output format selec- + This command also supports output destination and output format selec- tion. check-dates check-dates - Check that transactions are sorted by increasing date. With --date2, - checks secondary dates instead. With --strict, dates must also be - unique. With a query, only matched transactions' dates are checked. + Check that transactions are sorted by increasing date. With --date2, + checks secondary dates instead. With --strict, dates must also be + unique. With a query, only matched transactions' dates are checked. Reads the default journal file, or another specified with -f. check-dupes check-dupes - Reports account names having the same leaf but different prefixes. In - other words, two or more leaves that are categorized differently. + Reports account names having the same leaf but different prefixes. In + other words, two or more leaves that are categorized differently. Reads the default journal file, or another specified as an argument. An example: http://stefanorodighiero.net/software/hledger-dupes.html close close, equity - Prints a "closing balances" transaction and an "opening balances" + Prints a "closing balances" transaction and an "opening balances" transaction that bring account balances to and from zero, respectively. Useful for bringing asset/liability balances forward into a new journal - file, or for closing out revenues/expenses to retained earnings at the + file, or for closing out revenues/expenses to retained earnings at the end of a period. - The closing transaction transfers balances to "equity:closing bal- - ances". The opening transaction transfers balances from "equity:open- - ing balances". You can chose to print just one of the transactions by + The closing transaction transfers balances to "equity:closing bal- + ances". The opening transaction transfers balances from "equity:open- + ing balances". You can choose to print just one of the transactions by using the --opening or --closing flag. If you split your journal files by time (eg yearly), you will typically - run this command at the end of the year, and save the closing transac- - tion as last entry of the old file, and the opening transaction as the - first entry of the new file. This makes the files self contained, so - that correct balances are reported no matter which of them are loaded. - Ie, if you load just one file, the balances are initialised correctly; - or if you load several files, the redundant closing/opening transac- - tions cancel each other out. (They will show up in print or register - reports; you can exclude them with a query like not:desc:'(open- + run this command at the end of the year, and save the closing transac- + tion as last entry of the old file, and the opening transaction as the + first entry of the new file. This makes the files self contained, so + that correct balances are reported no matter which of them are loaded. + Ie, if you load just one file, the balances are initialised correctly; + or if you load several files, the redundant closing/opening transac- + tions cancel each other out. (They will show up in print or register + reports; you can exclude them with a query like not:desc:'(open- ing|closing) balances'.) If you're running a business, you might also use this command to "close - the books" at the end of an accounting period, transferring income - statement account balances to retained earnings. (You may want to + the books" at the end of an accounting period, transferring income + statement account balances to retained earnings. (You may want to change the equity account name to something like "equity:retained earn- ings".) - By default, the closing transaction is dated yesterday, the balances - are calculated as of end of yesterday, and the opening transaction is - dated today. To close on some other date, use: hledger close -e OPEN- - INGDATE. Eg, to close/open on the 2018/2019 boundary, use -e 2019. + By default, the closing transaction is dated yesterday, the balances + are calculated as of end of yesterday, and the opening transaction is + dated today. To close on some other date, use: hledger close -e OPEN- + INGDATE. Eg, to close/open on the 2018/2019 boundary, use -e 2019. You can also use -p or date:PERIOD (any starting date is ignored). Both transactions will include balance assertions for the - closed/reopened accounts. You probably shouldn't use status or real- - ness filters (like -C or -R or status:) with this command, or the gen- + closed/reopened accounts. You probably shouldn't use status or real- + ness filters (like -C or -R or status:) with this command, or the gen- erated balance assertions will depend on these flags. Likewise, if you - run this command with --auto, the balance assertions will probably + run this command with --auto, the balance assertions will probably always require --auto. Examples: - Carrying asset/liability balances into a new file for 2019, all from + Carrying asset/liability balances into a new file for 2019, all from command line: - Warning: we use >> here to append; be careful not to type a single > + Warning: we use >> here to append; be careful not to type a single > which would wipe your journal! $ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal @@ -1687,20 +1864,20 @@ COMMANDS files files - List all files included in the journal. With a REGEX argument, only - file names matching the regular expression (case sensitive) are shown. + List all files included in the journal. With a REGEX argument, only + file names matching the regular expression (case sensitive) are shown. help help Show any of the hledger manuals. - 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 + 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. - 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 + 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: @@ -1727,8 +1904,8 @@ COMMANDS 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- + 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. The input files are specified as arguments - no need to write -f before @@ -1739,11 +1916,25 @@ 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 + balance assignments (eg from an institution that provides only balances + 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, + please test it and send a pull request.) + incomestatement incomestatement, is This command displays a simple income statement, showing revenues and @@ -2021,8 +2212,8 @@ COMMANDS 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-autosync detect already-seen transactions when importing. + arguments) can be used to restrict the search space. Helps ledger- + autosync detect already-seen transactions when importing. rewrite rewrite @@ -2038,9 +2229,9 @@ COMMANDS Examples: - hledger-rewrite.hs ^income --add-posting '(liabilities:tax) *.33 ; income tax' --add-posting '(reserve:gifts) $100' - hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts) *-1"' - hledger-rewrite.hs -f rewrites.hledger + $ hledger-rewrite.hs ^income --add-posting '(liabilities:tax) *.33 ; income tax' --add-posting '(reserve:gifts) $100' + $ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts) *-1"' + $ hledger-rewrite.hs -f rewrites.hledger rewrites.hledger may consist of entries like: @@ -2220,8 +2411,8 @@ COMMANDS seed, for repeatable results from tests using randomness (currently none of them). - This is mainly used by developers, but it's nice to be able to san- - ity-check your installed hledger executable at any time. All tests are + This is mainly used by developers, but it's nice to be able to sanity- + check your installed hledger executable at any time. All tests are expected to pass - if you ever see otherwise, something has gone wrong, please report a bug! @@ -2234,15 +2425,15 @@ ADD-ON COMMANDS Add-ons can be invoked like any hledger command, but there are a few things to be aware of. Eg if the hledger-web add-on is installed, - o hledger -h web shows hledger's help, while hledger web -h shows + o hledger -h web shows hledger's help, while hledger web -h shows hledger-web's help. o Flags specific to the add-on must have a preceding -- to hide them from hledger. So hledger web --serve --port 9000 will be rejected; you must use hledger web -- --serve --port 9000. - o You can always run add-ons directly if preferred: - hledger-web --serve --port 9000. + o You can always run add-ons directly if preferred: hledger-web --serve + --port 9000. Add-ons are a relatively easy way to add local features or experiment with new ideas. They can be written in any language, but haskell @@ -2316,7 +2507,7 @@ FILES $HOME/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.journal). -BUGS +LIMITATIONS The need to precede addon command options with -- when invoked from hledger is awkward. @@ -2327,36 +2518,39 @@ BUGS In a Microsoft Windows CMD window, non-ascii characters and colours are not supported. + On Windows, non-ascii characters may not display correctly when running + a hledger built in CMD in MSYS/CYGWIN, or vice-versa. + 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 - remember you can also seek help from the IRC channel, mail list or bug + Here are some issues you might encounter when you run hledger (and + remember you can also seek help from the IRC channel, mail list or bug tracker): Successfully installed, but "No command 'hledger' found" stack and cabal install binaries into a special directory, which should - be added to your PATH environment variable. Eg on unix-like systems, + be added to your PATH environment variable. Eg on unix-like systems, that is ~/.local/bin and ~/.cabal/bin respectively. I set a custom LEDGER_FILE, but hledger is still using the default file - LEDGER_FILE should be a real environment variable, not just a shell - variable. The command env | grep LEDGER_FILE should show it. You may + LEDGER_FILE should be a real environment variable, not just a shell + variable. The command env | grep LEDGER_FILE should show it. You may need to use export. Here's an explanation. - "Illegal byte sequence" or "Invalid or incomplete multibyte or wide + "Illegal byte sequence" or "Invalid or incomplete multibyte or wide character" errors In order to handle non-ascii letters and symbols (like ), hledger needs an appropriate locale. This is usually configured system-wide; you can also configure it temporarily. The locale may need to be one that sup- - ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always, + ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always, I'm not sure yet). Here's an example of setting the locale temporarily, on ubuntu @@ -2375,7 +2569,7 @@ TROUBLESHOOTING $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile $ bash --login - If we preferred to use eg fr_FR.utf8, we might have to install that + If we preferred to use eg fr_FR.utf8, we might have to install that first: $ apt-get install language-pack-fr @@ -2396,7 +2590,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) @@ -2410,7 +2604,7 @@ COPYRIGHT SEE ALSO - hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), + hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1), hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time- dot(5), ledger(1) @@ -2418,4 +2612,4 @@ SEE ALSO -hledger 1.14.1 March 2019 hledger(1) +hledger 1.14.99 March 2019 hledger(1)