cli: doc: queries: clarifications, especially not:

This commit is contained in:
Simon Michael 2017-09-07 08:35:53 -07:00
parent 75df6e0277
commit 81d7d3f709
4 changed files with 335 additions and 338 deletions

View File

@ -937,12 +937,12 @@ Most commands accept an optional query expression, written as arguments
after the command name, to filter the data by date, account name or after the command name, to filter the data by date, account name or
other criteria. other criteria.
The syntax is similar to a web search: one or more space\-separated The syntax is similar to a web search: one or more space\-separated
search terms, quotes to enclose whitespace, optional prefixes to match search terms, quotes to enclose whitespace, prefixes to match specific
specific fields. fields, a not: prefix to negate the match.
Multiple search terms are combined as follows:
.PP .PP
All commands except print: show transactions/postings/accounts which We do not yet support arbitrary boolean combinations of search terms;
match (or negatively match) instead most commands show transactions/postings/accounts which match
(or negatively match):
.IP \[bu] 2 .IP \[bu] 2
any of the description terms AND any of the description terms AND
.IP \[bu] 2 .IP \[bu] 2
@ -952,7 +952,7 @@ any of the status terms AND
.IP \[bu] 2 .IP \[bu] 2
all the other terms. all the other terms.
.PP .PP
The print command: show transactions which The print command instead shows transactions which:
.IP \[bu] 2 .IP \[bu] 2
match any of the description terms AND match any of the description terms AND
.IP \[bu] 2 .IP \[bu] 2
@ -962,10 +962,13 @@ have no postings matching any of the negative account terms AND
.IP \[bu] 2 .IP \[bu] 2
match all the other terms. match all the other terms.
.PP .PP
The following kinds of search terms can be used: The following kinds of search terms can be used.
Remember these can also be prefixed with \f[B]\f[C]not:\f[]\f[], eg to
exclude a particular subaccount.
.TP .TP
.B \f[B]\f[C]REGEX\f[]\f[] .B \f[B]\f[C]REGEX\f[]\f[]
match account names by this regular expression match account names by this regular expression.
(No prefix is equivalent to \f[C]acct:\f[]).
.RS .RS
.RE .RE
.TP .TP
@ -1057,18 +1060,13 @@ Also remember that postings inherit the tags of their parent
transaction. transaction.
.RS .RS
.RE .RE
.TP .PP
.B \f[B]\f[C]not:\f[]\f[] The following special search term is used only you click an account name
before any of the above negates the match. in hledger\-web:
.RS
.RE
.TP .TP
.B \f[B]\f[C]inacct:ACCTNAME\f[]\f[] .B \f[B]\f[C]inacct:ACCTNAME\f[]\f[]
a special term used automatically when you click an account name in tells hledger\-web to show the transaction register for this account.
hledger\-web, specifying the account register we are currently in Can be filtered further with \f[C]acct\f[] etc.
(selects the transactions of that account and how to show them, can be
filtered further with \f[C]acct\f[] etc).
Not supported elsewhere in hledger.
.RS .RS
.RE .RE
.PP .PP

View File

