journal, bal: document account codes

This commit is contained in:
Simon Michael 2018-01-23 16:41:19 -08:00
parent e491f513a1
commit 37555617b7
11 changed files with 464 additions and 362 deletions

View File

@ -943,23 +943,55 @@ end\ aliases
.fi .fi
.SS account directive .SS account directive
.PP .PP
The \f[C]account\f[] directive predefines account names, as in Ledger The \f[C]account\f[] directive predeclares account names.
and Beancount. The simplest form is \f[C]account\ ACCTNAME\f[], eg:
This may be useful for your own documentation; hledger doesn't make use
of it yet.
.IP .IP
.nf .nf
\f[C] \f[C]
;\ account\ ACCT
;\ \ \ OPTIONAL\ COMMENTS/TAGS...
account\ assets:bank:checking account\ assets:bank:checking
\ a\ comment \f[]
\ acct\-no:12345 .fi
.PP
Currently this mainly helps with account name autocompletion in eg
hledger add, hledger\-iadd, hledger\-web, and ledger\-mode.
.PD 0
.P
.PD
In future it will also help detect misspelled accounts.
.PP
Account names can be followed by a numeric account code:
.IP
.nf
\f[C]
account\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 1000
account\ assets:bank:checking\ \ \ \ 1110
account\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ 2000
account\ revenues\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4000
account\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 6000
\f[]
.fi
.PP
This affects account display order in reports: accounts with codes are
listed before accounts without codes, in increasing code order.
(Otherwise, accounts are listed alphabetically.) Account codes should be
all numeric digits, unique, and separated from the account name by at
least two spaces (since account names may contain single spaces).
By convention, often the first digit indicates the type of account, as
in this numbering scheme and the example above.
In future, we might use this to recognize account types.
.PP
An account directive can also have indented subdirectives following it,
which are currently ignored.
Here is the full syntax:
.IP
.nf
\f[C]
;\ account\ ACCTNAME\ \ [OPTIONALCODE]
;\ \ \ [OPTIONALSUBDIRECTIVES]
account\ expenses:food account\ assets:bank:checking\ \ \ 1110
\ \ a\ comment
;\ etc. \ \ some\-tag:12345
\f[] \f[]
.fi .fi
.SS apply account directive .SS apply account directive

View File

@ -903,20 +903,41 @@ File: hledger_journal.info, Node: account directive, Next: apply account direc
1.14.2 account directive 1.14.2 account directive
------------------------ ------------------------
The 'account' directive predefines account names, as in Ledger and The 'account' directive predeclares account names. The simplest form is
Beancount. This may be useful for your own documentation; hledger 'account ACCTNAME', eg:
doesn't make use of it yet.
; account ACCT
; OPTIONAL COMMENTS/TAGS...
account assets:bank:checking account assets:bank:checking
a comment
acct-no:12345
account expenses:food Currently this mainly helps with account name autocompletion in eg
hledger add, hledger-iadd, hledger-web, and ledger-mode.
In future it will also help detect misspelled accounts.
; etc. Account names can be followed by a numeric account code:
account assets 1000
account assets:bank:checking 1110
account liabilities 2000
account revenues 4000
account expenses 6000
This affects account display order in reports: accounts with codes
are listed before accounts without codes, in increasing code order.
(Otherwise, accounts are listed alphabetically.) Account codes should
be all numeric digits, unique, and separated from the account name by at
least two spaces (since account names may contain single spaces). By
convention, often the first digit indicates the type of account, as in
this numbering scheme and the example above. In future, we might use
this to recognize account types.
An account directive can also have indented subdirectives following
it, which are currently ignored. Here is the full syntax:
; account ACCTNAME [OPTIONALCODE]
; [OPTIONALSUBDIRECTIVES]
account assets:bank:checking 1110
a comment
some-tag:12345
 
