doc: regenerate embedded manuals

[ci skip]
This commit is contained in:
Simon Michael 2017-11-28 17:20:41 -08:00
parent c433873e04
commit 4228203740
18 changed files with 1005 additions and 624 deletions

View File

@ -1,4 +1,4 @@
This is hledger-api.1.info, produced by makeinfo version 6.1 from stdin. This is hledger-api.1.info, produced by makeinfo version 6.0 from stdin.
 
File: hledger-api.1.info, Node: Top, Next: OPTIONS, Up: (dir) File: hledger-api.1.info, Node: Top, Next: OPTIONS, Up: (dir)

View File

@ -8,19 +8,77 @@
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 .SH DESCRIPTION
.PP .PP
hledger can read CSV files, converting each CSV record into a journal hledger can read CSV (comma\-separated value) files as if they were
entry (transaction), if you provide some conversion hints in a "rules journal files, automatically converting each CSV record into a
file". transaction.
This file should be named like the CSV file with an additional (To learn about \f[I]writing\f[] CSV, see CSV output.)
\f[C]\&.rules\f[] suffix (eg: \f[C]mybank.csv.rules\f[]); or, you can
specify the file with \f[C]\-\-rules\-file\ PATH\f[].
hledger will create it if necessary, with some default rules which
you\[aq]ll need to adjust.
At minimum, the rules file must specify the \f[C]date\f[] and
\f[C]amount\f[] fields.
For an example, see Cookbook: convert CSV files.
.PP .PP
To learn about \f[I]exporting\f[] CSV, see CSV output. Converting CSV to transactions requires some special conversion rules.
These do several things:
.IP \[bu] 2
they describe the layout and format of the CSV data
.IP \[bu] 2
they can customize the generated journal entries using a simple
templating language
.IP \[bu] 2
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
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.
.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.
Eg:
.IP
.nf
\f[C]
fields\ date,\ _,\ _,\ amount
date\-format\ \ %d/%m/%Y
skip\ 1
\f[]
.fi
.PP
A more complete example:
.IP
.nf
\f[C]
#\ 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"
#\ 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
#\ how\ to\ parse\ the\ date
date\-format\ %b\ %\-d,\ %Y
#\ combine\ two\ fields\ to\ make\ the\ description
description\ %toorfrom\ %name
#\ save\ these\ fields\ as\ tags
comment\ \ \ \ \ status:%amzstatus,\ fees:%fees
#\ set\ the\ base\ account\ for\ all\ transactions
account1\ \ \ \ assets:amazon
#\ flip\ the\ sign\ on\ the\ amount
amount\ \ \ \ \ \ \-%amount
\f[]
.fi
.PP
For more examples, see Convert CSV files.
.SH CSV RULES .SH CSV RULES
.PP .PP
The following seven kinds of rule can appear in the rules file, in any The following seven kinds of rule can appear in the rules file, in any

View File

@ -1,4 +1,4 @@
This is hledger_csv.5.info, produced by makeinfo version 6.1 from stdin. This is hledger_csv.5.info, produced by makeinfo version 6.0 from stdin.
 
File: hledger_csv.5.info, Node: Top, Next: CSV RULES, Up: (dir) File: hledger_csv.5.info, Node: Top, Next: CSV RULES, Up: (dir)
@ -6,16 +6,63 @@ File: hledger_csv.5.info, Node: Top, Next: CSV RULES, Up: (dir)
hledger_csv(5) hledger 1.4 hledger_csv(5) hledger 1.4
************************** **************************
hledger can read CSV files, converting each CSV record into a journal hledger can read CSV (comma-separated value) files as if they were
entry (transaction), if you provide some conversion hints in a "rules journal files, automatically converting each CSV record into a
file". This file should be named like the CSV file with an additional transaction. (To learn about _writing_ CSV, see CSV output.)
'.rules' suffix (eg: 'mybank.csv.rules'); or, you can specify the file
with '--rules-file PATH'. hledger will create it if necessary, with
some default rules which you'll need to adjust. At minimum, the rules
file must specify the 'date' and 'amount' fields. For an example, see
Cookbook: convert CSV files.
To learn about _exporting_ CSV, see CSV output. Converting CSV to transactions requires some special conversion
rules. These do several things:
* they describe the layout and format of the CSV data
* they can customize the generated journal entries using a simple
templating language
* they can add refinements based on patterns in the CSV data, eg
categorizing transactions with more detailed account names.
When reading a CSV file named 'FILE.csv', hledger looks for a
conversion rules file named 'FILE.csv.rules' in the same directory. You
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:
fields date, _, _, amount
date-format %d/%m/%Y
skip 1
A more complete example:
# 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"
# skip one header line
skip 1
# name the csv fields (and assign the transaction's date, amount and code)
fields date, _, toorfrom, name, amzstatus, amount, fees, code
# how to parse the date
date-format %b %-d, %Y
# combine two fields to make the description
description %toorfrom %name
# save these fields as tags
comment status:%amzstatus, fees:%fees
# set the base account for all transactions
account1 assets:amazon
# flip the sign on the amount
amount -%amount
For more examples, see Convert CSV files.
* Menu: * Menu:
* CSV RULES:: * CSV RULES::
@ -270,33 +317,33 @@ one rules file will be used for all the CSV files being read.
 
Tag Table: Tag Table:
Node: Top74 Node: Top74
Node: CSV RULES810 Node: CSV RULES2165
Ref: #csv-rules920 Ref: #csv-rules2275
Node: skip1182 Node: skip2537
Ref: #skip1278 Ref: #skip2633
Node: date-format1450 Node: date-format2805
Ref: #date-format1579 Ref: #date-format2934
Node: field list2085 Node: field list3440
Ref: #field-list2224 Ref: #field-list3579
Node: field assignment2929 Node: field assignment4284
Ref: #field-assignment3086 Ref: #field-assignment4441
Node: conditional block3590 Node: conditional block4945
Ref: #conditional-block3746 Ref: #conditional-block5101
Node: include4642 Node: include5997
Ref: #include4774 Ref: #include6129
Node: newest-first5005 Node: newest-first6360
Ref: #newest-first5121 Ref: #newest-first6476
Node: CSV TIPS5532 Node: CSV TIPS6887
Ref: #csv-tips5628 Ref: #csv-tips6983
Node: CSV ordering5746 Node: CSV ordering7101
Ref: #csv-ordering5866 Ref: #csv-ordering7221
Node: CSV accounts6047 Node: CSV accounts7402
Ref: #csv-accounts6187 Ref: #csv-accounts7542
Node: CSV amounts6441 Node: CSV amounts7796
Ref: #csv-amounts6589 Ref: #csv-amounts7944
Node: CSV balance assertions7364 Node: CSV balance assertions8719
Ref: #csv-balance-assertions7548 Ref: #csv-balance-assertions8903
Node: Reading multiple CSV files7753 Node: Reading multiple CSV files9108
Ref: #reading-multiple-csv-files7925 Ref: #reading-multiple-csv-files9280
 
End Tag Table End Tag Table

View File

@ -7,16 +7,65 @@ NAME
CSV - how hledger reads CSV data, and the CSV rules file format CSV - how hledger reads CSV data, and the CSV rules file format
DESCRIPTION DESCRIPTION
hledger can read CSV files, converting each CSV record into a journal hledger can read CSV (comma-separated value) files as if they were
entry (transaction), if you provide some conversion hints in a "rules journal files, automatically converting each CSV record into a transac-
file". This file should be named like the CSV file with an additional tion. (To learn about writing CSV, see CSV output.)
.rules suffix (eg: mybank.csv.rules); or, you can specify the file with
--rules-file PATH. hledger will create it if necessary, with some
default rules which you'll need to adjust. At minimum, the rules file
must specify the date and amount fields. For an example, see Cookbook:
convert CSV files.
To learn about exporting CSV, see CSV output. Converting CSV to transactions requires some special conversion rules.
These do several things:
o they describe the layout and format of the CSV data
o they can customize the generated journal entries using a simple tem-
plating language
o they can add refinements based on patterns in the CSV data, eg cate-
gorizing transactions with more detailed account names.
When reading a CSV file named FILE.csv, hledger looks for a conversion
rules file named FILE.csv.rules in the same directory. You can over-
ride 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:
fields date, _, _, amount
date-format %d/%m/%Y
skip 1
A more complete example:
# 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"
# skip one header line
skip 1
# name the csv fields (and assign the transaction's date, amount and code)
fields date, _, toorfrom, name, amzstatus, amount, fees, code
# how to parse the date
date-format %b %-d, %Y
# combine two fields to make the description
description %toorfrom %name
# save these fields as tags
comment status:%amzstatus, fees:%fees
# set the base account for all transactions
account1 assets:amazon
# flip the sign on the amount
amount -%amount
For more examples, see Convert CSV files.
CSV RULES CSV RULES
The following seven kinds of rule can appear in the rules file, in any The following seven kinds of rule can appear in the rules file, in any
@ -126,59 +175,59 @@ CSV RULES
newest-first newest-first
newest-first newest-first
Consider adding this rule if all of the following are true: you might 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 be processing just one day of data, your CSV records are in reverse
chronological order (newest first), and you care about preserving the chronological order (newest first), and you care about preserving the
order of same-day transactions. It usually isn't needed, because order of same-day transactions. It usually isn't needed, because
hledger autodetects the CSV order, but when all CSV records have the hledger autodetects the CSV order, but when all CSV records have the
same date it will assume they are oldest first. same date it will assume they are oldest first.
CSV TIPS CSV TIPS
CSV ordering CSV ordering
The generated journal entries will be sorted by date. The order of The generated journal entries will be sorted by date. The order of
same-day entries will be preserved (except in the special case where same-day entries will be preserved (except in the special case where
you might need newest-first, see above). you might need newest-first, see above).
CSV accounts 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 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. the account whose CSV we are reading.
CSV amounts CSV amounts
The amount field sets the amount of the account1 posting. The amount field sets the amount of the account1 posting.
If the CSV has debit/credit amounts in separate fields, assign to the 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 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 value will be used, with appropriate sign. If both contain a value, it
may not work so well.) may not work so well.)
If an amount value is parenthesised, it will be de-parenthesised and If an amount value is parenthesised, it will be de-parenthesised and
sign-flipped. sign-flipped.
If an amount value begins with a double minus sign, those will cancel If an amount value begins with a double minus sign, those will cancel
out and be removed. out and be removed.
If the CSV has the currency symbol in a separate field, assign that to 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 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 can use a field assignment to amount that interpolates both CSV fields
(giving more control, eg to put the currency symbol on the right). (giving more control, eg to put the currency symbol on the right).
CSV balance assertions CSV balance assertions
If the CSV includes a running balance, you can assign that to the bal- 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 ance pseudo field; whenever the running balance value is non-empty, it
will be asserted as the balance after the account1 posting. will be asserted as the balance after the account1 posting.
Reading multiple CSV files Reading multiple CSV files
You can read multiple CSV files at once using multiple -f arguments on You can read multiple CSV files at once using multiple -f arguments on
the command line, and hledger will look for a correspondingly-named 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 for each. Note if you use the --rules-file option, this one
rules file will be used for all the CSV files being read. rules file will be used for all the CSV files being read.
REPORTING BUGS REPORTING BUGS
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
or hledger mail list) or hledger mail list)
@ -192,7 +241,7 @@ COPYRIGHT
SEE ALSO 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- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1) dot(5), ledger(1)

View File

