doc: cli: consistent examples styling
[ci skip]
This commit is contained in:
		
							parent
							
								
									6d0161d742
								
							
						
					
					
						commit
						040f2ba1bf
					
				| @ -48,23 +48,30 @@ 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!* | ||||
| 
 | ||||
| ```shell | ||||
| $ 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: | ||||
| 
 | ||||
| ```shell | ||||
| $ hledger bs -f 2019.journal                   # one file - balances are correct | ||||
| $ 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: | ||||
| 
 | ||||
| ```journal | ||||
| 2018/12/30 a purchase made in 2018, clearing the following year | ||||
|     expenses:food          5 | ||||
|     assets:bank:checking  -5  ; [2019/1/2] | ||||
| ``` | ||||
| 
 | ||||
| Here's one way to resolve that: | ||||
| 
 | ||||
| ```journal | ||||
| ; in 2018.journal: | ||||
| 2018/12/30 a purchase made in 2018, clearing the following year | ||||
|     expenses:food          5 | ||||
| @ -74,4 +81,4 @@ Here's one way to resolve that: | ||||
| 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. | ||||
| To avoid this problem, use print instead of import: | ||||
| 
 | ||||
| ```shell | ||||
| $ hledger print IMPORTFILE [--new] >> $LEDGER_FILE | ||||
| ``` | ||||
| 
 | ||||
| (If you think import should leave amounts implicit like print does, | ||||
| 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. | ||||
| Eg: | ||||
| 
 | ||||
| ```console | ||||
| ```shell | ||||
| $ hledger -f bank1.csv print --new | ||||
| # 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 | ||||
| related account: | ||||
| 
 | ||||
| ``` | ||||
| ```shell | ||||
| $ 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.  | ||||
| 
 | ||||
| Examples: | ||||
| ``` | ||||
| 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 -f rewrites.hledger | ||||
| ```shell | ||||
| $ 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 -f rewrites.hledger | ||||
| ``` | ||||
| rewrites.hledger may consist of entries like: | ||||
| ``` | ||||
| ```journal | ||||
| = ^income amt:<0 date:2017 | ||||
|   (liabilities:tax)  *0.33  ; tax on income | ||||
|   (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`  | ||||
| (or on Windows, something like `C:/Users/USER/.hledger.journal`). | ||||
| You can override this with the `$LEDGER_FILE` environment variable: | ||||
| ```bash | ||||
| ```shell | ||||
| $ setenv LEDGER_FILE ~/finance/2016.journal | ||||
| $ hledger stats | ||||
| ``` | ||||
| or with the `-f/--file` option: | ||||
| ```bash | ||||
| ```shell | ||||
| $ hledger -f /some/file stats | ||||
| ``` | ||||
| 
 | ||||
| The file name `-` (hyphen) means standard input: | ||||
| ```bash | ||||
| ```shell | ||||
| $ 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),  | ||||
| you can force a specific reader/format by prepending it to the file path with a colon.  | ||||
| Examples: | ||||
| ```bash | ||||
| ```shell | ||||
| $ hledger -f csv:/some/csv-file.dat stats | ||||
| $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:- | ||||
| ``` | ||||
| @ -436,7 +436,7 @@ $ hledger balance --pivot member tag:member=. | ||||
|               -2 EUR | ||||
| ``` | ||||
| Another way (the acct: query matches against the pivoted "account name"): | ||||
| ``` | ||||
| ```shell | ||||
| $ hledger balance --pivot member acct:. | ||||
|               -2 EUR  John Doe | ||||
| -------------------- | ||||
| @ -468,17 +468,17 @@ P 2016/11/01 € $1.10 | ||||
| P 2016/12/21 € $1.03 | ||||
| ``` | ||||
| How many euros do I have ? | ||||
| ``` | ||||
| ```shell | ||||
| $ hledger -f t.j bal -N euros | ||||
|                 €100  assets:euros | ||||
| ``` | ||||
| What are they worth at end of nov 3 ? | ||||
| ``` | ||||
| ```shell | ||||
| $ hledger -f t.j bal -N euros -V -e 2016/11/4 | ||||
|              $110.00  assets:euros | ||||
| ``` | ||||
| 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 | ||||
|              $103.00  assets:euros | ||||
| ``` | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user