From 76db377468cb08173b78d314efddf350b5047c00 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Fri, 16 Jan 2015 16:52:59 -0800 Subject: [PATCH] document --output-format and --output-file (fix #233) --- doc/manual.md | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/doc/manual.md b/doc/manual.md index fe511d55f..15ce40742 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -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. 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 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 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 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)`. +##### 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 @@ -1176,6 +1199,11 @@ Examples: $ hledger print $ hledger print employees:bob | hledger -f- register expenses +The print command also supports +[output destination](#output-destination) +and +[CSV output](#csv-output). + #### register 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 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 The stats command displays summary information for the whole journal, or