bal/etc.: document html output, move to options section

This commit is contained in:
Simon Michael 2018-01-23 17:08:19 -08:00
parent 37555617b7
commit e657e96591
6 changed files with 367 additions and 350 deletions

View File

@ -987,6 +987,33 @@ directives, not transaction prices (unlike Ledger).
Using \-B/\[en]cost and \-V/\[en]value together is currently allowed, Using \-B/\[en]cost and \-V/\[en]value together is currently allowed,
but the results are probably not meaningful. but the results are probably not meaningful.
Let us know if you find a use for this. Let us know if you find a use for this.
.SS Output destination
.PP
Some commands (print, register, stats, the balance commands) can write
their output to a destination other than the console.
This is controlled by the \f[C]\-o/\-\-output\-file\f[] option.
.IP
.nf
\f[C]
$\ hledger\ balance\ \-o\ \-\ \ \ \ \ #\ write\ to\ stdout\ (the\ default)
$\ hledger\ balance\ \-o\ FILE\ \ #\ write\ to\ FILE
\f[]
.fi
.SS Output format
.PP
Some commands can write their output in other formats.
Eg print and register can output CSV, and the balance commands can
output CSV or HTML.
This is controlled by the \f[C]\-O/\-\-output\-format\f[] option, or by
specifying a \f[C]\&.csv\f[] or \f[C]\&.html\f[] file extension with
\f[C]\-o/\-\-output\-file\f[].
.IP
.nf
\f[C]
$\ hledger\ balance\ \-O\ csv\ \ \ \ \ \ \ #\ write\ CSV\ to\ stdout
$\ hledger\ balance\ \-o\ FILE.csv\ \ #\ write\ CSV\ to\ FILE.csv
\f[]
.fi
.SS Regular expressions .SS Regular expressions
.PP .PP
hledger uses regular expressions in a number of places: hledger uses regular expressions in a number of places:
@ -1448,7 +1475,7 @@ in single\-column balance reports: use this custom line format
.TP .TP
.B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[] .B \f[C]\-O\ FMT\ \-\-output\-format=FMT\f[]
select the output format. select the output format.
Supported formats: txt, csv. Supported formats: txt, csv, html.
.RS .RS
.RE .RE
.TP .TP
@ -1798,8 +1825,8 @@ Balance\ changes\ in\ 2017/11/01\-2017/12/31:
For more examples and details, see Budgeting and Forecasting. For more examples and details, see Budgeting and Forecasting.
.SS Custom balance output .SS Custom balance output
.PP .PP
In simple (non\-multi\-column) balance reports, you can customise the You can customise the layout of simple (non\-tabular) balance reports
output with \f[C]\-\-format\ FMT\f[]: with \f[C]\-\-format\ FMT\f[]:
.IP .IP
.nf .nf
\f[C] \f[C]
@ -1867,6 +1894,8 @@ rendered on one line
.IP \[bu] 2 .IP \[bu] 2
\f[C]%20(total)\ \ %2(depth_spacer)%\-(account)\f[] \- the default \f[C]%20(total)\ \ %2(depth_spacer)%\-(account)\f[] \- the default
format for the single\-column balance report format for the single\-column balance report
.PP
This command also supports output destination and output formats.
.SS Colour support .SS Colour support
.PP .PP
The balance command shows negative amounts in red, if: The balance command shows negative amounts in red, if:
@ -1874,33 +1903,6 @@ The balance command shows negative amounts in red, if:
the \f[C]TERM\f[] environment variable is not set to \f[C]dumb\f[] the \f[C]TERM\f[] environment variable is not set to \f[C]dumb\f[]
.IP \[bu] 2 .IP \[bu] 2
the output is not being redirected or piped anywhere the output is not being redirected or piped anywhere
.SS Output destination
.PP
The balance, print, register and stats commands can write their output
to a destination other than the console.
This is controlled by the \f[C]\-o/\-\-output\-file\f[] option.
.IP
.nf
\f[C]
$\ hledger\ balance\ \-o\ \-\ \ \ \ \ #\ write\ to\ stdout\ (the\ default)
$\ hledger\ balance\ \-o\ FILE\ \ #\ write\ to\ FILE
\f[]
.fi
.SS CSV output
.PP
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 \f[C]\-O/\-\-output\-format\f[] option, or by
specifying a \f[C]\&.csv\f[] file extension with
\f[C]\-o/\-\-output\-file\f[].
.IP
.nf
\f[C]
$\ hledger\ balance\ \-O\ csv\ \ \ \ \ \ \ #\ write\ CSV\ to\ stdout
$\ hledger\ balance\ \-o\ FILE.csv\ \ #\ write\ CSV\ to\ FILE.csv
\f[]
.fi
.SS balancesheet .SS balancesheet
.PP .PP
This command displays a simple balance sheet, showing historical ending This command displays a simple balance sheet, showing historical ending
@ -2011,6 +2013,8 @@ As with multicolumn balance reports, you can alter the report mode with
Normally balancesheet shows historical ending balances, which is what Normally balancesheet shows historical ending balances, which is what
you need for a balance sheet; note this means it ignores report begin you need for a balance sheet; note this means it ignores report begin
dates. dates.
.PP
This command also supports output destination and output formats.
.SS balancesheetequity .SS balancesheetequity
.PP .PP
Just like balancesheet, but also reports Equity (which it assumes is Just like balancesheet, but also reports Equity (which it assumes is
@ -2146,6 +2150,8 @@ report period.
Normally cashflow shows changes in assets per period, though as with Normally cashflow shows changes in assets per period, though as with
multicolumn balance reports you can alter the report mode with multicolumn balance reports you can alter the report mode with
\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[]. \f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].
.PP
This command also supports output destination and output formats.
.SS check\-dates .SS check\-dates
.PP .PP
Check that transactions are sorted by increasing date. Check that transactions are sorted by increasing date.
@ -2343,6 +2349,8 @@ report period.
Normally incomestatement shows revenues/expenses per period, though as Normally incomestatement shows revenues/expenses per period, though as
with multicolumn balance reports you can alter the report mode with with multicolumn balance reports you can alter the report mode with
\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[]. \f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].
.PP
This command also supports output destination and output formats.
.SS prices .SS prices
.PP .PP
Print all market prices from the journal. Print all market prices from the journal.
@ -2455,7 +2463,7 @@ increasing dates, and that transactions on the same day do not get
reordered. reordered.
See also the import command. See also the import command.
.PP .PP
The print command also supports output destination and CSV output. This command also supports output destination and output formats.
Here's an example of print's CSV output: Here's an example of print's CSV output:
.IP .IP
.nf .nf
@ -2667,9 +2675,7 @@ $\ hledger\ reg\ \-w\ $COLUMNS,40\ \ \ \ \ \ #\ use\ terminal\ width,\ and\ set\
\f[] \f[]
.fi .fi
.PP .PP
The register command also supports the \f[C]\-o/\-\-output\-file\f[] and This command also supports output destination and output formats.
\f[C]\-O/\-\-output\-format\f[] options for controlling output
destination and CSV output.
.SS register\-match .SS register\-match
.PP .PP
Print the one posting whose transaction description is closest to DESC, Print the one posting whose transaction description is closest to DESC,
@ -2708,8 +2714,7 @@ The stats command displays summary information for the whole journal, or
a matched part of it. a matched part of it.
With a reporting interval, it shows a report for each report period. With a reporting interval, it shows a report for each report period.
.PP .PP
The stats command also supports \f[C]\-o/\-\-output\-file\f[] for This command also supports output destination and output formats.
controlling output destination.
.SS tags .SS tags
.PP .PP
List all the tag names used in the journal. List all the tag names used in the journal.