@ -384,7 +384,26 @@ digit groups (thousands, or any other grouping) can be separated by
commas (in which case period is used for decimal point) or periods (in commas (in which case period is used for decimal point) or periods (in
which case comma is used for decimal point) which case comma is used for decimal point)
.PP .PP
You can use any of these variations when recording data, but when 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.
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
to resolve that ambiguity differently:
.IP
.nf
\f[C]
commodity\ $1,000.00
2017/12/25\ New\ life\ of\ Scrooge
\ \ \ \ expenses:gifts\ \ $1,000
\ \ \ \ assets
\f[]
.fi
.PP
Though journal may contain mixed styles to represent amount, when
hledger displays amounts, it will choose a consistent format for each hledger displays amounts, it will choose a consistent format for each
commodity. commodity.
(Except for price amounts, which are always formatted as written). (Except for price amounts, which are always formatted as written).
@ -716,9 +735,9 @@ P\ 2010/1/1\ €\ $1.40
.SS Comments .SS Comments
.PP .PP
Lines in the journal beginning with a semicolon (\f[C];\f[]) or hash Lines in the journal beginning with a semicolon (\f[C];\f[]) or hash
(\f[C]#\f[]) or asterisk (\f[C]*\f[]) are comments, and will be ignored. (\f[C]#\f[]) or star (\f[C]*\f[]) are comments, and will be ignored.
(Asterisk comments make it easy to treat your journal like an org\-mode (Star comments cause org\-mode nodes to be ignored, allowing emacs users
outline in emacs.) to fold and navigate their journals with org\-mode or orgstruct\-mode.)
.PP .PP
Also, anything between \f[C]comment\f[] and \f[C]end\ comment\f[] Also, anything between \f[C]comment\f[] and \f[C]end\ comment\f[]
directives is a (multi\-line) comment. directives is a (multi\-line) comment.
@ -730,20 +749,22 @@ description and/or indented on the following lines (before the
postings). postings).
Similarly, you can attach comments to an individual posting by writing Similarly, you can attach comments to an individual posting by writing
them after the amount and/or indented on the following lines. them after the amount and/or indented on the following lines.
Transaction and posting comments must begin with a semicolon
(\f[C];\f[]).
.PP .PP
Some examples: Some examples:
.IP .IP
.nf .nf
\f[C] \f[C]
#\ a\ journal\ comment #\ a\ file\ comment
;\ also\ a\ journal\ comment ;\ also\ a\ file\ comment
comment comment
This\ is\ a\ multiline\ comment, This\ is\ a\ multiline\ file\ comment,
which\ continues\ until\ a\ line which\ continues\ until\ a\ line
where\ the\ "end\ comment"\ string where\ the\ "end\ comment"\ string
appears\ on\ its\ own. appears\ on\ its\ own\ (or\ end\ of\ file).
end\ comment end\ comment
2012/5/14\ something\ \ ;\ a\ transaction\ comment 2012/5/14\ something\ \ ;\ a\ transaction\ comment
@ -752,7 +773,7 @@ end\ comment
\ \ \ \ posting2 \ \ \ \ posting2
\ \ \ \ ;\ a\ comment\ for\ posting\ 2 \ \ \ \ ;\ a\ comment\ for\ posting\ 2
\ \ \ \ ;\ another\ comment\ line\ for\ posting\ 2 \ \ \ \ ;\ another\ comment\ line\ for\ posting\ 2
;\ a\ journal\ comment\ (because\ not\ indented) ;\ a\ file\ comment\ (because\ not\ indented)
\f[] \f[]
.fi .fi
.SS Tags .SS Tags
@ -1038,7 +1059,7 @@ commodity\-less amounts, or until the next D directive.
D\ $1,000.00 D\ $1,000.00
1/1 1/1
\ \ a\ \ \ \ \ 5\ \ \ \ #\ <\-\ commodity\-less\ amount,\ becomes\ $1 \ \ a\ \ \ \ \ 5\ \ \ \ ;\ <\-\ commodity\-less\ amount,\ becomes\ $1
\ \ b \ \ b
\f[] \f[]
.fi .fi

View File

@ -1,4 +1,4 @@
This is hledger_journal.5.info, produced by makeinfo version 6.1 from This is hledger_journal.5.info, produced by makeinfo version 6.0 from
stdin. stdin.
 
@ -361,7 +361,20 @@ commodity name. Some examples:
commas (in which case period is used for decimal point) or periods commas (in which case period is used for decimal point) or periods
(in which case comma is used for decimal point) (in which case comma is used for decimal point)
You can use any of these variations when recording data, but when 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
decimals. On the other hand commodity format declared prior to that
line will help to resolve that ambiguity differently:
commodity $1,000.00
2017/12/25 New life of Scrooge
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 hledger displays amounts, it will choose a consistent format for each
commodity. (Except for price amounts, which are always formatted as commodity. (Except for price amounts, which are always formatted as
written). The display format is chosen as follows: written). The display format is chosen as follows:
@ -684,8 +697,9 @@ File: hledger_journal.5.info, Node: Comments, Next: Tags, Prev: Prices, Up:
============= =============
Lines in the journal beginning with a semicolon (';') or hash ('#') or Lines in the journal beginning with a semicolon (';') or hash ('#') or
asterisk ('*') are comments, and will be ignored. (Asterisk comments star ('*') are comments, and will be ignored. (Star comments cause
make it easy to treat your journal like an org-mode outline in emacs.) org-mode nodes to be ignored, allowing emacs users to fold and navigate
their journals with org-mode or orgstruct-mode.)
Also, anything between 'comment' and 'end comment' directives is a Also, anything between 'comment' and 'end comment' directives is a
(multi-line) comment. If there is no 'end comment', the comment extends (multi-line) comment. If there is no 'end comment', the comment extends
@ -695,18 +709,19 @@ to the end of the file.
description and/or indented on the following lines (before the description and/or indented on the following lines (before the
postings). Similarly, you can attach comments to an individual posting postings). Similarly, you can attach comments to an individual posting
by writing them after the amount and/or indented on the following lines. by writing them after the amount and/or indented on the following lines.
Transaction and posting comments must begin with a semicolon (';').
Some examples: Some examples:
# a journal comment # a file comment
; also a journal comment ; also a file comment
comment comment
This is a multiline comment, This is a multiline file comment,
which continues until a line which continues until a line
where the "end comment" string where the "end comment" string
appears on its own. appears on its own (or end of file).
end comment end comment
2012/5/14 something ; a transaction comment 2012/5/14 something ; a transaction comment
@ -715,7 +730,7 @@ end comment
posting2 posting2
; a comment for posting 2 ; a comment for posting 2
; another comment line for posting 2 ; another comment line for posting 2
; a journal comment (because not indented) ; a file comment (because not indented)
 
File: hledger_journal.5.info, Node: Tags, Next: Directives, Prev: Comments, Up: FILE FORMAT File: hledger_journal.5.info, Node: Tags, Next: Directives, Prev: Comments, Up: FILE FORMAT
@ -992,7 +1007,7 @@ amounts, or until the next D directive.
D $1,000.00 D $1,000.00
1/1 1/1
a 5 # <- commodity-less amount, becomes $1 a 5 ; <- commodity-less amount, becomes $1
b b
 
@ -1087,61 +1102,61 @@ Node: Account names11207
Ref: #account-names11352 Ref: #account-names11352
Node: Amounts11839 Node: Amounts11839
Ref: #amounts11977 Ref: #amounts11977
Node: Virtual Postings14078 Node: Virtual Postings14568
Ref: #virtual-postings14239 Ref: #virtual-postings14729
Node: Balance Assertions15459 Node: Balance Assertions15949
Ref: #balance-assertions15636 Ref: #balance-assertions16126
Node: Assertions and ordering16532 Node: Assertions and ordering17022
Ref: #assertions-and-ordering16720 Ref: #assertions-and-ordering17210
Node: Assertions and included files17420 Node: Assertions and included files17910
Ref: #assertions-and-included-files17663 Ref: #assertions-and-included-files18153
Node: Assertions and multiple -f options17996 Node: Assertions and multiple -f options18486
Ref: #assertions-and-multiple--f-options18252 Ref: #assertions-and-multiple--f-options18742
Node: Assertions and commodities18384 Node: Assertions and commodities18874
Ref: #assertions-and-commodities18621 Ref: #assertions-and-commodities19111
Node: Assertions and subaccounts19317 Node: Assertions and subaccounts19807
Ref: #assertions-and-subaccounts19551 Ref: #assertions-and-subaccounts20041
Node: Assertions and virtual postings20072 Node: Assertions and virtual postings20562
Ref: #assertions-and-virtual-postings20281 Ref: #assertions-and-virtual-postings20771
Node: Balance Assignments20423 Node: Balance Assignments20913
Ref: #balance-assignments20594 Ref: #balance-assignments21084
Node: Prices21713 Node: Prices22203
Ref: #prices21848 Ref: #prices22338
Node: Transaction prices21899 Node: Transaction prices22389
Ref: #transaction-prices22046 Ref: #transaction-prices22536
Node: Market prices24202 Node: Market prices24692
Ref: #market-prices24339 Ref: #market-prices24829
Node: Comments25299 Node: Comments25789
Ref: #comments25423 Ref: #comments25913
Node: Tags26536 Node: Tags27155
Ref: #tags26656 Ref: #tags27275
Node: Directives28058 Node: Directives28677
Ref: #directives28173 Ref: #directives28792
Node: Account aliases28366 Node: Account aliases28985
Ref: #account-aliases28512 Ref: #account-aliases29131
Node: Basic aliases29116 Node: Basic aliases29735
Ref: #basic-aliases29261 Ref: #basic-aliases29880
Node: Regex aliases29951 Node: Regex aliases30570
Ref: #regex-aliases30121 Ref: #regex-aliases30740
Node: Multiple aliases30839 Node: Multiple aliases31458
Ref: #multiple-aliases31013 Ref: #multiple-aliases31632
Node: end aliases31511 Node: end aliases32130
Ref: #end-aliases31653 Ref: #end-aliases32272
Node: account directive31754 Node: account directive32373
Ref: #account-directive31936 Ref: #account-directive32555
Node: apply account directive32232 Node: apply account directive32851
Ref: #apply-account-directive32430 Ref: #apply-account-directive33049
Node: Multi-line comments33089 Node: Multi-line comments33708
Ref: #multi-line-comments33281 Ref: #multi-line-comments33900
Node: commodity directive33409 Node: commodity directive34028
Ref: #commodity-directive33595 Ref: #commodity-directive34214
Node: Default commodity34467 Node: Default commodity35086
Ref: #default-commodity34642 Ref: #default-commodity35261
Node: Default year35179 Node: Default year35798
Ref: #default-year35346 Ref: #default-year35965
Node: Including other files35769 Node: Including other files36388
Ref: #including-other-files35928 Ref: #including-other-files36547
Node: EDITOR SUPPORT36325 Node: EDITOR SUPPORT36944
Ref: #editor-support36445 Ref: #editor-support37064
 
End Tag Table End Tag Table

View File

