doc: update manuals re --sort-amount

This commit is contained in:
Simon Michael 2017-09-29 19:31:44 -10:00
parent 62c822c1e6
commit 8c86d9b578
7 changed files with 358 additions and 304 deletions

View File

@ -881,9 +881,7 @@ Anywhere it matches inside an account name, the matched part will be
replaced by REPLACEMENT. replaced by REPLACEMENT.
If REGEX contains parenthesised match groups, these can be referenced by If REGEX contains parenthesised match groups, these can be referenced by
the usual numeric backreferences in REPLACEMENT. the usual numeric backreferences in REPLACEMENT.
Note, currently regular expression aliases may cause noticeable Eg:
slow\-downs.
(And if you use Ledger on your hledger file, they will be ignored.) Eg:
.IP .IP
.nf .nf
\f[C] \f[C]
@ -891,6 +889,9 @@ 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"
\f[] \f[]
.fi .fi
.PP
Also note that REPLACEMENT continues to the end of line (or on command
line, to end of option argument), so it can contain trailing whitespace.
.SS Multiple aliases .SS Multiple aliases
.PP .PP
You can define as many aliases as you like using directives or You can define as many aliases as you like using directives or

View File

@ -841,13 +841,15 @@ 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 inside an account name, the matched part will be replaced by
REPLACEMENT. If REGEX contains parenthesised match groups, these can be REPLACEMENT. If REGEX contains parenthesised match groups, these can be
referenced by the usual numeric backreferences in REPLACEMENT. Note, referenced by the usual numeric backreferences in REPLACEMENT. Eg:
currently regular expression aliases may cause noticeable slow-downs.
(And if you use Ledger on your hledger file, they will be ignored.) 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 line, to end of option argument), so it can contain trailing
whitespace.
 
File: hledger_journal.5.info, Node: Multiple aliases, Next: end aliases, Prev: Regex aliases, Up: Account aliases File: hledger_journal.5.info, Node: Multiple aliases, Next: end aliases, Prev: Regex aliases, Up: Account aliases
@ -1121,25 +1123,25 @@ Node: Basic aliases29122
Ref: #basic-aliases29267 Ref: #basic-aliases29267
Node: Regex aliases29957 Node: Regex aliases29957
Ref: #regex-aliases30127 Ref: #regex-aliases30127
Node: Multiple aliases30842 Node: Multiple aliases30845
Ref: #multiple-aliases31016 Ref: #multiple-aliases31019
Node: end aliases31514 Node: end aliases31517
Ref: #end-aliases31656 Ref: #end-aliases31659
Node: account directive31757 Node: account directive31760
Ref: #account-directive31939 Ref: #account-directive31942
Node: apply account directive32235 Node: apply account directive32238
Ref: #apply-account-directive32433 Ref: #apply-account-directive32436
Node: Multi-line comments33092 Node: Multi-line comments33095
Ref: #multi-line-comments33284 Ref: #multi-line-comments33287
Node: commodity directive33412 Node: commodity directive33415
Ref: #commodity-directive33598 Ref: #commodity-directive33601
Node: Default commodity34470 Node: Default commodity34473
Ref: #default-commodity34645 Ref: #default-commodity34648
Node: Default year35182 Node: Default year35185
Ref: #default-year35349 Ref: #default-year35352
Node: Including other files35772 Node: Including other files35775
Ref: #including-other-files35931 Ref: #including-other-files35934
Node: EDITOR SUPPORT36328 Node: EDITOR SUPPORT36331
Ref: #editor-support36448 Ref: #editor-support36451
 
End Tag Table End Tag Table

View File

@ -643,34 +643,36 @@ FILE FORMAT
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. Note, cur- erenced by the usual numeric backreferences in REPLACEMENT. Eg:
rently regular expression aliases may cause noticeable slow-downs.
(And if you use Ledger on your hledger file, they will be ignored.) 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
line, to end of option argument), so it can contain trailing white-
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 +687,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 +705,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 +714,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 +735,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 +749,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
@ -762,8 +764,8 @@ FILE FORMAT
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,24 +785,24 @@ 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:
@ -813,13 +815,15 @@ EDITOR SUPPORT
Mate-2 Mate-2
Text Wrangler https://github.com/ledger/ledger/wiki/Edit- Text Wrangler https://github.com/ledger/ledger/wiki/Edit-
ing-Ledger-files-with-TextWrangler ing-Ledger-files-with-TextWrangler
Visual Studio https://marketplace.visualstudio.com/items?item- Visual Studio https://marketplace.visualstudio.com/items?item-
Code Name=mark-hansen.hledger-vscode Code Name=mark-hansen.hledger-vscode
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)
@ -833,7 +837,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