View File

@ -681,6 +681,37 @@ File: hledger.info, Node: Combining -B and -V, Next: Regular expressions, Pre
Using -B/-cost and -V/-value together is currently allowed, but the Using -B/-cost and -V/-value together is currently allowed, but the
results are probably not meaningful. Let us know if you find a use for results are probably not meaningful. Let us know if you find a use for
this. this.
* Menu:
* Output destination::
* Output format::

File: hledger.info, Node: Output destination, Next: Output format, Up: Combining -B and -V
2.15.1 Output destination
-------------------------
Some commands (print, register, stats, the balance 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)
$ hledger balance -o FILE # write to FILE

File: hledger.info, Node: Output format, Prev: Output destination, Up: Combining -B and -V
2.15.2 Output format
--------------------
Some commands can write their output in other formats. Eg print and
register can output CSV, and the balance commands can output CSV or
HTML. This is controlled by the '-O/--output-format' option, or by
specifying a '.csv' or '.html' file extension with '-o/--output-file'.
$ hledger balance -O csv # write CSV to stdout
$ hledger balance -o FILE.csv # write CSV to FILE.csv
 
File: hledger.info, Node: Regular expressions, Prev: Combining -B and -V, Up: OPTIONS File: hledger.info, Node: Regular expressions, Prev: Combining -B and -V, Up: OPTIONS
@ -1084,7 +1115,7 @@ Show accounts and their balances. Aliases: b, bal.
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
'-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, html.
'-o FILE --output-file=FILE' '-o FILE --output-file=FILE'
write output to FILE. A file extension matching one of the above write output to FILE. A file extension matching one of the above
@ -1159,8 +1190,6 @@ $ hledger balance -p 2008/6 expenses --no-total
* Budgets:: * Budgets::
* Custom balance output:: * Custom balance output::
* Colour support:: * Colour support::
* Output destination::
* CSV output::
 