@ -666,29 +666,32 @@ subsets of your data. Most commands accept an optional query
expression, written as arguments after the command name, to filter the expression, written as arguments after the command name, to filter the
data by date, account name or other criteria. The syntax is similar to data by date, account name or other criteria. The syntax is similar to
a web search: one or more space-separated search terms, quotes to a web search: one or more space-separated search terms, quotes to
enclose whitespace, optional prefixes to match specific fields. enclose whitespace, prefixes to match specific fields, a not: prefix to
Multiple search terms are combined as follows: negate the match.
All commands except print: show transactions/postings/accounts which We do not yet support arbitrary boolean combinations of search terms;
match (or negatively match) instead most commands show transactions/postings/accounts which match
(or negatively match):
* any of the description terms AND * any of the description terms AND
* any of the account terms AND * any of the account terms AND
* any of the status terms AND * any of the status terms AND
* all the other terms. * all the other terms.
The print command: show transactions which The print command instead shows transactions which:
* match any of the description terms AND * match any of the description terms AND
* have any postings matching any of the positive account terms AND * have any postings matching any of the positive account terms AND
* have no postings matching any of the negative account terms AND * have no postings matching any of the negative account terms AND
* match all the other terms. * match all the other terms.
The following kinds of search terms can be used: The following kinds of search terms can be used. Remember these can
also be prefixed with *'not:'*, eg to exclude a particular subaccount.
*'REGEX'* *'REGEX'*
match account names by this regular expression match account names by this regular expression. (No prefix is
equivalent to 'acct:').
*'acct:REGEX'* *'acct:REGEX'*
same as above same as above
@ -749,16 +752,14 @@ match (or negatively match)
query is considered to match a transaction if it matches any of the query is considered to match a transaction if it matches any of the
postings. Also remember that postings inherit the tags of their postings. Also remember that postings inherit the tags of their
parent transaction. parent transaction.
*'not:'*
before any of the above negates the match. The following special search term is used only you click an account
name in hledger-web:
*'inacct:ACCTNAME'* *'inacct:ACCTNAME'*
a special term used automatically when you click an account name in tells hledger-web to show the transaction register for this
hledger-web, specifying the account register we are currently in account. Can be filtered further with 'acct' etc.
(selects the transactions of that account and how to show them, can
be filtered further with 'acct' etc). Not supported elsewhere in
hledger.
Some of these can also be expressed as command-line options (eg Some of these can also be expressed as command-line options (eg
'depth:2' is equivalent to '--depth 2'). Generally you can mix options 'depth:2' is equivalent to '--depth 2'). Generally you can mix options
@ -2162,95 +2163,95 @@ Node: Regular expressions19999
Ref: #regular-expressions20137 Ref: #regular-expressions20137
Node: QUERIES21498 Node: QUERIES21498
Ref: #queries21602 Ref: #queries21602
Node: COMMANDS25534 Node: COMMANDS25580
Ref: #commands25648 Ref: #commands25694
Node: accounts26327 Node: accounts26373
Ref: #accounts26427 Ref: #accounts26473
Node: activity27409 Node: activity27455
Ref: #activity27521 Ref: #activity27567
Node: add27880 Node: add27926
Ref: #add27981 Ref: #add28027
Node: balance30639 Node: balance30685
Ref: #balance30752 Ref: #balance30798
Node: Flat mode33767 Node: Flat mode33813
Ref: #flat-mode33894 Ref: #flat-mode33940
Node: Depth limited balance reports34314 Node: Depth limited balance reports34360
Ref: #depth-limited-balance-reports34517 Ref: #depth-limited-balance-reports34563
Node: Multicolumn balance reports34937 Node: Multicolumn balance reports34983
Ref: #multicolumn-balance-reports35148 Ref: #multicolumn-balance-reports35194
Node: Custom balance output39796 Node: Custom balance output39842
Ref: #custom-balance-output39980 Ref: #custom-balance-output40026
Node: Colour support42073 Node: Colour support42119
Ref: #colour-support42234 Ref: #colour-support42280
Node: Output destination42407 Node: Output destination42453
Ref: #output-destination42565 Ref: #output-destination42611
Node: CSV output42835 Node: CSV output42881
Ref: #csv-output42954 Ref: #csv-output43000
Node: balancesheet43351 Node: balancesheet43397
Ref: #balancesheet43489 Ref: #balancesheet43535
Node: balancesheetequity45396 Node: balancesheetequity45442
Ref: #balancesheetequity45547 Ref: #balancesheetequity45593
Node: cashflow46336 Node: cashflow46382
Ref: #cashflow46459 Ref: #cashflow46505
Node: help48310 Node: help48356
Ref: #help48422 Ref: #help48468
Node: incomestatement49496 Node: incomestatement49542
Ref: #incomestatement49627 Ref: #incomestatement49673
Node: print51519 Node: print51565
Ref: #print51636 Ref: #print51682
Node: register55392 Node: register55438
Ref: #register55505 Ref: #register55551
Node: Custom register output60001 Node: Custom register output60047
Ref: #custom-register-output60132 Ref: #custom-register-output60178
Node: stats61429 Node: stats61475
Ref: #stats61535 Ref: #stats61581
Node: test62416 Node: test62462
Ref: #test62503 Ref: #test62549
Node: ADD-ON COMMANDS62871 Node: ADD-ON COMMANDS62917
Ref: #add-on-commands62983 Ref: #add-on-commands63029
Node: Official add-ons64270 Node: Official add-ons64316
Ref: #official-add-ons64412 Ref: #official-add-ons64458
Node: api64499 Node: api64545
Ref: #api64590 Ref: #api64636
Node: ui64642 Node: ui64688
Ref: #ui64743 Ref: #ui64789
Node: web64801 Node: web64847
Ref: #web64892 Ref: #web64938
Node: Third party add-ons64938 Node: Third party add-ons64984
Ref: #third-party-add-ons65115 Ref: #third-party-add-ons65161
Node: diff65250 Node: diff65296
Ref: #diff65349 Ref: #diff65395
Node: iadd65448 Node: iadd65494
Ref: #iadd65564 Ref: #iadd65610
Node: interest65647 Node: interest65693
Ref: #interest65770 Ref: #interest65816
Node: irr65865 Node: irr65911
Ref: #irr65965 Ref: #irr66011
Node: Experimental add-ons66043 Node: Experimental add-ons66089
Ref: #experimental-add-ons66197 Ref: #experimental-add-ons66243
Node: autosync66599 Node: autosync66645
Ref: #autosync66713 Ref: #autosync66759
Node: budget66952 Node: budget66998
Ref: #budget67076 Ref: #budget67122
Node: chart67142 Node: chart67188
Ref: #chart67261 Ref: #chart67307
Node: check67332 Node: check67378
Ref: #check67456 Ref: #check67502
Node: check-dates67523 Node: check-dates67569
Ref: #check-dates67665 Ref: #check-dates67711
Node: check-dupes67738 Node: check-dupes67784
Ref: #check-dupes67881 Ref: #check-dupes67927
Node: equity67958 Node: equity68004
Ref: #equity68086 Ref: #equity68132
Node: prices68205 Node: prices68251
Ref: #prices68334 Ref: #prices68380
Node: print-unique68389 Node: print-unique68435
Ref: #print-unique68538 Ref: #print-unique68584
Node: register-match68631 Node: register-match68677
Ref: #register-match68787 Ref: #register-match68833
Node: rewrite68885 Node: rewrite68931
Ref: #rewrite69019 Ref: #rewrite69065
Node: tags69097 Node: tags69143
Ref: #tags69202 Ref: #tags69248
 