@ -7,23 +7,23 @@ NAME
Journal - hledger's default file format, representing a General Journal Journal - hledger's default file format, representing a General Journal
DESCRIPTION DESCRIPTION
hledger's usual data source is a plain text file containing journal hledger's usual data source is a plain text file containing journal
entries in hledger journal format. This file represents a standard entries in hledger journal format. This file represents a standard
accounting general journal. I use file names ending in .journal, but accounting general journal. I use file names ending in .journal, but
that's not required. The journal file contains a number of transaction that's not required. The journal file contains a number of transaction
entries, each describing a transfer of money (or any commodity) between entries, each describing a transfer of money (or any commodity) between
two or more named accounts, in a simple format readable by both hledger two or more named accounts, in a simple format readable by both hledger
and humans. and humans.
hledger's journal format is a compatible subset, mostly, of ledger's hledger's journal format is a compatible subset, mostly, of ledger's
journal format, so hledger can work with compatible ledger journal journal format, so hledger can work with compatible ledger journal
files as well. It's safe, and encouraged, to run both hledger and files as well. It's safe, and encouraged, to run both hledger and
ledger on the same journal file, eg to validate the results you're get- ledger on the same journal file, eg to validate the results you're get-
ting. ting.
You can use hledger without learning any more about this file; just use You can use hledger without learning any more about this file; just use
the add or web commands to create and update it. Many users, though, the add or web commands to create and update it. Many users, though,
also edit the journal file directly with a text editor, perhaps also edit the journal file directly with a text editor, perhaps
assisted by the helper modes for emacs or vim. assisted by the helper modes for emacs or vim.
Here's an example: Here's an example:
@ -57,73 +57,73 @@ DESCRIPTION
FILE FORMAT FILE FORMAT
Transactions Transactions
Transactions are movements of some quantity of commodities between Transactions are movements of some quantity of commodities between
named accounts. Each transaction is represented by a journal entry named accounts. Each transaction is represented by a journal entry
beginning with a simple date in column 0. This can be followed by any beginning with a simple date in column 0. This can be followed by any
of the following, separated by spaces: of the following, separated by spaces:
o (optional) a status character (empty, !, or *) o (optional) a status character (empty, !, or *)
o (optional) a transaction code (any short number or text, enclosed in o (optional) a transaction code (any short number or text, enclosed in
parentheses) parentheses)
o (optional) a transaction description (any remaining text until end of o (optional) a transaction description (any remaining text until end of
line or a semicolon) line or a semicolon)
o (optional) a transaction comment (any remaining text following a o (optional) a transaction comment (any remaining text following a
semicolon until end of line) semicolon until end of line)
Then comes zero or more (but usually at least 2) indented lines repre- Then comes zero or more (but usually at least 2) indented lines repre-
senting... senting...
Postings Postings
A posting is an addition of some amount to, or removal of some amount A posting is an addition of some amount to, or removal of some amount
from, an account. Each posting line begins with at least one space or from, an account. Each posting line begins with at least one space or
tab (2 or 4 spaces is common), followed by: tab (2 or 4 spaces is common), followed by:
o (optional) a status character (empty, !, or *), followed by a space o (optional) a status character (empty, !, or *), followed by a space
o (required) an account name (any text, optionally containing single o (required) an account name (any text, optionally containing single
spaces, until end of line or a double space) spaces, until end of line or a double space)
o (optional) two or more spaces or tabs followed by an amount. o (optional) two or more spaces or tabs followed by an amount.
Positive amounts are being added to the account, negative amounts are Positive amounts are being added to the account, negative amounts are
being removed. being removed.
The amounts within a transaction must always sum up to zero. As a con- The amounts within a transaction must always sum up to zero. As a con-
venience, one amount may be left blank; it will be inferred so as to venience, one amount may be left blank; it will be inferred so as to
balance the transaction. balance the transaction.
Be sure to note the unusual two-space delimiter between account name Be sure to note the unusual two-space delimiter between account name
and amount. This makes it easy to write account names containing spa- and amount. This makes it easy to write account names containing spa-
ces. But if you accidentally leave only one space (or tab) before the ces. But if you accidentally leave only one space (or tab) before the
amount, the amount will be considered part of the account name. amount, the amount will be considered part of the account name.
Dates Dates
Simple dates Simple dates
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 Leading zeros are optional. The year may be omitted, in which case it
will be inferred from the context - the current transaction, the will be inferred from the context - the current transaction, the
default year set with a default year directive, or the current date default year set with a default year directive, or the current date
when the command is run. Some examples: 2010/01/31, 1/31, 2010-01-31, when the command is run. Some examples: 2010/01/31, 1/31, 2010-01-31,
2010.1.31. 2010.1.31.
Secondary dates Secondary dates
Real-life transactions sometimes involve more than one date - eg the Real-life transactions sometimes involve more than one date - eg the
date you write a cheque, and the date it clears in your bank. When you 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 want to model this, eg for more accurate balances, you can specify
individual posting dates, which I recommend. Or, you can use the sec- individual posting dates, which I recommend. Or, you can use the sec-
ondary dates (aka auxiliary/effective dates) feature, supported for ondary dates (aka auxiliary/effective dates) feature, supported for
compatibility with Ledger. compatibility with Ledger.
A secondary date can be written after the primary date, separated by an 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 equals sign. The primary date, on the left, is used by default; the
secondary date, on the right, is used when the --date2 flag is speci- secondary date, on the right, is used when the --date2 flag is speci-
fied (--aux-date or --effective also work). fied (--aux-date or --effective also work).
The meaning of secondary dates is up to you, but it's best to follow a The meaning of secondary dates is up to you, but it's best to follow a
consistent rule. Eg write the bank's clearing date as primary, and consistent rule. Eg write the bank's clearing date as primary, and
when needed, the date the transaction was initiated as secondary. when needed, the date the transaction was initiated as secondary.
Here's an example. Note that a secondary date will use the year of the Here's an example. Note that a secondary date will use the year of the
@ -139,18 +139,18 @@ FILE FORMAT
$ hledger register checking --date2 $ hledger register checking --date2
2010/02/19 movie ticket assets:checking $-10 $-10 2010/02/19 movie ticket assets:checking $-10 $-10
Secondary dates require some effort; you must use them consistently in Secondary dates require some effort; you must use them consistently in
your journal entries and remember whether to use or not use the --date2 your journal entries and remember whether to use or not use the --date2
flag for your reports. They are included in hledger for Ledger compat- flag for your reports. They are included in hledger for Ledger compat-
ibility, but posting dates are a more powerful and less confusing ibility, but posting dates are a more powerful and less confusing
alternative. alternative.
Posting dates Posting dates
You can give individual postings a different date from their parent You can give individual postings a different date from their parent
transaction, by adding a posting comment containing a tag (see below) transaction, by adding a posting comment containing a tag (see below)
like date:DATE. This is probably the best way to control posting dates like date:DATE. This is probably the best way to control posting dates
precisely. Eg in this example the expense should appear in May precisely. Eg in this example the expense should appear in May
reports, and the deduction from checking should be reported on 6/1 for reports, and the deduction from checking should be reported on 6/1 for
easy bank reconciliation: easy bank reconciliation:
2015/5/30 2015/5/30
@ -163,80 +163,82 @@ FILE FORMAT
$ hledger -f t.j register checking $ hledger -f t.j register checking
2015/06/01 assets:checking $-10 $-10 2015/06/01 assets:checking $-10 $-10
DATE should be a simple date; if the year is not specified it will use DATE should be a simple date; if the year is not specified it will use
the year of the transaction's date. You can set the secondary date the year of the transaction's date. You can set the secondary date
similarly, with date2:DATE2. The date: or date2: tags must have a similarly, with date2:DATE2. The date: or date2: tags must have a
valid simple date value if they are present, eg a date: tag with no valid simple date value if they are present, eg a date: tag with no
value is not allowed. value is not allowed.
Ledger's earlier, more compact bracketed date syntax is also supported: Ledger's earlier, more compact bracketed date syntax is also supported:
[DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any [DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any
square-bracketed sequence of the 0123456789/-.= characters in this way. square-bracketed sequence of the 0123456789/-.= characters in this way.
With this syntax, DATE infers its year from the transaction and DATE2 With this syntax, DATE infers its year from the transaction and DATE2
infers its year from DATE. infers its year from DATE.
Status Status
Transactions, or individual postings within a transaction, can have a Transactions, or individual postings within a transaction, can have a
status mark, which is a single character before the transaction status mark, which is a single character before the transaction
description or posting account name, separated from it by a space, description or posting account name, separated from it by a space,
indicating one of three statuses: indicating one of three statuses:
mark status mark status
------------------ ------------------
unmarked unmarked
! pending ! pending
* cleared * cleared
When reporting, you can filter by status with the -U/--unmarked, When reporting, you can filter by status with the -U/--unmarked,
-P/--pending, and -C/--cleared flags; or the status:, status:!, and -P/--pending, and -C/--cleared flags; or the status:, status:!, and
status:* queries; or the U, P, C keys in hledger-ui. status:* queries; or the U, P, C keys in hledger-ui.
Note, in Ledger and in older versions of hledger, the "unmarked" state Note, in Ledger and in older versions of hledger, the "unmarked" state
is called "uncleared". As of hledger 1.3 we have renamed it to is called "uncleared". As of hledger 1.3 we have renamed it to
unmarked for clarity. unmarked for clarity.
To replicate Ledger and old hledger's behaviour of also matching pend- To replicate Ledger and old hledger's behaviour of also matching pend-
ing, combine -U and -P. ing, combine -U and -P.
Status marks are optional, but can be helpful eg for reconciling with Status marks are optional, but can be helpful eg for reconciling with
real-world accounts. Some editor modes provide highlighting and short- real-world accounts. Some editor modes provide highlighting and short-
cuts for working with status. Eg in Emacs ledger-mode, you can toggle cuts for working with status. Eg in Emacs ledger-mode, you can toggle
transaction status with C-c C-e, or posting status with C-c C-c. transaction status with C-c C-e, or posting status with C-c C-c.
What "uncleared", "pending", and "cleared" actually mean is up to you. What "uncleared", "pending", and "cleared" actually mean is up to you.
Here's one suggestion: Here's one suggestion:
status meaning status meaning
-------------------------------------------------------------------------- --------------------------------------------------------------------------
uncleared recorded but not yet reconciled; needs review uncleared recorded but not yet reconciled; needs review
pending tentatively reconciled (if needed, eg during a big recon- pending tentatively reconciled (if needed, eg during a big recon-
ciliation) ciliation)
cleared complete, reconciled as far as possible, and considered cleared complete, reconciled as far as possible, and considered
correct correct
With this scheme, you would use -PC to see the current balance at your With this scheme, you would use -PC to see the current balance at your
bank, -U to see things which will probably hit your bank soon (like bank, -U 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 uncashed checks), and no flags to see the most up-to-date state of your
finances. finances.
Description Description
A transaction's description is the rest of the line following the date A transaction's description is the rest of the line following the date
and status mark (or until a comment begins). Sometimes called the and status mark (or until a comment begins). Sometimes called the
"narration" in traditional bookkeeping, it can be used for whatever you "narration" in traditional bookkeeping, it can be used for whatever you
wish, or left blank. Transaction descriptions can be queried, unlike wish, or left blank. Transaction descriptions can be queried, unlike
comments. comments.
Payee and note Payee and note
You can optionally include a | (pipe) character in a description to You can optionally include a | (pipe) character in a description to
subdivide it into a payee/payer name on the left and additional notes 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 on the right. This may be worthwhile if you need to do more precise
querying and pivoting by payee. querying and pivoting by payee.
Account names Account names
Account names typically have several parts separated by a full colon, Account names typically have several parts separated by a full colon,
from which hledger derives a hierarchical chart of accounts. They can from which hledger derives a hierarchical chart of accounts. They can
be anything you like, but in finance there are traditionally five be anything you like, but in finance there are traditionally five
top-level accounts: assets, liabilities, income, expenses, and equity. top-level accounts: assets, liabilities, income, expenses, and equity.
Account names may contain single spaces, eg: assets:accounts receiv- Account names may contain single spaces, eg: assets:accounts receiv-
able. Because of this, they must always be followed by two or more able. Because of this, they must always be followed by two or more
@ -276,9 +278,22 @@ FILE FORMAT
commas (in which case period is used for decimal point) or periods commas (in which case period is used for decimal point) or periods
(in which case comma is used for decimal point) (in which case comma is used for decimal point)
You can use any of these variations when recording data, but when You can use any of these variations when recording data. However,
hledger displays amounts, it will choose a consistent format for each there is some ambiguous way of representing numbers like $1.000 and
commodity. (Except for price amounts, which are always formatted as $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
2017/12/25 New life of Scrooge
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
written). The display format is chosen as follows: written). The display format is chosen as follows:
o if there is a commodity directive specifying the format, that is used o if there is a commodity directive specifying the format, that is used
@ -521,30 +536,32 @@ FILE FORMAT
P 2010/1/1 $1.40 P 2010/1/1 $1.40
Comments Comments
Lines in the journal beginning with a semicolon (;) or hash (#) or Lines in the journal beginning with a semicolon (;) or hash (#) or star
asterisk (*) are comments, and will be ignored. (Asterisk comments (*) are comments, and will be ignored. (Star comments cause org-mode
make it easy to treat your journal like an org-mode outline in emacs.) nodes to be ignored, allowing emacs users to fold and navigate their
journals with org-mode or orgstruct-mode.)
Also, anything between comment and end comment directives is a Also, anything between comment and end comment directives is a
(multi-line) comment. If there is no end comment, the comment extends (multi-line) comment. If there is no end comment, the comment extends
to the end of the file. to the end of the file.
You can attach comments to a transaction by writing them after the You can attach comments to a transaction by writing them after the
description and/or indented on the following lines (before the post- description and/or indented on the following lines (before the post-
ings). Similarly, you can attach comments to an individual posting by ings). Similarly, you can attach comments to an individual posting by
writing them after the amount and/or indented on the following lines. writing them after the amount and/or indented on the following lines.
Transaction and posting comments must begin with a semicolon (;).
Some examples: Some examples:
# a journal comment # a file comment
; also a journal comment ; also a file comment
comment comment
This is a multiline comment, This is a multiline file comment,
which continues until a line which continues until a line
where the "end comment" string where the "end comment" string
appears on its own. appears on its own (or end of file).
end comment end comment
2012/5/14 something ; a transaction comment 2012/5/14 something ; a transaction comment
@ -553,7 +570,7 @@ FILE FORMAT
posting2 posting2
; a comment for posting 2 ; a comment for posting 2
; another comment line for posting 2 ; another comment line for posting 2
; a journal comment (because not indented) ; a file comment (because not indented)
Tags 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
@ -623,54 +640,54 @@ FILE FORMAT
Or, you can use the --alias 'OLD=NEW' option on the command line. This 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. affects all entries. It's useful for trying out aliases interactively.
OLD and NEW are full account names. hledger will replace any occur- OLD and NEW are full account names. hledger will replace any occur-
rence of the old account name with the new one. Subaccounts are also rence of the old account name with the new one. Subaccounts are also
affected. Eg: affected. Eg:
alias checking = assets:bank:wells fargo:checking 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" # rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"
Regex aliases 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: indicated by the forward slashes:
alias /REGEX/ = REPLACEMENT alias /REGEX/ = REPLACEMENT
or --alias '/REGEX/=REPLACEMENT'. or --alias '/REGEX/=REPLACEMENT'.
REGEX is a case-insensitive regular expression. Anywhere it matches REGEX is a case-insensitive regular expression. Anywhere it matches
inside an account name, the matched part will be replaced by REPLACE- inside an account name, the matched part will be replaced by REPLACE-
MENT. If REGEX contains parenthesised match groups, these can be ref- MENT. If REGEX contains parenthesised match groups, these can be ref-
erenced by the usual numeric backreferences in REPLACEMENT. Eg: erenced by the usual numeric backreferences in REPLACEMENT. Eg:
alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3 alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3
# rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking" # rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"
Also note that REPLACEMENT continues to the end of line (or on command 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- line, to end of option argument), so it can contain trailing white-
space. space.
Multiple aliases Multiple aliases
You can define as many aliases as you like using directives or com- You can define as many aliases as you like using directives or com-
mand-line options. Aliases are recursive - each alias sees the result mand-line options. Aliases are recursive - each alias sees the result
of applying previous ones. (This is different from Ledger, where of applying previous ones. (This is different from Ledger, where
aliases are non-recursive by default). Aliases are applied in the fol- aliases are non-recursive by default). Aliases are applied in the fol-
lowing order: lowing 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) precedence over earlier ones; directives not yet seen are ignored)
2. alias options, in the order they appear on the command line 2. alias options, in the order they appear on the command line
end aliases end aliases
You can clear (forget) all currently defined aliases with the You can clear (forget) all currently defined aliases with the
end aliases directive: end aliases directive:
end aliases end aliases
account directive account directive
The account directive predefines account names, as in Ledger and Bean- The account directive predefines account names, as in Ledger and Bean-
count. This may be useful for your own documentation; hledger doesn't count. This may be useful for your own documentation; hledger doesn't
make use of it yet. make use of it yet.
; account ACCT ; account ACCT
@ -685,8 +702,8 @@ FILE FORMAT
; etc. ; etc.
apply account directive apply account directive
You can specify a parent account which will be prepended to all You can specify a parent account which will be prepended to all
accounts within a section of the journal. Use the apply account and accounts within a section of the journal. Use the apply account and
end apply account directives like so: end apply account directives like so:
apply account home apply account home
@ -703,7 +720,7 @@ FILE FORMAT
home:food $10 home:food $10
home:cash $-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: file. Included files are also affected, eg:
apply account business apply account business
@ -712,16 +729,16 @@ FILE FORMAT
apply account personal apply account personal
include personal.journal 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. ported.
Multi-line comments Multi-line comments
A line containing just comment starts a multi-line comment, and a line A line containing just comment starts a multi-line comment, and a line
containing just end comment ends it. See comments. containing just end comment ends it. See comments.
commodity directive commodity directive
The commodity directive predefines commodities (currently this is just The commodity directive predefines commodities (currently this is just
informational), and also it may define the display format for amounts informational), and also it may define the display format for amounts
in this commodity (overriding the automatically inferred format). in this commodity (overriding the automatically inferred format).
It may be written on a single line, like this: It may be written on a single line, like this:
@ -733,8 +750,8 @@ FILE FORMAT
; separating thousands with comma. ; separating thousands with comma.
commodity 1,000.0000 AAAA commodity 1,000.0000 AAAA
or on multiple lines, using the "format" subdirective. In this case or on multiple lines, using the "format" subdirective. In this case
the commodity symbol appears twice and should be the same in both the commodity symbol appears twice and should be the same in both
places: places:
; commodity SYMBOL ; commodity SYMBOL
@ -747,10 +764,10 @@ FILE FORMAT
format INR 9,99,99,999.00 format INR 9,99,99,999.00
Default commodity 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 used for amounts without a commodity symbol (ie, plain numbers). (Note
this differs from Ledger's default commodity directive.) The commodity this differs from Ledger's default commodity directive.) The commodity
and display format will be applied to all subsequent commodity-less and display format will be applied to all subsequent commodity-less
amounts, or until the next D directive. amounts, or until the next D directive.
# commodity-less amounts should be treated as dollars # commodity-less amounts should be treated as dollars
@ -758,12 +775,12 @@ FILE FORMAT
D $1,000.00 D $1,000.00
1/1 1/1
a 5 # <- commodity-less amount, becomes $1 a 5 ; <- commodity-less amount, becomes $1
b b
Default year Default year
You can set a default year to be used for subsequent dates which don't 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. specify a year. This is a line beginning with Y followed by the year.
Eg: Eg:
Y2009 ; set default year to 2009 Y2009 ; set default year to 2009
@ -783,26 +800,27 @@ FILE FORMAT
assets assets
Including other files Including other files
You can pull in the content of additional journal files by writing an You can pull in the content of additional journal files by writing an
include directive, like this: include directive, like this:
include path/to/file.journal include path/to/file.journal
If the path does not begin with a slash, it is relative to the current If the path does not begin with a slash, it is relative to the current
file. Glob patterns (*) are not currently supported. file. Glob patterns (*) are not currently supported.
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. include journal, timeclock or timedot files, but not CSV files.
EDITOR SUPPORT EDITOR SUPPORT
Add-on modes exist for various text editors, to make working with jour- Add-on modes exist for various text editors, to make working with jour-
nal files easier. They add colour, navigation aids and helpful com- nal files easier. They add colour, navigation aids and helpful com-
mands. For hledger users who edit the journal file directly (the mands. For hledger users who edit the journal file directly (the
majority), using one of these modes is quite recommended. majority), using one of these modes is quite recommended.
These were written with Ledger in mind, but also work with hledger These were written with Ledger in mind, but also work with hledger
files: files:
Emacs http://www.ledger-cli.org/3.0/doc/ledger-mode.html Emacs http://www.ledger-cli.org/3.0/doc/ledger-mode.html
Vim https://github.com/ledger/ledger/wiki/Get- Vim https://github.com/ledger/ledger/wiki/Get-
ting-started ting-started
@ -818,7 +836,7 @@ EDITOR SUPPORT
REPORTING BUGS REPORTING BUGS
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
or hledger mail list) or hledger mail list)
@ -832,7 +850,7 @@ COPYRIGHT
SEE ALSO 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- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1) dot(5), ledger(1)