File: hledger.info, Node: Flat mode, Next: Depth limited balance reports, Up: balance File: hledger.info, Node: Flat mode, Next: Depth limited balance reports, Up: balance
@ -1393,8 +1422,8 @@ File: hledger.info, Node: Custom balance output, Next: Colour support, Prev:
4.4.5 Custom balance output 4.4.5 Custom balance output
--------------------------- ---------------------------
In simple (non-multi-column) balance reports, you can customise the You can customise the layout of simple (non-tabular) balance reports
output with '--format FMT': with '--format FMT':
$ hledger balance --format "%20(account) %12(total)" $ hledger balance --format "%20(account) %12(total)"
assets $-1 assets $-1
@ -1447,8 +1476,10 @@ may be needed to get pleasing results.
* '%20(total) %2(depth_spacer)%-(account)' - the default format for * '%20(total) %2(depth_spacer)%-(account)' - the default format for
the single-column balance report the single-column balance report
This command also supports output destination and output formats.
 
File: hledger.info, Node: Colour support, Next: Output destination, Prev: Custom balance output, Up: balance File: hledger.info, Node: Colour support, Prev: Custom balance output, Up: balance
4.4.6 Colour support 4.4.6 Colour support
-------------------- --------------------
@ -1458,34 +1489,6 @@ The balance command shows negative amounts in red, if:
* the 'TERM' environment variable is not set to 'dumb' * the 'TERM' environment variable is not set to 'dumb'
* the output is not being redirected or piped anywhere * the output is not being redirected or piped anywhere

File: hledger.info, Node: Output destination, Next: CSV output, Prev: Colour support, Up: balance
4.4.7 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
'-o/--output-file' option.
$ hledger balance -o - # write to stdout (the default)
$ hledger balance -o FILE # write to FILE

File: hledger.info, Node: CSV output, Prev: Output destination, Up: balance
4.4.8 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'
option, or by specifying a '.csv' file extension with
'-o/--output-file'.
$ hledger balance -O csv # write CSV to stdout
$ hledger balance -o FILE.csv # write CSV to FILE.csv
 
File: hledger.info, Node: balancesheet, Next: balancesheetequity, Prev: balance, Up: COMMANDS File: hledger.info, Node: balancesheet, Next: balancesheetequity, Prev: balance, Up: COMMANDS
@ -1569,6 +1572,8 @@ the report mode with '--change'/'--cumulative'/'--historical'. Normally
balancesheet shows historical ending balances, which is what you need balancesheet shows historical ending balances, which is what you need
for a balance sheet; note this means it ignores report begin dates. for a balance sheet; note this means it ignores report begin dates.
This command also supports output destination and output formats.
 