End Tag Table End Tag Table

View File

@ -605,11 +605,12 @@ QUERIES
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, optional prefixes to match specific fields. Multiple whitespace, prefixes to match specific fields, a not: prefix to negate
search terms are combined as follows: the match.
All commands except print: show transactions/postings/accounts which We do not yet support arbitrary boolean combinations of search terms;
match (or negatively match) instead most commands show transactions/postings/accounts which match
(or negatively match):
o any of the description terms AND o any of the description terms AND
@ -619,7 +620,7 @@ QUERIES
o all the other terms. o all the other terms.
The print command: show transactions which The print command instead shows transactions which:
o match any of the description terms AND o match any of the description terms AND
@ -629,30 +630,32 @@ QUERIES
o match all the other terms. o match all the other terms.
The following kinds of search terms can be used: The following kinds of search terms can be used. Remember these can
also be prefixed with not:, eg to exclude a particular subaccount.
REGEX match account names by this regular expression REGEX match account names by this regular expression. (No prefix is
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:\\$.
@ -661,20 +664,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
@ -688,34 +691,32 @@ 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.
not: before any of the above negates the match. The following special search term is used only you click an account
name in hledger-web:
inacct:ACCTNAME inacct:ACCTNAME
a special term used automatically when you click an account name tells hledger-web to show the transaction register for this
in hledger-web, specifying the account register we are currently account. Can be filtered further with acct etc.
in (selects the transactions of that account and how to show
them, can be filtered further with acct etc). Not supported
elsewhere in hledger.
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 any unambiguous prefix of hledger incomestatement). You can also write any unambiguous prefix of
a command name (hledger inc), or one of the standard short aliases dis- a command name (hledger inc), or one of the standard short aliases dis-
played in the command list (hledger is). played in the command list (hledger is).
@ -730,14 +731,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:
@ -780,8 +781,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
@ -794,24 +795,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.
@ -819,20 +820,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):
@ -869,7 +870,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
@ -904,13 +905,13 @@ 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.
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
@ -927,25 +928,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
@ -955,9 +956,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
@ -965,9 +966,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
@ -977,12 +978,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
@ -997,8 +998,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
@ -1014,8 +1015,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:
@ -1031,26 +1032,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:
@ -1072,7 +1073,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)"
@ -1090,7 +1091,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)
@ -1101,14 +1102,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)
@ -1117,7 +1118,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.
@ -1125,14 +1126,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
@ -1143,8 +1144,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)
@ -1152,8 +1153,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
@ -1167,7 +1168,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
@ -1198,8 +1199,8 @@ COMMANDS
--format=LINEFORMAT --format=LINEFORMAT
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
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
@ -1222,19 +1223,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.)
@ -1269,7 +1270,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
@ -1300,9 +1301,9 @@ COMMANDS
--format=LINEFORMAT --format=LINEFORMAT
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
This command displays a simple cashflow statement It shows the change This command displays a simple cashflow statement It shows the change
in all "cash" (ie, liquid assets) accounts for the period. It cur- in all "cash" (ie, liquid assets) accounts for the period. It cur-
rently assumes that cash accounts are under a top-level account named rently assumes that cash accounts are under a top-level account named
asset and do not contain receivable, :A/R or :fixed. asset and do not contain receivable, :A/R or :fixed.
$ hledger cashflow $ hledger cashflow
@ -1320,20 +1321,20 @@ COMMANDS
$-1 $-1
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. Normally cashflow shows changes in assets per period, report period. Normally cashflow shows changes in assets per period,
though as with multicolumn balance reports you can alter the report though as with multicolumn balance reports you can alter the report
mode with --change/--cumulative/--historical. mode with --change/--cumulative/--historical.
help help
Show any of the hledger manuals. Show any of the hledger manuals.
The help command displays any of the main hledger manuals, in one of The help command displays any of the main hledger manuals, in one of
several ways. Run it with no argument to list the manuals, or provide several ways. Run it with no argument to list the manuals, or provide
a full or partial manual name to select one. a full or partial manual name to select one.
hledger manuals are available in several formats. hledger help will hledger manuals are available in several formats. hledger help will
use the first of these display methods that it finds: info, man, use the first of these display methods that it finds: info, man,
$PAGER, less, stdout (or when non-interactive, just stdout). You can $PAGER, less, stdout (or when non-interactive, just stdout). You can
force a particular viewer with the --info, --man, --pager, --cat flags. force a particular viewer with the --info, --man, --pager, --cat flags.
$ hledger help $ hledger help
@ -1363,7 +1364,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
@ -1394,8 +1395,8 @@ COMMANDS
--format=LINEFORMAT --format=LINEFORMAT
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
This command displays a simple income statement. It currently assumes This command displays a simple income statement. It currently assumes
that you have top-level accounts named income (or revenue) and expense that you have top-level accounts named income (or revenue) and expense
(plural forms also allowed.) (plural forms also allowed.)
$ hledger incomestatement $ hledger incomestatement
@ -1420,8 +1421,8 @@ 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. Normally incomestatement shows revenues/expenses per report period. Normally incomestatement shows revenues/expenses per
period, though as with multicolumn balance reports you can alter the period, though as with multicolumn balance reports you can alter the
report mode with --change/--cumulative/--historical. report mode with --change/--cumulative/--historical.
print print
@ -1431,14 +1432,14 @@ COMMANDS
show all amounts explicitly show all amounts explicitly
-m STR --match=STR -m STR --match=STR
show the transaction whose description is most similar to STR, show the transaction whose description is most similar to STR,
and is most recent and is most recent
-O FMT --output-format=FMT -O FMT --output-format=FMT
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.
$ hledger print $ hledger print
@ -1466,23 +1467,23 @@ COMMANDS
The print command displays full journal entries (transactions) from the The print command displays full journal entries (transactions) from the
journal file, tidily formatted. journal file, tidily formatted.
As of hledger 1.2, print's output is always a valid hledger journal. As of hledger 1.2, print's output is always a valid hledger journal.
However it may not preserve all original content, eg it does not print However it may not preserve all original content, eg it does not print
directives or inter-transaction comments. directives or inter-transaction comments.
Normally, transactions' implicit/explicit amount style is preserved: Normally, transactions' implicit/explicit amount style is preserved:
when an amount is omitted in the journal, it will be omitted in the when an amount is omitted in the journal, it will be omitted in the
output. You can use the -x/--explicit flag to make all amounts output. You can use the -x/--explicit flag to make all amounts
explicit, which can be useful for troubleshooting or for making your explicit, which can be useful for troubleshooting or for making your
journal more readable and robust against data entry errors. Note, in journal more readable and robust against data entry errors. Note, in
this mode postings with a multi-commodity amount (possible with an this mode postings with a multi-commodity amount (possible with an
implicit amount in a multi-commodity transaction) will be split into implicit amount in a multi-commodity transaction) will be split into
multiple single-commodity postings, for valid journal output. multiple single-commodity postings, for valid journal output.
With -B/--cost, amounts with transaction prices are converted to cost With -B/--cost, amounts with transaction prices are converted to cost
(using the transaction price). (using the transaction price).
The print command also supports output destination and CSV output. The print command also supports output destination and CSV output.
Here's an example of print's CSV output: Here's an example of print's CSV output:
$ hledger print -Ocsv $ hledger print -Ocsv
@ -1499,20 +1500,20 @@ COMMANDS
"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","","" "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""
"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""
o There is one CSV record per posting, with the parent transaction's o There is one CSV record per posting, with the parent transaction's
fields repeated. fields repeated.
o The "txnidx" (transaction index) field shows which postings belong to o The "txnidx" (transaction index) field shows which postings belong to
the same transaction. (This number might change if transactions are the same transaction. (This number might change if transactions are
reordered within the file, files are parsed/included in a different reordered within the file, files are parsed/included in a different
order, etc.) order, etc.)
o The amount is separated into "commodity" (the symbol) and "amount" o The amount is separated into "commodity" (the symbol) and "amount"
(numeric quantity) fields. (numeric quantity) fields.
o The numeric amount is repeated in either the "credit" or "debit" col- o The numeric amount is repeated in either the "credit" or "debit" col-
umn, for convenience. (Those names are not accurate in the account- umn, for convenience. (Those names are not accurate in the account-
ing sense; it just puts negative amounts under credit and zero or ing sense; it just puts negative amounts under credit and zero or
greater amounts under debit.) greater amounts under debit.)
register register
@ -1522,7 +1523,7 @@ COMMANDS
show running total from report start date (default) show running total from report start date (default)
-H --historical -H --historical
show historical running total/balance (includes postings before show historical running total/balance (includes postings before
report start date) report start date)
-A --average -A --average
@ -1533,18 +1534,18 @@ COMMANDS
show postings' siblings instead show postings' siblings instead
-w N --width=N -w N --width=N
set output width (default: terminal width or COLUMNS. -wN,M set output width (default: terminal width or COLUMNS. -wN,M
sets description width as well) sets description width as well)
-O FMT --output-format=FMT -O FMT --output-format=FMT
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.
The register command displays postings, one per line, and their running The register command displays postings, one per line, and their running
total. This is typically used with a query selecting a particular total. This is typically used with a query selecting a particular
account, to see that account's activity: account, to see that account's activity:
$ hledger register checking $ hledger register checking
@ -1553,8 +1554,8 @@ COMMANDS
2008/06/02 save assets:bank:checking $-1 $1 2008/06/02 save assets:bank:checking $-1 $1
2008/12/31 pay off assets:bank:checking $-1 0 2008/12/31 pay off assets:bank:checking $-1 0
The --historical/-H flag adds the balance from any undisplayed prior The --historical/-H flag adds the balance from any undisplayed prior
postings to the running total. This is useful when you want to see postings to the running total. This is useful when you want to see
only recent activity, with a historically accurate running balance: only recent activity, with a historically accurate running balance:
$ hledger register checking -b 2008/6 --historical $ hledger register checking -b 2008/6 --historical
@ -1564,23 +1565,23 @@ COMMANDS
The --depth option limits the amount of sub-account detail displayed. The --depth option limits the amount of sub-account detail displayed.
The --average/-A flag shows the running average posting amount instead The --average/-A flag shows the running average posting amount instead
of the running total (so, the final number displayed is the average for of the running total (so, the final number displayed is the average for
the whole report period). This flag implies --empty (see below). It the whole report period). This flag implies --empty (see below). It
is affected by --historical. It works best when showing just one is affected by --historical. It works best when showing just one
account and one commodity. account and one commodity.
The --related/-r flag shows the other postings in the transactions of The --related/-r flag shows the other postings in the transactions of
the postings which would normally be shown. the postings which would normally be shown.
With a reporting interval, register shows summary postings, one per With a reporting interval, register shows summary postings, one per
interval, aggregating the postings to each account: interval, aggregating the postings to each account:
$ hledger register --monthly income $ hledger register --monthly income
2008/01 income:salary $-1 $-1 2008/01 income:salary $-1 $-1
2008/06 income:gifts $-1 $-2 2008/06 income:gifts $-1 $-2
Periods with no activity, and summary postings with a zero amount, are Periods with no activity, and summary postings with a zero amount, are
not shown by default; use the --empty/-E flag to see them: not shown by default; use the --empty/-E flag to see them:
$ hledger register --monthly income -E $ hledger register --monthly income -E
@ -1597,7 +1598,7 @@ COMMANDS
2008/11 0 $-2 2008/11 0 $-2
2008/12 0 $-2 2008/12 0 $-2
Often, you'll want to see just one line per interval. The --depth Often, you'll want to see just one line per interval. The --depth
option helps with this, causing subaccounts to be aggregated: option helps with this, causing subaccounts to be aggregated:
$ hledger register --monthly assets --depth 1h $ hledger register --monthly assets --depth 1h
@ -1605,19 +1606,19 @@ COMMANDS
2008/06 assets $-1 0 2008/06 assets $-1 0
2008/12 assets $-1 $-1 2008/12 assets $-1 $-1
Note when using report intervals, if you specify start/end dates these Note when using report intervals, if you specify start/end dates these
will be adjusted outward if necessary to contain a whole number of will be adjusted outward if necessary to contain a whole number of
intervals. This ensures that the first and last intervals are full intervals. This ensures that the first and last intervals are full
length and comparable to the others in the report. length and comparable to the others in the report.
Custom register output Custom register output
register uses the full terminal width by default, except on windows. register uses the full terminal width by default, except on windows.
You can override this by setting the COLUMNS environment variable (not You can override this by setting the COLUMNS environment variable (not
a bash shell variable) or by using the --width/-w option. a bash shell variable) or by using the --width/-w option.
The description and account columns normally share the space equally The description and account columns normally share the space equally
(about half of (width - 40) each). You can adjust this by adding a (about half of (width - 40) each). You can adjust this by adding a
description width as part of --width's argument, comma-separated: description width as part of --width's argument, comma-separated:
--width W,D . Here's a diagram: --width W,D . Here's a diagram:
<--------------------------------- width (W) ----------------------------------> <--------------------------------- width (W) ---------------------------------->
@ -1633,14 +1634,14 @@ COMMANDS
$ hledger reg -w 100,40 # set overall width 100, description width 40 $ hledger reg -w 100,40 # set overall width 100, description width 40
$ hledger reg -w $COLUMNS,40 # use terminal width, and set description width $ hledger reg -w $COLUMNS,40 # use terminal width, and set description width
The register command also supports the -o/--output-file and -O/--out- The register command also supports the -o/--output-file and -O/--out-
put-format options for controlling output destination and CSV output. put-format options for controlling output destination and CSV output.
stats stats
Show some journal statistics. Show some journal statistics.
-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.
$ hledger stats $ hledger stats
@ -1655,8 +1656,8 @@ COMMANDS
Accounts : 8 (depth 3) Accounts : 8 (depth 3)
Commodities : 1 ($) Commodities : 1 ($)
The stats command displays summary information for the whole journal, The stats command displays summary information for the whole journal,
or a matched part of it. With a reporting interval, it shows a report or a matched part of it. With a reporting interval, it shows a report
for each report period. for each report period.
The stats command also supports -o/--output-file for controlling output The stats command also supports -o/--output-file for controlling output
@ -1668,34 +1669,34 @@ COMMANDS
$ hledger test $ hledger test
Cases: 74 Tried: 74 Errors: 0 Failures: 0 Cases: 74 Tried: 74 Errors: 0 Failures: 0
This command runs hledger's built-in unit tests and displays a quick This command runs hledger's built-in unit tests and displays a quick
report. With a regular expression argument, it selects only tests with report. With a regular expression argument, it selects only tests with
matching names. It's mainly used in development, but it's also nice to matching names. It's mainly used in development, but it's also nice to
be able to check your hledger executable for smoke at any time. be able to check your hledger executable for smoke at any time.
ADD-ON COMMANDS ADD-ON COMMANDS
hledger also searches for external add-on commands, and will include hledger also searches for external add-on commands, and will include
these in the commands list. These are programs or scripts in your PATH these in the commands list. These are programs or scripts in your PATH
whose name starts with hledger- and ends with a recognised file exten- whose name starts with hledger- and ends with a recognised file exten-
sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh). sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh).
Add-ons can be invoked like any hledger command, but there are a few Add-ons can be invoked like any hledger command, but there are a few
things to be aware of. Eg if the hledger-web add-on is installed, things to be aware of. Eg if the hledger-web add-on is installed,
o hledger -h web shows hledger's help, while hledger web -h shows o hledger -h web shows hledger's help, while hledger web -h shows
hledger-web's help. hledger-web's help.
o Flags specific to the add-on must have a preceding -- to hide them o Flags specific to the add-on must have a preceding -- to hide them
from hledger. So hledger web --serve --port 9000 will be rejected; from hledger. So hledger web --serve --port 9000 will be rejected;
you must use hledger web -- --serve --port 9000. you must use hledger web -- --serve --port 9000.
o You can always run add-ons directly if preferred: o You can always run add-ons directly if preferred:
hledger-web --serve --port 9000. hledger-web --serve --port 9000.
Add-ons are a relatively easy way to add local features or experiment Add-ons are a relatively easy way to add local features or experiment
with new ideas. They can be written in any language, but haskell with new ideas. They can be written in any language, but haskell
scripts have a big advantage: they can use the same hledger (and scripts have a big advantage: they can use the same hledger (and
haskell) library functions that built-in commands do, for command-line haskell) library functions that built-in commands do, for command-line
options, journal parsing, reporting, etc. options, journal parsing, reporting, etc.
Here are some hledger add-ons available: Here are some hledger add-ons available:
@ -1713,7 +1714,7 @@ ADD-ON COMMANDS
hledger-web provides a simple web interface. hledger-web provides a simple web interface.
Third party add-ons Third party add-ons
These are maintained separately, and usually updated shortly after a These are maintained separately, and usually updated shortly after a
hledger release. hledger release.
diff diff
@ -1721,7 +1722,7 @@ ADD-ON COMMANDS
journal file and another. journal file and another.
iadd iadd
hledger-iadd is a curses-style, more interactive replacement for the hledger-iadd is a curses-style, more interactive replacement for the
add command. add command.
interest interest
@ -1729,19 +1730,19 @@ ADD-ON COMMANDS
ing to various schemes. ing to various schemes.
irr irr
hledger-irr calculates the internal rate of return of an investment hledger-irr calculates the internal rate of return of an investment
account. account.
Experimental add-ons Experimental add-ons
These are available in source form in the hledger repo's bin/ direc- These are available in source form in the hledger repo's bin/ direc-
tory; installing them is pretty easy. They may be less mature and doc- tory; installing them is pretty easy. They may be less mature and doc-
umented than built-in commands. Reading and tweaking these is a good umented than built-in commands. Reading and tweaking these is a good
way to start making your own! way to start making your own!
autosync autosync
hledger-autosync is a symbolic link for easily running ledger-autosync, hledger-autosync is a symbolic link for easily running ledger-autosync,
if installed. ledger-autosync does deduplicating conversion of OFX if installed. ledger-autosync does deduplicating conversion of OFX
data and some CSV formats, and can also download the data if your bank data and some CSV formats, and can also download the data if your bank
offers OFX Direct Connect. offers OFX Direct Connect.
budget budget
@ -1757,18 +1758,18 @@ ADD-ON COMMANDS
hledger-check-dates.hs checks that journal entries are ordered by date. hledger-check-dates.hs checks that journal entries are ordered by date.
check-dupes check-dupes
hledger-check-dupes.hs checks for account names sharing the same leaf hledger-check-dupes.hs checks for account names sharing the same leaf
name. name.
equity equity
hledger-equity.hs prints balance-resetting transactions, useful for hledger-equity.hs prints balance-resetting transactions, useful for
bringing account balances across file boundaries. bringing account balances across file boundaries.
prices prices
hledger-prices.hs prints all prices from the journal. hledger-prices.hs prints all prices from the journal.
print-unique print-unique
hledger-print-unique.hs prints transactions which do not reuse an hledger-print-unique.hs prints transactions which do not reuse an
already-seen description. already-seen description.
register-match register-match
@ -1783,21 +1784,21 @@ ADD-ON COMMANDS
hledger-tags.hs Lists tag names in use. hledger-tags.hs Lists tag names in use.
ENVIRONMENT ENVIRONMENT
COLUMNS The screen width used by the register command. Default: the COLUMNS The screen width used by the register command. Default: the
full terminal width. full terminal width.
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 addon command options with -- when invoked from The need to precede addon command options with -- when invoked from
hledger is awkward. hledger is awkward.
When input data contains non-ascii characters, a suitable system locale When input data contains non-ascii characters, a suitable system locale
@ -1810,33 +1811,33 @@ BUGS
In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger
add. add.
Not all of Ledger's journal file syntax is supported. See file format Not all of Ledger's journal file syntax is supported. See file format
differences. differences.
On large data files, hledger is slower and uses more memory than On large data files, hledger is slower and uses more memory than
Ledger. Ledger.
TROUBLESHOOTING TROUBLESHOOTING
Here are some issues you might encounter when you run hledger (and Here are some issues you might encounter when you run hledger (and
remember you can also seek help from the IRC channel, mail list or bug remember you can also seek help from the IRC channel, mail list or bug
tracker): tracker):
Successfully installed, but "No command 'hledger' found" Successfully installed, but "No command 'hledger' found"
stack and cabal install binaries into a special directory, which should stack and cabal install binaries into a special directory, which should
be added to your PATH environment variable. Eg on unix-like systems, be added to your PATH environment variable. Eg on unix-like systems,
that is ~/.local/bin and ~/.cabal/bin respectively. 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
@ -1855,7 +1856,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
@ -1876,7 +1877,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)
@ -1890,7 +1891,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