File: hledger_journal.info, Node: apply account directive, Next: Multi-line comments, Prev: account directive, Up: Directives File: hledger_journal.info, Node: apply account directive, Next: Multi-line comments, Prev: account directive, Up: Directives
@ -1218,23 +1239,23 @@ Node: end aliases32215
Ref: #end-aliases32355 Ref: #end-aliases32355
Node: account directive32456 Node: account directive32456
Ref: #account-directive32636 Ref: #account-directive32636
Node: apply account directive32932 Node: apply account directive33983
Ref: #apply-account-directive33128 Ref: #apply-account-directive34179
Node: Multi-line comments33787 Node: Multi-line comments34838
Ref: #multi-line-comments33977 Ref: #multi-line-comments35028
Node: commodity directive34105 Node: commodity directive35156
Ref: #commodity-directive34289 Ref: #commodity-directive35340
Node: Default commodity35161 Node: Default commodity36212
Ref: #default-commodity35334 Ref: #default-commodity36385
Node: Default year35871 Node: Default year36922
Ref: #default-year36036 Ref: #default-year37087
Node: Including other files36459 Node: Including other files37510
Ref: #including-other-files36616 Ref: #including-other-files37667
Node: Periodic transactions37013 Node: Periodic transactions38064
Ref: #periodic-transactions37184 Ref: #periodic-transactions38235
Node: Automated posting rules37927 Node: Automated posting rules38978
Ref: #automated-posting-rules38105 Ref: #automated-posting-rules39156
Node: EDITOR SUPPORT39214 Node: EDITOR SUPPORT40265
Ref: #editor-support39344 Ref: #editor-support40395
 
End Tag Table End Tag Table

View File

@ -716,20 +716,39 @@ end aliases
### account directive ### account directive
The `account` directive predefines account names, as in Ledger and Beancount. The `account` directive predeclares account names. The simplest form is `account ACCTNAME`, eg:
This may be useful for your own documentation; hledger doesn't make use of it yet.
```journal ```journal
; account ACCT
; OPTIONAL COMMENTS/TAGS...
account assets:bank:checking account assets:bank:checking
a comment ```
acct-no:12345 Currently this mainly helps with account name autocompletion in eg
hledger add, hledger-iadd, hledger-web, and ledger-mode.
In future it will also help detect misspelled accounts.
account expenses:food Account names can be followed by a numeric account code:
```journal
account assets 1000
account assets:bank:checking 1110
account liabilities 2000
account revenues 4000
account expenses 6000
```
This affects account display order in reports: accounts with codes are listed before accounts without codes, in increasing code order.
(Otherwise, accounts are listed alphabetically.)
Account codes should be all numeric digits, unique, and separated from the account name by at least two spaces (since account names may contain single spaces).
By convention, often the first digit indicates the type of account,
as in
[this numbering scheme](http://www.dwmbeancounter.com/BCTutorSite/Courses/ChartAccounts/lesson02-6.html)
and the example above.
In future, we might use this to recognize account types.
; etc. An account directive can also have indented subdirectives following it, which are currently ignored. Here is the full syntax:
```journal
; account ACCTNAME [OPTIONALCODE]
; [OPTIONALSUBDIRECTIVES]
account assets:bank:checking 1110
a comment
some-tag:12345
``` ```
### apply account directive ### apply account directive

View File

@ -690,20 +690,41 @@ FILE FORMAT
end aliases end aliases
account directive account directive
The account directive predefines account names, as in Ledger and Bean- The account directive predeclares account names. The simplest form is
count. This may be useful for your own documentation; hledger doesn't account ACCTNAME, eg:
make use of it yet.
; account ACCT
; OPTIONAL COMMENTS/TAGS...
account assets:bank:checking account assets:bank:checking
a comment
acct-no:12345
account expenses:food Currently this mainly helps with account name autocompletion in eg
hledger add, hledger-iadd, hledger-web, and ledger-mode.
In future it will also help detect misspelled accounts.
; etc. Account names can be followed by a numeric account code:
account assets 1000
account assets:bank:checking 1110
account liabilities 2000
account revenues 4000
account expenses 6000
This affects account display order in reports: accounts with codes are
listed before accounts without codes, in increasing code order. (Oth-
erwise, accounts are listed alphabetically.) Account codes should be
all numeric digits, unique, and separated from the account name by at
least two spaces (since account names may contain single spaces). By
convention, often the first digit indicates the type of account, as in
this numbering scheme and the example above. In future, we might use
this to recognize account types.
An account directive can also have indented subdirectives following it,
which are currently ignored. Here is the full syntax:
; account ACCTNAME [OPTIONALCODE]
; [OPTIONALSUBDIRECTIVES]
account assets:bank:checking 1110
a comment
some-tag:12345
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
@ -880,7 +901,6 @@ EDITOR SUPPORT
Editor Editor
-------------------------------------------------------------------------- --------------------------------------------------------------------------
Emacs http://www.ledger-cli.org/3.0/doc/ledger-mode.html Emacs http://www.ledger-cli.org/3.0/doc/ledger-mode.html
Vim https://github.com/ledger/ledger/wiki/Getting-started Vim https://github.com/ledger/ledger/wiki/Getting-started
Sublime Text https://github.com/ledger/ledger/wiki/Edit- Sublime Text https://github.com/ledger/ledger/wiki/Edit-
ing-Ledger-files-with-Sublime-Text-or-RubyMine ing-Ledger-files-with-Sublime-Text-or-RubyMine