File: hledger.info, Node: balancesheetequity, Next: cashflow, Prev: balancesheet, Up: COMMANDS File: hledger.info, Node: balancesheetequity, Next: cashflow, Prev: balancesheet, Up: COMMANDS
@ -1679,6 +1684,8 @@ each report period. Normally cashflow shows changes in assets 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'.
This command also supports output destination and output formats.
 
File: hledger.info, Node: check-dates, Next: check-dupes, Prev: cashflow, Up: COMMANDS File: hledger.info, Node: check-dates, Next: check-dupes, Prev: cashflow, Up: COMMANDS
@ -1856,6 +1863,8 @@ each report period. Normally incomestatement shows revenues/expenses
per period, though as with multicolumn balance reports you can alter the per period, though as with multicolumn balance reports you can alter the
report mode with '--change'/'--cumulative'/'--historical'. report mode with '--change'/'--cumulative'/'--historical'.
This command also supports output destination and output formats.
 
File: hledger.info, Node: prices, Next: print, Prev: incomestatement, Up: COMMANDS File: hledger.info, Node: prices, Next: print, Prev: incomestatement, Up: COMMANDS
@ -1951,7 +1960,7 @@ $ hledger -f bank1.csv print --new
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. This command also supports output destination and output formats.
Here's an example of print's CSV output: Here's an example of print's CSV output:
$ hledger print -Ocsv $ hledger print -Ocsv
@ -2122,9 +2131,7 @@ $ export COLUMNS=100; hledger reg # set till session end (or window resize)
$ 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 This command also supports output destination and output formats.
'-O/--output-format' options for controlling output destination and CSV
output.
 
File: hledger.info, Node: register-match, Next: rewrite, Prev: register, Up: COMMANDS File: hledger.info, Node: register-match, Next: rewrite, Prev: register, Up: COMMANDS
@ -2173,8 +2180,7 @@ Commodities : 1 ($)
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 This command also supports output destination and output formats.
output destination.
 