@ -6,29 +6,29 @@ to filter the data by date, account name or other criteria.
The syntax is similar to a web search: The syntax is similar to a web search:
one or more space-separated search terms, one or more space-separated search terms,
quotes to enclose whitespace, quotes to enclose whitespace,
optional prefixes to match specific fields. prefixes to match specific fields,
Multiple search terms are combined as follows: a not: prefix to negate the match.
All commands except print: We do not yet support arbitrary boolean combinations of search terms;
show transactions/postings/accounts which match (or negatively match) instead most commands show transactions/postings/accounts which match (or negatively match):
- any of the description terms AND - any of the description terms AND
- any of the account terms AND - any of the account terms AND
- any of the status terms AND - any of the status terms AND
- all the other terms. - all the other terms.
The print command: The [print](/manual.html#print) command instead shows transactions which:
show transactions which
- match any of the description terms AND - match any of the description terms AND
- have any postings matching any of the positive account terms AND - have any postings matching any of the positive account terms AND
- have no postings matching any of the negative account terms AND - have no postings matching any of the negative account terms AND
- match all the other terms. - match all the other terms.
The following kinds of search terms can be used: The following kinds of search terms can be used.
Remember these can also be prefixed with **`not:`**, eg to exclude a particular subaccount.
**`REGEX`** **`REGEX`**
: match account names by this regular expression : match account names by this regular expression. (No prefix is equivalent to `acct:`).
**`acct:REGEX`** **`acct:REGEX`**
: same as above : same as above
@ -88,14 +88,11 @@ tag: query is considered to match a transaction if it matches any of
the postings. Also remember that postings inherit the tags of their the postings. Also remember that postings inherit the tags of their
parent transaction. parent transaction.
**`not:`** The following special search term is used only you click an account name in hledger-web:
: before any of the above negates the match.
**`inacct:ACCTNAME`** **`inacct:ACCTNAME`**
: a special term used automatically when you click an account name in hledger-web, : tells hledger-web to show the transaction register for this account.
specifying the account register we are currently in Can be filtered further with `acct` etc.
(selects the transactions of that account and how to show them, can be filtered further with `acct` etc).
Not supported elsewhere in hledger.
Some of these can also be expressed as command-line options (eg `depth:2` is equivalent to `--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 arguments, and the resulting query will be their intersection Generally you can mix options and query arguments, and the resulting query will be their intersection