View File

@ -289,7 +289,7 @@ balancemode = (defCommandMode $ ["balance"] ++ aliases) { -- also accept but don
,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)" ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode to display prettier tables" ,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode to display prettier tables"
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed." ,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."
,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions" ,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"
,flagNone ["show-unbudgeted"] (setboolopt "show-unbudgeted") "with --budget, show unbudgeted accounts also" ,flagNone ["show-unbudgeted"] (setboolopt "show-unbudgeted") "with --budget, show unbudgeted accounts also"
] ]

View File

@ -106,7 +106,7 @@ compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = (defCommandMode $ cb
,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)" ,flagNone ["no-elide"] (\opts -> setboolopt "no-elide" opts) "don't squash boring parent accounts (in tree mode)"
,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)" ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"
,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables" ,flagNone ["pretty-tables"] (\opts -> setboolopt "pretty-tables" opts) "use unicode when displaying tables"
,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account name" ,flagNone ["sort-amount","S"] (\opts -> setboolopt "sort-amount" opts) "sort by amount instead of account code/name"
,outputFormatFlag ,outputFormatFlag
,outputFileFlag ,outputFileFlag
] ]

View File

@ -1464,7 +1464,7 @@ use unicode to display prettier tables.
.RE .RE
.TP .TP
.B \f[C]\-\-sort\-amount\f[] .B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name (in flat mode). sort by amount instead of account code/name (in flat mode).
With multiple columns, sorts by the row total, or by row average if that With multiple columns, sorts by the row total, or by row average if that
is displayed. is displayed.
.RS .RS
@ -1510,14 +1510,18 @@ balance.
.PP .PP
By default, accounts are displayed hierarchically, with subaccounts By default, accounts are displayed hierarchically, with subaccounts
indented below their parent. indented below their parent.
At each level of the tree, accounts are sorted by account code if any,
then by account name.
Or with \f[C]\-S/\-\-sort\-amount\f[], by their balance amount.
.PP
\[lq]Boring\[rq] accounts, which contain a single interesting subaccount \[lq]Boring\[rq] accounts, which contain a single interesting subaccount
and no balance of their own, are elided into the following line for more and no balance of their own, are elided into the following line for more
compact output. compact output.
(Use \f[C]\-\-no\-elide\f[] to prevent this. (Not yet supported in tabular reports.) Use \f[C]\-\-no\-elide\f[] to
Eliding of boring accounts is not yet supported in multicolumn reports.) prevent this.
.PP .PP
Each account's balance is the \[lq]inclusive\[rq] balance \- it includes Account balances are \[lq]inclusive\[rq] \- they include the balances of
the balances of any subaccounts. any subaccounts.
.PP .PP
Accounts which have zero balance (and no non\-zero subaccounts) are Accounts which have zero balance (and no non\-zero subaccounts) are
omitted. omitted.
@ -1971,7 +1975,7 @@ in single\-column balance reports: use this custom line format
.RE .RE
.TP .TP
.B \f[C]\-\-sort\-amount\f[] .B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name sort by amount instead of account code/name
.RS .RS
.RE .RE
.PP .PP
@ -2113,7 +2117,7 @@ in single\-column balance reports: use this custom line format
.RE .RE
.TP .TP
.B \f[C]\-\-sort\-amount\f[] .B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name sort by amount instead of account code/name
.RS .RS
.RE .RE
.PP .PP
@ -2300,7 +2304,7 @@ in single\-column balance reports: use this custom line format
.RE .RE
.TP .TP
.B \f[C]\-\-sort\-amount\f[] .B \f[C]\-\-sort\-amount\f[]
sort by amount instead of account name sort by amount instead of account code/name
.RS .RS
.RE .RE
.PP .PP

View File