File: hledger.info, Node: tags, Next: test, Prev: stats, Up: COMMANDS File: hledger.info, Node: tags, Next: test, Prev: stats, Up: COMMANDS
@ -2418,103 +2424,103 @@ Node: Market value21197
Ref: #market-value21332 Ref: #market-value21332
Node: Combining -B and -V22515 Node: Combining -B and -V22515
Ref: #combining--b-and--v22679 Ref: #combining--b-and--v22679
Node: Regular expressions22826 Node: Output destination22876
Ref: #regular-expressions22969 Ref: #output-destination23026
Node: QUERIES24330 Node: Output format23309
Ref: #queries24432 Ref: #output-format23449
Node: COMMANDS28399 Node: Regular expressions23834
Ref: #commands28511 Ref: #regular-expressions23977
Node: accounts29493 Node: QUERIES25338
Ref: #accounts29591 Ref: #queries25440
Node: activity30837 Node: COMMANDS29407
Ref: #activity30947 Ref: #commands29519
Node: add31307 Node: accounts30501
Ref: #add31406 Ref: #accounts30599
Node: balance34067 Node: activity31845
Ref: #balance34178 Ref: #activity31955
Node: Flat mode37658 Node: add32315
Ref: #flat-mode37783 Ref: #add32414
Node: Depth limited balance reports38203 Node: balance35075
Ref: #depth-limited-balance-reports38404 Ref: #balance35186
Node: Multicolumn balance reports38824 Node: Flat mode38634
Ref: #multicolumn-balance-reports39019 Ref: #flat-mode38759
Node: Budgets43708 Node: Depth limited balance reports39179
Ref: #budgets43855 Ref: #depth-limited-balance-reports39380
Node: Custom balance output47686 Node: Multicolumn balance reports39800
Ref: #custom-balance-output47848 Ref: #multicolumn-balance-reports39995
Node: Colour support49941 Node: Budgets44684
Ref: #colour-support50100 Ref: #budgets44831
Node: Output destination50273 Node: Custom balance output48662
Ref: #output-destination50429 Ref: #custom-balance-output48824
Node: CSV output50699 Node: Colour support50981
Ref: #csv-output50816 Ref: #colour-support51113
Node: balancesheet51213 Node: balancesheet51286
Ref: #balancesheet51349 Ref: #balancesheet51422
Node: balancesheetequity53581 Node: balancesheetequity53724
Ref: #balancesheetequity53730 Ref: #balancesheetequity53873
Node: cashflow54267 Node: cashflow54410
Ref: #cashflow54395 Ref: #cashflow54538
Node: check-dates56439 Node: check-dates56652
Ref: #check-dates56566 Ref: #check-dates56779
Node: check-dupes56683 Node: check-dupes56896
Ref: #check-dupes56807 Ref: #check-dupes57020
Node: close56944 Node: close57157
Ref: #close57051 Ref: #close57264
Node: help57381 Node: help57594
Ref: #help57481 Ref: #help57694
Node: import58555 Node: import58768
Ref: #import58669 Ref: #import58882
Node: incomestatement59399 Node: incomestatement59612
Ref: #incomestatement59533 Ref: #incomestatement59746
Node: prices61858 Node: prices62141
Ref: #prices61973 Ref: #prices62256
Node: print62016 Node: print62299
Ref: #print62126 Ref: #print62409
Node: print-unique67011 Node: print-unique67293
Ref: #print-unique67137 Ref: #print-unique67419
Node: register67205 Node: register67487
Ref: #register67332 Ref: #register67614
Node: Custom register output71833 Node: Custom register output72115
Ref: #custom-register-output71962 Ref: #custom-register-output72244
Node: register-match73259 Node: register-match73465
Ref: #register-match73393 Ref: #register-match73599
Node: rewrite73576 Node: rewrite73782
Ref: #rewrite73693 Ref: #rewrite73899
Node: stats73762 Node: stats73968
Ref: #stats73865 Ref: #stats74071
Node: tags74747 Node: tags74932
Ref: #tags74845 Ref: #tags75030
Node: test75081 Node: test75266
Ref: #test75165 Ref: #test75350
Node: ADD-ON COMMANDS75533 Node: ADD-ON COMMANDS75718
Ref: #add-on-commands75643 Ref: #add-on-commands75828
Node: Official add-ons76930 Node: Official add-ons77115
Ref: #official-add-ons77070 Ref: #official-add-ons77255
Node: api77157 Node: api77342
Ref: #api77246 Ref: #api77431
Node: ui77298 Node: ui77483
Ref: #ui77397 Ref: #ui77582
Node: web77455 Node: web77640
Ref: #web77544 Ref: #web77729
Node: Third party add-ons77590 Node: Third party add-ons77775
Ref: #third-party-add-ons77765 Ref: #third-party-add-ons77950
Node: diff77900 Node: diff78085
Ref: #diff77997 Ref: #diff78182
Node: iadd78096 Node: iadd78281
Ref: #iadd78210 Ref: #iadd78395
Node: interest78293 Node: interest78478
Ref: #interest78414 Ref: #interest78599
Node: irr78509 Node: irr78694
Ref: #irr78607 Ref: #irr78792
Node: Experimental add-ons78685 Node: Experimental add-ons78870
Ref: #experimental-add-ons78837 Ref: #experimental-add-ons79022
Node: autosync79128 Node: autosync79313
Ref: #autosync79240 Ref: #autosync79425
Node: budget79479 Node: budget79664
Ref: #budget79601 Ref: #budget79786
Node: chart79667 Node: chart79852
Ref: #chart79784 Ref: #chart79969
Node: check79855 Node: check80040
Ref: #check79957 Ref: #check80142
 
End Tag Table End Tag Table

View File