View File

@ -1,4 +1,4 @@
This is hledger_timeclock.5.info, produced by makeinfo version 6.1 from This is hledger_timeclock.5.info, produced by makeinfo version 6.0 from
stdin. stdin.
 

View File

@ -7,11 +7,11 @@ NAME
Timeclock - the time logging format of timeclock.el, as read by hledger Timeclock - the time logging format of timeclock.el, as read by hledger
DESCRIPTION DESCRIPTION
hledger can read timeclock files. As with Ledger, these are (a subset 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 of) timeclock.el's format, containing clock-in and clock-out entries as
in the example below. The date is a simple date. The time format is in the example below. The date is a simple date. The time format is
HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. The timezone, HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. The timezone,
if present, must be four digits and is ignored (currently the time is if present, must be four digits and is ignored (currently the time is
always interpreted as a local time). always interpreted as a local time).
i 2015/03/30 09:00:00 some:account name optional description after two spaces i 2015/03/30 09:00:00 some:account name optional description after two spaces
@ -19,9 +19,9 @@ DESCRIPTION
i 2015/03/31 22:21:45 another account i 2015/03/31 22:21:45 another account
o 2015/04/01 02:00:34 o 2015/04/01 02:00:34
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 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 one day, it is split into several transactions, one for each day. For
the above time log, hledger print generates these journal entries: the above time log, hledger print generates these journal entries:
$ hledger -f t.timeclock print $ hledger -f t.timeclock print
@ -42,7 +42,7 @@ DESCRIPTION
To generate time logs, ie to clock in and clock out, you could: 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- o use emacs and the built-in timeclock.el, or the extended time-
clock-x.el and perhaps the extras in ledgerutils.el clock-x.el and perhaps the extras in ledgerutils.el
o at the command line, use these bash aliases: o at the command line, use these bash aliases:
@ -51,13 +51,13 @@ DESCRIPTION
alias to="echo o `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 o or use the old ti and to scripts in the ledger 2.x repository. These
rely on a "timeclock" executable which I think is just the ledger 2 rely on a "timeclock" executable which I think is just the ledger 2
executable renamed. executable renamed.
REPORTING BUGS REPORTING BUGS
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
or hledger mail list) or hledger mail list)
@ -71,7 +71,7 @@ COPYRIGHT
SEE ALSO 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- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1) dot(5), ledger(1)

View File

@ -1,4 +1,4 @@
This is hledger_timedot.5.info, produced by makeinfo version 6.1 from This is hledger_timedot.5.info, produced by makeinfo version 6.0 from
stdin. stdin.
 

View File

@ -272,6 +272,11 @@ troubleshooting.
updated file. updated file.
This allows some basic data entry. This allows some basic data entry.
.PP .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
$PATH.
.PP
\f[C]E\f[] runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default \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]emacsclient\ \-a\ ""\ \-nw\f[]) on the journal file.
With some editors (emacs, vi), the cursor will be positioned at the With some editors (emacs, vi), the cursor will be positioned at the

View File

@ -1,4 +1,4 @@
This is hledger-ui.1.info, produced by makeinfo version 6.1 from stdin. This is hledger-ui.1.info, produced by makeinfo version 6.0 from stdin.
 
File: hledger-ui.1.info, Node: Top, Next: OPTIONS, Up: (dir) File: hledger-ui.1.info, Node: Top, Next: OPTIONS, Up: (dir)
@ -207,6 +207,10 @@ temporarily can be useful for troubleshooting.
'a' runs command-line hledger's add command, and reloads the updated 'a' runs command-line hledger's add command, and reloads the updated
file. This allows some basic data entry. 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
installed in $PATH.
'E' runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default ('emacsclient 'E' runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default ('emacsclient
-a "" -nw') on the journal file. With some editors (emacs, vi), the -a "" -nw') on the journal file. With some editors (emacs, vi), the
cursor will be positioned at the current transaction when invoked from cursor will be positioned at the current transaction when invoked from
@ -369,15 +373,15 @@ Node: OPTIONS825
Ref: #options924 Ref: #options924
Node: KEYS3861 Node: KEYS3861
Ref: #keys3958 Ref: #keys3958
Node: SCREENS6754 Node: SCREENS6917
Ref: #screens6841 Ref: #screens7004
Node: Accounts screen6931 Node: Accounts screen7094
Ref: #accounts-screen7061 Ref: #accounts-screen7224
Node: Register screen9291 Node: Register screen9454
Ref: #register-screen9448 Ref: #register-screen9611
Node: Transaction screen11522 Node: Transaction screen11685
Ref: #transaction-screen11682 Ref: #transaction-screen11845
Node: Error screen12552 Node: Error screen12715
Ref: #error-screen12676 Ref: #error-screen12839
 
End Tag Table End Tag Table

View File

@ -195,6 +195,10 @@ KEYS
a runs command-line hledger's add command, and reloads the updated a runs command-line hledger's add command, and reloads the updated
file. This allows some basic data entry. 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
installed in $PATH.
E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac- E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac-
sclient -a "" -nw) on the journal file. With some editors (emacs, vi), sclient -a "" -nw) on the journal file. With some editors (emacs, vi),
the cursor will be positioned at the current transaction when invoked the cursor will be positioned at the current transaction when invoked

