;doc: cli: document which commands support which output formats
This commit is contained in:
parent
7edcf77eae
commit
1ba25f9714
@ -1417,26 +1417,73 @@ This is controlled by the `--pretty` option:
|
|||||||
|
|
||||||
## Output format
|
## Output format
|
||||||
|
|
||||||
Some commands (print, register, the balance commands) offer a choice of output format.
|
Some commands offer additional output formats, other than the usual plain text terminal output.
|
||||||
In addition to the usual plain text format (`txt`), there are
|
Here are those commands and the formats currently supported:
|
||||||
CSV (`csv`), HTML (`html`), JSON (`json`) and SQL (`sql`).
|
|
||||||
This is controlled by the `-O/--output-format` option:
|
| | txt | csv | json | html | sql |
|
||||||
|
|--------------------------|-----|-----|------|---------|-----|
|
||||||
|
| aregister | Y | Y | Y | | |
|
||||||
|
| balance *[1]* | Y | Y | Y | Y *[2]* | |
|
||||||
|
| balancesheet *[1]* | Y | Y | Y | Y | |
|
||||||
|
| balancesheetequity *[1]* | Y | Y | Y | Y | |
|
||||||
|
| cashflow *[1]* | Y | Y | Y | Y | |
|
||||||
|
| incomestatement *[1]* | Y | Y | Y | Y | |
|
||||||
|
| print | Y | Y | Y | | Y |
|
||||||
|
| register | Y | Y | Y | | |
|
||||||
|
<!--
|
||||||
|
| accounts | | | | | |
|
||||||
|
| activity | | | | | |
|
||||||
|
| add | | | | | |
|
||||||
|
| check | | | | | |
|
||||||
|
| check-fancyassertions | | | | | |
|
||||||
|
| check-tagfiles | | | | | |
|
||||||
|
| close | | | | | |
|
||||||
|
| codes | | | | | |
|
||||||
|
| commodities | | | | | |
|
||||||
|
| descriptions | | | | | |
|
||||||
|
| diff | | | | | |
|
||||||
|
| files | | | | | |
|
||||||
|
| iadd | | | | | |
|
||||||
|
| import | | | | | |
|
||||||
|
| interest | | | | | |
|
||||||
|
| notes | | | | | |
|
||||||
|
| payees | | | | | |
|
||||||
|
| prices | | | | | |
|
||||||
|
| print-unique | | | | | |
|
||||||
|
| register-match | | | | | |
|
||||||
|
| rewrite | | | | | |
|
||||||
|
| roi | | | | | |
|
||||||
|
| stats | | | | | |
|
||||||
|
| stockquotes | | | | | |
|
||||||
|
| tags | | | | | |
|
||||||
|
| test | | | | | |
|
||||||
|
-->
|
||||||
|
|
||||||
|
- *[1] Balance commands also have a multi-commodity [`--layout` option](#commodity-layout) which affects some output formats.*
|
||||||
|
- *[2] Except with no report interval, or with the `--budget` flag.*
|
||||||
|
|
||||||
|
The output format is selected by the `-O/--output-format=FMT` option:
|
||||||
```shell
|
```shell
|
||||||
$ hledger print -O csv
|
$ hledger print -O csv # print CSV on stdout
|
||||||
```
|
|
||||||
or, by a file extension specified with `-o/--output-file`:
|
|
||||||
```shell
|
|
||||||
$ hledger balancesheet -o foo.html # write HTML to foo.html
|
|
||||||
```
|
|
||||||
The `-O` option can be used to override the file extension if needed:
|
|
||||||
```shell
|
|
||||||
$ hledger balancesheet -o foo.txt -O html # write HTML to foo.txt
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Some notes about JSON output:
|
or by the filename extension of an output file specified with the `-o/--output-file=FILE.FMT` option:
|
||||||
|
```shell
|
||||||
|
$ hledger balancesheet -o foo.csv # write CSV to foo.csv
|
||||||
|
```
|
||||||
|
|
||||||
- This feature is marked experimental, and not yet much used; you
|
The `-O` option can be combined with `-o` to override the file extension, if needed:
|
||||||
should expect our JSON to evolve. Real-world feedback is welcome.
|
```shell
|
||||||
|
$ hledger balancesheet -o foo.txt -O csv # write CSV to foo.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
### HTML output
|
||||||
|
|
||||||
|
- HTML output can be styled by an optional `hledger.css` file in the same directory.
|
||||||
|
|
||||||
|
### JSON output
|
||||||
|
|
||||||
|
- Not yet much used; real-world feedback is welcome.
|
||||||
|
|
||||||
- Our JSON is rather large and verbose, as it is quite a faithful
|
- Our JSON is rather large and verbose, as it is quite a faithful
|
||||||
representation of hledger's internal data types. To understand the
|
representation of hledger's internal data types. To understand the
|
||||||
@ -1464,10 +1511,9 @@ Some notes about JSON output:
|
|||||||
find otherwise, please let us know.
|
find otherwise, please let us know.
|
||||||
(Cf [#1195](https://github.com/simonmichael/hledger/issues/1195))
|
(Cf [#1195](https://github.com/simonmichael/hledger/issues/1195))
|
||||||
|
|
||||||
Notes about SQL output:
|
### SQL output
|
||||||
|
|
||||||
- SQL output is also marked experimental, and much like JSON could use
|
- Not yet much used; real-world feedback is welcome.
|
||||||
real-world feedback.
|
|
||||||
|
|
||||||
- SQL output is expected to work with sqlite, MySQL and PostgreSQL
|
- SQL output is expected to work with sqlite, MySQL and PostgreSQL
|
||||||
|
|
||||||
@ -1477,6 +1523,8 @@ real-world feedback.
|
|||||||
of existing data (via `delete` or `truncate` SQL statements) or drop
|
of existing data (via `delete` or `truncate` SQL statements) or drop
|
||||||
tables completely as otherwise your postings will be duped.
|
tables completely as otherwise your postings will be duped.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Commodity styles
|
## Commodity styles
|
||||||
|
|
||||||
The display style of a commodity/currency is inferred according to the rules
|
The display style of a commodity/currency is inferred according to the rules
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user