doc: cli: consistent examples styling
[ci skip]
This commit is contained in:
		
							parent
							
								
									6d0161d742
								
							
						
					
					
						commit
						040f2ba1bf
					
				| @ -48,30 +48,37 @@ Carrying asset/liability balances into a new file for 2019, all from command lin | |||||||
| 
 | 
 | ||||||
| *Warning: we use `>>` here to append; be careful not to type a single `>` which would wipe your journal!* | *Warning: we use `>>` here to append; be careful not to type a single `>` which would wipe your journal!* | ||||||
| 
 | 
 | ||||||
|     $ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal | ```shell | ||||||
|     $ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal | $ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal | ||||||
|  | $ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| Now: | Now: | ||||||
| 
 | 
 | ||||||
|     $ hledger bs -f 2019.journal                   # one file - balances are correct | ```shell | ||||||
|     $ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct | $ hledger bs -f 2019.journal                   # one file - balances are correct | ||||||
|     $ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn | $ hledger bs -f 2018.journal -f 2019.journal   # two files - balances still correct | ||||||
|  | $ hledger bs -f 2018.journal not:desc:closing  # to see year-end balances, must exclude closing txn | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| Transactions spanning the closing date can complicate matters, breaking balance assertions: | Transactions spanning the closing date can complicate matters, breaking balance assertions: | ||||||
| 
 | 
 | ||||||
|     2018/12/30 a purchase made in 2018, clearing the following year | ```journal | ||||||
|         expenses:food          5 | 2018/12/30 a purchase made in 2018, clearing the following year | ||||||
|         assets:bank:checking  -5  ; [2019/1/2] |     expenses:food          5 | ||||||
|  |     assets:bank:checking  -5  ; [2019/1/2] | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| Here's one way to resolve that: | Here's one way to resolve that: | ||||||
| 
 | 
 | ||||||
|     ; in 2018.journal: | ```journal | ||||||
|     2018/12/30 a purchase made in 2018, clearing the following year | ; in 2018.journal: | ||||||
|         expenses:food          5 | 2018/12/30 a purchase made in 2018, clearing the following year | ||||||
|         liabilities:pending |     expenses:food          5 | ||||||
| 
 |     liabilities:pending | ||||||
|     ; in 2019.journal: |  | ||||||
|     2019/1/2 clearance of last year's pending transactions |  | ||||||
|         liabilities:pending    5 = 0 |  | ||||||
|         assets:checking |  | ||||||
| 
 | 
 | ||||||