View File

@ -1,4 +1,4 @@
This is hledger-web.1.info, produced by makeinfo version 6.1 from stdin. This is hledger-web.1.info, produced by makeinfo version 6.0 from stdin.
 
File: hledger-web.1.info, Node: Top, Next: OPTIONS, Up: (dir) File: hledger-web.1.info, Node: Top, Next: OPTIONS, Up: (dir)

View File

@ -57,22 +57,22 @@ DESCRIPTION
With --file-url you can set a different base url for static files, eg With --file-url you can set a different base url for static files, eg
for better caching or cookie-less serving on high performance websites. for better caching or cookie-less serving on high performance websites.
Note there is no built-in access control (aside from listening on Note there is no built-in access control (aside from listening on
127.0.0.1 by default). So you will need to hide hledger-web behind an 127.0.0.1 by default). So you will need to hide hledger-web behind an
authenticating proxy (such as apache or nginx) if you want to restrict authenticating proxy (such as apache or nginx) if you want to restrict
who can see and add entries to your journal. who can see and add entries to your journal.
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. This is not shown in the web UI, but it will be applied on the data. This is not shown in the web UI, but it will be applied
in addition to any search query entered there. in addition to any search query entered there.
With journal and timeclock files (but not CSV files, currently) the web With journal and timeclock files (but not CSV files, currently) the web
app detects changes made by other means and will show the new data on app detects changes made by other means and will show the new data on
the next request. If a change makes the file unparseable, hledger-web the next request. If a change makes the file unparseable, hledger-web
will show an error until the file has been fixed. will show an error until the file has been fixed.
OPTIONS OPTIONS
Note: if invoking hledger-web as a hledger subcommand, write -- before Note: if invoking hledger-web as a hledger subcommand, write -- before
options as shown above. options as shown above.
--serve --serve
@ -85,14 +85,14 @@ OPTIONS
listen on this TCP port (default: 5000) listen on this TCP port (default: 5000)
--base-url=URL --base-url=URL
set the base url (default: http://IPADDR:PORT). You would set the base url (default: http://IPADDR:PORT). You would
change this when sharing over the network, or integrating within change this when sharing over the network, or integrating within
a larger website. a larger website.
--file-url=URL --file-url=URL
set the static files url (default: BASEURL/static). hledger-web set the static files url (default: BASEURL/static). hledger-web
normally serves static files itself, but if you wanted to serve normally serves static files itself, but if you wanted to serve
them from another server for efficiency, you would set the url them from another server for efficiency, you would set the url
with this. with this.
hledger input options: hledger input options:
@ -102,7 +102,7 @@ OPTIONS
$LEDGER_FILE or $HOME/.hledger.journal) $LEDGER_FILE or $HOME/.hledger.journal)
--rules-file=RULESFILE --rules-file=RULESFILE
Conversion rules file to use when reading CSV (default: Conversion rules file to use when reading CSV (default:
FILE.rules) FILE.rules)
--alias=OLD=NEW --alias=OLD=NEW
@ -140,11 +140,11 @@ OPTIONS
multiperiod/multicolumn report by year multiperiod/multicolumn report by year
-p --period=PERIODEXP -p --period=PERIODEXP
set start date, end date, and/or reporting interval all at once set start date, end date, and/or reporting interval all at once
(overrides the flags above) (overrides the flags above)
--date2 --date2
match the secondary date instead (see command help for other match the secondary date instead (see command help for other
effects) effects)
-U --unmarked -U --unmarked
@ -166,11 +166,11 @@ OPTIONS
show items with zero amount, normally hidden show items with zero amount, normally hidden
-B --cost -B --cost
convert amounts to their cost at transaction time (using the convert amounts to their cost at transaction time (using the
transaction price, if any) transaction price, if any)
-V --value -V --value
convert amounts to their market value on the report end date convert amounts to their market value on the report end date
(using the most recent applicable market price, if any) (using the most recent applicable market price, if any)
When a reporting option appears more than once in the command line, the When a reporting option appears more than once in the command line, the
@ -190,22 +190,22 @@ OPTIONS
show debug output (levels 1-9, default: 1) show debug output (levels 1-9, default: 1)
A @FILE argument will be expanded to the contents of FILE, which should A @FILE argument will be expanded to the contents of FILE, which should
contain one command line option/argument per line. (To prevent this, contain one command line option/argument per line. (To prevent this,
insert a -- argument before.) insert a -- argument before.)
ENVIRONMENT ENVIRONMENT
LEDGER_FILE The journal file path when not specified with -f. Default: LEDGER_FILE The journal file path when not specified with -f. Default:
~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-
nal). nal).
FILES FILES
Reads data from one or more files in hledger journal, timeclock, time- Reads data from one or more files in hledger journal, timeclock, time-
dot, or CSV format specified with -f, or $LEDGER_FILE, or dot, or CSV format specified with -f, or $LEDGER_FILE, or
$HOME/.hledger.journal (on windows, perhaps $HOME/.hledger.journal (on windows, perhaps
C:/Users/USER/.hledger.journal). C:/Users/USER/.hledger.journal).
BUGS BUGS
The need to precede options with -- when invoked from hledger is awk- The need to precede options with -- when invoked from hledger is awk-
ward. ward.
-f- doesn't work (hledger-web can't read from stdin). -f- doesn't work (hledger-web can't read from stdin).
@ -219,7 +219,7 @@ BUGS
REPORTING BUGS REPORTING BUGS
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
or hledger mail list) or hledger mail list)
@ -233,7 +233,7 @@ COPYRIGHT
SEE ALSO 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- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1) dot(5), ledger(1)

View File

@ -721,11 +721,32 @@ T{
T} T}
.TE .TE
.PP .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,
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.
.SS For example:
.PP
\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[] \-\- starts on
2008/12/29, closest preceeding Monday
\f[C]\-p\ "monthly\ in\ 2008/11/25"\f[] \-\- starts on 2018/11/01
.PD 0
.P
.PD
\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\ "yearly\ from\ 2009\-12\-29"\f[] \- starts on
2009/01/01, first day of 2009
\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-
.PP
The following more complex report intervals are also supported: The following more complex report intervals are also supported:
\f[C]biweekly\f[], \f[C]bimonthly\f[], \f[C]biweekly\f[], \f[C]bimonthly\f[],
\f[C]every\ N\ days|weeks|months|quarters|years\f[], \f[C]every\ day|week|month|quarter|year\f[],
\f[C]every\ Nth\ day\ [of\ month]\f[], \f[C]every\ N\ days|weeks|months|quarters|years\f[].
\f[C]every\ Nth\ day\ of\ week\f[]. .PP
All of these will start on the first day of the requested period and end
on the last one, as described above.
.PP .PP
Examples: Examples:
.PP .PP
@ -733,13 +754,56 @@ Examples:
tab(@); tab(@);
l. l.
T{ T{
\f[C]\-p\ "bimonthly\ from\ 2008"\f[] \f[C]\-p\ "bimonthly\ from\ 2008"\f[] \-\- periods will have boundaries
on 2008/01/01, 2008/03/01, ...
T} T}
T{ T{
\f[C]\-p\ "every\ 2\ weeks"\f[] \f[C]\-p\ "every\ 2\ weeks"\f[] \-\- starts on closest preceeding Monday
T} T}
T{ T{
\f[C]\-p\ "every\ 5\ days\ from\ 1/3"\f[] \f[C]\-p\ "every\ 5\ month\ from\ 2009/03"\f[] \-\- periods will have
boundaries on 2009/03/01, 2009/08/01, ...
T}
.TE
.PP
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\ <weekday>\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[].
.PP
Examples:
.PP
.TS
tab(@);
l.
T{
\f[C]\-p\ "every\ 2nd\ day\ of\ week"\f[] \-\- periods will go from Tue
to Tue
T}
T{
\f[C]\-p\ "every\ Tue"\f[] \-\- same
T}
T{
\f[C]\-p\ "every\ 15th\ day"\f[] \-\- period boundaries will be on 15th
of each month
T}
T{
\f[C]\-p\ "every\ 2nd\ Monday"\f[] \-\- 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
T}
T{
\f[C]\-p\ "every\ 5th\ Nov"\f[] \-\- same
T}
T{
\f[C]\-p\ "every\ Nov\ 5th"\f[] \-\- same
T} T}
.TE .TE
.PP .PP

View File

@ -1,4 +1,4 @@
This is hledger.1.info, produced by makeinfo version 6.1 from stdin. This is hledger.1.info, produced by makeinfo version 6.0 from stdin.
 
File: hledger.1.info, Node: Top, Next: EXAMPLES, Up: (dir) File: hledger.1.info, Node: Top, Next: EXAMPLES, Up: (dir)
@ -125,6 +125,7 @@ File: hledger.1.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top
* Report start & end date:: * Report start & end date::
* Report intervals:: * Report intervals::
* Period expressions:: * Period expressions::
* For example::
* Depth limiting:: * Depth limiting::
* Pivoting:: * Pivoting::
* Cost:: * Cost::
@ -432,7 +433,7 @@ complex intervals may be specified with a period expression. Report
intervals can not be specified with a query, currently. intervals can not be specified with a query, currently.
 
File: hledger.1.info, Node: Period expressions, Next: Depth limiting, Prev: Report intervals, Up: OPTIONS File: hledger.1.info, Node: Period expressions, Next: For example, Prev: Report intervals, Up: OPTIONS
2.10 Period expressions 2.10 Period expressions
======================= =======================
@ -486,15 +487,54 @@ start/end dates (if any), the word 'in' is optional. Examples:
'-p "monthly in 2008"' '-p "monthly in 2008"'
'-p "quarterly"' '-p "quarterly"'
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 expression specifies different explicit start and end
date.

File: hledger.1.info, Node: For example, Next: Depth limiting, Prev: Period expressions, Up: OPTIONS
2.11 For example:
=================
'-p "weekly from 2009/1/1 to 2009/4/1"' - starts on 2008/12/29, closest
preceeding Monday '-p "monthly in 2008/11/25"' - starts on 2018/11/01
'-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: The following more complex report intervals are also supported:
'biweekly', 'bimonthly', 'every N days|weeks|months|quarters|years', 'biweekly', 'bimonthly', 'every day|week|month|quarter|year', 'every N
'every Nth day [of month]', 'every Nth day of week'. 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.
Examples: Examples:
'-p "bimonthly from 2008"' '-p "bimonthly from 2008"' - periods will have boundaries on 2008/01/01, 2008/03/01, ...
'-p "every 2 weeks"' '-p "every 2 weeks"' - starts on closest preceeding Monday
'-p "every 5 days from 1/3"' '-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 <weekday>', '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 will go from Tue to Tue
'-p "every Tue"' - same
'-p "every 15th day"' - period boundaries will be on 15th of each month
'-p "every 2nd Monday"' - period boundaries will be on second Monday of each month
'-p "every 11/05"' - yearly periods with boundaries on 5th of Nov
'-p "every 5th Nov"' - same
'-p "every Nov 5th"' - same
Show historical balances at end of 15th each month (N is exclusive Show historical balances at end of 15th each month (N is exclusive
end date): end date):
@ -507,9 +547,9 @@ start date and exclusive end date):
'hledger register checking -p "every 3rd day of week"' 'hledger register checking -p "every 3rd day of week"'
 
File: hledger.1.info, Node: Depth limiting, Next: Pivoting, Prev: Period expressions, Up: OPTIONS File: hledger.1.info, Node: Depth limiting, Next: Pivoting, Prev: For example, Up: OPTIONS
2.11 Depth limiting 2.12 Depth limiting
=================== ===================
With the '--depth N' option (short form: '-N'), commands like account, With the '--depth N' option (short form: '-N'), commands like account,
@ -521,7 +561,7 @@ less detail. This flag has the same effect as a 'depth:' query argument
 
File: hledger.1.info, Node: Pivoting, Next: Cost, Prev: Depth limiting, Up: OPTIONS File: hledger.1.info, Node: Pivoting, Next: Cost, Prev: Depth limiting, Up: OPTIONS
2.12 Pivoting 2.13 Pivoting
============= =============
Normally hledger sums amounts, and organizes them in a hierarchy, based Normally hledger sums amounts, and organizes them in a hierarchy, based
@ -578,7 +618,7 @@ $ hledger balance --pivot member acct:.
 