@ -635,6 +635,23 @@ OPTIONS
results are probably not meaningful. Let us know if you find a use for results are probably not meaningful. Let us know if you find a use for
this. this.
Output destination
Some commands (print, register, stats, the balance commands) can write
their output to a destination other than the console. This is con-
trolled by the -o/--output-file option.
$ hledger balance -o - # write to stdout (the default)
$ hledger balance -o FILE # write to FILE
Output format
Some commands can write their output in other formats. Eg print and
register can output CSV, and the balance commands can output CSV or
HTML. This is controlled by the -O/--output-format option, or by spec-
ifying a .csv or .html file extension with -o/--output-file.
$ hledger balance -O csv # write CSV to stdout
$ hledger balance -o FILE.csv # write CSV to FILE.csv
Regular expressions Regular expressions
hledger uses regular expressions in a number of places: hledger uses regular expressions in a number of places:
@ -987,7 +1004,7 @@ COMMANDS
in single-column balance reports: use this custom line format in single-column balance reports: use this custom line format
-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, html.
-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
@ -1260,8 +1277,8 @@ 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 You can customise the layout of simple (non-tabular) balance reports
output with --format FMT: with --format FMT:
$ hledger balance --format "%20(account) %12(total)" $ hledger balance --format "%20(account) %12(total)"
assets $-1 assets $-1
@ -1323,6 +1340,8 @@ COMMANDS
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
This command also supports output destination and output formats.
Colour support Colour support
The balance command shows negative amounts in red, if: The balance command shows negative amounts in red, if:
@ -1330,23 +1349,6 @@ COMMANDS
o the output is not being redirected or piped anywhere 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
-o/--output-file option.
$ hledger balance -o - # write to stdout (the default)
$ hledger balance -o FILE # write to FILE
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
option, or by specifying a .csv file extension with -o/--output-file.
$ hledger balance -O csv # write CSV to stdout
$ hledger balance -o FILE.csv # write CSV to FILE.csv
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
@ -1422,6 +1424,8 @@ COMMANDS
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.
This command also supports output destination and output formats.
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).
@ -1519,6 +1523,8 @@ COMMANDS
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.
This command also supports output destination and output formats.
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.
@ -1662,6 +1668,8 @@ COMMANDS
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.
This command also supports output destination and output formats.
prices prices
Print all market prices from the journal. Print all market prices from the journal.
@ -1745,7 +1753,7 @@ COMMANDS
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. This command also supports output destination and output formats.
Here's an example of print's CSV output: Here's an example of print's CSV output:
$ hledger print -Ocsv $ hledger print -Ocsv
@ -1899,8 +1907,7 @@ 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- This command also supports output destination and output formats.
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,
@ -1933,8 +1940,7 @@ COMMANDS
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 This command also supports output destination and output formats.
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,

View File