@ -207,7 +207,7 @@ Show a balance sheet. Alias: bs.
: in single-column balance reports: use this custom line format : in single-column balance reports: use this custom line format
`--sort-amount` `--sort-amount`
: Sort by amount (total row amount, or by average if that is displayed), instead of account name (in flat mode) : sort by amount instead of account name
This command displays a simple [balance This command displays a simple [balance
sheet](http://en.wikipedia.org/wiki/Balance_sheet). It currently assumes that sheet](http://en.wikipedia.org/wiki/Balance_sheet). It currently assumes that
@ -317,7 +317,7 @@ Show a cashflow statement. Alias: cf.
: in single-column balance reports: use this custom line format : in single-column balance reports: use this custom line format
`--sort-amount` `--sort-amount`
: Sort by amount (total row amount, or by average if that is displayed), instead of account name (in flat mode) : sort by amount instead of account name
This command displays a simple This command displays a simple
[cashflow statement](http://en.wikipedia.org/wiki/Cash_flow_statement) [cashflow statement](http://en.wikipedia.org/wiki/Cash_flow_statement)
@ -444,7 +444,7 @@ Show an income statement. Alias: is.
: in single-column balance reports: use this custom line format : in single-column balance reports: use this custom line format
`--sort-amount` `--sort-amount`
: Sort by amount (total row amount, or by average if that is displayed), instead of account name (in flat mode) : sort by amount instead of account name
This command displays a simple This command displays a simple
[income statement](http://en.wikipedia.org/wiki/Income_statement). It [income statement](http://en.wikipedia.org/wiki/Income_statement). It

View File

@ -1352,6 +1352,12 @@ A file extension matching one of the above formats selects that format.
Use unicode to display prettier tables. Use unicode to display prettier tables.
.RS .RS
.RE .RE
.TP
.B \f[C]\-\-sort\-amount\f[]
Sort by amount (total row amount, or by average if that is displayed),
instead of account name (in flat mode)
.RS
.RE
.PP .PP
The balance command displays accounts and balances. The balance command displays accounts and balances.
It is hledger\[aq]s most featureful and versatile command. It is hledger\[aq]s most featureful and versatile command.
@ -1730,6 +1736,11 @@ don\[aq]t squash boring parent accounts (in tree mode)
in single\-column balance reports: use this custom line format in single\-column balance reports: use this custom line format
.RS .RS
.RE .RE
.TP
.B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name
.RS
.RE
.PP .PP
This command displays a simple balance sheet. This command displays a simple balance sheet.
It currently assumes that you have top\-level accounts named It currently assumes that you have top\-level accounts named
@ -1869,6 +1880,11 @@ don\[aq]t squash boring parent accounts (in tree mode)
in single\-column balance reports: use this custom line format in single\-column balance reports: use this custom line format
.RS .RS
.RE .RE
.TP
.B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name
.RS
.RE
.PP .PP
This command displays a simple cashflow statement It shows the change in This command displays a simple cashflow statement It shows the change in
all "cash" (ie, liquid assets) accounts for the period. all "cash" (ie, liquid assets) accounts for the period.
@ -2033,6 +2049,11 @@ don\[aq]t squash boring parent accounts (in tree mode)
in single\-column balance reports: use this custom line format in single\-column balance reports: use this custom line format
.RS .RS
.RE .RE
.TP
.B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name
.RS
.RE
.PP .PP
This command displays a simple income statement. This command displays a simple income statement.
It currently assumes that you have top\-level accounts named It currently assumes that you have top\-level accounts named

View File

@ -1022,6 +1022,10 @@ Show accounts and their balances. Aliases: b, bal.
'--pretty-tables' '--pretty-tables'
Use unicode to display prettier tables. Use unicode to display prettier tables.
'--sort-amount'
Sort by amount (total row amount, or by average if that is
displayed), 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.
@ -1354,6 +1358,9 @@ Show a balance sheet. Alias: bs.
'--format=LINEFORMAT' '--format=LINEFORMAT'
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
'--sort-amount'
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
@ -1469,6 +1476,9 @@ Show a cashflow statement. Alias: cf.
'--format=LINEFORMAT' '--format=LINEFORMAT'
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
'--sort-amount'
sort by amount instead of account name
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 currently in all "cash" (ie, liquid assets) accounts for the period. It currently
@ -1624,6 +1634,9 @@ Show an income statement. Alias: is.
'--format=LINEFORMAT' '--format=LINEFORMAT'
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
'--sort-amount'
sort by amount instead of account name
This command displays a simple income statement. It currently This command displays a simple income statement. It currently
assumes that you have top-level accounts named 'income' (or 'revenue') assumes that you have top-level accounts named 'income' (or 'revenue')
@ -2224,87 +2237,87 @@ Node: add28403
Ref: #add28504 Ref: #add28504
Node: balance31162 Node: balance31162
Ref: #balance31275 Ref: #balance31275
Node: Flat mode34295 Node: Flat mode34432
Ref: #flat-mode34422 Ref: #flat-mode34559
Node: Depth limited balance reports34842 Node: Depth limited balance reports34979
Ref: #depth-limited-balance-reports35045 Ref: #depth-limited-balance-reports35182
Node: Multicolumn balance reports35465 Node: Multicolumn balance reports35602
Ref: #multicolumn-balance-reports35676 Ref: #multicolumn-balance-reports35813
Node: Custom balance output40324 Node: Custom balance output40461
Ref: #custom-balance-output40508 Ref: #custom-balance-output40645
Node: Colour support42601 Node: Colour support42738
Ref: #colour-support42762 Ref: #colour-support42899
Node: Output destination42935 Node: Output destination43072
Ref: #output-destination43093 Ref: #output-destination43230
Node: CSV output43363 Node: CSV output43500
Ref: #csv-output43482 Ref: #csv-output43619
Node: balancesheet43879 Node: balancesheet44016
Ref: #balancesheet44017 Ref: #balancesheet44154
Node: balancesheetequity45924 Node: balancesheetequity46122
Ref: #balancesheetequity46075 Ref: #balancesheetequity46273
Node: cashflow46864 Node: cashflow47062
Ref: #cashflow46994 Ref: #cashflow47192
Node: check-dates48845 Node: check-dates49104
Ref: #check-dates48974 Ref: #check-dates49233
Node: check-dupes49091 Node: check-dupes49350
Ref: #check-dupes49218 Ref: #check-dupes49477
Node: equity49355 Node: equity49614
Ref: #equity49467 Ref: #equity49726
Node: help49630 Node: help49889
Ref: #help49733 Ref: #help49992
Node: import50807 Node: import51066
Ref: #import50923 Ref: #import51182
Node: incomestatement51318 Node: incomestatement51577
Ref: #incomestatement51454 Ref: #incomestatement51713
Node: prices53346 Node: prices53666
Ref: #prices53463 Ref: #prices53783
Node: print53506 Node: print53826
Ref: #print53618 Ref: #print53938
Node: print-unique58464 Node: print-unique58784
Ref: #print-unique58592 Ref: #print-unique58912
Node: register58660 Node: register58980
Ref: #register58789 Ref: #register59109
Node: Custom register output63290 Node: Custom register output63610
Ref: #custom-register-output63421 Ref: #custom-register-output63741
Node: register-match64718 Node: register-match65038
Ref: #register-match64854 Ref: #register-match65174
Node: rewrite65037 Node: rewrite65357
Ref: #rewrite65156 Ref: #rewrite65476
Node: stats65225 Node: stats65545
Ref: #stats65330 Ref: #stats65650
Node: tags66211 Node: tags66531
Ref: #tags66311 Ref: #tags66631
Node: test66343 Node: test66663
Ref: #test66429 Ref: #test66749
Node: ADD-ON COMMANDS66797 Node: ADD-ON COMMANDS67117
Ref: #add-on-commands66909 Ref: #add-on-commands67229
Node: Official add-ons68196 Node: Official add-ons68516
Ref: #official-add-ons68338 Ref: #official-add-ons68658
Node: api68425 Node: api68745
Ref: #api68516 Ref: #api68836
Node: ui68568 Node: ui68888
Ref: #ui68669 Ref: #ui68989
Node: web68727 Node: web69047
Ref: #web68818 Ref: #web69138
Node: Third party add-ons68864 Node: Third party add-ons69184
Ref: #third-party-add-ons69041 Ref: #third-party-add-ons69361
Node: diff69176 Node: diff69496
Ref: #diff69275 Ref: #diff69595
Node: iadd69374 Node: iadd69694
Ref: #iadd69490 Ref: #iadd69810
Node: interest69573 Node: interest69893
Ref: #interest69696 Ref: #interest70016
Node: irr69791 Node: irr70111
Ref: #irr69891 Ref: #irr70211
Node: Experimental add-ons69969 Node: Experimental add-ons70289
Ref: #experimental-add-ons70123 Ref: #experimental-add-ons70443
Node: autosync70414 Node: autosync70734
Ref: #autosync70528 Ref: #autosync70848
Node: budget70767 Node: budget71087
Ref: #budget70891 Ref: #budget71211
Node: chart70957 Node: chart71277
Ref: #chart71076 Ref: #chart71396
Node: check71147 Node: check71467
Ref: #check71251 Ref: #check71571
 
End Tag Table End Tag Table

View File

@ -917,7 +917,11 @@ COMMANDS
--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 --sort-amount
Sort by amount (total row amount, or by average if that is dis-
played), instead of account name (in flat mode)
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
@ -934,25 +938,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
@ -962,9 +966,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
@ -972,9 +976,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
@ -984,12 +988,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
@ -1004,8 +1008,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
@ -1021,8 +1025,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:
@ -1038,26 +1042,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:
@ -1079,7 +1083,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)"
@ -1097,7 +1101,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)
@ -1108,14 +1112,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)
@ -1124,7 +1128,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.
@ -1132,14 +1136,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
@ -1150,8 +1154,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)
@ -1159,8 +1163,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
@ -1174,7 +1178,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
@ -1205,8 +1209,11 @@ 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 --sort-amount
that you have top-level accounts named asset and liability (plural sort by amount instead of account name
This command displays a simple balance sheet. It currently assumes
that you have top-level accounts named asset and liability (plural
forms also allowed.) forms also allowed.)
$ hledger balancesheet $ hledger balancesheet
@ -1229,19 +1236,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.)
@ -1276,7 +1283,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
@ -1307,9 +1314,12 @@ 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 --sort-amount
in all "cash" (ie, liquid assets) accounts for the period. It cur- sort by amount instead of account name
rently assumes that cash accounts are under a top-level account named
This command displays a simple cashflow statement It shows the change
in all "cash" (ie, liquid assets) accounts for the period. It cur-
rently assumes that cash accounts are under a top-level account named
asset and do not contain receivable, :A/R or :fixed. asset and do not contain receivable, :A/R or :fixed.
$ hledger cashflow $ hledger cashflow
@ -1327,33 +1337,33 @@ 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.
check-dates check-dates
Check that transactions are sorted by increasing date. With a query, Check that transactions are sorted by increasing date. With a query,
only matched transactions' dates are checked. only matched transactions' dates are checked.
check-dupes check-dupes
Report account names having the same leaf but different prefixes. An Report account names having the same leaf but different prefixes. An
example: http://stefanorodighiero.net/software/hledger-dupes.html example: http://stefanorodighiero.net/software/hledger-dupes.html
equity equity
Print closing/opening transactions that bring some or all account bal- Print closing/opening transactions that bring some or all account bal-
ances to zero and back. Can be useful for bringing account balances ances to zero and back. Can be useful for bringing account balances
across file boundaries. across file boundaries.
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
@ -1377,17 +1387,17 @@ 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
just show the transactions to be imported just show the transactions to be imported
Input files are provided as arguments, or glob patterns. So eg to add Input files are provided as arguments, or glob patterns. So eg to add
new transactions from all CSV files to the main journal: hledger import new transactions from all CSV files to the main journal: hledger import
*.csv *.csv
New transactions are detected like print --new (using .latest.FILE New transactions are detected like print --new (using .latest.FILE
state files). state files).
incomestatement incomestatement
@ -1397,7 +1407,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
@ -1428,8 +1438,11 @@ 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 --sort-amount
that you have top-level accounts named income (or revenue) and expense sort by amount instead of account name
This command displays a simple income statement. It currently assumes
that you have top-level accounts named income (or revenue) and expense
(plural forms also allowed.) (plural forms also allowed.)
$ hledger incomestatement $ hledger incomestatement
@ -1454,8 +1467,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.
prices prices
@ -1465,7 +1478,7 @@ COMMANDS
Show transactions from the journal. Aliases: p, txns. Show transactions from the journal. Aliases: p, txns.
-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
--new show only newer-dated transactions added in each file since last --new show only newer-dated transactions added in each file since last
@ -1478,7 +1491,7 @@ 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.
$ hledger print $ hledger print
@ -1509,39 +1522,39 @@ COMMANDS
it does not preserve directives or inter-transaction comments it does not preserve directives or inter-transaction comments
Normally, the journal entry's explicit or implicit amount style is pre- Normally, the journal entry's explicit or implicit amount style is pre-
served. Ie when an amount is omitted in the journal, it will be omit- served. Ie when an amount is omitted in the journal, it will be omit-
ted in the output. You can use the -x/--explicit flag to make all ted in the output. You can use the -x/--explicit flag to make all
amounts explicit, which can be useful for troubleshooting or for making amounts explicit, which can be useful for troubleshooting or for making
your journal more readable and robust against data entry errors. Note, your journal more readable and robust against data entry errors. Note,
-x will cause postings with a multi-commodity amount (these can arise -x will cause postings with a multi-commodity amount (these can arise
when a multi-commodity transaction has an implicit amount) will be when a multi-commodity transaction has an implicit amount) will be
split into multiple single-commodity postings, for valid journal out- split into multiple single-commodity postings, for valid journal out-
put. put.
With -B/--cost, amounts with transaction prices are converted to cost With -B/--cost, amounts with transaction prices are converted to cost
using that price. using that price.
With -m/--match and a STR argument, print will show at most one trans- With -m/--match and a STR argument, print will show at most one trans-
action: the one one whose description is most similar to STR, and is action: the one one whose description is most similar to STR, and is
most recent. STR should contain at least two characters. If there is most recent. STR should contain at least two characters. If there is
no similar-enough match, no transaction will be shown. no similar-enough match, no transaction will be shown.
With --new, for each FILE being read, hledger reads (and writes) a spe- With --new, for each FILE being read, hledger reads (and writes) a spe-
cial state file (.latest.FILE in the same directory), containing the cial state file (.latest.FILE in the same directory), containing the
latest transaction date(s) that were seen last time FILE was read. latest transaction date(s) that were seen last time FILE was read.
When this file is found, only transactions with newer dates (and new When this file is found, only transactions with newer dates (and new
transactions on the latest date) are printed. This is useful for transactions on the latest date) are printed. This is useful for
ignoring already-seen entries in import data, such as downloaded CSV ignoring already-seen entries in import data, such as downloaded CSV
files. Eg: files. Eg:
$ hledger -f bank1.csv print --new $ hledger -f bank1.csv print --new
# shows transactions added since last print --new on this file # shows transactions added since last print --new on this file
This assumes that transactions added to FILE always have same or This assumes that transactions added to FILE always have same or
increasing dates, and that transactions on the same day do not get increasing dates, and that transactions on the same day do not get
reordered. See also the import command. reordered. See also the import command.
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
@ -1558,20 +1571,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.)
print-unique print-unique
@ -1584,7 +1597,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
@ -1595,18 +1608,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
@ -1615,8 +1628,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
@ -1626,23 +1639,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
@ -1659,7 +1672,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
@ -1667,19 +1680,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) ---------------------------------->
@ -1695,12 +1708,12 @@ 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.
register-match register-match
Print the one posting whose transaction description is closest to DESC, Print the one posting whose transaction description is closest to DESC,
in the style of the register command. Helps ledger-autosync detect in the style of the register command. Helps ledger-autosync detect
already-seen transactions when importing. already-seen transactions when importing.
rewrite rewrite
@ -1710,7 +1723,7 @@ COMMANDS
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
@ -1725,8 +1738,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
@ -1741,34 +1754,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:
@ -1786,7 +1799,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
@ -1794,7 +1807,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
@ -1802,19 +1815,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
@ -1827,21 +1840,21 @@ ADD-ON COMMANDS
hledger-check.hs checks more powerful account balance assertions. hledger-check.hs checks more powerful account balance assertions.
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
@ -1854,33 +1867,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
@ -1899,7 +1912,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
@ -1920,7 +1933,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)
@ -1934,7 +1947,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)