@ -1094,7 +1094,7 @@ Show accounts and their balances. Aliases: b, bal.
use unicode to display prettier tables. use unicode to display prettier tables.
'--sort-amount' '--sort-amount'
sort by amount instead of account name (in flat mode). With sort by amount instead of account code/name (in flat mode). With
multiple columns, sorts by the row total, or by row average if that multiple columns, sorts by the row total, or by row average if that
is displayed. is displayed.
'--budget' '--budget'
@ -1128,14 +1128,17 @@ where you do not filter by date and your journal sets the correct
opening balances, this is the same as the account's ending balance. opening balances, 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. At each level of the tree, accounts are
interesting subaccount and no balance of their own, are elided into the sorted by account code if any, then by account name. Or with
following line for more compact output. (Use '--no-elide' to prevent '-S/--sort-amount', by their balance amount.
this. Eliding of boring accounts is not yet supported in multicolumn
reports.)
Each account's balance is the "inclusive" balance - it includes the "Boring" accounts, which contain a single interesting subaccount and
balances of any subaccounts. no balance of their own, are elided into the following line for more
compact output. (Not yet supported in tabular reports.) Use
'--no-elide' to prevent this.
Account balances are "inclusive" - they include the balances of any
subaccounts.
Accounts which have zero balance (and no non-zero subaccounts) are Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use '-E/--empty' to show them. omitted. Use '-E/--empty' to show them.
@ -1537,7 +1540,7 @@ conventional financial statements, unlike balance/print/register)
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 instead of account name sort by amount instead of account code/name
Example: Example:
@ -1653,7 +1656,7 @@ statements, unlike balance/print/register) (experimental). (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 instead of account name sort by amount instead of account code/name
Example: Example:
@ -1821,7 +1824,7 @@ unlike balance/print/register) (experimental). (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 instead of account name sort by amount instead of account code/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')
@ -2429,89 +2432,89 @@ Node: add31307
Ref: #add31406 Ref: #add31406
Node: balance34067 Node: balance34067
Ref: #balance34178 Ref: #balance34178
Node: Flat mode37552 Node: Flat mode37658
Ref: #flat-mode37677 Ref: #flat-mode37783
Node: Depth limited balance reports38097 Node: Depth limited balance reports38203
Ref: #depth-limited-balance-reports38298 Ref: #depth-limited-balance-reports38404
Node: Multicolumn balance reports38718 Node: Multicolumn balance reports38824
Ref: #multicolumn-balance-reports38913 Ref: #multicolumn-balance-reports39019
Node: Budgets43602 Node: Budgets43708
Ref: #budgets43749 Ref: #budgets43855
Node: Custom balance output47580 Node: Custom balance output47686
Ref: #custom-balance-output47742 Ref: #custom-balance-output47848
Node: Colour support49835 Node: Colour support49941
Ref: #colour-support49994 Ref: #colour-support50100
Node: Output destination50167 Node: Output destination50273
Ref: #output-destination50323 Ref: #output-destination50429
Node: CSV output50593 Node: CSV output50699
Ref: #csv-output50710 Ref: #csv-output50816
Node: balancesheet51107 Node: balancesheet51213
Ref: #balancesheet51243 Ref: #balancesheet51349
Node: balancesheetequity53470 Node: balancesheetequity53581
Ref: #balancesheetequity53619 Ref: #balancesheetequity53730
Node: cashflow54156 Node: cashflow54267
Ref: #cashflow54284 Ref: #cashflow54395
Node: check-dates56323 Node: check-dates56439
Ref: #check-dates56450 Ref: #check-dates56566
Node: check-dupes56567 Node: check-dupes56683
Ref: #check-dupes56691 Ref: #check-dupes56807
Node: close56828 Node: close56944
Ref: #close56935 Ref: #close57051
Node: help57265 Node: help57381
Ref: #help57365 Ref: #help57481
Node: import58439 Node: import58555
Ref: #import58553 Ref: #import58669
Node: incomestatement59283 Node: incomestatement59399
Ref: #incomestatement59417 Ref: #incomestatement59533
Node: prices61737 Node: prices61858
Ref: #prices61852 Ref: #prices61973
Node: print61895 Node: print62016
Ref: #print62005 Ref: #print62126
Node: print-unique66890 Node: print-unique67011
Ref: #print-unique67016 Ref: #print-unique67137
Node: register67084 Node: register67205
Ref: #register67211 Ref: #register67332
Node: Custom register output71712 Node: Custom register output71833
Ref: #custom-register-output71841 Ref: #custom-register-output71962
Node: register-match73138 Node: register-match73259
Ref: #register-match73272 Ref: #register-match73393
Node: rewrite73455 Node: rewrite73576
Ref: #rewrite73572 Ref: #rewrite73693
Node: stats73641 Node: stats73762
Ref: #stats73744 Ref: #stats73865
Node: tags74626 Node: tags74747
Ref: #tags74724 Ref: #tags74845
Node: test74960 Node: test75081
Ref: #test75044 Ref: #test75165
Node: ADD-ON COMMANDS75412 Node: ADD-ON COMMANDS75533
Ref: #add-on-commands75522 Ref: #add-on-commands75643
Node: Official add-ons76809 Node: Official add-ons76930
Ref: #official-add-ons76949 Ref: #official-add-ons77070
Node: api77036 Node: api77157
Ref: #api77125 Ref: #api77246
Node: ui77177 Node: ui77298
Ref: #ui77276 Ref: #ui77397
Node: web77334 Node: web77455
Ref: #web77423 Ref: #web77544
Node: Third party add-ons77469 Node: Third party add-ons77590
Ref: #third-party-add-ons77644 Ref: #third-party-add-ons77765
Node: diff77779 Node: diff77900
Ref: #diff77876 Ref: #diff77997
Node: iadd77975 Node: iadd78096
Ref: #iadd78089 Ref: #iadd78210
Node: interest78172 Node: interest78293
Ref: #interest78293 Ref: #interest78414
Node: irr78388 Node: irr78509
Ref: #irr78486 Ref: #irr78607
Node: Experimental add-ons78564 Node: Experimental add-ons78685
Ref: #experimental-add-ons78716 Ref: #experimental-add-ons78837
Node: autosync79007 Node: autosync79128
Ref: #autosync79119 Ref: #autosync79240
Node: budget79358 Node: budget79479
Ref: #budget79480 Ref: #budget79601
Node: chart79546 Node: chart79667
Ref: #chart79663 Ref: #chart79784
Node: check79734 Node: check79855
Ref: #check79836 Ref: #check79957
 
End Tag Table End Tag Table

View File

@ -997,9 +997,9 @@ COMMANDS
use unicode to display prettier tables. use unicode to display prettier tables.
--sort-amount --sort-amount
sort by amount instead of account name (in flat mode). With sort by amount instead of account code/name (in flat mode).
multiple columns, sorts by the row total, or by row average if With multiple columns, sorts by the row total, or by row average
that is displayed. if that is displayed.
--budget --budget
show performance compared to budget goals defined by periodic show performance compared to budget goals defined by periodic
@ -1031,19 +1031,22 @@ COMMANDS
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. At each level of the tree, accounts are
interesting subaccount and no balance of their own, are elided into the sorted by account code if any, then by account name. Or with
following line for more compact output. (Use --no-elide to prevent -S/--sort-amount, by their balance amount.
this. Eliding of boring accounts is not yet supported in multicolumn
reports.)
Each account's balance is the "inclusive" balance - it includes the "Boring" accounts, which contain a single interesting subaccount and no
balances of any subaccounts. balance of their own, are elided into the following line for more com-
pact output. (Not yet supported in tabular reports.) Use --no-elide to
prevent this.
Accounts which have zero balance (and no non-zero subaccounts) are Account balances are "inclusive" - they include the balances of any
subaccounts.
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
@ -1053,9 +1056,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
@ -1063,9 +1066,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
@ -1075,12 +1078,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
@ -1095,8 +1098,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
@ -1112,8 +1115,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:
@ -1129,26 +1132,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:
@ -1170,13 +1173,13 @@ 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
Budgets Budgets
With --budget and a report interval, all periodic transactions in your With --budget and a report interval, all periodic transactions in your
journal with that interval, active during the requested report period, journal with that interval, active during the requested report period,
are interpreted as recurring budget goals for the specified accounts are interpreted as recurring budget goals for the specified accounts
(and subaccounts), and the report will show the difference between (and subaccounts), and the report will show the difference between
actual and budgeted balances. actual and budgeted balances.
For example, you can take average monthly expenses in the common For example, you can take average monthly expenses in the common
expense categories to construct a minimal monthly budget: expense categories to construct a minimal monthly budget:
;; Budget ;; Budget
@ -1235,8 +1238,8 @@ COMMANDS
-----------------------++------------------------------------------------- -----------------------++-------------------------------------------------
|| 0 0 || 0 0
Accounts with no budget goals (not mentioned in the periodic transac- Accounts with no budget goals (not mentioned in the periodic transac-
tions) will be aggregated under <unbudgeted>, unless you add the tions) will be aggregated under <unbudgeted>, unless you add the
--show-unbudgeted flag to display them normally: --show-unbudgeted flag to display them normally:
$ hledger balance --budget --show-unbudgeted $ hledger balance --budget --show-unbudgeted
@ -1257,7 +1260,7 @@ COMMANDS
For more examples and details, see Budgeting and Forecasting. For more examples and details, see Budgeting and Forecasting.
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)"
@ -1275,7 +1278,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)
@ -1286,14 +1289,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)
@ -1302,7 +1305,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.
@ -1310,14 +1313,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
@ -1328,8 +1331,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)
@ -1337,8 +1340,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
@ -1346,11 +1349,11 @@ COMMANDS
balancesheet balancesheet
This command displays a simple balance sheet, showing historical ending This command displays a simple balance sheet, showing historical ending
balances of asset and liability accounts (ignoring any report begin balances of asset and liability accounts (ignoring any report begin
date). It assumes that these accounts are under a top-level asset or date). It assumes that these accounts are under a top-level asset or
liability account (case insensitive, plural forms also allowed). Note liability account (case insensitive, plural forms also allowed). Note
this report shows all account balances with normal positive sign (like this report shows all account balances with normal positive sign (like
conventional financial statements, unlike balance/print/register) conventional financial statements, unlike balance/print/register)
(experimental). (bs) (experimental). (bs)
--change --change
@ -1358,7 +1361,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
@ -1390,7 +1393,7 @@ COMMANDS
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 instead of account name sort by amount instead of account code/name
Example: Example:
@ -1414,13 +1417,13 @@ 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
Just like balancesheet, but also reports Equity (which it assumes is Just like balancesheet, but also reports Equity (which it assumes is
under a top-level equity account). under a top-level equity account).
Example: Example:
@ -1450,10 +1453,10 @@ COMMANDS
0 0
cashflow cashflow
This command displays a simple cashflow statement, showing changes in This command displays a simple cashflow statement, showing changes in
"cash" accounts. It assumes that these accounts are under a top-level "cash" accounts. It assumes that these accounts are under a top-level
asset account (case insensitive, plural forms also allowed) and do not asset account (case insensitive, plural forms also allowed) and do not
contain receivable or A/R in their name. Note this report shows all contain receivable or A/R in their name. Note this report shows all
account balances with normal positive sign (like conventional financial account balances with normal positive sign (like conventional financial
statements, unlike balance/print/register) (experimental). (cf) statements, unlike balance/print/register) (experimental). (cf)
@ -1461,7 +1464,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
@ -1493,7 +1496,7 @@ COMMANDS
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 instead of account name sort by amount instead of account code/name
Example: Example:
@ -1512,35 +1515,35 @@ 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
close close
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 asset/liability ances to zero and back. Can be useful for bringing asset/liability
balances across file boundaries, or for closing out income/expenses for balances across file boundaries, or for closing out income/expenses for
a period. This was formerly called "equity", as in Ledger, and that a period. This was formerly called "equity", as in Ledger, and that
alias is also accepted. See close -help for more. alias is also accepted. See close -help for more.
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
@ -1564,7 +1567,7 @@ COMMANDS
... ...
import import
Read new transactions added to each FILE since last run, and add them Read new transactions added to each FILE since last run, and add them
to the main journal file. to the main journal file.
--dry-run --dry-run
@ -1574,28 +1577,28 @@ COMMANDS
each one. So eg to add new transactions from all CSV files to the main each one. So eg to add new transactions from all CSV files to the main
journal, it's just: hledger import *.csv journal, it's just: hledger import *.csv
New transactions are detected in the same way as print -new: by assum- New transactions are detected in the same way as print -new: by assum-
ing transactions are always added to the input files in increasing date ing transactions are always added to the input files in increasing date
order, and by saving .latest.FILE state files. order, and by saving .latest.FILE state files.
The -dry-run output is in journal format, so you can filter it, eg to The -dry-run output is in journal format, so you can filter it, eg to
see only uncategorised transactions: see only uncategorised transactions:
$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
incomestatement incomestatement
This command displays a simple income statement, showing revenues and This command displays a simple income statement, showing revenues and
expenses during a period. It assumes that these accounts are under a expenses during a period. It assumes that these accounts are under a
top-level revenue or income or expense account (case insensitive, plu- top-level revenue or income or expense account (case insensitive, plu-
ral forms also allowed). Note this report shows all account balances ral forms also allowed). Note this report shows all account balances
with normal positive sign (like conventional financial statements, with normal positive sign (like conventional financial statements,
unlike balance/print/register) (experimental). (is) unlike balance/print/register) (experimental). (is)
--change --change
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
@ -1627,10 +1630,10 @@ COMMANDS
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 instead of account name sort by amount instead of account code/name
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
@ -1655,8 +1658,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
@ -1666,7 +1669,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
@ -1679,7 +1682,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
@ -1710,39 +1713,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. This can be used for troubleshooting. using that price. This can be used for troubleshooting.
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
@ -1759,20 +1762,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
@ -1785,7 +1788,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
@ -1796,18 +1799,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
@ -1816,8 +1819,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
@ -1827,23 +1830,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
@ -1860,7 +1863,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
@ -1868,18 +1871,18 @@ 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:
@ -1896,12 +1899,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
@ -1911,7 +1914,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
@ -1926,16 +1929,16 @@ 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
destination. destination.
tags tags
List all the tag names used in the journal. With a TAGREGEX argument, List all the tag names used in the journal. With a TAGREGEX argument,
only tag names matching the regular expression (case insensitive) are only tag names matching the regular expression (case insensitive) are
shown. With additional QUERY arguments, only transactions matching the shown. With additional QUERY arguments, only transactions matching the
query are considered. query are considered.
@ -1945,34 +1948,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:
@ -1990,7 +1993,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
@ -1998,7 +2001,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
@ -2006,19 +2009,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
@ -2031,21 +2034,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
@ -2058,33 +2061,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
@ -2103,7 +2106,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
@ -2124,7 +2127,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)
@ -2138,7 +2141,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