@ -36,7 +36,7 @@ Show accounts and their balances. Aliases: b, bal.
`-O FMT --output-format=FMT ` `-O FMT --output-format=FMT `
: select the output format. Supported formats: : select the output format. Supported formats:
txt, csv. txt, csv, html.
`-o FILE --output-file=FILE` `-o FILE --output-file=FILE`
: write output to FILE. A file extension matching one of the above formats selects that format. : write output to FILE. A file extension matching one of the above formats selects that format.
@ -336,8 +336,7 @@ For more examples and details, see [Budgeting and Forecasting](budgeting-and-for
### Custom balance output ### Custom balance output
In simple (non-multi-column) balance reports, you can customise the You can customise the layout of simple (non-tabular) balance reports with `--format FMT`:
output with `--format FMT`:
```shell ```shell
$ hledger balance --format "%20(account) %12(total)" $ hledger balance --format "%20(account) %12(total)"
@ -391,6 +390,8 @@ 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 - `%,%-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 - `%20(total) %2(depth_spacer)%-(account)` - the default format for the single-column balance report
This command also supports [output destination](/manual.html#output-destination) and [output formats](/manual.html#output-formats).
### Colour support ### Colour support
The balance command shows negative amounts in red, if: The balance command shows negative amounts in red, if:
@ -398,27 +399,4 @@ The balance command shows negative amounts in red, if:
- the `TERM` environment variable is not set to `dumb` - the `TERM` environment variable is not set to `dumb`
- the output is not being redirected or piped anywhere - 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
`-o/--output-file` option.
```shell
$ hledger balance -o - # write to stdout (the default)
$ hledger balance -o FILE # write to FILE
```
### 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` option, or by specifying a `.csv` file extension
with `-o/--output-file`.
```shell
$ hledger balance -O csv # write CSV to stdout
$ hledger balance -o FILE.csv # write CSV to FILE.csv
```

View File

@ -250,6 +250,8 @@ Normally balancesheet shows historical ending balances, which is what
you need for a balance sheet; note this means it ignores report begin you need for a balance sheet; note this means it ignores report begin
dates. dates.
This command also supports [output destination](/manual.html#output-destination) and [output formats](/manual.html#output-formats).
## balancesheetequity ## balancesheetequity
Just like [balancesheet](#balancesheet), but also reports Equity Just like [balancesheet](#balancesheet), but also reports Equity
(which it assumes is under a top-level `equity` account). (which it assumes is under a top-level `equity` account).
@ -349,6 +351,8 @@ Normally cashflow shows changes in assets per period, though
as with [multicolumn balance reports](#multicolumn-balance-reports) as with [multicolumn balance reports](#multicolumn-balance-reports)
you can alter the report mode with `--change`/`--cumulative`/`--historical`. you can alter the report mode with `--change`/`--cumulative`/`--historical`.
This command also supports [output destination](/manual.html#output-destination) and [output formats](/manual.html#output-formats).
## check-dates ## check-dates
Check that transactions are sorted by increasing date. Check that transactions are sorted by increasing date.
With a query, only matched transactions' dates are checked. With a query, only matched transactions' dates are checked.
@ -499,6 +503,8 @@ Normally incomestatement shows revenues/expenses per period, though
as with [multicolumn balance reports](#multicolumn-balance-reports) as with [multicolumn balance reports](#multicolumn-balance-reports)
you can alter the report mode with `--change`/`--cumulative`/`--historical`. you can alter the report mode with `--change`/`--cumulative`/`--historical`.
This command also supports [output destination](/manual.html#output-destination) and [output formats](/manual.html#output-formats).
## prices ## prices
Print all [market prices](/manual#market-prices) from the journal. Print all [market prices](/manual#market-prices) from the journal.
@ -579,10 +585,7 @@ This assumes that transactions added to FILE always have same or increasing date
and that transactions on the same day do not get reordered. and that transactions on the same day do not get reordered.
See also the [import](#import) command. See also the [import](#import) command.
The print command also supports This command also supports [output destination](/manual.html#output-destination) and [output formats](/manual.html#output-formats).
[output destination](#output-destination)
and
[CSV output](#csv-output).
Here's an example of print's CSV output: Here's an example of print's CSV output:
```shell ```shell
$ hledger print -Ocsv $ hledger print -Ocsv
@ -737,9 +740,7 @@ $ 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 This command also supports [output destination](/manual.html#output-destination) and [output formats](/manual.html#output-formats).
`-o/--output-file` and `-O/--output-format` options for controlling
[output destination](#output-destination) and [CSV output](#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,
@ -773,8 +774,7 @@ The stats command displays summary information for the whole journal, or
a matched part of it. With a [reporting interval](#reporting-interval), a matched part of it. With a [reporting interval](#reporting-interval),
it shows a report for each report period. it shows a report for each report period.
The stats command also supports `-o/--output-file` This command also supports [output destination](/manual.html#output-destination) and [output formats](/manual.html#output-formats).
for controlling [output destination](#output-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,

View File

@ -414,6 +414,28 @@ not [transaction prices](journal.html#transaction-prices) (unlike Ledger).
Using -B/--cost and -V/--value together is currently allowed, but the Using -B/--cost and -V/--value together is currently allowed, but the
results are probably not meaningful. Let us know if you find a use for this. results are probably not meaningful. Let us know if you find a use for this.
### Output destination
Some commands (print, register, stats, the balance commands)
can write their output to a destination other than the console.
This is controlled by the `-o/--output-file` option.
```shell
$ hledger balance -o - # write to stdout (the default)
$ hledger balance -o FILE # write to FILE
```
### Output format
Some commands can write their output in other formats.
Eg print and register can output CSV, and the balance commands can output CSV or HTML.
This is controlled by the `-O/--output-format` option, or by specifying a `.csv` or `.html` file extension with `-o/--output-file`.
```shell
$ hledger balance -O csv # write CSV to stdout
$ hledger balance -o FILE.csv # write CSV to FILE.csv
```
## Regular expressions ## Regular expressions
hledger uses [regular expressions](http://www.regular-expressions.info) in a number of places: hledger uses [regular expressions](http://www.regular-expressions.info) in a number of places: