diff --git a/bin/README.md b/bin/README.md index 9abae42435f..0cb9c8bcfd7 100644 --- a/bin/README.md +++ b/bin/README.md @@ -66,7 +66,7 @@ $ fin # list the scripts available is a way to organise your finance-related reports and scripts using standard bash. (See also [justfile](#justfile) below.) -```shell +```cli $ alias f=~/src/hledger/bin/ft $ f --------------------------------------------------------------------------------"; } @@ -103,7 +103,7 @@ Add hledger options to customise reports. [`tt`](https://github.com/simonmichael/hledger/blob/master/bin/tt) is a similar bash multi-script for time reports. -```shell +```cli $ alias t=~/src/hledger/bin/tt $ t -------------------------------------------------------------------------------- @@ -141,7 +141,7 @@ More on [hledger and just](just.md). Here is a [justfile](https://github.com/simonmichael/hledger/blob/master/bin/justfile) reimplementing the `ft` and `tt` scripts more simply: -```shell +```cli $ brew install just # eg $ alias j=just $ cd ~/finance @@ -268,7 +268,7 @@ The [hledger-utils python package](https://pypi.org/project/hledger-utils/) prov a `hledger-edit` command to edit the queried transactions in your `$EDITOR` no matter what file they reside in. Install or upgrade: -```shell +```cli $ pip install -U hledger-utils # might be slightly different on your system ``` @@ -292,7 +292,7 @@ The [hledger-utils python package](https://pypi.org/project/hledger-utils/) prov a `hledger-plot` command for generating charts with matplotlib. Install or upgrade: -```shell +```cli $ pip install -U hledger-utils # might be slightly different on your system ``` Examples: diff --git a/doc/BENCHMARKS.md b/doc/BENCHMARKS.md index 13f51d7ef45..dbe1077a4c9 100644 --- a/doc/BENCHMARKS.md +++ b/doc/BENCHMARKS.md @@ -15,7 +15,7 @@ This installs haskell dependencies (but not system dependencies) and rebuilds as then runs [hledger/bench/bench.hs](https://github.com/simonmichael/hledger/blob/master/hledger/bench/bench.hs), which by default shows quick elapsed-time measurements for several operations on a standard data file: -```shell +```cli $ stack bench hledger NOTE: the bench command is functionally equivalent to 'build --bench' ... @@ -35,7 +35,7 @@ Benchmark bench: FINISH bench.hs has some other modes, which you can use by compiling and running it directly. `--criterion` reports more detailed and dependable measurements, but takes longer: -```shell +```cli $ cd hledger; stack exec -- ghc -ibench bench/bench && bench/bench --criterion ... Linking bench/bench ... @@ -80,7 +80,7 @@ variance introduced by outliers: 16% (moderately inflated) It can also show the results for multiple h/ledger executables side by side, if you tweak the bench.hs code. Unlike the other modes, it does not link with the hledger code directly, but runs the "hledger" executable found in $PATH (so ensure that's the one you intend to test). -```shell +```cli $ cd hledger; stack exec -- ghc -ibench bench/bench && bench/bench --simplebench Benchmarking /Users/simon/.local/bin/hledger in /Users/simon/src/hledger/hledger with simplebench and shell Using bench/default.bench @@ -107,12 +107,12 @@ simplebench.hs is a generic benchmarker of one or more executables (specified on It has a better command-line interface than bench.hs, so you may find it more convenient for comparing multiple hledger versions, or hledger and ledger. Eg: -```shell +```cli $ stack exec -- ghc tools/simplebench [1 of 1] Compiling Main ( tools/simplebench.hs, tools/simplebench.o ) Linking tools/simplebench ... ``` -```shell +```cli $ tools/simplebench -h tools/simplebench -h simplebench: at least one executable needed @@ -133,7 +133,7 @@ Tips: - tests can be commented out with # - results are saved in benchresults.{html,txt} ``` -```shell +```cli cd hledger; $ ../tools/simplebench -f bench/default.bench hledger ledger Using bench/default.bench Running 4 tests 2 times with 2 executables at 2015-08-24 04:24:37.257068 UTC: diff --git a/doc/CODE.md b/doc/CODE.md index fbc4a8adc1b..af8705f2314 100644 --- a/doc/CODE.md +++ b/doc/CODE.md @@ -166,7 +166,7 @@ Here are some ways to run it during development: - `yesod devel`: runs in developer mode, rebuilds automatically when config, template, static or haskell files change (but only files in the hledger-web package): -```shell +```cli $ (cd hledger-web; yesod devel) ``` @@ -176,7 +176,7 @@ $ (cd hledger-web; yesod devel) - `stack ghci`: runs the server in developer mode from GHCI. Changes to static files like hledger.js will be visible on page reload; to see other changes, restart it as shown. -```shell +```cli $ (cd hledger-web; stack ghci hledger-web) hledger-web> :main --serve # restart: ctrl-c, :r, enter, ctrl-p, ctrl-p, enter ``` @@ -184,7 +184,7 @@ hledger-web> :main --serve # restart: ctrl-c, :r, enter, ctrl-p, ctrl-p, enter - `make ghci-web`: runs the server in developer mode from GHCI, also interprets the hledger-lib and hledger packages so that :reload picks up changes in those packages too: -```shell +```cli $ make ghci-web ghci> :main --serve ``` diff --git a/doc/EXAMPLES.md b/doc/EXAMPLES.md index 7bc102fa389..ce8235988af 100644 --- a/doc/EXAMPLES.md +++ b/doc/EXAMPLES.md @@ -12,7 +12,7 @@ The numbers describe the number of transactions, number of accounts, and maximum They are generated by [`tools/generatejournal.hs`](https://github.com/simonmichael/hledger/blob/master/tools/generatejournal.hs). They should get built automatically as needed, if not you can use `make samplejournals`: -```shell +```cli $ make samplejournals ghc tools/generatejournal.hs [1 of 1] Compiling Main ( tools/generatejournal.hs, tools/generatejournal.o ) diff --git a/doc/MAKE.md b/doc/MAKE.md index c4374e6a127..61e6090f275 100644 --- a/doc/MAKE.md +++ b/doc/MAKE.md @@ -9,7 +9,7 @@ The Makefile contains a fair amount of obsolete cruft and needs cleanup. Some ta The Makefile is self-documenting. Run `make` to see a list of the main make rules: -```shell +```cli $ make Makefile:37: -------------------- hledger make rules -------------------- Makefile:39: make [help] -- list documented rules in this makefile. make -n RULE shows more detail. @@ -23,11 +23,11 @@ Makefile:304: make hledgerdev -- quickly build the hledger executable (with ghc To see what a make rule will do without actually doing it, use the `-n` flag: -```shell +```cli $ make build -n stack build ``` -```shell +```cli $ make test -n (stack test \ && echo pkgtest PASSED) || echo pkgtest FAILED diff --git a/hledger-ui/hledger-ui.m4.md b/hledger-ui/hledger-ui.m4.md index 5c6d55f4c87..12069c00e49 100644 --- a/hledger-ui/hledger-ui.m4.md +++ b/hledger-ui/hledger-ui.m4.md @@ -341,7 +341,7 @@ This is very useful when reconciling. A good workflow is to have your bank's online register open in a browser window, for reference; the journal file open in an editor window; and hledger-ui in watch mode in a terminal window, eg: -```shell +```cli $ hledger-ui --watch --register checking -C ``` As you mark things cleared in the editor, diff --git a/hledger-web/hledger-web.m4.md b/hledger-web/hledger-web.m4.md index 01074b6bc95..61524e4cfcb 100644 --- a/hledger-web/hledger-web.m4.md +++ b/hledger-web/hledger-web.m4.md @@ -207,7 +207,7 @@ In addition to the web UI, hledger-web also serves a JSON API that can be used to get data or add new transactions. If you want the JSON API only, you can use the `--serve-api` flag. Eg: -```shell +```cli $ hledger-web -f examples/sample.journal --serve-api ... ``` @@ -227,7 +227,7 @@ You can get JSON data from these routes: Eg, all account names in the journal (similar to the [accounts](hledger.html#accounts) command). (hledger-web's JSON does not include newlines, here we use python to prettify it): -```shell +```cli $ curl -s http://127.0.0.1:5000/accountnames | python -m json.tool [ "assets", @@ -248,7 +248,7 @@ $ curl -s http://127.0.0.1:5000/accountnames | python -m json.tool Or all transactions: -```shell +```cli $ curl -s http://127.0.0.1:5000/transactions | python -m json.tool [ { @@ -294,7 +294,7 @@ The payload must be the full, exact JSON representation of a hledger transaction You can get sample JSON from hledger-web's `/transactions` or `/accounttransactions`, or you can export it with hledger-lib, eg like so: -```shell +```cli .../hledger$ stack ghci hledger-lib >>> writeJsonFile "txn.json" (head $ jtxns samplejournal) >>> :q @@ -395,7 +395,7 @@ and related data types): And here's how to test adding it with curl. This should add a new entry to your journal: -```shell +```cli $ curl http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.json ``` diff --git a/hledger/Hledger/Cli/Commands/Accounts.md b/hledger/Hledger/Cli/Commands/Accounts.md index ce21d94fb31..470bfb21323 100644 --- a/hledger/Hledger/Cli/Commands/Accounts.md +++ b/hledger/Hledger/Cli/Commands/Accounts.md @@ -39,7 +39,7 @@ account name, or if none can be found, it fails with a non-zero exit code. Examples: -```shell +```cli $ hledger accounts assets:bank:checking assets:bank:saving @@ -50,7 +50,7 @@ income:gifts income:salary liabilities:debts ``` -```shell +```cli $ hledger accounts --undeclared --directives >> $LEDGER_FILE $ hledger check accounts ``` diff --git a/hledger/Hledger/Cli/Commands/Activity.md b/hledger/Hledger/Cli/Commands/Activity.md index fd6d0318894..faac136af85 100644 --- a/hledger/Hledger/Cli/Commands/Activity.md +++ b/hledger/Hledger/Cli/Commands/Activity.md @@ -9,7 +9,7 @@ counts by day, week, month or other reporting interval (by day is the default). With query arguments, it counts only matched transactions. Examples: -```shell +```cli $ hledger activity --quarterly 2008-01-01 ** 2008-04-01 ******* diff --git a/hledger/Hledger/Cli/Commands/Aregister.md b/hledger/Hledger/Cli/Commands/Aregister.md index f192c05ba68..c32046b364b 100644 --- a/hledger/Hledger/Cli/Commands/Aregister.md +++ b/hledger/Hledger/Cli/Commands/Aregister.md @@ -40,7 +40,7 @@ causing it to be different from the account's real-world running balance. An example: this shows the transactions and historical running balance during july, in the first account whose name contains "checking": -```shell +```cli $ hledger areg checking date:jul ``` diff --git a/hledger/Hledger/Cli/Commands/Balance.md b/hledger/Hledger/Cli/Commands/Balance.md index 6ce3c43f35b..e506dd39af1 100644 --- a/hledger/Hledger/Cli/Commands/Balance.md +++ b/hledger/Hledger/Cli/Commands/Balance.md @@ -96,7 +96,7 @@ if any, and then alphabetically by account name. For instance (using [examples/sample.journal](https://github.com/simonmichael/hledger/blob/master/examples/sample.journal)): -```shell +```cli $ hledger -f examples/sample.journal bal $1 assets:bank:saving $-2 assets:cash @@ -113,7 +113,7 @@ Accounts with a zero balance (and no non-zero subaccounts, in tree mode - see below) are hidden by default. Use `-E/--empty` to show them (revealing `assets:bank:checking` here): -```shell +```cli $ hledger -f examples/sample.journal bal -E 0 assets:bank:checking $1 assets:bank:saving @@ -135,7 +135,7 @@ For single-period balance reports displayed in the terminal (only), you can use `--format FMT` to customise the format and content of each line. Eg: -```shell +```cli $ hledger -f examples/sample.journal balance --format "%20(account) %12(total)" assets $-1 bank:saving $1 @@ -196,7 +196,7 @@ cleared transactions only, etc. by using [query](#queries) arguments or [options](#report-start--end-date) to limit the postings being matched. Eg: -```shell +```cli $ hledger -f examples/sample.journal bal --cleared assets date:200806 $-2 assets:cash -------------------- @@ -211,7 +211,7 @@ with their full names visible, as in the examples above. With `-t/--tree`, the account hierarchy is shown, with subaccounts' "leaf" names indented below their parent: -```shell +```cli $ hledger -f examples/sample.journal balance $-1 assets $1 bank:saving @@ -253,7 +253,7 @@ Account balances at the depth limit always include the balances from any deeper subaccounts (even in list mode). Eg, limiting to depth 1: -```shell +```cli $ hledger -f examples/sample.journal balance -1 $-1 assets $2 expenses @@ -268,7 +268,7 @@ $ hledger -f examples/sample.journal balance -1 You can also hide one or more top-level account name parts, using `--drop NUM`. This can be useful for hiding repetitive top-level account names: -```shell +```cli $ hledger -f examples/sample.journal bal expenses --drop 1 $1 food $1 supplies @@ -314,7 +314,7 @@ Note it is not useful to calculate percentages if the amounts in a column have mixed signs. In this case, make a separate report for each sign, eg: -```shell +```cli $ hledger bal -% amt:`>0` $ hledger bal -% amt:`<0` ``` @@ -323,7 +323,7 @@ Similarly, if the amounts in a column have mixed commodities, convert them to one commodity with `-B`, `-V`, `-X` or `--value`, or make a separate report for each commodity: -```shell +```cli $ hledger bal -% cur:\\$ $ hledger bal -% cur:€ ``` @@ -335,7 +335,7 @@ With a [report interval](#report-intervals) (set by the `-D/--daily`, `-p/--period` flag), `balance` shows a tabular report, with columns representing successive time periods (and a title): -```shell +```cli $ hledger -f examples/sample.journal bal --quarterly income expenses -E Balance changes in 2008: @@ -530,7 +530,7 @@ For example, you can take average monthly expenses in the common expense categor ``` You can now see a monthly budget report: -```shell +```cli $ hledger balance -M --budget Budget performance in 2017/11/01-2017/12/31: @@ -565,7 +565,7 @@ shown, as they have no budget amounts declared. This can be confusing. When you need to make things clearer, use the `-E/--empty` flag, which will reveal all accounts including unbudgeted ones, giving the full picture. Eg: -```shell +```cli $ hledger balance -M --budget --empty Budget performance in 2017/11/01-2017/12/31: @@ -587,7 +587,7 @@ Budget performance in 2017/11/01-2017/12/31: You can roll over unspent budgets to next period with `--cumulative`: -```shell +```cli $ hledger balance -M --budget --cumulative Budget performance in 2017/11/01-2017/12/31: @@ -639,7 +639,7 @@ day of 2020-01-15: expenses:food $400 assets:checking ``` -```shell +```cli $ hledger bal expenses --budget Budget performance in 2020-01-15: @@ -654,7 +654,7 @@ To avoid this, specify the budget report's period, or at least the start date, with `-b`/`-e`/`-p`/`date:`, to ensure it includes the budget goal transactions (periodic transactions) that you want. Eg, adding `-b 2020/1/1` to the above: -```shell +```cli $ hledger bal expenses --budget -b 2020/1/1 Budget performance in 2020-01-01..2020-01-15: @@ -713,7 +713,7 @@ For example, let's consider these transactions: As you can see, we have transactions in `expenses:personal:electronics:upgrades` and `expenses:personal:train tickets`, and since both of these accounts are without explicitly defined budget, these transactions would be counted towards budgets of `expenses:personal:electronics` and `expenses:personal` accordingly: -```shell +```cli $ hledger balance --budget -M Budget performance in 2019/01: @@ -728,7 +728,7 @@ Budget performance in 2019/01: ``` And with `--empty`, we can get a better picture of budget allocation and consumption: -```shell +```cli $ hledger balance --budget -M --empty Budget performance in 2019/01: @@ -749,7 +749,7 @@ Budget performance in 2019/01: The budget report evaluates periodic transaction rules to generate special "goal transactions", which generate the goal amounts for each account in each report subperiod. When troubleshooting, you can use `print --forecast` to show these as forecasted transactions: -```shell +```cli $ hledger print --forecast=BUDGETREPORTPERIOD tag:generated ``` @@ -826,7 +826,7 @@ note only CSV output supports all of them: Examples: - Wide layout. With many commodities, reports can be very wide: - ```shell + ```cli $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide Balance changes in 2012-01-01..2014-12-31: @@ -838,7 +838,7 @@ Examples: ``` - Limited wide layout. A width limit reduces the width, but some commodities will be hidden: - ```shell + ```cli $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide,32 Balance changes in 2012-01-01..2014-12-31: @@ -850,7 +850,7 @@ Examples: ``` - Tall layout. Each commodity gets a new line (may be different in each column), and account names are repeated: - ```shell + ```cli $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=tall Balance changes in 2012-01-01..2014-12-31: @@ -870,7 +870,7 @@ Examples: ``` - Bare layout. Commodity symbols are kept in one column, each commodity gets its own report row, account names are repeated: - ```shell + ```cli $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=bare Balance changes in 2012-01-01..2014-12-31: @@ -891,7 +891,7 @@ Examples: - Bare layout also affects [CSV output](#output-format), which is useful for producing data that is easier to consume, eg for making charts: - ```shell + ```cli $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare "account","commodity","balance" "Assets:US:ETrade","GLD","70.00" @@ -917,7 +917,7 @@ Examples: This is the easiest kind of data for other software to consume. Here's how it looks: - ```shell + ```cli $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -Y -O csv --layout=tidy "account","period","start_date","end_date","commodity","value" "Assets:US:ETrade","2012","2012-01-01","2012-12-31","GLD","0" diff --git a/hledger/Hledger/Cli/Commands/Balancesheet.md b/hledger/Hledger/Cli/Commands/Balancesheet.md index 8ea0108245d..51bc59c2fdb 100644 --- a/hledger/Hledger/Cli/Commands/Balancesheet.md +++ b/hledger/Hledger/Cli/Commands/Balancesheet.md @@ -17,7 +17,7 @@ Or if no such accounts are declared, it shows top-level accounts named Example: -```shell +```cli $ hledger balancesheet Balance Sheet diff --git a/hledger/Hledger/Cli/Commands/Balancesheetequity.md b/hledger/Hledger/Cli/Commands/Balancesheetequity.md index a24df6d2ead..1aa0463d9ba 100644 --- a/hledger/Hledger/Cli/Commands/Balancesheetequity.md +++ b/hledger/Hledger/Cli/Commands/Balancesheetequity.md @@ -15,7 +15,7 @@ Or if no such accounts are declared, it shows top-level accounts named `asset`, `liability` or `equity` (case insensitive, plurals allowed) and their subaccounts. Example: -```shell +```cli $ hledger balancesheetequity Balance Sheet With Equity diff --git a/hledger/Hledger/Cli/Commands/Cashflow.md b/hledger/Hledger/Cli/Commands/Cashflow.md index b79cbe9bfa7..f6f2abc0d4e 100644 --- a/hledger/Hledger/Cli/Commands/Cashflow.md +++ b/hledger/Hledger/Cli/Commands/Cashflow.md @@ -23,7 +23,7 @@ More precisely: all accounts matching this case insensitive regular expression: and their subaccounts. An example cashflow report: -```shell +```cli $ hledger cashflow Cashflow Statement diff --git a/hledger/Hledger/Cli/Commands/Check.md b/hledger/Hledger/Cli/Commands/Check.md index 0df810d7384..1cda053f629 100644 --- a/hledger/Hledger/Cli/Commands/Check.md +++ b/hledger/Hledger/Cli/Commands/Check.md @@ -13,7 +13,7 @@ Specify their names (or a prefix) as argument(s). Some examples: -```shell +```cli hledger check # basic checks hledger check -s # basic + strict checks hledger check ordereddates payees # basic + two other checks diff --git a/hledger/Hledger/Cli/Commands/Close.md b/hledger/Hledger/Cli/Commands/Close.md index ee6c0344324..d6bb6739a74 100644 --- a/hledger/Hledger/Cli/Commands/Close.md +++ b/hledger/Hledger/Cli/Commands/Close.md @@ -106,14 +106,14 @@ in effect splitting the multi-day transaction into two single-day transactions: Record 2022's revenues/expenses as retained earnings on 2022-12-31, appending the generated transaction to the journal: -```shell +```cli $ hledger close --retain -f 2022.journal -p 2022 >> 2022.journal ``` Note 2022's income statement will now show only zeroes, because revenues and expenses have been moved entirely to equity. To see them again, you could exclude the retain transaction: -```shell +```cli $ hledger -f 2022.journal is not:desc:'retain earnings' ``` @@ -121,7 +121,7 @@ $ hledger -f 2022.journal is not:desc:'retain earnings' Close assets/liabilities/equity on 2022-12-31 and re-open them on 2023-01-01: -```shell +```cli $ hledger close --migrate -f 2022.journal -p 2022 # copy/paste the closing transaction to the end of 2022.journal # copy/paste the opening transaction to the start of 2023.journal @@ -130,7 +130,7 @@ $ hledger close --migrate -f 2022.journal -p 2022 The output format is selected by the `-O/--output-format=FMT` option: -```shell +```cli $ hledger print -O csv # print CSV on stdout ``` or by the filename extension of an output file specified with the `-o/--output-file=FILE.FMT` option: -```shell +```cli $ hledger balancesheet -o foo.csv # write CSV to foo.csv ``` The `-O` option can be combined with `-o` to override the file extension, if needed: -```shell +```cli $ hledger balancesheet -o foo.txt -O csv # write CSV to foo.txt ``` @@ -658,7 +658,7 @@ by the [`print`](#print) command, which are always displayed with all decimal digits). For example, the following will force dollar amounts to be displayed as shown: -```shell +```cli $ hledger print -c '$1.000,0' ``` @@ -710,7 +710,7 @@ Typically you would start with 1 and increase until you are seeing enough. Debug output goes to stderr, and is not affected by `-o/--output-file` (unless you redirect stderr to stdout, eg: `2>&1`). It will be interleaved with normal output, which can help reveal when parts of the code are evaluated. To capture debug output in a log file instead, you can usually redirect stderr, eg: -```shell +```cli hledger bal --debug=3 2>hledger.log ``` @@ -982,12 +982,12 @@ be reported on 6/1 for easy bank reconciliation: assets:checking ; bank cleared it on monday, date:6/1 ``` -```shell +```cli $ hledger -f t.j register food 2015-05-30 expenses:food $10 $10 ``` -```shell +```cli $ hledger -f t.j register checking 2015-06-01 assets:checking $-10 $-10 ``` @@ -1785,7 +1785,7 @@ account expenses ``` those accounts will be displayed in declaration order: -```shell +```cli $ hledger accounts -1 assets liabilities @@ -1994,7 +1994,7 @@ In case of trouble, adding `--debug=6` to the command line will show which alias As explained at [Directives and multiple files](#directives-and-multiple-files), `alias` directives do not affect parent or sibling files. Eg in this command, -```shell +```cli hledger -f a.aliases -f b.journal ``` account aliases defined in a.aliases will not affect b.journal. @@ -2040,7 +2040,7 @@ For example, you could erase all account names: a:aa 1 b ``` -```shell +```cli $ hledger print --alias '/.*/=' 2021-01-01 1 @@ -2056,7 +2056,7 @@ that would give a different journal when reparsed: old 1 other ``` -```shell +```cli $ hledger print --alias old="new USD" | hledger -f- print 2021-01-01 new USD 1 @@ -2087,7 +2087,7 @@ it tries and fails to infer a type for "foo". If you are using account aliases and the [`type:` query](#queries) is not matching accounts as you expect, try troubleshooting with the accounts command, eg something like: -```shell +```cli $ hledger accounts --alias assets=bassetts type:a ``` @@ -2420,7 +2420,7 @@ Some examples: expenses:gifts $20 assets:checking ``` -```shell +```cli $ hledger print --auto 2017-12-01 expenses:food $10 @@ -2800,7 +2800,7 @@ skip 1 fields date, description, , amount date-format %d/%m/%Y ``` -```shell +```cli $ hledger print -f basic.csv 2019-11-12 Foo expenses:unknown 10.23 @@ -2955,7 +2955,7 @@ In either of these cases, hledger will do a time-zone-aware conversion, localising the CSV date-times to your current system time zone. If you prefer to localise to some other time zone, eg for reproducibility, you can (on unix at least) set the output timezone with the TZ environment variable, eg: -```shell +```cli $ TZ=-1000 hledger print -f foo.csv # or TZ=-1000 hledger import foo.csv ``` @@ -3448,7 +3448,7 @@ Some tips: It's a good idea to get rapid feedback while creating/troubleshooting CSV rules. Here's a good way, using entr from [eradman.com/entrproject](https://eradman.com/entrproject): -```shell +```cli $ ls foo.csv* | entr bash -c 'echo ----; hledger -f foo.csv print desc:SOMEDESC' ``` A desc: query (eg) is used to select just one, or a few, transactions of interest. @@ -3480,7 +3480,7 @@ filename extension. When reading files with the "wrong" extension, you can ensure the CSV reader (and the default field separator) by prefixing the file path with `csv:`, `ssv:` or `tsv:`: Eg: -```shell +```cli $ hledger -f ssv:foo.dat print ``` @@ -3538,7 +3538,7 @@ There is one exception: balance assertions, if you have generated them, will not be checked, since normally these will work only when the CSV data is part of the main journal. If you do need to check balance assertions generated from CSV right away, pipe into another hledger: -```shell +```cli $ hledger -f file.csv print | hledger -f- print ``` @@ -3554,7 +3554,7 @@ journal. It is idempotent, so you don't have to remember how many times you ran it or with which version of the CSV. (It keeps state in a hidden `.latest.FILE.csv` file.) This is the easiest way to import CSV data. Eg: -```shell +```cli # download the latest CSV files, then run this command. # Note, no -f flags needed here. $ hledger import *.csv [--dry] @@ -3833,7 +3833,7 @@ currency EUR # set the base account for all txns account1 assets:bank:boi:checking ``` -```shell +```cli $ hledger -f bankofireland-checking.csv print 2012-12-07 LODGMENT 529898 assets:bank:boi:checking EUR10.0 = EUR131.2 @@ -3866,7 +3866,7 @@ description %Notes account1 assets:coinbase:cc amount %Quantity_Transacted %Asset @ %Spot_Price_at_Transaction %Spot_Price_Currency ``` -```shell +```cli $ hledger print -f coinbase.csv 2021-12-30 Received 100.00 USDC from an external account assets:coinbase:cc 100 USDC @ 0.740000 GBP @@ -3920,7 +3920,7 @@ if %fees [1-9] account3 expenses:fees amount3 %fees ``` -```shell +```cli $ hledger -f amazon-orders.csv print 2012-07-29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo. ; status:Completed assets:amazon @@ -4059,7 +4059,7 @@ if Google ``` -```shell +```cli $ hledger -f paypal-custom.csv print 2019-10-01 (60P57143A8206782E) Calm Radio MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month ; itemid:, fromemail:simon@joyful.com, toemail:memberships@calmradio.com, time:03:46:20, type:Subscription Payment, status:Completed assets:online:paypal $-6.99 = $-6.99 @@ -4137,7 +4137,7 @@ Here is a [sample.timeclock](https://raw.github.com/simonmichael/hledger/master/examples/sample.timeclock) to download and some queries to try: -```shell +```cli $ hledger -f sample.timeclock balance # current time balances $ hledger -f sample.timeclock register -p 2009/3 # sessions in march 2009 $ hledger -f sample.timeclock register -p weekly --depth 1 --empty # time summary by week @@ -4181,7 +4181,7 @@ hledger reads this as a transaction on this day with three No commodity symbol is assumed, but we typically interpret it as hours. -```shell +```cli $ hledger -f a.timedot print # .timedot file extension (or timedot: prefix) is required 2023-05-01 * (hom:errands) 2.00 ; two hours @@ -4263,7 +4263,7 @@ biz:research . inc:client1 .... .... biz:research . ``` -```shell +```cli $ hledger -f a.timedot print date:2016/2/2 2016-02-02 * (inc:client1) 2.00 @@ -4271,7 +4271,7 @@ $ hledger -f a.timedot print date:2016/2/2 2016-02-02 * (biz:research) 0.25 ``` -```shell +```cli $ hledger -f a.timedot bal --daily --tree Balance changes in 2016-02-01-2016-02-03: @@ -4304,13 +4304,13 @@ $ hledger -f a.timedot print (work:adm) 0.25 ; t:s ``` -```shell +```cli $ hledger -f a.timedot bal 1.75 work:adm -------------------- 1.75 ``` -```shell +```cli $ hledger -f a.timedot bal --pivot t 1.00 c 0.50 e @@ -4347,7 +4347,7 @@ Using `.` as account name separator: fos.hledger.timedot 4h fos.ledger .. ``` -```shell +```cli $ hledger -f a.timedot --alias '/\./=:' bal -t 4.50 fos 4.00 hledger:timedot @@ -4359,7 +4359,7 @@ $ hledger -f a.timedot --alias '/\./=:' bal -t