File: hledger.1.info, Node: Cost, Next: Market value, Prev: Pivoting, Up: OPTIONS File: hledger.1.info, Node: Cost, Next: Market value, Prev: Pivoting, Up: OPTIONS
2.13 Cost 2.14 Cost
========= =========
The '-B/--cost' flag converts amounts to their cost at transaction time, The '-B/--cost' flag converts amounts to their cost at transaction time,
@ -587,7 +627,7 @@ if they have a transaction price specified.
 
File: hledger.1.info, Node: Market value, Next: Regular expressions, Prev: Cost, Up: OPTIONS File: hledger.1.info, Node: Market value, Next: Regular expressions, Prev: Cost, Up: OPTIONS
2.14 Market value 2.15 Market value
================= =================
The '-V/--value' flag converts the reported amounts to their market The '-V/--value' flag converts the reported amounts to their market
@ -636,7 +676,7 @@ directives, not transaction prices (unlike Ledger).
 
File: hledger.1.info, Node: Regular expressions, Prev: Market value, Up: OPTIONS File: hledger.1.info, Node: Regular expressions, Prev: Market value, Up: OPTIONS
2.15 Regular expressions 2.16 Regular expressions
======================== ========================
hledger uses regular expressions in a number of places: hledger uses regular expressions in a number of places:
@ -2222,129 +2262,131 @@ Node: EXAMPLES1886
Ref: #examples1988 Ref: #examples1988
Node: OPTIONS3634 Node: OPTIONS3634
Ref: #options3738 Ref: #options3738
Node: General options4038 Node: General options4054
Ref: #general-options4165 Ref: #general-options4181
Node: Command options6484 Node: Command options6500
Ref: #command-options6637 Ref: #command-options6653
Node: Command arguments7035 Node: Command arguments7051
Ref: #command-arguments7191 Ref: #command-arguments7207
Node: Argument files7312 Node: Argument files7328
Ref: #argument-files7465 Ref: #argument-files7481
Node: Special characters7731 Node: Special characters7747
Ref: #special-characters7886 Ref: #special-characters7902
Node: Input files9305 Node: Input files9321
Ref: #input-files9443 Ref: #input-files9459
Node: Smart dates11406 Node: Smart dates11422
Ref: #smart-dates11549 Ref: #smart-dates11565
Node: Report start & end date12528 Node: Report start & end date12544
Ref: #report-start-end-date12700 Ref: #report-start-end-date12716
Node: Report intervals13766 Node: Report intervals13782
Ref: #report-intervals13931 Ref: #report-intervals13947
Node: Period expressions14332 Node: Period expressions14348
Ref: #period-expressions14494 Ref: #period-expressions14507
Node: Depth limiting16834 Node: For example16552
Ref: #depth-limiting16980 Ref: #for-example16697
Node: Pivoting17322 Node: Depth limiting18621
Ref: #pivoting17442 Ref: #depth-limiting18760
Node: Cost19118 Node: Pivoting19102
Ref: #cost19228 Ref: #pivoting19222
Node: Market value19346 Node: Cost20898
Ref: #market-value19483 Ref: #cost21008
Node: Regular expressions20783 Node: Market value21126
Ref: #regular-expressions20921 Ref: #market-value21263
Node: QUERIES22282 Node: Regular expressions22563
Ref: #queries22386 Ref: #regular-expressions22701
Node: COMMANDS26353 Node: QUERIES24062
Ref: #commands26467 Ref: #queries24166
Node: accounts27450 Node: COMMANDS28133
Ref: #accounts27550 Ref: #commands28247
Node: activity28543 Node: accounts29230
Ref: #activity28655 Ref: #accounts29330
Node: add29014 Node: activity30323
Ref: #add29115 Ref: #activity30435
Node: balance31773 Node: add30794
Ref: #balance31886 Ref: #add30895
Node: Flat mode35043 Node: balance33553
Ref: #flat-mode35170 Ref: #balance33666
Node: Depth limited balance reports35590 Node: Flat mode36823
Ref: #depth-limited-balance-reports35793 Ref: #flat-mode36950
Node: Multicolumn balance reports36213 Node: Depth limited balance reports37370
Ref: #multicolumn-balance-reports36424 Ref: #depth-limited-balance-reports37573
Node: Custom balance output41072 Node: Multicolumn balance reports37993
Ref: #custom-balance-output41256 Ref: #multicolumn-balance-reports38204
Node: Colour support43349 Node: Custom balance output42852
Ref: #colour-support43510 Ref: #custom-balance-output43036
Node: Output destination43683 Node: Colour support45129
Ref: #output-destination43841 Ref: #colour-support45290
Node: CSV output44111 Node: Output destination45463
Ref: #csv-output44230 Ref: #output-destination45621
Node: balancesheet44627 Node: CSV output45891
Ref: #balancesheet44765 Ref: #csv-output46010
Node: balancesheetequity46733 Node: balancesheet46407
Ref: #balancesheetequity46884 Ref: #balancesheet46545
Node: cashflow47673 Node: balancesheetequity48513
Ref: #cashflow47803 Ref: #balancesheetequity48664
Node: check-dates49715 Node: cashflow49453
Ref: #check-dates49844 Ref: #cashflow49583
Node: check-dupes49961 Node: check-dates51495
Ref: #check-dupes50088 Ref: #check-dates51624
Node: equity50225 Node: check-dupes51741
Ref: #equity50337 Ref: #check-dupes51868
Node: help50500 Node: equity52005
Ref: #help50603 Ref: #equity52117
Node: import51677 Node: help52280
Ref: #import51793 Ref: #help52383
Node: incomestatement52523 Node: import53457
Ref: #incomestatement52659 Ref: #import53573
Node: prices54612 Node: incomestatement54303
Ref: #prices54729 Ref: #incomestatement54439
Node: print54772 Node: prices56392
Ref: #print54884 Ref: #prices56509
Node: print-unique59730 Node: print56552
Ref: #print-unique59858 Ref: #print56664
Node: register59926 Node: print-unique61510
Ref: #register60055 Ref: #print-unique61638
Node: Custom register output64556 Node: register61706
Ref: #custom-register-output64687 Ref: #register61835
Node: register-match65984 Node: Custom register output66336
Ref: #register-match66120 Ref: #custom-register-output66467
Node: rewrite66303 Node: register-match67764
Ref: #rewrite66422 Ref: #register-match67900
Node: stats66491 Node: rewrite68083
Ref: #stats66596 Ref: #rewrite68202
Node: tags67477 Node: stats68271
Ref: #tags67577 Ref: #stats68376
Node: test67813 Node: tags69257
Ref: #test67899 Ref: #tags69357
Node: ADD-ON COMMANDS68267 Node: test69593
Ref: #add-on-commands68379 Ref: #test69679
Node: Official add-ons69666 Node: ADD-ON COMMANDS70047
Ref: #official-add-ons69808 Ref: #add-on-commands70159
Node: api69895 Node: Official add-ons71446
Ref: #api69986 Ref: #official-add-ons71588
Node: ui70038 Node: api71675
Ref: #ui70139 Ref: #api71766
Node: web70197 Node: ui71818
Ref: #web70288 Ref: #ui71919
Node: Third party add-ons70334 Node: web71977
Ref: #third-party-add-ons70511 Ref: #web72068
Node: diff70646 Node: Third party add-ons72114
Ref: #diff70745 Ref: #third-party-add-ons72291
Node: iadd70844 Node: diff72426
Ref: #iadd70960 Ref: #diff72525
Node: interest71043 Node: iadd72624
Ref: #interest71166 Ref: #iadd72740
Node: irr71261 Node: interest72823
Ref: #irr71361 Ref: #interest72946
Node: Experimental add-ons71439 Node: irr73041
Ref: #experimental-add-ons71593 Ref: #irr73141
Node: autosync71884 Node: Experimental add-ons73219
Ref: #autosync71998 Ref: #experimental-add-ons73373
Node: budget72237 Node: autosync73664
Ref: #budget72361 Ref: #autosync73778
Node: chart72427 Node: budget74017
Ref: #chart72546 Ref: #budget74141
Node: check72617 Node: chart74207
Ref: #check72721 Ref: #chart74326
Node: check74397
Ref: #check74501
 
End Tag Table End Tag Table

View File