@ -45,7 +45,7 @@ txt, csv.
: use unicode to display prettier tables. : use unicode to display prettier tables.
`--sort-amount` `--sort-amount`
: sort by amount instead of account name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed. : sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed.
`--budget` `--budget`
: show performance compared to budget goals defined by [periodic transactions](journal.html#periodic-transactions) : show performance compared to budget goals defined by [periodic transactions](journal.html#periodic-transactions)
@ -75,15 +75,15 @@ $ hledger balance
More precisely, the balance command shows the *change* to each account's balance caused by all (matched) postings. More precisely, the balance command shows the *change* to each account's balance caused by all (matched) postings.
In the common case where you do not filter by date and your journal sets the correct opening balances, this is the same as the account's ending balance. In the common case where you do not filter by date and your journal sets the correct opening balances, 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.
indented below their parent. At each level of the tree, accounts are sorted by [account code](/manual.html#account-directive) if any, then by account name.
"Boring" accounts, which contain a single interesting Or with `-S/--sort-amount`, by their balance amount.
subaccount and no balance of their own, are elided into the following
line for more compact output. (Use `--no-elide` to prevent this.
Eliding of boring accounts is not yet supported in multicolumn reports.)
Each account's balance is the "inclusive" balance - it includes the "Boring" accounts, which contain a single interesting subaccount and
balances of any subaccounts. no balance of their own, are elided into the following line for more compact output.
(Not yet supported in tabular reports.) Use `--no-elide` to prevent this.
Account balances are "inclusive" - they include the balances of any subaccounts.
Accounts which have zero balance (and no non-zero subaccounts) are Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use `-E/--empty` to show them. omitted. Use `-E/--empty` to show them.

View File

@ -218,7 +218,7 @@ _include_({{hledger_balance.m4.md}})
: 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 instead of account name : sort by amount instead of account code/name
Example: Example:
```shell ```shell
@ -324,7 +324,7 @@ Total:
: 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 instead of account name : sort by amount instead of account code/name
Example: Example:
```shell ```shell
@ -463,7 +463,7 @@ $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions
: 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 instead of account name : sort by amount instead of account code/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