|  | ; in 2019.journal: | ||||||
|  | 2019/1/2 clearance of last year's pending transactions | ||||||
|  |     liabilities:pending    5 = 0 | ||||||
|  |     assets:checking | ||||||
|  | ``` | ||||||
|  | |||||||
| @ -30,7 +30,9 @@ As a result, importing entries with balance assignments | |||||||
| will probably generate incorrect posting amounts. | will probably generate incorrect posting amounts. | ||||||
| To avoid this problem, use print instead of import: | To avoid this problem, use print instead of import: | ||||||
| 
 | 
 | ||||||
|     $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE | ```shell | ||||||
|  | $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE | ||||||
|  | ``` | ||||||
| 
 | 
 | ||||||
| (If you think import should leave amounts implicit like print does, | (If you think import should leave amounts implicit like print does, | ||||||
| please test it and send a pull request.) | please test it and send a pull request.) | ||||||
|  | |||||||
| @ -58,7 +58,7 @@ with newer dates (and new transactions on the latest date) are printed. | |||||||
| This is useful for ignoring already-seen entries in import data, such as downloaded CSV files. | This is useful for ignoring already-seen entries in import data, such as downloaded CSV files. | ||||||
| Eg: | Eg: | ||||||
| 
 | 
 | ||||||
| ```console | ```shell | ||||||
| $ hledger -f bank1.csv print --new | $ hledger -f bank1.csv print --new | ||||||
| # shows transactions added since last print --new on this file | # shows transactions added since last print --new on this file | ||||||
| ``` | ``` | ||||||
|  | |||||||
| @ -46,7 +46,7 @@ displayed as negative numbers. | |||||||
| It's also useful to show postings on the checking account together with the | It's also useful to show postings on the checking account together with the | ||||||
| related account: | related account: | ||||||
| 
 | 
 | ||||||
| ``` | ```shell | ||||||
| $ hledger register --related --invert assets:checking | $ hledger register --related --invert assets:checking | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -10,13 +10,13 @@ but adds one or more specified postings to any transactions matching QUERY. | |||||||
| The posting amounts can be fixed, or a multiplier of the existing transaction's first posting amount.  | The posting amounts can be fixed, or a multiplier of the existing transaction's first posting amount.  | ||||||
| 
 | 
 | ||||||
| Examples: | Examples: | ||||||
| ``` | ```shell | ||||||
| hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100' | $ hledger-rewrite.hs ^income --add-posting '(liabilities:tax)  *.33  ; income tax' --add-posting '(reserve:gifts)  $100' | ||||||
| hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"' | $ hledger-rewrite.hs expenses:gifts --add-posting '(reserve:gifts)  *-1"' | ||||||
| hledger-rewrite.hs -f rewrites.hledger | $ hledger-rewrite.hs -f rewrites.hledger | ||||||
| ``` | ``` | ||||||
| rewrites.hledger may consist of entries like: | rewrites.hledger may consist of entries like: | ||||||
| ``` | ```journal | ||||||
| = ^income amt:<0 date:2017 | = ^income amt:<0 date:2017 | ||||||
|   (liabilities:tax)  *0.33  ; tax on income |   (liabilities:tax)  *0.33  ; tax on income | ||||||
|   (reserve:grocery)  *0.25  ; reserve 25% for grocery |   (reserve:grocery)  *0.25  ; reserve 25% for grocery | ||||||
|  | |||||||
| @ -149,17 +149,17 @@ hledger reads transactions from a data file (and the add command writes to it). | |||||||
| By default this file is `$HOME/.hledger.journal`  | By default this file is `$HOME/.hledger.journal`  | ||||||
| (or on Windows, something like `C:/Users/USER/.hledger.journal`). | (or on Windows, something like `C:/Users/USER/.hledger.journal`). | ||||||
| You can override this with the `$LEDGER_FILE` environment variable: | You can override this with the `$LEDGER_FILE` environment variable: | ||||||
| ```bash | ```shell | ||||||
| $ setenv LEDGER_FILE ~/finance/2016.journal | $ setenv LEDGER_FILE ~/finance/2016.journal | ||||||
| $ hledger stats | $ hledger stats | ||||||
| ``` | ``` | ||||||
| or with the `-f/--file` option: | or with the `-f/--file` option: | ||||||
| ```bash | ```shell | ||||||
| $ hledger -f /some/file stats | $ hledger -f /some/file stats | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| The file name `-` (hyphen) means standard input: | The file name `-` (hyphen) means standard input: | ||||||
| ```bash | ```shell | ||||||
| $ cat some.journal | hledger -f- | $ cat some.journal | hledger -f- | ||||||
| ``` | ``` | ||||||
| 
 | 
 | ||||||
| @ -178,7 +178,7 @@ or if that is not recognised, by trying each built-in "reader" in turn: | |||||||
| If needed (eg to ensure correct error messages when a file has the "wrong" extension),  | If needed (eg to ensure correct error messages when a file has the "wrong" extension),  | ||||||
| you can force a specific reader/format by prepending it to the file path with a colon.  | you can force a specific reader/format by prepending it to the file path with a colon.  | ||||||
| Examples: | Examples: | ||||||
| ```bash | ```shell | ||||||
| $ hledger -f csv:/some/csv-file.dat stats | $ hledger -f csv:/some/csv-file.dat stats | ||||||
| $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- | $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- | ||||||
| ``` | ``` | ||||||
| @ -436,7 +436,7 @@ $ hledger balance --pivot member tag:member=. | |||||||
|               -2 EUR |               -2 EUR | ||||||
| ``` | ``` | ||||||
| Another way (the acct: query matches against the pivoted "account name"): | Another way (the acct: query matches against the pivoted "account name"): | ||||||
| ``` | ```shell | ||||||
| $ hledger balance --pivot member acct:. | $ hledger balance --pivot member acct:. | ||||||
|               -2 EUR  John Doe |               -2 EUR  John Doe | ||||||
| -------------------- | -------------------- | ||||||
| @ -468,17 +468,17 @@ P 2016/11/01 € $1.10 | |||||||
| P 2016/12/21 € $1.03 | P 2016/12/21 € $1.03 | ||||||
| ``` | ``` | ||||||
| How many euros do I have ? | How many euros do I have ? | ||||||
| ``` | ```shell | ||||||
| $ hledger -f t.j bal -N euros | $ hledger -f t.j bal -N euros | ||||||
|                 €100  assets:euros |                 €100  assets:euros | ||||||
| ``` | ``` | ||||||
| What are they worth at end of nov 3 ? | What are they worth at end of nov 3 ? | ||||||
| ``` | ```shell | ||||||
| $ hledger -f t.j bal -N euros -V -e 2016/11/4 | $ hledger -f t.j bal -N euros -V -e 2016/11/4 | ||||||
|              $110.00  assets:euros |              $110.00  assets:euros | ||||||
| ``` | ``` | ||||||
| What are they worth after 2016/12/21 ? (no report end date specified, defaults to today) | What are they worth after 2016/12/21 ? (no report end date specified, defaults to today) | ||||||
| ``` | ```shell | ||||||
| $ hledger -f t.j bal -N euros -V | $ hledger -f t.j bal -N euros -V | ||||||
|              $103.00  assets:euros |              $103.00  assets:euros | ||||||
| ``` | ``` | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user