@ -286,6 +286,7 @@ OPTIONS
format automatically based on the file extension, or if that is not format automatically based on the file extension, or if that is not
recognised, by trying each built-in "reader" in turn: recognised, by trying each built-in "reader" in turn:
Reader: Reads: Used for file extensions: Reader: Reads: Used for file extensions:
----------------------------------------------------------------------------- -----------------------------------------------------------------------------
journal hledger's journal format, also .journal .j .hledger journal hledger's journal format, also .journal .j .hledger
@ -323,14 +324,16 @@ OPTIONS
Examples: Examples:
2009/1/1, 2009/01/01, simple dates, several sep- 2009/1/1, 2009/01/01, simple dates, several sep-
2009-1-1, 2009.1.1 arators allowed 2009-1-1, 2009.1.1 arators allowed
2009/1, 2009 same as above - a missing 2009/1, 2009 same as above - a missing
day or month defaults to 1 day or month defaults to 1
1/1, january, jan, relative dates, meaning
this year january 1 of the current
year
1/1, january, jan, relative dates, meaning
this year january 1 of the current
year
next year january 1 of next year next year january 1 of next year
this month the 1st of the current this month the 1st of the current
month month
@ -355,6 +358,7 @@ OPTIONS
Examples: Examples:
-b 2016/3/17 begin on St. Patrick's -b 2016/3/17 begin on St. Patrick's
day 2016 day 2016
-e 12/1 end at the start of decem- -e 12/1 end at the start of decem-
@ -382,25 +386,27 @@ OPTIONS
Period expressions Period expressions
The -p/--period option accepts period expressions, a shorthand way of The -p/--period option accepts period expressions, a shorthand way of
expressing a start date, end date, and/or report interval all at once. 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. Here's a basic period expression specifying the first quarter of 2009.
Note, hledger always treats start dates as inclusive and end dates as Note, hledger always treats start dates as inclusive and end dates as
exclusive: exclusive:
-p "from 2009/1/1 to 2009/4/1" -p "from 2009/1/1 to 2009/4/1"
Keywords like "from" and "to" are optional, and so are the spaces, 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 long as you don't run two dates together. "to" can also be written as
"-". These are equivalent to the above: "-". These are equivalent to the above:
-p "2009/1/1 2009/4/1" -p "2009/1/1 2009/4/1"
-p2009/1/1to2009/4/1 -p2009/1/1to2009/4/1
-p2009/1/1-2009/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: also be written as:
-p "1/1 4/1" -p "1/1 4/1"
-p "january-apr" -p "january-apr"
-p "this year to 4/1" -p "this year to 4/1"
@ -408,43 +414,91 @@ OPTIONS
If you specify only one date, the missing start or end date will be the If you specify only one date, the missing start or end date will be the
earliest or latest transaction in your journal: earliest or latest transaction in your journal:
-p "from 2009/1/1" everything after january -p "from 2009/1/1" everything after january
1, 2009 1, 2009
-p "from 2009/1" the same -p "from 2009/1" the same
-p "from 2009" the same -p "from 2009" the same
-p "to 2009" everything before january -p "to 2009" everything before january
1, 2009 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: date like so:
-p "2009" the year 2009; equivalent
-p "2009" the year 2009; equivalent
to "2009/1/1 to 2010/1/1" 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 lent to "2009/1/1 to
2009/2/1" 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" to "2009/1/1 to 2009/1/2"
The argument of -p can also begin with, or be, a report interval The argument of -p can also begin with, or be, a report interval
expression. The basic report intervals are daily, weekly, monthly, expression. The basic report intervals are daily, weekly, monthly,
quarterly, or yearly, which have the same effect as the -D,-W,-M,-Q, or 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: word in is optional. Examples:
-p "weekly from 2009/1/1 to 2009/4/1" -p "weekly from 2009/1/1 to 2009/4/1"
-p "monthly in 2008" -p "monthly in 2008"
-p "quarterly" -p "quarterly"
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
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
preceeding Monday -p "monthly in 2008/11/25" -- starts on 2018/11/01
-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: The following more complex report intervals are also supported:
biweekly, bimonthly, every N days|weeks|months|quarters|years, biweekly, bimonthly, every day|week|month|quarter|year,
every Nth day [of month], every Nth day of week. 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.
Examples: Examples:
-p "bimonthly from 2008"
-p "every 2 weeks" -p "bimonthly from 2008" -- periods
-p "every 5 days from 1/3" 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" --
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 <weekday>, 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
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-
aries will be on second Monday of each
month
-p "every 11/05" -- yearly periods with
boundaries on 5th of Nov
-p "every 5th Nov" -- same
-p "every Nov 5th" -- same
Show historical balances at end of 15th each month (N is exclusive end Show historical balances at end of 15th each month (N is exclusive end
date): date):
@ -557,7 +611,7 @@ OPTIONS
$ hledger -f t.j bal euros -V -e 2016/12/21 $ hledger -f t.j bal euros -V -e 2016/12/21
$103.00 assets:euros $103.00 assets:euros
Currently, hledger's -V only uses market prices recorded with P direc- Currently, hledger's -V only uses market prices recorded with P direc-
tives, not transaction prices (unlike Ledger). tives, not transaction prices (unlike Ledger).
Using -B and -V together is allowed. Using -B and -V together is allowed.
@ -565,56 +619,56 @@ OPTIONS
Regular expressions Regular expressions
hledger uses regular expressions in a number of places: 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 REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX
o CSV rules conditional blocks: if 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 --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: general they:
o are case insensitive 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) matched)
o are POSIX extended regular expressions o are POSIX extended regular expressions
o also support GNU word boundaries (\<, \>, \b, \B) 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 replacement strings
o do not support mode modifiers like (?s) o do not support mode modifiers like (?s)
Some things to note: Some things to note:
o In the alias directive and --alias option, regular expressions must o In the alias directive and --alias option, regular expressions must
be enclosed in forward slashes (/REGEX/). Elsewhere in hledger, be enclosed in forward slashes (/REGEX/). Elsewhere in hledger,
these are not required. these are not required.
o In queries, to match a regular expression metacharacter like $ as a o In queries, to match a regular expression metacharacter like $ as a
literal character, prepend a backslash. Eg to search for amounts literal character, prepend a backslash. Eg to search for amounts
with the dollar sign in hledger-web, write cur:\$. 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- ing to the shell and so must be escaped at least once more. See Spe-
cial characters. cial characters.
QUERIES QUERIES
One of hledger's strengths is being able to quickly report on precise One of hledger's strengths is being able to quickly report on precise
subsets of your data. Most commands accept an optional query expres- subsets of your data. Most commands accept an optional query expres-
sion, written as arguments after the command name, to filter the data 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 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 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. the match.
We do not yet support arbitrary boolean combinations of search terms; We do not yet support arbitrary boolean combinations of search terms;
instead most commands show transactions/postings/accounts which match instead most commands show transactions/postings/accounts which match
(or negatively match): (or negatively match):
o any of the description terms AND o any of the description terms AND
@ -635,32 +689,32 @@ QUERIES
o match all the other terms. 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. also be prefixed with not:, eg to exclude a particular subaccount.
REGEX match account names by this regular expression. (No prefix is REGEX match account names by this regular expression. (No prefix is
equivalent to acct:). equivalent to acct:).
acct:REGEX acct:REGEX
same as above same as above
amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N
match postings with a single-commodity amount that is equal to, match postings with a single-commodity amount that is equal to,
less than, or greater than N. (Multi-commodity amounts are not less than, or greater than N. (Multi-commodity amounts are not
tested, and will always match.) The comparison has two modes: if 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 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. ignoring sign.
code:REGEX code:REGEX
match by transaction code (eg check number) match by transaction code (eg check number)
cur:REGEX cur:REGEX
match postings or transactions including any amounts whose cur- match postings or transactions including any amounts whose cur-
rency/commodity symbol is fully matched by REGEX. (For a par- rency/commodity symbol is fully matched by REGEX. (For a par-
tial match, use .*REGEX.*). Note, to match characters which are tial match, use .*REGEX.*). Note, to match characters which are
regex-significant, like the dollar sign ($), you need to prepend regex-significant, like the dollar sign ($), you need to prepend
\. And when using the command line you need to add one more \. And when using the command line you need to add one more
level of quoting to hide it from the shell, so eg do: level of quoting to hide it from the shell, so eg do:
hledger print cur:'\$' or hledger print cur:\\$. hledger print cur:'\$' or hledger print cur:\\$.
@ -669,20 +723,20 @@ QUERIES
date:PERIODEXPR date:PERIODEXPR
match dates within the specified period. PERIODEXPR is a period match dates within the specified period. PERIODEXPR is a period
expression (with no report interval). Examples: date:2016, expression (with no report interval). Examples: date:2016,
date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the
--date2 command line flag is present, this matches secondary --date2 command line flag is present, this matches secondary
dates instead. dates instead.
date2:PERIODEXPR date2:PERIODEXPR
match secondary dates within the specified period. match secondary dates within the specified period.
depth:N depth:N
match (or display, depending on command) accounts at or above match (or display, depending on command) accounts at or above
this depth this depth
note:REGEX 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 |) whole description when there's no |)
payee:REGEX payee:REGEX
@ -696,38 +750,38 @@ QUERIES
match unmarked, pending, or cleared transactions respectively match unmarked, pending, or cleared transactions respectively
tag:REGEX[=REGEX] tag:REGEX[=REGEX]
match by tag name, and optionally also by tag value. Note a match by tag name, and optionally also by tag value. Note a
tag: query is considered to match a transaction if it matches tag: query is considered to match a transaction if it matches
any of the postings. Also remember that postings inherit the any of the postings. Also remember that postings inherit the
tags of their parent transaction. tags of their parent transaction.
The following special search term is used automatically in hledger-web, The following special search term is used automatically in hledger-web,
only: only:
inacct:ACCTNAME 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. account. Can be filtered further with acct etc.
Some of these can also be expressed as command-line options (eg depth:2 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 is equivalent to --depth 2). Generally you can mix options and query
arguments, and the resulting query will be their intersection (perhaps arguments, and the resulting query will be their intersection (perhaps
excluding the -p/--period option). excluding the -p/--period option).
COMMANDS COMMANDS
hledger provides a number of subcommands; hledger with no arguments hledger provides a number of subcommands; hledger with no arguments
shows a list. shows a list.
If you install additional hledger-* packages, or if you put programs or 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. subcommands.
Run a subcommand by writing its name as first argument (eg Run a subcommand by writing its name as first argument (eg
hledger incomestatement). You can also write one of the standard short hledger incomestatement). You can also write one of the standard short
aliases displayed in parentheses in the command list (hledger b), or aliases displayed in parentheses in the command list (hledger b), or
any any unambiguous prefix of a command name (hledger inc). any any unambiguous prefix of a command name (hledger inc).
Here are all the builtin commands in alphabetical order. See also Here are all the builtin commands in alphabetical order. See also
hledger for a more organised command list, and hledger CMD -h for hledger for a more organised command list, and hledger CMD -h for
detailed command help. detailed command help.
accounts accounts
@ -740,14 +794,14 @@ COMMANDS
--drop=N --drop=N
in flat mode: omit N leading account name parts in flat mode: omit N leading account name parts
This command lists all account names that are in use (ie, all the This command lists all account names that are in use (ie, all the
accounts which have at least one transaction posting to them). With accounts which have at least one transaction posting to them). With
query arguments, only matched account names are shown. query arguments, only matched account names are shown.
It shows a flat list by default. With --tree, it uses indentation to It shows a flat list by default. With --tree, it uses indentation to
show the account hierarchy. show the account hierarchy.
In flat mode you can add --drop N to omit the first few account name In flat mode you can add --drop N to omit the first few account name
components. components.
Examples: Examples:
@ -790,8 +844,8 @@ COMMANDS
activity activity
Show an ascii barchart of posting counts per interval. Show an ascii barchart of posting counts per interval.
The activity command displays an ascii histogram showing transaction The activity command displays an ascii histogram showing transaction
counts by day, week, month or other reporting interval (by day is the counts by day, week, month or other reporting interval (by day is the
default). With query arguments, it counts only matched transactions. default). With query arguments, it counts only matched transactions.
$ hledger activity --quarterly $ hledger activity --quarterly
@ -804,24 +858,24 @@ COMMANDS
Prompt for transactions and add them to the journal. Prompt for transactions and add them to the journal.
--no-new-accounts --no-new-accounts
don't allow creating new accounts; helps prevent typos when don't allow creating new accounts; helps prevent typos when
entering account names entering account names
Many hledger users edit their journals directly with a text editor, or Many hledger users edit their journals directly with a text editor, or
generate them from CSV. For more interactive data entry, there is the generate them from CSV. For more interactive data entry, there is the
add command, which prompts interactively on the console for new trans- add command, which prompts interactively on the console for new trans-
actions, and appends them to the journal file (if there are multiple actions, and appends them to the journal file (if there are multiple
-f FILE options, the first file is used.) Existing transactions are not -f FILE options, the first file is used.) Existing transactions are not
changed. This is the only hledger command that writes to the journal changed. This is the only hledger command that writes to the journal
file. file.
To use it, just run hledger add and follow the prompts. You can add as 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. control-d or control-c to exit.
Features: Features:
o add tries to provide useful defaults, using the most similar recent o add tries to provide useful defaults, using the most similar recent
transaction (by description) as a template. transaction (by description) as a template.
o You can also set the initial defaults with command line arguments. o You can also set the initial defaults with command line arguments.
@ -829,20 +883,20 @@ COMMANDS
o Readline-style edit keys can be used during data entry. o Readline-style edit keys can be used during data entry.
o The tab key will auto-complete whenever possible - accounts, descrip- 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. 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. bare numbers entered.
o A parenthesised transaction code may be entered following a date. o A parenthesised transaction code may be entered following a date.
o Comments and tags may be entered following a description or amount. 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. 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. supports it.
Example (see the tutorial for a detailed explanation): Example (see the tutorial for a detailed explanation):
@ -879,7 +933,7 @@ COMMANDS
show balance change in each period (default) show balance change in each period (default)
--cumulative --cumulative
show balance change accumulated across periods (in multicolumn show balance change accumulated across periods (in multicolumn
reports) reports)
-H --historical -H --historical
@ -914,17 +968,17 @@ COMMANDS
select the output format. Supported formats: txt, csv. select the output format. Supported formats: txt, csv.
-o FILE --output-file=FILE -o FILE --output-file=FILE
write output to FILE. A file extension matching one of the write output to FILE. A file extension matching one of the
above formats selects that format. above formats selects that format.
--pretty-tables --pretty-tables
Use unicode to display prettier tables. Use unicode to display prettier tables.
--sort-amount --sort-amount
Sort by amount (total row amount, or by average if that is dis- Sort by amount (total row amount, or by average if that is dis-
played), instead of account name (in flat mode) played), instead of account name (in flat mode)
The balance command displays accounts and balances. It is hledger's The balance command displays accounts and balances. It is hledger's
most featureful and versatile command. most featureful and versatile command.
$ hledger balance $ hledger balance
@ -941,25 +995,25 @@ COMMANDS
-------------------- --------------------
0 0
More precisely, the balance command shows the change to each account's More precisely, the balance command shows the change to each account's
balance caused by all (matched) postings. In the common case where you balance caused by all (matched) postings. In the common case where you
do not filter by date and your journal sets the correct opening bal- do not filter by date and your journal sets the correct opening bal-
ances, this is the same as the account's ending balance. ances, this is the same as the account's ending balance.
By default, accounts are displayed hierarchically, with subaccounts By default, accounts are displayed hierarchically, with subaccounts
indented below their parent. "Boring" accounts, which contain a single indented below their parent. "Boring" accounts, which contain a single
interesting subaccount and no balance of their own, are elided into the interesting subaccount and no balance of their own, are elided into the
following line for more compact output. (Use --no-elide to prevent following line for more compact output. (Use --no-elide to prevent
this. Eliding of boring accounts is not yet supported in multicolumn this. Eliding of boring accounts is not yet supported in multicolumn
reports.) reports.)
Each account's balance is the "inclusive" balance - it includes the Each account's balance is the "inclusive" balance - it includes the
balances of any subaccounts. 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. 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: it:
$ hledger balance -p 2008/6 expenses --no-total $ hledger balance -p 2008/6 expenses --no-total
@ -969,9 +1023,9 @@ COMMANDS
Flat mode Flat mode
To see a flat list of full account names instead of the default hierar- To see a flat list of full account names instead of the default hierar-
chical display, use --flat. In this mode, accounts (unless chical display, use --flat. In this mode, accounts (unless
depth-clipped) show their "exclusive" balance, excluding any subaccount depth-clipped) show their "exclusive" balance, excluding any subaccount
balances. In this mode, you can also use --drop N to omit the first balances. In this mode, you can also use --drop N to omit the first
few account name components. few account name components.
$ hledger balance -p 2008/6 expenses -N --flat --drop 1 $ hledger balance -p 2008/6 expenses -N --flat --drop 1
@ -979,9 +1033,9 @@ COMMANDS
$1 supplies $1 supplies
Depth limited balance reports Depth limited balance reports
With --depth N, balance shows accounts only to the specified depth. With --depth N, balance shows accounts only to the specified depth.
This is very useful to show a complex charts of accounts in less This is very useful to show a complex charts of accounts in less
detail. In flat mode, balances from accounts below the depth limit detail. In flat mode, balances from accounts below the depth limit
will be shown as part of a parent account at the depth limit. will be shown as part of a parent account at the depth limit.
$ hledger balance -N --depth 1 $ hledger balance -N --depth 1
@ -991,12 +1045,12 @@ COMMANDS
$1 liabilities $1 liabilities
Multicolumn balance reports Multicolumn balance reports
With a reporting interval, multiple balance columns will be shown, one With a reporting interval, multiple balance columns will be shown, one
for each report period. There are three types of multi-column balance for each report period. There are three types of multi-column balance
report, showing different information: report, showing different information:
1. By default: each column shows the sum of postings in that period, ie 1. By default: each column shows the sum of postings in that period, ie
the account's change of balance in that period. This is useful eg the account's change of balance in that period. This is useful eg
for a monthly income statement: for a monthly income statement:
$ hledger balance --quarterly income expenses -E $ hledger balance --quarterly income expenses -E
@ -1011,8 +1065,8 @@ COMMANDS
-------------------++--------------------------------- -------------------++---------------------------------
|| $-1 $1 0 0 || $-1 $1 0 0
2. With --cumulative: each column shows the ending balance for that 2. With --cumulative: each column shows the ending balance for that
period, accumulating the changes across periods, starting from 0 at period, accumulating the changes across periods, starting from 0 at
the report start date: the report start date:
$ hledger balance --quarterly income expenses -E --cumulative $ hledger balance --quarterly income expenses -E --cumulative
@ -1028,8 +1082,8 @@ COMMANDS
|| $-1 0 0 0 || $-1 0 0 0
3. With --historical/-H: each column shows the actual historical ending 3. With --historical/-H: each column shows the actual historical ending
balance for that period, accumulating the changes across periods, balance for that period, accumulating the changes across periods,
starting from the actual balance at the report start date. This is 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 useful eg for a multi-period balance sheet, and when you are showing
only the data after a certain start date: only the data after a certain start date:
@ -1045,26 +1099,26 @@ COMMANDS
----------------------++------------------------------------- ----------------------++-------------------------------------
|| 0 0 0 || 0 0 0
Multi-column balance reports display accounts in flat mode by default; Multi-column balance reports display accounts in flat mode by default;
to see the hierarchy, use --tree. to see the hierarchy, use --tree.
With a reporting interval (like --quarterly above), the report With a reporting interval (like --quarterly above), the report
start/end dates will be adjusted if necessary so that they encompass 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- the displayed report periods. This is so that the first and last peri-
ods will be "full" and comparable to the others. ods will be "full" and comparable to the others.
The -E/--empty flag does two things in multicolumn balance reports: The -E/--empty flag does two things in multicolumn balance reports:
first, the report will show all columns within the specified report first, the report will show all columns within the specified report
period (without -E, leading and trailing columns with all zeroes are period (without -E, leading and trailing columns with all zeroes are
not shown). Second, all accounts which existed at the report start not shown). Second, all accounts which existed at the report start
date will be considered, not just the ones with activity during the date will be considered, not just the ones with activity during the
report period (use -E to include low-activity accounts which would oth- report period (use -E to include low-activity accounts which would oth-
erwise would be omitted). erwise would be omitted).
The -T/--row-total flag adds an additional column showing the total for The -T/--row-total flag adds an additional column showing the total for
each row. 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. row.
Here's an example of all three: Here's an example of all three:
@ -1086,7 +1140,7 @@ COMMANDS
# Average is rounded to the dollar here since all journal amounts are # Average is rounded to the dollar here since all journal amounts are
Custom balance output Custom balance output
In simple (non-multi-column) balance reports, you can customise the In simple (non-multi-column) balance reports, you can customise the
output with --format FMT: output with --format FMT:
$ hledger balance --format "%20(account) %12(total)" $ hledger balance --format "%20(account) %12(total)"
@ -1104,7 +1158,7 @@ COMMANDS
0 0
The FMT format string (plus a newline) specifies the formatting applied 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: data fields interpolated like so:
%[MIN][.MAX](FIELDNAME) %[MIN][.MAX](FIELDNAME)
@ -1115,14 +1169,14 @@ COMMANDS
o FIELDNAME must be enclosed in parentheses, and can be one of: 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. if MIN is specified, MIN * depth spaces.
o account - the account's name o account - the account's name
o total - the account's balance/posted total, right justified 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: modity amounts are rendered:
o %_ - render on multiple lines, bottom-aligned (the default) o %_ - render on multiple lines, bottom-aligned (the default)
@ -1131,7 +1185,7 @@ COMMANDS
o %, - render on one line, comma-separated o %, - render on one line, comma-separated
There are some quirks. Eg in one-line mode, %(depth_spacer) has no There are some quirks. Eg in one-line mode, %(depth_spacer) has no
effect, instead %(account) has indentation built in. effect, instead %(account) has indentation built in.
Experimentation may be needed to get pleasing results. Experimentation may be needed to get pleasing results.
@ -1139,14 +1193,14 @@ COMMANDS
o %(total) - the account's total o %(total) - the account's total
o %-20.20(account) - the account's name, left justified, padded to 20 o %-20.20(account) - the account's name, left justified, padded to 20
characters and clipped at 20 characters characters and clipped at 20 characters
o %,%-50(account) %25(total) - account name padded to 50 characters, o %,%-50(account) %25(total) - account name padded to 50 characters,
total padded to 20 characters, with multiple commodities rendered on total padded to 20 characters, with multiple commodities rendered on
one line one line
o %20(total) %2(depth_spacer)%-(account) - the default format for the o %20(total) %2(depth_spacer)%-(account) - the default format for the
single-column balance report single-column balance report
Colour support Colour support
@ -1157,8 +1211,8 @@ COMMANDS
o the output is not being redirected or piped anywhere o the output is not being redirected or piped anywhere
Output destination Output destination
The balance, print, register and stats commands can write their output The balance, print, register and stats commands can write their output
to a destination other than the console. This is controlled by the to a destination other than the console. This is controlled by the
-o/--output-file option. -o/--output-file option.
$ hledger balance -o - # write to stdout (the default) $ hledger balance -o - # write to stdout (the default)
@ -1166,8 +1220,8 @@ COMMANDS
CSV output CSV output
The balance, print and register commands can write their output as CSV. The balance, print and register commands can write their output as CSV.
This is useful for exporting data to other applications, eg to make This is useful for exporting data to other applications, eg to make
charts in a spreadsheet. This is controlled by the -O/--output-format charts in a spreadsheet. This is controlled by the -O/--output-format
option, or by specifying a .csv file extension with -o/--output-file. option, or by specifying a .csv file extension with -o/--output-file.
$ hledger balance -O csv # write CSV to stdout $ hledger balance -O csv # write CSV to stdout
@ -1181,7 +1235,7 @@ COMMANDS
balances balances
--cumulative --cumulative
show balance change accumulated across periods (in multicolumn show balance change accumulated across periods (in multicolumn
reports), instead of historical ending balances reports), instead of historical ending balances
-H --historical -H --historical
@ -1215,8 +1269,8 @@ COMMANDS
--sort-amount --sort-amount
sort by amount instead of account name sort by amount instead of account name
This command displays a simple balance sheet. It currently assumes This command displays a simple balance sheet. It currently assumes
that you have top-level accounts named asset and liability (plural that you have top-level accounts named asset and liability (plural
forms also allowed.) forms also allowed.)
$ hledger balancesheet $ hledger balancesheet
@ -1239,19 +1293,19 @@ COMMANDS
0 0
With a reporting interval, multiple columns will be shown, one for each With a reporting interval, multiple columns will be shown, one for each
report period. As with multicolumn balance reports, you can alter the report period. As with multicolumn balance reports, you can alter the
report mode with --change/--cumulative/--historical. Normally bal- report mode with --change/--cumulative/--historical. Normally bal-
ancesheet shows historical ending balances, which is what you need for ancesheet shows historical ending balances, which is what you need for
a balance sheet; note this means it ignores report begin dates. a balance sheet; note this means it ignores report begin dates.
balancesheetequity balancesheetequity
Show a balance sheet including equity. Alias: bse. Show a balance sheet including equity. Alias: bse.
Other than showing the equity accounts, this command is exactly the Other than showing the equity accounts, this command is exactly the
same as the command balancesheet. Please refer to it for the available same as the command balancesheet. Please refer to it for the available
options. options.
This command displays a balancesheet. It currently assumes that you This command displays a balancesheet. It currently assumes that you
have top-level accounts named asset, liability and equity (plural forms have top-level accounts named asset, liability and equity (plural forms
also allowed.) also allowed.)
@ -1286,7 +1340,7 @@ COMMANDS
show balance change in each period (default) show balance change in each period (default)
--cumulative --cumulative
show balance change accumulated across periods (in multicolumn show balance change accumulated across periods (in multicolumn
reports), instead of changes during periods reports), instead of changes during periods
-H --historical -H --historical
@ -1390,7 +1444,7 @@ COMMANDS
... ...
import import
Read new transactions added to each FILE since last run, and add them Read new transactions added to each FILE since last run, and add them
to the main journal file. to the main journal file.
--dry-run --dry-run
@ -1404,7 +1458,7 @@ COMMANDS
ing transactions are always added to the input files in increasing date ing transactions are always added to the input files in increasing date
order, and by saving .latest.FILE state files. 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: see only uncategorised transactions:
$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
@ -1416,7 +1470,7 @@ COMMANDS
show balance change in each period (default) show balance change in each period (default)
--cumulative --cumulative
show balance change accumulated across periods (in multicolumn show balance change accumulated across periods (in multicolumn
reports), instead of changes during periods reports), instead of changes during periods
-H --historical -H --historical
@ -1896,16 +1950,16 @@ TROUBLESHOOTING
that is ~/.local/bin and ~/.cabal/bin respectively. that is ~/.local/bin and ~/.cabal/bin respectively.
I set a custom LEDGER_FILE, but hledger is still using the default file 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 LEDGER_FILE should be a real environment variable, not just a shell
variable. The command env | grep LEDGER_FILE should show it. You may variable. The command env | grep LEDGER_FILE should show it. You may
need to use export. Here's an explanation. 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 character" errors
In order to handle non-ascii letters and symbols (like ), hledger needs In order to handle non-ascii letters and symbols (like ), hledger needs
an appropriate locale. This is usually configured system-wide; you can an appropriate locale. This is usually configured system-wide; you can
also configure it temporarily. The locale may need to be one that sup- 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). I'm not sure yet).
Here's an example of setting the locale temporarily, on ubuntu Here's an example of setting the locale temporarily, on ubuntu
@ -1924,7 +1978,7 @@ TROUBLESHOOTING
$ echo "export LANG=en_US.UTF-8" >>~/.bash_profile $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
$ bash --login $ 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: first:
$ apt-get install language-pack-fr $ apt-get install language-pack-fr
@ -1945,7 +1999,7 @@ TROUBLESHOOTING
REPORTING BUGS REPORTING BUGS
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
or hledger mail list) or hledger mail list)
@ -1959,7 +2013,7 @@ COPYRIGHT
SEE ALSO 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- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1) dot(5), ledger(1)