bal: document colour support

[ci skip]
This commit is contained in:
Simon Michael 2017-04-25 18:42:35 -07:00
parent 10d85bedec
commit bc111c49ca
4 changed files with 279 additions and 241 deletions

View File

@ -45,7 +45,7 @@ txt, csv.
: Use unicode to display prettier tables.
The balance command displays accounts and balances.
It is hledger's most featureful and most useful command.
It is hledger's most featureful and versatile command.
```shell
$ hledger balance
@ -70,12 +70,12 @@ By default, accounts are displayed hierarchically, with subaccounts
indented below their parent.
"Boring" accounts, which contain a single interesting
subaccount and no balance of their own, are elided into the following
line for more compact output. (Use `--no-elide` to prevent this.)
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
balances of any subaccounts.
Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use `-E/--empty` to show them.
@ -290,6 +290,13 @@ Some example formats:
- `%,%-50(account) %25(total)` - account name padded to 50 characters, total padded to 20 characters, with multiple commodities rendered on one line
- `%20(total) %2(depth_spacer)%-(account)` - the default format for the single-column balance report
### Colour support
The balance command shows negative amounts in red, if:
- the `TERM` environment variable is not set to `dumb`
- the output is not being redirected or piped anywhere
### Output destination
The balance, print, register and stats commands can write their output to a

View File

@ -1354,7 +1354,7 @@ Use unicode to display prettier tables.
.RE
.PP
The balance command displays accounts and balances.
It is hledger\[aq]s most featureful and most useful command.
It is hledger\[aq]s most featureful and versatile command.
.IP
.nf
\f[C]
@ -1385,7 +1385,8 @@ indented below their parent.
"Boring" accounts, which contain a single interesting subaccount and no
balance of their own, are elided into the following line for more
compact output.
(Use \f[C]\-\-no\-elide\f[] to prevent this.)
(Use \f[C]\-\-no\-elide\f[] to prevent this.
Eliding of boring accounts is not yet supported in multicolumn reports.)
.PP
Each account\[aq]s balance is the "inclusive" balance \- it includes the
balances of any subaccounts.
@ -1631,6 +1632,13 @@ rendered on one line
.IP \[bu] 2
\f[C]%20(total)\ \ %2(depth_spacer)%\-(account)\f[] \- the default
format for the single\-column balance report
.SS Colour support
.PP
The balance command shows negative amounts in red, if:
.IP \[bu] 2
the \f[C]TERM\f[] environment variable is not set to \f[C]dumb\f[]
.IP \[bu] 2
the output is not being redirected or piped anywhere
.SS Output destination
.PP
The balance, print, register and stats commands can write their output

View File

@ -1013,7 +1013,7 @@ Show accounts and their balances. Alias: bal.
Use unicode to display prettier tables.
The balance command displays accounts and balances. It is hledger's
most featureful and most useful command.
most featureful and versatile command.
$ hledger balance
$-1 assets
@ -1038,7 +1038,8 @@ opening balances, this is the same as the account's ending balance.
indented below their parent. "Boring" accounts, which contain a single
interesting subaccount and no balance of their own, are elided into the
following line for more compact output. (Use '--no-elide' to prevent
this.)
this. Eliding of boring accounts is not yet supported in multicolumn
reports.)
Each account's balance is the "inclusive" balance - it includes the
balances of any subaccounts.
@ -1060,6 +1061,7 @@ $ hledger balance -p 2008/6 expenses --no-total
* Depth limited balance reports::
* Multicolumn balance reports::
* Custom balance output::
* Colour support::
* Output destination::
* CSV output::
@ -1197,7 +1199,7 @@ Balance changes in 2008:
# Average is rounded to the dollar here since all journal amounts are

File: hledger.1.info, Node: Custom balance output, Next: Output destination, Prev: Multicolumn balance reports, Up: balance
File: hledger.1.info, Node: Custom balance output, Next: Colour support, Prev: Multicolumn balance reports, Up: balance
4.4.4 Custom balance output
---------------------------
@ -1257,9 +1259,20 @@ may be needed to get pleasing results.
the single-column balance report

File: hledger.1.info, Node: Output destination, Next: CSV output, Prev: Custom balance output, Up: balance
File: hledger.1.info, Node: Colour support, Next: Output destination, Prev: Custom balance output, Up: balance
4.4.5 Output destination
4.4.5 Colour support
--------------------
The balance command shows negative amounts in red, if:
* the 'TERM' environment variable is not set to 'dumb'
* the output is not being redirected or piped anywhere

File: hledger.1.info, Node: Output destination, Next: CSV output, Prev: Colour support, Up: balance
4.4.6 Output destination
------------------------
The balance, print, register and stats commands can write their output
@ -1272,7 +1285,7 @@ $ hledger balance -o FILE # write to FILE

File: hledger.1.info, Node: CSV output, Prev: Output destination, Up: balance
4.4.6 CSV output
4.4.7 CSV output
----------------
The balance, print and register commands can write their output as CSV.
@ -2144,83 +2157,85 @@ Node: add27846
Ref: #add27947
Node: balance30605
Ref: #balance30718
Node: Flat mode33643
Ref: #flat-mode33770
Node: Depth limited balance reports34190
Ref: #depth-limited-balance-reports34393
Node: Multicolumn balance reports34813
Ref: #multicolumn-balance-reports35024
Node: Custom balance output39672
Ref: #custom-balance-output39860
Node: Output destination41953
Ref: #output-destination42118
Node: CSV output42388
Ref: #csv-output42507
Node: balancesheet42904
Ref: #balancesheet43032
Node: cashflow44939
Ref: #cashflow45056
Node: help46924
Ref: #help47036
Node: incomestatement47874
Ref: #incomestatement48004
Node: info49896
Ref: #info50003
Node: man50367
Ref: #man50464
Node: print50869
Ref: #print50974
Node: register54730
Ref: #register54843
Node: Custom register output59339
Ref: #custom-register-output59470
Node: stats60767
Ref: #stats60873
Node: test61754
Ref: #test61841
Node: ADD-ON COMMANDS62209
Ref: #add-on-commands62321
Node: Official add-ons63608
Ref: #official-add-ons63750
Node: api63837
Ref: #api63928
Node: ui63980
Ref: #ui64081
Node: web64139
Ref: #web64230
Node: Third party add-ons64276
Ref: #third-party-add-ons64453
Node: diff64588
Ref: #diff64687
Node: iadd64786
Ref: #iadd64902
Node: interest64985
Ref: #interest65108
Node: irr65203
Ref: #irr65303
Node: Experimental add-ons65381
Ref: #experimental-add-ons65535
Node: autosync65928
Ref: #autosync66042
Node: budget66281
Ref: #budget66405
Node: chart66471
Ref: #chart66590
Node: check66661
Ref: #check66785
Node: check-dates66852
Ref: #check-dates66994
Node: check-dupes67067
Ref: #check-dupes67210
Node: equity67287
Ref: #equity67415
Node: prices67534
Ref: #prices67663
Node: print-unique67718
Ref: #print-unique67867
Node: register-match67960
Ref: #register-match68116
Node: rewrite68214
Ref: #rewrite68335
Node: Flat mode33733
Ref: #flat-mode33860
Node: Depth limited balance reports34280
Ref: #depth-limited-balance-reports34483
Node: Multicolumn balance reports34903
Ref: #multicolumn-balance-reports35114
Node: Custom balance output39762
Ref: #custom-balance-output39946
Node: Colour support42039
Ref: #colour-support42200
Node: Output destination42373
Ref: #output-destination42531
Node: CSV output42801
Ref: #csv-output42920
Node: balancesheet43317
Ref: #balancesheet43445
Node: cashflow45352
Ref: #cashflow45469
Node: help47337
Ref: #help47449
Node: incomestatement48287
Ref: #incomestatement48417
Node: info50309
Ref: #info50416
Node: man50780
Ref: #man50877
Node: print51282
Ref: #print51387
Node: register55143
Ref: #register55256
Node: Custom register output59752
Ref: #custom-register-output59883
Node: stats61180
Ref: #stats61286
Node: test62167
Ref: #test62254
Node: ADD-ON COMMANDS62622
Ref: #add-on-commands62734
Node: Official add-ons64021
Ref: #official-add-ons64163
Node: api64250
Ref: #api64341
Node: ui64393
Ref: #ui64494
Node: web64552
Ref: #web64643
Node: Third party add-ons64689
Ref: #third-party-add-ons64866
Node: diff65001
Ref: #diff65100
Node: iadd65199
Ref: #iadd65315
Node: interest65398
Ref: #interest65521
Node: irr65616
Ref: #irr65716
Node: Experimental add-ons65794
Ref: #experimental-add-ons65948
Node: autosync66341
Ref: #autosync66455
Node: budget66694
Ref: #budget66818
Node: chart66884
Ref: #chart67003
Node: check67074
Ref: #check67198
Node: check-dates67265
Ref: #check-dates67407
Node: check-dupes67480
Ref: #check-dupes67623
Node: equity67700
Ref: #equity67828
Node: prices67947
Ref: #prices68076
Node: print-unique68131
Ref: #print-unique68280
Node: register-match68373
Ref: #register-match68529
Node: rewrite68627
Ref: #rewrite68748

End Tag Table

View File

@ -910,7 +910,7 @@ COMMANDS
Use unicode to display prettier tables.
The balance command displays accounts and balances. It is hledger's
most featureful and most useful command.
most featureful and versatile command.
$ hledger balance
$-1 assets
@ -935,15 +935,16 @@ COMMANDS
indented below their parent. "Boring" accounts, which contain a single
interesting subaccount and no balance of their own, are elided into the
following line for more compact output. (Use --no-elide to prevent
this.)
this. Eliding of boring accounts is not yet supported in multicolumn
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.
Accounts which have zero balance (and no non-zero subaccounts) are
Accounts which have zero balance (and no non-zero subaccounts) are
omitted. Use -E/--empty to show them.
A final total is displayed by default; use -N/--no-total to suppress
A final total is displayed by default; use -N/--no-total to suppress
it:
$ hledger balance -p 2008/6 expenses --no-total
@ -953,9 +954,9 @@ COMMANDS
Flat mode
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
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.
$ hledger balance -p 2008/6 expenses -N --flat --drop 1
@ -963,9 +964,9 @@ COMMANDS
$1 supplies
Depth limited balance reports
With --depth N, balance shows accounts only to the specified depth.
This is very useful to show a complex charts of accounts in less
detail. In flat mode, balances from accounts below the depth limit
With --depth N, balance shows accounts only to the specified depth.
This is very useful to show a complex charts of accounts in less
detail. In flat mode, balances from accounts below the depth limit
will be shown as part of a parent account at the depth limit.
$ hledger balance -N --depth 1
@ -975,12 +976,12 @@ COMMANDS
$1 liabilities
Multicolumn balance reports
With a reporting interval, multiple balance columns will be shown, one
for each report period. There are three types of multi-column balance
With a reporting interval, multiple balance columns will be shown, one
for each report period. There are three types of multi-column balance
report, showing different information:
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:
$ hledger balance --quarterly income expenses -E
@ -995,8 +996,8 @@ COMMANDS
-------------------++---------------------------------
|| $-1 $1 0 0
2. With --cumulative: each column shows the ending balance for that
period, accumulating the changes across periods, starting from 0 at
2. With --cumulative: each column shows the ending balance for that
period, accumulating the changes across periods, starting from 0 at
the report start date:
$ hledger balance --quarterly income expenses -E --cumulative
@ -1012,8 +1013,8 @@ COMMANDS
|| $-1 0 0 0
3. With --historical/-H: each column shows the actual historical ending
balance for that period, accumulating the changes across periods,
starting from the actual balance at the report start date. This is
balance for that period, accumulating the changes across periods,
starting from the actual balance at the report start date. This is
useful eg for a multi-period balance sheet, and when you are showing
only the data after a certain start date:
@ -1029,26 +1030,26 @@ COMMANDS
----------------------++-------------------------------------
|| 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.
With a reporting interval (like --quarterly above), the report
start/end dates will be adjusted if necessary so that they encompass
With a reporting interval (like --quarterly above), the report
start/end dates will be adjusted if necessary so that they encompass
the displayed report periods. This is so that the first and last peri-
ods will be "full" and comparable to the others.
The -E/--empty flag does two things in multicolumn balance reports:
first, the report will show all columns within the specified report
period (without -E, leading and trailing columns with all zeroes are
not shown). Second, all accounts which existed at the report start
date will be considered, not just the ones with activity during the
The -E/--empty flag does two things in multicolumn balance reports:
first, the report will show all columns within the specified report
period (without -E, leading and trailing columns with all zeroes are
not shown). Second, all accounts which existed at the report start
date will be considered, not just the ones with activity during the
report period (use -E to include low-activity accounts which would oth-
erwise would be omitted).
The -T/--row-total flag adds an additional column showing the total for
each row.
The -A/--average flag adds a column showing the average value in each
The -A/--average flag adds a column showing the average value in each
row.
Here's an example of all three:
@ -1070,7 +1071,7 @@ COMMANDS
# Average is rounded to the dollar here since all journal amounts are
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:
$ hledger balance --format "%20(account) %12(total)"
@ -1088,7 +1089,7 @@ COMMANDS
0
The FMT format string (plus a newline) specifies the formatting applied
to each account/balance pair. It may contain any suitable text, with
to each account/balance pair. It may contain any suitable text, with
data fields interpolated like so:
%[MIN][.MAX](FIELDNAME)
@ -1099,14 +1100,14 @@ COMMANDS
o FIELDNAME must be enclosed in parentheses, and can be one of:
o depth_spacer - a number of spaces equal to the account's depth, or
o depth_spacer - a number of spaces equal to the account's depth, or
if MIN is specified, MIN * depth spaces.
o account - the account's name
o total - the account's balance/posted total, right justified
Also, FMT can begin with an optional prefix to control how multi-com-
Also, FMT can begin with an optional prefix to control how multi-com-
modity amounts are rendered:
o %_ - render on multiple lines, bottom-aligned (the default)
@ -1115,7 +1116,7 @@ COMMANDS
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.
Experimentation may be needed to get pleasing results.
@ -1123,19 +1124,26 @@ COMMANDS
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
o %,%-50(account) %25(total) - account name padded to 50 characters,
total padded to 20 characters, with multiple commodities rendered on
o %,%-50(account) %25(total) - account name padded to 50 characters,
total padded to 20 characters, with multiple commodities rendered on
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
Colour support
The balance command shows negative amounts in red, if:
o the TERM environment variable is not set to dumb
o the output is not being redirected or piped anywhere
Output destination
The balance, print, register and stats commands can write their output
to a destination other than the console. This is controlled by the
The balance, print, register and stats commands can write their output
to a destination other than the console. This is controlled by the
-o/--output-file option.
$ hledger balance -o - # write to stdout (the default)
@ -1143,8 +1151,8 @@ COMMANDS
CSV output
The balance, print and register commands can write their output as CSV.
This is useful for exporting data to other applications, eg to make
charts in a spreadsheet. This is controlled by the -O/--output-format
This is useful for exporting data to other applications, eg to make
charts in a spreadsheet. This is controlled by the -O/--output-format
option, or by specifying a .csv file extension with -o/--output-file.
$ hledger balance -O csv # write CSV to stdout
@ -1158,7 +1166,7 @@ COMMANDS
balances
--cumulative
show balance change accumulated across periods (in multicolumn
show balance change accumulated across periods (in multicolumn
reports), instead of historical ending balances
-H --historical
@ -1189,8 +1197,8 @@ COMMANDS
--format=LINEFORMAT
in single-column balance reports: use this custom line format
This command displays a simple balance sheet. It currently assumes
that you have top-level accounts named asset and liability (plural
This command displays a simple balance sheet. It currently assumes
that you have top-level accounts named asset and liability (plural
forms also allowed.)
$ hledger balancesheet
@ -1213,9 +1221,9 @@ COMMANDS
0
With a reporting interval, multiple columns will be shown, one for each
report period. As with multicolumn balance reports, you can alter the
report mode with --change/--cumulative/--historical. Normally bal-
ancesheet shows historical ending balances, which is what you need for
report period. As with multicolumn balance reports, you can alter the
report mode with --change/--cumulative/--historical. Normally bal-
ancesheet shows historical ending balances, which is what you need for
a balance sheet; note this means it ignores report begin dates.
cashflow
@ -1225,7 +1233,7 @@ COMMANDS
show balance change in each period (default)
--cumulative
show balance change accumulated across periods (in multicolumn
show balance change accumulated across periods (in multicolumn
reports), instead of changes during periods
-H --historical
@ -1256,9 +1264,9 @@ COMMANDS
--format=LINEFORMAT
in single-column balance reports: use this custom line format
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
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 or A/R (plural forms also allowed.)
$ hledger cashflow
@ -1276,18 +1284,18 @@ COMMANDS
$-1
With a reporting interval, multiple columns will be shown, one for each
report period. Normally cashflow shows changes in assets per period,
though as with multicolumn balance reports you can alter the report
report period. Normally cashflow shows changes in assets per period,
though as with multicolumn balance reports you can alter the report
mode with --change/--cumulative/--historical.
help
Show any of the hledger manuals.
The help command displays any of the main hledger man pages. (Unlike
hledger --help, which displays only the hledger man page.) Run it with
no arguments to list available topics (their names are shortened for
easier typing), and run hledger help TOPIC to select one. The output
is similar to a man page, but fixed width. It may be long, so you may
The help command displays any of the main hledger man pages. (Unlike
hledger --help, which displays only the hledger man page.) Run it with
no arguments to list available topics (their names are shortened for
easier typing), and run hledger help TOPIC to select one. The output
is similar to a man page, but fixed width. It may be long, so you may
wish to pipe it into a pager. See also info and man.
$ hledger help
@ -1315,7 +1323,7 @@ COMMANDS
show balance change in each period (default)
--cumulative
show balance change accumulated across periods (in multicolumn
show balance change accumulated across periods (in multicolumn
reports), instead of changes during periods
-H --historical
@ -1346,8 +1354,8 @@ COMMANDS
--format=LINEFORMAT
in single-column balance reports: use this custom line format
This command displays a simple income statement. It currently assumes
that you have top-level accounts named income (or revenue) and expense
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.)
$ hledger incomestatement
@ -1372,30 +1380,30 @@ COMMANDS
0
With a reporting interval, multiple columns will be shown, one for each
report period. Normally incomestatement shows revenues/expenses per
period, though as with multicolumn balance reports you can alter the
report period. Normally incomestatement shows revenues/expenses per
period, though as with multicolumn balance reports you can alter the
report mode with --change/--cumulative/--historical.
info
Show any of the hledger manuals using info.
The info command displays any of the hledger reference manuals using
the info hypertextual documentation viewer. This can be a very effi-
cient way to browse large manuals. It requires the "info" program to
The info command displays any of the hledger reference manuals using
the info hypertextual documentation viewer. This can be a very effi-
cient way to browse large manuals. It requires the "info" program to
be available in your PATH.
As with help, run it with no arguments to list available topics (manu-
As with help, run it with no arguments to list available topics (manu-
als).
man
Show any of the hledger manuals using man.
The man command displays any of the hledger reference manuals using
man, the standard documentation viewer on unix systems. This will fit
the text to your terminal width, and probably invoke a pager automati-
The man command displays any of the hledger reference manuals using
man, the standard documentation viewer on unix systems. This will fit
the text to your terminal width, and probably invoke a pager automati-
cally. It requires the "man" program to be available in your PATH.
As with help, run it with no arguments to list available topics (manu-
As with help, run it with no arguments to list available topics (manu-
als).
print
@ -1405,14 +1413,14 @@ COMMANDS
show all amounts explicitly
-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
-O FMT --output-format=FMT
select the output format. Supported formats: txt, csv.
-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.
$ hledger print
@ -1440,23 +1448,23 @@ COMMANDS
The print command displays full journal entries (transactions) from the
journal file, tidily formatted.
As of hledger 1.2, print's output is always a valid hledger journal.
However it may not preserve all original content, eg it does not print
As of hledger 1.2, print's output is always a valid hledger journal.
However it may not preserve all original content, eg it does not print
directives or inter-transaction comments.
Normally, transactions' implicit/explicit amount style is preserved:
when an amount is omitted in the journal, it will be omitted in the
output. You can use the -x/--explicit flag to make all amounts
explicit, which can be useful for troubleshooting or for making your
journal more readable and robust against data entry errors. Note, in
this mode postings with a multi-commodity amount (possible with an
implicit amount in a multi-commodity transaction) will be split into
Normally, transactions' implicit/explicit amount style is preserved:
when an amount is omitted in the journal, it will be omitted in the
output. You can use the -x/--explicit flag to make all amounts
explicit, which can be useful for troubleshooting or for making your
journal more readable and robust against data entry errors. Note, in
this mode postings with a multi-commodity amount (possible with an
implicit amount in a multi-commodity transaction) will be split into
multiple single-commodity postings, for valid journal output.
With -B/--cost, amounts with transaction prices are converted to cost
With -B/--cost, amounts with transaction prices are converted to cost
(using the transaction price).
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:
$ hledger print -Ocsv
@ -1473,20 +1481,20 @@ COMMANDS
"5","2008/12/31","","*","","pay off","","liabilities:debts","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.
o The "txnidx" (transaction index) field shows which postings belong to
the same transaction. (This number might change if transactions are
reordered within the file, files are parsed/included in a different
the same transaction. (This number might change if transactions are
reordered within the file, files are parsed/included in a different
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.
o The numeric amount is repeated in either the "credit" or "debit" col-
umn, for convenience. (Those names are not accurate in the account-
ing sense; it just puts negative amounts under credit and zero or
umn, for convenience. (Those names are not accurate in the account-
ing sense; it just puts negative amounts under credit and zero or
greater amounts under debit.)
register
@ -1496,7 +1504,7 @@ COMMANDS
show running total from report start date (default)
-H --historical
show historical running total/balance (includes postings before
show historical running total/balance (includes postings before
report start date)
-A --average
@ -1507,18 +1515,18 @@ COMMANDS
show postings' siblings instead
-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)
-O FMT --output-format=FMT
select the output format. Supported formats: txt, csv.
-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.
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:
$ hledger register checking
@ -1527,8 +1535,8 @@ COMMANDS
2008/06/02 save assets:bank:checking $-1 $1
2008/12/31 pay off assets:bank:checking $-1 0
The --historical/-H flag adds the balance from any undisplayed prior
postings to the running total. This is useful when you want to see
The --historical/-H flag adds the balance from any undisplayed prior
postings to the running total. This is useful when you want to see
only recent activity, with a historically accurate running balance:
$ hledger register checking -b 2008/6 --historical
@ -1538,23 +1546,23 @@ COMMANDS
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
the whole report period). This flag implies --empty (see below). It
is affected by --historical. It works best when showing just one
the whole report period). This flag implies --empty (see below). It
is affected by --historical. It works best when showing just one
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.
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:
$ hledger register --monthly income
2008/01 income:salary $-1 $-1
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:
$ hledger register --monthly income -E
@ -1571,7 +1579,7 @@ COMMANDS
2008/11 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:
$ hledger register --monthly assets --depth 1h
@ -1579,19 +1587,19 @@ COMMANDS
2008/06 assets $-1 0
2008/12 assets $-1 $-1
Note when using report intervals, if you specify start/end dates these
will be adjusted outward if necessary to contain a whole number of
intervals. This ensures that the first and last intervals are full
Note when using report intervals, if you specify start/end dates these
will be adjusted outward if necessary to contain a whole number of
intervals. This ensures that the first and last intervals are full
length and comparable to the others in the report.
Custom register output
register uses the full terminal width by default, except on windows.
You can override this by setting the COLUMNS environment variable (not
register uses the full terminal width by default, except on windows.
You can override this by setting the COLUMNS environment variable (not
a bash shell variable) or by using the --width/-w option.
The description and account columns normally share the space equally
(about half of (width - 40) each). You can adjust this by adding a
description width as part of --width's argument, comma-separated:
The description and account columns normally share the space equally
(about half of (width - 40) each). You can adjust this by adding a
description width as part of --width's argument, comma-separated:
--width W,D . Here's a diagram:
<--------------------------------- width (W) ---------------------------------->
@ -1607,14 +1615,14 @@ COMMANDS
$ hledger reg -w 100,40 # set overall width 100, description width 40
$ 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.
stats
Show some journal statistics.
-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.
$ hledger stats
@ -1629,8 +1637,8 @@ COMMANDS
Accounts : 8 (depth 3)
Commodities : 1 ($)
The stats command displays summary information for the whole journal,
or a matched part of it. With a reporting interval, it shows a report
The stats command displays summary information for the whole journal,
or a matched part of it. With a reporting interval, it shows a report
for each report period.
The stats command also supports -o/--output-file for controlling output
@ -1642,34 +1650,34 @@ COMMANDS
$ hledger test
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
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.
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
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).
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,
o hledger -h web shows hledger's help, while hledger web -h shows
hledger-web's help.
o Flags specific to the add-on must have a preceding -- to hide them
from hledger. So hledger web --serve --port 9000 will be rejected;
o Flags specific to the add-on must have a preceding -- to hide them
from hledger. So hledger web --serve --port 9000 will be rejected;
you must use hledger web -- --serve --port 9000.
o You can always run add-ons directly if preferred:
o You can always run add-ons directly if preferred:
hledger-web --serve --port 9000.
Add-ons are a relatively easy way to add local features or experiment
with new ideas. They can be written in any language, but haskell
scripts have a big advantage: they can use the same hledger (and
haskell) library functions that built-in commands do, for command-line
Add-ons are a relatively easy way to add local features or experiment
with new ideas. They can be written in any language, but haskell
scripts have a big advantage: they can use the same hledger (and
haskell) library functions that built-in commands do, for command-line
options, journal parsing, reporting, etc.
Here are some hledger add-ons available:
@ -1687,7 +1695,7 @@ ADD-ON COMMANDS
hledger-web provides a simple web interface.
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.
diff
@ -1695,7 +1703,7 @@ ADD-ON COMMANDS
journal file and another.
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.
interest
@ -1703,19 +1711,19 @@ ADD-ON COMMANDS
ing to various schemes.
irr
hledger-irr calculates the internal rate of return of an investment
hledger-irr calculates the internal rate of return of an investment
account.
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-
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!
autosync
hledger-autosync is a symbolic link for easily running ledger-autosync,
if installed. ledger-autosync does deduplicating conversion of OFX
data and some CSV formats, and can also download the data if your bank
if installed. ledger-autosync does deduplicating conversion of OFX
data and some CSV formats, and can also download the data if your bank
offers OFX Direct Connect.
budget
@ -1731,18 +1739,18 @@ ADD-ON COMMANDS
hledger-check-dates.hs checks that journal entries are ordered by date.
check-dupes
hledger-check-dupes.hs checks for account names sharing the same leaf
hledger-check-dupes.hs checks for account names sharing the same leaf
name.
equity
hledger-equity.hs prints balance-resetting transactions, useful for
hledger-equity.hs prints balance-resetting transactions, useful for
bringing account balances across file boundaries.
prices
hledger-prices.hs prints all prices from the journal.
print-unique
hledger-print-unique.hs prints transactions which do not reuse an
hledger-print-unique.hs prints transactions which do not reuse an
already-seen description.
register-match
@ -1754,21 +1762,21 @@ ADD-ON COMMANDS
tions.
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.
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).
FILES
Reads data from one or more files in hledger journal, timeclock, time-
dot, or CSV format specified with -f, or $LEDGER_FILE, or
$HOME/.hledger.journal (on windows, perhaps
Reads data from one or more files in hledger journal, timeclock, time-
dot, or CSV format specified with -f, or $LEDGER_FILE, or
$HOME/.hledger.journal (on windows, perhaps
C:/Users/USER/.hledger.journal).
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.
When input data contains non-ascii characters, a suitable system locale
@ -1781,33 +1789,33 @@ BUGS
In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger
add.
Not all of Ledger's journal file syntax is supported. See file format
Not all of Ledger's journal file syntax is supported. See file format
differences.
On large data files, hledger is slower and uses more memory than
On large data files, hledger is slower and uses more memory than
Ledger.
TROUBLESHOOTING
Here are some issues you might encounter when you run hledger (and
remember you can also seek help from the IRC channel, mail list or bug
Here are some issues you might encounter when you run hledger (and
remember you can also seek help from the IRC channel, mail list or bug
tracker):
Successfully installed, but "No command 'hledger' found"
stack and cabal install binaries into a special directory, which should
be added to your PATH environment variable. Eg on unix-like systems,
be added to your PATH environment variable. Eg on unix-like systems,
that is ~/.local/bin and ~/.cabal/bin respectively.
I set a custom LEDGER_FILE, but hledger is still using the default file
LEDGER_FILE should be a real environment variable, not just a shell
variable. The command env | grep LEDGER_FILE should show it. You may
LEDGER_FILE should be a real environment variable, not just a shell
variable. The command env | grep LEDGER_FILE should show it. You may
need to use export. Here's an explanation.
"Illegal byte sequence" or "Invalid or incomplete multibyte or wide
"Illegal byte sequence" or "Invalid or incomplete multibyte or wide
character" errors
In order to handle non-ascii letters and symbols (like ), hledger needs
an appropriate locale. This is usually configured system-wide; you can
also configure it temporarily. The locale may need to be one that sup-
ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,
ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,
I'm not sure yet).
Here's an example of setting the locale temporarily, on ubuntu
@ -1826,7 +1834,7 @@ TROUBLESHOOTING
$ echo "export LANG=en_US.UTF-8" >>~/.bash_profile
$ bash --login
If we preferred to use eg fr_FR.utf8, we might have to install that
If we preferred to use eg fr_FR.utf8, we might have to install that
first:
$ apt-get install language-pack-fr
@ -1847,7 +1855,7 @@ TROUBLESHOOTING
REPORTING BUGS
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel
or hledger mail list)
@ -1861,7 +1869,7 @@ COPYRIGHT
SEE ALSO
hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),
hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),
hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-
dot(5), ledger(1)