document --output-format and --output-file (fix #233)

This commit is contained in:
Simon Michael 2015-01-16 16:52:59 -08:00
parent af56ced3b0
commit 76db377468

View File

@ -550,6 +550,9 @@ hledger will create it if necessary, with some default rules which you'll need t
At minimum, the rules file must specify the `date` and `amount` fields. At minimum, the rules file must specify the `date` and `amount` fields.
For an example, see [How to read CSV files](how-to-read-csv-files.html). For an example, see [How to read CSV files](how-to-read-csv-files.html).
(For CSV output, see [CSV output](#csv-output).)
#### CSV rules #### CSV rules
The following six kinds of rule can appear in the rules file, in any order. The following six kinds of rule can appear in the rules file, in any order.
@ -1072,7 +1075,7 @@ for each row. The `-A/--average` flag adds a column showing the
average value in each row. Note in `--H/--historical` mode only the average value in each row. Note in `--H/--historical` mode only the
average is useful, and in `--cumulative` mode neither is useful. average is useful, and in `--cumulative` mode neither is useful.
##### Custom output formats ##### Customising console output
In simple balance reports (only), the `--format FMT` option will customize In simple balance reports (only), the `--format FMT` option will customize
the format of output lines. `FMT` is like a C printf/strftime-style the format of output lines. `FMT` is like a C printf/strftime-style
@ -1136,6 +1139,26 @@ Or, if you'd like to export the balance sheet:
The default output format is `%20(total) %2(depth_spacer)%-(account)`. The default output format is `%20(total) %2(depth_spacer)%-(account)`.
##### Output destination
The balance, print and register commands can write their output to a
destination other than the console. This is controlled by the
`-o/--output-file` option. Eg:
- `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`. Eg:
- `hledger balance -O csv` - write CSV to stdout
- `hledger balance -o FILE.csv` - write CSV to FILE.csv
#### balancesheet #### balancesheet
@ -1176,6 +1199,11 @@ Examples:
$ hledger print $ hledger print
$ hledger print employees:bob | hledger -f- register expenses $ hledger print employees:bob | hledger -f- register expenses
The print command also supports
[output destination](#output-destination)
and
[CSV output](#csv-output).
#### register #### register
The register command displays postings, one per line, and their running The register command displays postings, one per line, and their running
@ -1223,6 +1251,11 @@ When using report intervals, the report's normal start/end dates are
"enlarged" to contain a whole number of intervals, so that the first "enlarged" to contain a whole number of intervals, so that the first
and last intervals will be "full" and comparable to the others. and last intervals will be "full" and comparable to the others.
The register command also supports
[output destination](#output-destination)
and
[CSV output](#csv-output).
#### stats #### stats
The stats command displays summary information for the whole journal, or The stats command displays summary information for the whole journal, or