hledger 1.14.2 → 1.52.1
raw patch · 134 files changed
Files
- CHANGES.md +5572/−1396
- Hledger/Cli.hs +691/−19
- Hledger/Cli/Anchor.hs +96/−0
- Hledger/Cli/Anon.hs +58/−0
- Hledger/Cli/CliOptions.hs +543/−317
- Hledger/Cli/Commands.hs +427/−183
- Hledger/Cli/Commands/Accounts.hs +92/−42
- Hledger/Cli/Commands/Accounts.txt +46/−10
- Hledger/Cli/Commands/Activity.hs +23/−25
- Hledger/Cli/Commands/Activity.txt +3/−1
- Hledger/Cli/Commands/Add.hs +355/−260
- Hledger/Cli/Commands/Add.txt +72/−46
- Hledger/Cli/Commands/Aregister.hs +300/−0
- Hledger/Cli/Commands/Aregister.txt +105/−0
- Hledger/Cli/Commands/Balance.hs +1122/−528
- Hledger/Cli/Commands/Balance.txt +949/−472
- Hledger/Cli/Commands/Balancesheet.hs +10/−8
- Hledger/Cli/Commands/Balancesheet.txt +85/−32
- Hledger/Cli/Commands/Balancesheetequity.hs +14/−9
- Hledger/Cli/Commands/Balancesheetequity.txt +92/−22
- Hledger/Cli/Commands/Cashflow.hs +8/−5
- Hledger/Cli/Commands/Cashflow.txt +88/−26
- Hledger/Cli/Commands/Check.hs +113/−0
- Hledger/Cli/Commands/Check.txt +105/−0
- Hledger/Cli/Commands/Checkdates.hs +0/−70
- Hledger/Cli/Commands/Checkdates.txt +0/−7
- Hledger/Cli/Commands/Checkdupes.hs +0/−43
- Hledger/Cli/Commands/Checkdupes.txt +0/−8
- Hledger/Cli/Commands/Close.hs +242/−45
- Hledger/Cli/Commands/Close.txt +228/−59
- Hledger/Cli/Commands/Codes.hs +39/−0
- Hledger/Cli/Commands/Codes.txt +46/−0
- Hledger/Cli/Commands/Commands.txt +6/−0
- Hledger/Cli/Commands/Commodities.hs +36/−11
- Hledger/Cli/Commands/Commodities.txt +17/−2
- Hledger/Cli/Commands/Demo.hs +180/−0
- Hledger/Cli/Commands/Demo.txt +27/−0
- Hledger/Cli/Commands/Descriptions.hs +38/−0
- Hledger/Cli/Commands/Descriptions.txt +17/−0
- Hledger/Cli/Commands/Diff.hs +116/−0
- Hledger/Cli/Commands/Diff.txt +34/−0
- Hledger/Cli/Commands/Files.hs +8/−11
- Hledger/Cli/Commands/Files.txt +3/−1
- Hledger/Cli/Commands/Help.hs +27/−40
- Hledger/Cli/Commands/Help.txt +26/−26
- Hledger/Cli/Commands/Import.hs +76/−22
- Hledger/Cli/Commands/Import.txt +210/−13
- Hledger/Cli/Commands/Incomestatement.hs +27/−6
- Hledger/Cli/Commands/Incomestatement.txt +89/−34
- Hledger/Cli/Commands/Notes.hs +38/−0
- Hledger/Cli/Commands/Notes.txt +17/−0
- Hledger/Cli/Commands/Payees.hs +58/−0
- Hledger/Cli/Commands/Payees.txt +30/−0
- Hledger/Cli/Commands/Prices.hs +89/−60
- Hledger/Cli/Commands/Prices.txt +18/−5
- Hledger/Cli/Commands/Print.hs +322/−124
- Hledger/Cli/Commands/Print.txt +166/−55
- Hledger/Cli/Commands/Printunique.hs +0/−26
- Hledger/Cli/Commands/Printunique.txt +0/−16
- Hledger/Cli/Commands/Register.hs +238/−116
- Hledger/Cli/Commands/Register.txt +74/−15
- Hledger/Cli/Commands/Registermatch.hs +0/−89
- Hledger/Cli/Commands/Registermatch.txt +0/−8
- Hledger/Cli/Commands/Repl.txt +78/−0
- Hledger/Cli/Commands/Rewrite.hs +62/−55
- Hledger/Cli/Commands/Rewrite.txt +28/−19
- Hledger/Cli/Commands/Roi.hs +282/−176
- Hledger/Cli/Commands/Roi.txt +167/−15
- Hledger/Cli/Commands/Run.hs +275/−0
- Hledger/Cli/Commands/Run.txt +88/−0
- Hledger/Cli/Commands/Setup.hs +624/−0
- Hledger/Cli/Commands/Setup.txt +61/−0
- Hledger/Cli/Commands/Stats.hs +152/−77
- Hledger/Cli/Commands/Stats.txt +45/−17
- Hledger/Cli/Commands/Tags.hs +84/−19
- Hledger/Cli/Commands/Tags.txt +36/−5
- Hledger/Cli/Commands/Test.txt +18/−14
- Hledger/Cli/CompoundBalanceCommand.hs +319/−306
- Hledger/Cli/Conf.hs +293/−0
- Hledger/Cli/DocFiles.hs +120/−73
- Hledger/Cli/Main.hs +0/−264
- Hledger/Cli/Script.hs +56/−0
- Hledger/Cli/Utils.hs +210/−175
- Hledger/Cli/Version.hs +253/−51
- LICENSE +4/−4
- README.md +7/−123
- app/hledger-cli.hs +6/−3
- bench/bench.hs +4/−5
- embeddedfiles/add.cast +524/−0
- embeddedfiles/balance.cast +100/−0
- embeddedfiles/hledger-accounts.md +36/−0
- embeddedfiles/hledger-add.md +24/−0
- embeddedfiles/hledger-api.1 +0/−143
- embeddedfiles/hledger-api.info +0/−86
- embeddedfiles/hledger-api.txt +0/−120
- embeddedfiles/hledger-aregister.md +20/−0
- embeddedfiles/hledger-balance.md +37/−0
- embeddedfiles/hledger-balancesheet.md +33/−0
- embeddedfiles/hledger-import.md +28/−0
- embeddedfiles/hledger-incomestatement.md +21/−0
- embeddedfiles/hledger-print.md +32/−0
- embeddedfiles/hledger-ui.1 +398/−413
- embeddedfiles/hledger-ui.info +416/−252
- embeddedfiles/hledger-ui.md +32/−0
- embeddedfiles/hledger-ui.txt +345/−304
- embeddedfiles/hledger-web.1 +441/−330
- embeddedfiles/hledger-web.info +443/−212
- embeddedfiles/hledger-web.md +32/−0
- embeddedfiles/hledger-web.txt +391/−240
- embeddedfiles/hledger.1 +13773/−3273
- embeddedfiles/hledger.info +13899/−2856
- embeddedfiles/hledger.md +37/−0
- embeddedfiles/hledger.txt +10856/−2420
- embeddedfiles/hledger_csv.5 +0/−335
- embeddedfiles/hledger_csv.info +0/−349
- embeddedfiles/hledger_csv.txt +0/−252
- embeddedfiles/hledger_journal.5 +0/−1772
- embeddedfiles/hledger_journal.info +0/−1693
- embeddedfiles/hledger_journal.txt +0/−1304
- embeddedfiles/hledger_timeclock.5 +0/−92
- embeddedfiles/hledger_timeclock.info +0/−60
- embeddedfiles/hledger_timeclock.txt +0/−80
- embeddedfiles/hledger_timedot.5 +0/−154
- embeddedfiles/hledger_timedot.info +0/−116
- embeddedfiles/hledger_timedot.txt +0/−127
- embeddedfiles/install.cast +1578/−0
- embeddedfiles/print.cast +43/−0
- hledger.1 +0/−3275
- hledger.cabal +175/−154
- hledger.info +0/−2856
- hledger.txt +0/−2421
- shell-completion/hledger-completion.bash +2215/−0
- test/test.hs +0/−8
- test/unittest.hs +14/−0
CHANGES.md view
@@ -1,1396 +1,5572 @@-User-visible changes in the hledger command line tool and library.---# 1.14.2 2019-03-20--- require easytest <0.3 to fix build issue--- fix some CSV parse errors which weren't in human readable format--# 1.14.1 2019-03-01--- fix missing Commodities.txt build error--# 1.14 2019-03-01--- journal: subaccount-including balance assertions have been- added, with syntax =* and ==* (experimental) (#290)--- new commodities command lists commodity symbols--- new --invert option flips sign of amounts in reports--# 1.13.2 (2019/02/04)--- print, register: restore the accidentally dropped -o, -O flags (#967)--# 1.13.1 (2019/02/02)--- stop depending on here to avoid haskell-src-meta/stackage blockage.--# 1.13 (2019/02/01)--- cli: reorganised commands list. Addons now have a + prefix.--- cli: the command line help and manual section for all hledger's- commands are now consistent, and generated from the same source.--- cli: comprehensive bash completion support is now provided (in- shell-completion/). See how-to in the Cookbook. (Jakob Schöttl)--- balance --budget: budget amounts now aggregate hierarchically, like- account balances. Unbudgeted accounts can be shown with -E/--empty- (along with zero-balance accounts), and the --show-budgeted flag has- been dropped. (Dmitry Astapov)--- balance: new --transpose flag switches the rows and columns of- tabular balance reports (in txt and csv output formats). (Dmitry- Astapov)--- close: generated balance assertions now have exact amounts with all- decimal digits, ignoring display precision. Also, balance assertion- amounts will no longer contain prices. (#941, #824, #958)--- files: now shows up in the commands list--- import: be silent when there's nothing to import--- roi: percentages smaller than 0.01% are displayed as zero (Dmitry- Astapov)--- stats, ui: correct file order is preserved when using --auto (#949)--- journal: account directive: the account name can now be followed by- a comment on the same line--- journal: account directive: account types for the bs/bse/cf/is- commands can now be set with a `type:` tag, whose value is `Asset`,- `Liability`, `Equity`, `Revenue`, `Expense`, `A`, `L`, `E`, `R` or- `X` (case-insensitive). The previous syntax (`account assets A`) is- now deprecated.--- journal: account directive: account sort codes like `account 1000`- (introduced in 1.9, deprecated in 1.11) are no longer supported.--- journal: transaction modifiers (auto postings) can affect periodic- transactions (--auto can add postings to transactions generated with- --forecast). (Dmitry Astapov)--- journal: balance assertion errors now show exact amounts with all- decimal digits. Previously it was possible, in case of a commodity- directive limiting the display precision, to have a balance- assertion error with asserted and actual amounts looking the- same. (#941)--- journal: fixed a periodic transaction parsing failure (#942) (Dmitry- Astapov)--# 1.12.1 (2018/12/03)--- roi: use math-functions lib instead of statistics,- be more stackage nightly compatible--# 1.12 (2018/12/02)--- install script: ensure a new-enough version of stack; more informative output--- build with GHC 8.6/base-4.12 (Peter Simons)--- add required upper bound for statistics (Samuel May)--- --anon anonymises more thoroughly (including linked original postings) (Moritz Kiefer)--- unbalanced transaction errors now include location info (Mykola Orliuk)--- accounts command: --drop also affects the default flat output, without needing an explicit --flat flag--- accounts command: the --codes flag has been dropped--- accounts command: filtering by non-account-name queries now works--- add command: fix transaction rendering regression during data entry and in journal file--- balance command: fix wrongful eliding of zero-balance parent accounts in tree mode (Dmitry Astapov)--- journal format, bs/bse/cf/is commands: account directives can declare account types (#877)- Previously you had to use one of the standard english account names- (assets, liabilities..) for top-level accounts, if you wanted them to- appear in the right place in the balancesheet, balancesheetequity,- cashflow or incomestatement reports.-- Now you can use your preferred account names, and use account directives- to declare which accounting class (Asset, Liability, Equity, Revenue or- eXpense) an account (and its subaccounts) belongs to, by writing one of- the letters A, L, E, R, X after the account name, after two or more- spaces. This syntax may change (see issue). Experimental.-- Currently we allow unlimited account type declarations anywhere in the- account tree. So you could declare a liability account somewhere under- assets, and maybe a revenue account under that, and another asset account- even further down. In such cases you start to see oddities like accounts- appearing in multiple places in a tree-mode report. I have left it this- way for now in case it helps with, eg, modelling contra accounts, or- combining multiple files each with their own account type- declarations. (In that scenario, if we only allowed type declarations on- top-level accounts, or only allowed a single account of each type,- complications seem likely.)--- journal format: periodic transaction rules now require a double space separator.- In periodic transaction rules which specify a transaction description or- same-line transaction comment, this must be separated from the period- expression by two or more spaces, to prevent ambiguous parsing. Eg- this will parse correctly as "monthly" thanks to the double space:-- ~ monthly In 2020 we'll end this monthly transaction.--- journal format: exact/complete balance assertions (Samuel May).- A stronger kind of balance assertion, written with a double equals sign,- asserts an account's complete account balance, not just the balance in- one commodity. (But only if it is a single-commodity balance, for now.)- Eg:-- 1/1- (a) A 1- (a) B 1- (a) 0 = A 1 ; commodity A balance assertion, succeeds- (a) 0 == A 1 ; complete balance assertion, fails--- journal format: account directives now allow whitespace or a comment after the account name--- journal format: using \~ for home directory in include directives now works (#896) (Mykola Orliuk)--- journal format: prevent misleading parse error messages with cyclic include directives (#853) (Alex Chen)--- journal format: transaction modifier multipliers handle total-priced amounts correctly (#928).- Multipliers (*N) in transaction modifier rules did not multiply- total-priced amounts properly. Now the total prices are also multiplied,- keeping the transaction balanced.--- journal format: do amount inference/balance assignments/assertions before transaction modifiers (#893, #908) (Jesse Rosenthal)- Previously, transaction modifier (auto postings) rules were applied- before missing amounts were inferred. This meant amount multipliers could- generate too many missing-amount postings, making the transaction- unbalanceable (#893).-- Now, missing amount inference (and balance assignments, and balance- assertions, which are interdependent) are done earlier, before- transaction modifier rules are applied (#900, #903).-- Also, we now disallow the combination of balance assignments and- transaction modifier rules which both affect the same account, which- could otherwise cause confusing balance assertion failures (#912).- (Because assignments now generate amounts to satisfy balance assertions- before transaction modifier rules are applied (#908).)--- journal format: periodic transaction rules are now aware of Y default year directives. (#892)- Ie when a default year Y is in effect, they resolve partial or relative- dates using Y/1/1 as the reference date, rather than today's date.--# 1.11.1 (2018/10/06)--- fix wrong transaction rendering in balance assertion errors and when- using the add command--# 1.11 (2018/9/30)--- The default display order of accounts is now influenced by- the order of account directives. Accounts declared by account- directives are displayed first (top-most), in declaration order,- followed by undeclared accounts in alphabetical order. Numeric- account codes are no longer used, and are ignored and considered- deprecated.-- So if your accounts are displaying in a weird order after upgrading,- and you want them alphabetical like before, just sort your account- directives alphabetically.--- Account sorting (by name, by declaration, by amount) is now more- robust and supported consistently by all commands (accounts,- balance, bs..) in all modes (tree & flat, tabular & non-tabular).--- close: new --opening/--closing flags to print only the opening or- closing transaction--- files: a new command to list included files--- prices: query arguments are now supported. Prices can be filtered by- date, and postings providing transaction prices can also be filtered.--- rewrite: help clarifies relation to print --auto (#745)--- roi: a new command to compute return on investment, based on hledger-irr--- test: has more verbose output, more informative failure messages,- and no longer tries to read the journal--- csv: We use a more robust CSV lib (cassava) and now support- non-comma separators, eg --separator ';' (experimental, this flag- will probably become a CSV rule) (#829)--- csv: interpolated field names in values are now properly case insensitive, so- this works:-- fields ...,Transaction_Date,...- date %Transaction_Date--- journal: D (default commodity) directives no longer break multiplier- amounts in transaction modifiers (AKA automated postings) (#860)--- journal: "Automated Postings" have been renamed to "Transaction Modifiers".--- journal: transaction comments in transaction modifier rules are now parsed correctly. (#745)--- journal: when include files form a cycle, we give an error instead- of hanging.--- upper-case day/month names in period expressions no longer give an error (#847, #852)--# 1.10 (2018/6/30)--- journal: many parse error messages have become more informative, and- some now show the source line and error location.--- journal: ;tag: is no longer parsed as a tag named ";tag" (#655)--- journal: transaction price amounts having their own price amounts is- now a parse error--- journal: amounts with space as digit group separator and trailing whitespace- now parse correctly (#780)--- journal: in amounts containing digits and a single space, the space- is now interpreted as a digit group separator, not a decimal separator (#749)--- journal: in commodity/format/D directives, the amount must now include a decimal separator.-- When more precise control is needed over number parsing, our- recommended solution is commodity directives. Commodity directives- that don't specify the decimal separator leave things ambiguous,- increasing the chance of misparsing numbers. In some cases it could- cause amounts with a decimal point to be parsed as if with a digit- group separator, so 1.234 became 1234.-- It seems the simple and really only way to do this reliably is to require- an explicit decimal point character. Most folks probably do this already.- Unfortunately, it makes another potential incompatiblity with ledger and- beancount journals. But the error message will be clear and easy to- work around.--- journal: directives currently have diverse and somewhat tricky- semantics, especially with multiple files. The manual now describes- their behaviour precisely.--- journal: `alias` and `apply account` directives now affect `account` directives (#825)--- journal: periodic transactions can now have all the usual transaction fields- (status mark, code, description, comment), for generating more expressive- forecast transactions.--- journal: forecast transactions now have the generating period- expression attached as a tag named "recur".--- journal: periodic transactions now start on the first instance of the- recurring date, rather than the day after the last regular transaction (#750)--- journal: periodic transaction rules now allow period expressions relative to today's date--- csv: amount-in/amount-out errors are more detailed--- balance: --drop is now ignored when not in flat mode,- rather than producing a corrupted report (#754)--- budget: --drop now preserves the <unbudgeted> top-level account in --budget reports--- register: in CSV output, the code field is now included (#746)--- smart dates now allow the YYYYMM format, and are better documented--- use hledger-lib 1.10--# 1.9.1 (2018/4/30)--- use hledger-lib 1.9.1--- budget (balance --budget): monthly columns are displayed in the- proper order. This fixes a regression in 1.9.--- budget: budgets can be built from periodic transactions with- different intervals again. In 1.9, budgets were restricted to a- single interval, but this was a mistake. This restores the 1.5- behaviour.--- budget: budget reports are more intuitive and much less likely to- produce no output.--- budget: when no report interval is specified, a budget report for- the whole journal period is shown.--- budget: periodic transactions and the requested report period can- each have their own start/end dates, and the resulting report will- span the union of those periods, showing zeroes where data is- missing.--- budget: total row and total/average columns are now calculated correctly--- budget: actual, percentage, and goal amounts are now aligned in- columns for better readability (usually, unless numbers get huge).--- budget: combining --budget and --sort-amount is not yet supported- and now gives an error.--- csv: handle "-%amount" in a rule when the CSV amount is parenthesised (#736)--- journal: automated postings are now generated early, before journal finalisation,- so they are present for amount inference, transaction balancing, and balance assertions- (#729)--- journal: automated postings are now inserted right after the posting that triggered them- (#729)--- cli: command-line account aliases are now applied early, before journal finalisation,- so they are equivalent to alias directives in the journal (#730)--- journal: inferred amounts now have the appropriate standard amount style applied- (setting the precision correctly, eg). (#737)--- journal: when checking for balanced transactions, amount styles declared with- commodity directives are also used (previously only inferred amount styles were).--# 1.9 (2018/3/31)--- support ghc 8.4, latest deps--- journal: account directives can define a numeric account code to- customize sorting. bal/bs/cf/is will sort accounts by account code,- if any, then account name.--- journal: support scientific number notation (#704, #706)--- csv: reading a CSV file containing no records is no longer an error--- cli: when the system text encoding is UTF-8, ignore any UTF-8 BOM- prefix found when reading files. (Paypal's new CSV has this BOM- prefix, causing a confusing parse error.)--- cli: tabular reports no longer have a trailing blank line added.- (This allows omitting the ">=0" delimiters in our functional tests,- making them easier to read and maintain.)--- acc: the accounts command now has --declared and --used flags--- bal: the --invert flag flips all signs--- bal: --drop now works with CSV output--- bal/bs/bse/cf/is: show overall report span in title--- bal/bs/bse/cf/is: show short month names as headings in monthly reports--- bal/bs/bse/cf/is: these commands can now generate HTML output--- bal/bs/is/cf: drop short name and indent fields from multicolumn CSV--- bs/bse/cf/is: these, the "financial statement" commands, now show- normal income, liability and equity balances as positive numbers.- Negative numbers now indicate a contra-balance (eg an overdrawn- checking account), a net loss, or a negative net worth. This makes- these reports more like conventional financial statements, and easier- to read and share with others. (Other commands, like balance, have not- changed.) (experimental)--- bs/cf/is: always show a tabular report, even with no report- interval. Previously you would get a simple borderless report like- the original balance command. Less code, fewer bugs.--- bs/bse/cf/is: in CSV output, don't repeat the headings row for each subreport--- budget: warn that CSV output with bal --budget is unimplemented--- budget: bal --budget shows budget goals even with no or zero actual amounts.- Makes budget reports more intuitive, at the cost of a temporary hack- which may misorder columns in some cases (if actual and budget- activity occur in a different range of columns).--- budget: --budget uses only periodic txns with the selected interval.\- Budgets with different interval, eg a daily and weekly budget, are independent.--- budget: show mostly fixed-width columns for readability--- budget: fix bug where a budget report could include budget goals- ending on the day before the report start date (splitSpan issue)--- close: the equity command has been renamed to close. It now ignores- any begin date (it always closes historical end balances). It also- ignores --date2.--# 1.5 (2017/12/31)--- --auto adds Ledger-style automated postings to transactions (Dmitry Astapov, Mykola Orliuk)--- --forecast generates Ledger-style periodic transactions in the future (Dmitry Astapov, Mykola Orliuk)--- -V/--value uses today's market prices by default, not those of last transaction date. #683, #648--- add: suggest implied (parent) and declared (by account directives) account names also--- bal: --budget shows performance compared to budget goals defined- with periodic transactions. Accounts with budget goals are- displayed folded (depth-clipped) at a depth matching the budget- specification. Unbudgeted accounts are hidden, or with- --show-unbudgeted, shown at their usual depth. (Dmitry Astapov)--- import: the output of --dry-run is now valid journal format--- print: -B shows converted amounts again, as in 1.1, even without- -x. #551 (Mykola Orliuk, Simon Michael)--- tag: the first argument now filters tag names, additional arguments- filter transactions (#261)--- remove upper bounds on all but hledger* and base (experimental)--# 1.4 (2017/9/30)--- cli: a @FILE argument reads flags & args from FILE, one per line--- cli: reorganized commands list, added some new command aliases:-- - accounts: a- - balance: b- - print: p, txns- - register: r--- cli: accept -NUM as a shortcut for --depth=NUM (eg: -2)--- cli: improve command-line help for --date2 (#604)--- cli: make --help and -h the same, drop --man and --info for now (#579)--- help: offers multiple formats, accepts topic substrings.- The separate info/man commands have been dropped. help now- chooses an appropriate documentation format as follows:-- - it uses info if available,- - otherwise man if available,- - otherwise $PAGER if defined,- - otherwise less if available,- - otherwise it prints on stdout- - (and it always prints on stdout when piped).-- You can override this with the `--info`/`--man`/`--pager`/`--cat` flags.- (#579)--- bal/bs/cf/is: --sort-amount/-S sorts by largest amount instead of- account name--- bs/cf/is: support --output-file and --output-format=txt\|csv- The CSV output should be reasonably ok for dragging into a- spreadsheet and reformatting.--- bal/bs/cf/is: consistent double space between columns, consistent- single final blank line. Previously, amounts wider than the column- headings would be separated by only a single space.--- bs/is: don't let an empty subreport disable the grand totals (fixes #588)--- cf: exclude asset accounts with ":fixed" in their name (Christian G. Warden, Simon Michael, #584)--- new balancesheetequity command: like balancesheet but also shows- equity accounts (Nicholas Niro)--- new import command: adds new transactions seen in one or more input- files to the main journal file--- print: --new shows only transactions added since last time- (saves state in .latest.JOURNALFILE file)--- new tags command: lists tags in matched transactions--- most addons formerly shipped in bin/ are now builtin commands. These- include: check-dates, check-dupes, equity, prices, print-unique,- register-match, rewrite.--- refactor: new Commands module and subdirectory.- Builtin commands are now gathered more tightly in a single module,- Hledger.Cli.Commands, facilitating change. The legacy "convert"- command has been dropped.--- refactor: BalanceView -> CompoundBalanceCommand--- deps: drop support for directory < 1.2--- deps: allow ansi-terminal 0.7--- deps: drop oldtime flag, require time 1.5+--- deps: simplify shakespeare bounds--- deps: remove ghc < 7.6 support--# 1.3.1 (2017/8/25)--- bs/is: don't let an empty subreport disable the grand totals (#588)--- allow megaparsec 6 (#594)--- allow megaparsec-6.1 (Hans-Peter Deifel)--- restore upper bounds on hledger packages--# 1.3 (2017/6/30)--The "uncleared" transaction/posting status, and associated UI flags-and keys, have been renamed to "unmarked" to remove ambiguity and-confusion. This means that we have dropped the `--uncleared` flag,-and our `-U` flag now matches only unmarked things and not pending-ones. See the issue and linked mail list discussion for more-background. (#564)--Also the -P short flag has been added for --pending, and the -U/-P/-C-flags can be combined.--bs/is: fix "Ratio has zero denominator" error (#535)--bs/is/cf: fix --flat (#552) (Justin Le, Simon Michael)--bal/bs/is/cf: show negative amounts in red (Simon Michael, Justin Le).-These commands now shows negative amounts in red, when hledger detects-that ANSI codes are supported, (ie when TERM is not "dumb" and stdout-is not being redirected or piped).--print: show pending mark on postings (fixes #563).-A pending mark on postings is now displayed, just like a cleared mark.-Also there will now be a space between the mark and account name.--print: amounts are now better aligned, eg when there are posting-status marks or virtual postings--# 1.2 (2017/3/31)--## CLI--"hledger" and "hledger -h" now print a better organised commands list-and general usage message respectively (#297).--The common reporting flags can now be used anywhere on the command line.--Fixed deduplication of addons in commands list.--Fixed ugly stack traces in command line parse error messages.--The -V/--value flag is now a global report flag, so it works with-balance, print, register, balancesheet, incomestatement, cashflow,-etc. (Justin Le)--The `--pivot` global reporting option replaces all account names with-the value of some other field or tag. It has been improved, eg:--- we don't add the field/tag name name as a prefix-- when pivoting on a tag, if the tag is missing we show a blank- (rather than showing mixed tag values and account names)-- a pipe character delimiter may be used in descriptions to get a more accurate- and useful payee report (`hledger balance --pivot payee`)--options cleanups--## Addons--Easier installation:-move add-ons and example scripts to bin/,-convert to stack scripts,-add a build script to install all deps,-add some functional tests,-test add-ons with Travis CI,-add installation docs to download page.--Improved docs:-all addons now contain their own documentation. Most of them (all but-hledger-budget) use a new reduced-boilerplate declaration format-and can show short (-h) and long (--help) command line help.-(Long help is declared with pre and postambles to the generated-options help, short help is that truncated at the start of the hledger-common flags.)--`hledger` now shows a cleaner list of addon commands, showing only the-compiled version of an addon when both source and compiled versions-are in $PATH. (Addons with .exe extension or no extension are-considered compiled. Modification time is not checked, ie, an old-compiled addon will override a newer source version. If there are-three or more versions of an addon, all are shown. )--New addons added/included:--- autosync - example symlink to ledger-autosync-- budget - experimental budget reporting command supporting Ledger-like periodic transactions and automated transactions (Mykola Orliuk)-- chart - pie-chart-generating prototype, a repackaging of the old hledger-chart tool-- check - more powerful balance assertions (Michael Walker)-- check-dupes - find accounts sharing the same leaf name (Stefano Rodighiero)-- prices - show all market price records (Mykola Orliuk)-- register-match - a helper for ledger-autosync's deduplication, finds best match for a transaction description--The equity command now always generates a valid journal transaction,-handles prices better, and adds balance assertions (Mykola Orliuk).--The rewrite command is more robust and powerful (Mykola Orliuk):--- in addition to command-line rewrite options, it understands rewrite rules- defined in the journal, similar to Ledger's automated transactions (#99).- Eg:-- = ^income- (liabilities:tax) *.33-- = expenses:gifts- budget:gifts *-1- assets:budget *1--- it can generate diff output, allowing easier review of the proposed- changes, and safe modification of original journal files (preserving- file-level comments and directives). Eg:-- hledger-rewrite --diff Agency --add-posting 'Expenses:Taxes *0.17' | patch--- rewrites can affect multiple postings in a transaction, not just one.--- posting-specific dates are handled better--## balance--A new --pretty-tables option uses unicode characters for rendering-table borders in multicolumn reports (#522) (Moritz Kiefer)--## balancesheet/cashflow/incomestatement--These commands are now more powerful, able to show multicolumn reports-and generally having the same features as the balance command. (Justin Le)--balancesheet has always ignored a begin date specified with a `-b` or-`-p` option; now it also ignores a begin date specified with a `date:`-query. (Related discussion at #531)--## print--The output of print is now always a valid journal (fixes #465) (Mykola Orliuk).--print now tries to preserves the format of implicit/explicit balancing-amounts and prices, by default. To print with all amounts explicit,-use the new `--explicit/-x` flag (fixes #442). (Mykola Orliuk)--Don't lose the commodity of zero amounts/zero balance assertions (fixes #475) (Mykola Orliuk)--## Misc--Fix a regression in the readability of option parsing errors (#478) (Hans-Peter Deifel)--Fix an example in Cli/Main.hs (Steven R. Baker)--Allow megaparsec 5.2 (#503)--# 1.1 (2016/12/31)--## balance--- with -V, don't ignore market prices in the future (#453, #403)--- with -V and multiple same-date market prices, use the last parsed not the highest price (#403)--## misc--- fix non-existent "oldtime" dependency (#431)--- extra/hledger-equity.hs now generates valid journal format when there are multiple commodities--# 1.0.1 (2016/10/27)--- allow megaparsec 5.0 or 5.1--- fix benchmark build failure (#423)--# 1.0 (2016/10/26)--## add--- suggest only one commodity at a time as default amount (#383)-- (since we currently can't input more than one at a time)--## balance--- added --change flag for consistency--- -H/--historical now also affects single-column balance reports with a start date (#392).-- This has the same effect as just omitting the start date, but adds consistency.--- in CSV output, render amounts in one-line format (#336)--## balancesheet--- fix an infinite loop (#393)--## print--- in CSV output, fix and rename the transaction id field--## register--- fix a sorting regression with --date2 (#326)--- --average/-A is now affected by --historical/-H--- added --cumulative flag for consistency--- in CSV output, include the transaction id and rename the total field (#391)--## stats--- fixed an issue with ordering of include files--## misc--- --pivot option added, groups postings by tag instead of account (#323) (Malte Brandy)--- --anon option added, obfuscates account names and descriptions (#265) (Brian Scott)-- (Only affects the hledger tool, for now.)--- try to clarify balance/register's various report modes,-- kinds of "balance" displayed, and related options and language.--- with multiple --change/--cumulative/--historical flags, use the last one instead of complaining--- don't add the "d" suffix when displaying day periods--- stack-ify extra/hledger-rewrite.hs--## misc--- added GHC 8 support, dropped GHC 7.6 and 7.8 support.-- GHC 7.8 support could be restored with small code changes and a maintainer.--- a cabal.project file has been added (Moritz Kiefer)--- use hpack for maintaining cabal files (#371).-- Instead of editing cabal files directly, we now edit the less- verbose and less redundant package.yaml files and let stack (or- hpack) update the cabal files. We commit both the .yaml and- .cabal files.--- clean up some old cabal flags--- tools/simplebench has been spun off as the quickbench package.--- add Appveyor CI builds, provide up-to-date binaries for Windows--- extra: add a bunch of CSV rules examples--## docs--- the website is simpler, clearer, and more mobile-friendly.-- Docs are now collected on a single page and organised by type: getting started, reference, more.--- reference docs have been split into one manual for each executable and file format.-- This helps with maintenance and packaging and also should make it- easier to see what's available and to read just what you need.--- manuals are now provided in html, plain text, man and info formats-- generated from the same source by a new Shake-based docs build system. (#292)--- versioned manuals are provided on the website, covering recent releases and the latest dev version (#385, #387)--- manuals are built in to the hledger executables, allowing easy offline reading on all platforms.-- PROG -h shows PROG's command-line usage- PROG --help shows PROG's manual (fixed width)- PROG --man shows PROG's manual with man (formatted/paged)- PROG --info shows PROG's manual with info (hypertext)- hledger help [TOPIC] shows any manual- hledger man [TOPIC] shows any manual with man- hledger info [TOPIC] shows any manual with info--- the general and reporting options are now listed in all executable manuals.-- We assume any of them which are unsupported are harmlessly ignored.--- demo.hledger.org is using beancount's example journal.-- This is the somewhat realistic example journal from the beancount- project, tweaked for hledger.--- minor copyedits (jungle-boogie)--## cli--- parsing multiple input files is now robust.-- When multiple -f options are provided, we now parse each file- individually rather than just concatenating them, so they can- have different formats (#320). Note this also means that- directives (like \`Y\` or \`alias\`) no longer carry over from one- file to the next.--- -I has been added as the short flag for --ignore-assertions-- (this is different from Ledger's CLI, but useful for hledger-ui).--- parsing an argument-less --debug option is more robust--0.27 (2015/10/30)--Account aliases:--- Regular expression account aliases are now fast enough that you can- use lots of them without slowing things down. They now take- O(aliases x accounts) time, instead of O(aliases x transactions);- also, regular expressions are no longer recompiled unnecessarily.--Documentation:--- Each hledger package now includes one or more man pages, generated- from markdown by the mighty pandoc. Currently there are six: one- for each main executable and each input file format. Currently these- somewhat duplicate the manual on the website; this will be resolved- somehow. (#282).--- The site is now built with hakyll-std, a generic hakyll script.--- hledger once again has a HCAR entry.--Tools:--- The hledger cabal files are now generated from package.yaml files by- hpack, in principle, removing a lot of error-prone duplication and- boilerplate. (In practice, both files are being updated manually- for the moment, until hpack supports flags and conditional blocks.)--- Time/allocation and heap profiling is working again, and easier:-- - `make quickprof-CMD` generates a profile for CMD, which runs- against one of the sample journals. (CMD must be one word,- enclosing in double quotes isn't working here for some reason).-- - `make quickheap-CMD` generates a heap profile for CMD, in- hledgerprof.ps, and tries to open it in a viewer (currently the- mac-friendly "open" executable, so you may need to adjust this in- the makefile). As with quickprof, CMD must be one word and runs- against one of the sample journals.-- - `make hledgerprof` builds the hledgerprof executable used for- time/allocation profiling. `make hledgercov` builds the hledgercov- executable used for coverage reports.--- Travis CI now tests the build on each github push and announces- status changes by email and on #hledger.--Journal format:--- Dates must now begin with a digit (not /, eg).--- The comment directive longer requires an end comment, and will- extend to the end of the file(s) without it.--Command-line interface:--- Output (balance reports, register reports, print output etc.)- containing wide characters, eg chinese/japanese/korean characters,- should now align correctly, when viewed in apps and fonts that show- wide characters as double width (#242).--- The argument for --depth or depth: must now be positive.--add:--- Journal entries are now written with all amounts explicit, to avoid- losing price info (#283).--- Fixed a bug which sometimes (when the same letter pair was repeated)- caused it not to pick the most similar past transaction for defaults.--balance:--- There is now a -V/--value flag to report current market value (as in Ledger).- It converts all reported amounts using their "default market price".- "Market price" is the new name for "historical prices", defined with the P directive.- The default market price for a commodity is the most recent one found in the journal on or before the report end date.-- Unlike Ledger, hledger's -V uses only the market prices recorded- with P directives; it does not use the "transaction prices"- recorded as part of posting amounts (which are used by -B/--cost).- Also, using both -B and -V at the same time is supported.--- Fixed a bug in amount normalization which caused amount styles- (commodity symbol placement, decimal point character, etc.) to be- lost in certain cases (#230, #276).--- The balance command's --format option can now adjust the rendering- style of multi-commodity amounts, if you begin the format string- with one of:-- %_ - renders amounts on multiple lines, bottom-aligned (the default)- %^ - renders amounts on multiple lines, top-aligned- %, - renders amounts on one line, comma-separated--- The balance report's final total (and the line above it) now adapt- themselves to a custom --format.--print:--- The --match option prints the journal entry that best matches a- description (ie whose description field is most similar to the value- given, and if there are several equally similar, the most recent).- This was originally an add-on I used to guess account names for- ledger-autosync. It's nice for quickly looking up a recent- transaction from a guessed or partial description.--- print now always right-aligns the amounts in an entry, even when- they are wider than 12 characters. (If there is a price, it's- considered part of the amount for right-alignment.)--register:--- Amount columns now resize automatically, using more space if it's- needed and available.--0.26 (2015/7/12)--Account aliases:--- Account aliases are once again non-regular-expression-based, by default. (#252)-- The regex account aliases added in 0.24 trip up people switching between- hledger and Ledger. (Also they are currently slow).-- This change makes the old non-regex aliases the default; they are- unsurprising, useful, and pretty close in functionality to Ledger's.-- The new regex aliases are still available; they must be enclosed- in forward slashes. (Ledger effectively ignores these.)--Journal format:--- We now parse, and also print, journal entries with no postings, as- proposed on the mail lists. These are not well-formed General- Journal entries/transactions, but here is my rationale:-- - Ledger and beancount parse them- - if they are parsed, they should be printed- - they provide a convenient way to record (and report) non-transaction events- - they permit more gradual introduction and learning of the concepts.- So eg a beginner can keep a simple journal before learning about accounts and postings.--- Trailing whitespace after a `comment` directive is now ignored.--Command-line interface:--- The -f/file option may now be used multiple times.- This is equivalent to concatenating the input files before running hledger.- The add command adds entries to the first file specified.--Queries:--- real: (no argument) is now a synonym for real:1--- tag: now matches tag names with a regular expression, like most other queries--- empty: is no longer supported, as it overlaps a bit confusingly with- amt:0. The --empty flag is still available.--- You can now match on pending status (#250)-- A transaction/posting status of ! (pending) was effectively equivalent- to * (cleared). Now it's a separate state, not matched by --cleared.- The new Ledger-compatible --pending flag matches it, and so does- --uncleared.-- The relevant search query terms are now status:*, status:! and- status: (the old status:1 and status:0 spellings are deprecated).-- Since we interpret --uncleared and status: as "any state except cleared",- it's not currently possible to match things which are neither cleared- nor pending.--activity:--- activity no longer excludes 0-amount postings by default.--add:--- Don't show quotes around the journal file path in the "Creating..."- message, for consistency with the subsequent "Adding..." message.--balancesheet:--- Accounts beginning with "debt" or now also recognised as liabilities.--print:--- We now limit the display precision of inferred prices. (#262)-- When a transaction posts to two commodities without specifying the- conversion price, we generate a price which makes it balance (cf- http://hledger.org/manual.html#prices). The print command showed- this with full precision (so that manual calculations with the- displayed numbers would look right), but this sometimes meant we- showed 255 digits (when there are multiple postings in the- commodity being priced, and the averaged unit price is an- irrational number). In this case we now set the price's display- precision to the sum of the (max) display precisions of the- commodities involved. An example:-- hledgerdev -f- print- <<<- 1/1- c C 10.00- c C 11.00- d D -320.00- >>>- 2015/01/01- c C 10.00 @ D 15.2381- c C 11.00 @ D 15.2381- d D -320.00-- >>>=0-- There might still be cases where this will show more price decimal- places than necessary.--- We now show inferred unit prices with at least 2 decimal places.-- When inferring prices, if the commodities involved have low- display precisions, we don't do a good job of rendering- accurate-looking unit prices. Eg if the journal doesn't use any- decimal places, any inferred unit prices are also displayed with- no decimal places, which makes them look wrong to the user. Now,- we always give inferred unit prices a minimum display precision of- 2, which helps a bit.--register:--- Postings with no amounts could give a runtime error in some obscure case, now fixed.--stats:--- stats now supports -o/--outputfile, like register/balance/print.-- An O(n\^2) performance slowdown has been fixed, it's now much faster on large journals.-- +--------------------------------------++--------+--------+- | || 0.25 | 0.26 |- +======================================++========+========+- | -f data/100x100x10.journal stats || 0.10 | 0.16 |- | -f data/1000x1000x10.journal stats || 0.45 | 0.21 |- | -f data/10000x1000x10.journal stats || 58.92 | 2.16 |- +--------------------------------------++--------+--------+--Miscellaneous:--- The June 30 day span was not being rendered correctly; fixed. (#272)--- The bench script invoked by "cabal bench" or "stack bench" now runs- some simple benchmarks.-- You can get more accurate benchmark times by running with --criterion.- This will usually give much the same numbers and takes much longer.-- Or with --simplebench, it benchmarks whatever commands are- configured in bench/default.bench. This mode uses the first- "hledger" executable in $PATH.--- The deprecated shakespeare-text dependency has been removed more thoroughly.--0.25.1 (2015/4/29)--- timelog: support the description field (#247)--0.25 (2015/4/7)--- GHC 7.10 compatibility (#239)--- build with terminfo support on POSIX systems by default-- On non-windows systems, we now build with terminfo support by- default, useful for detecting terminal width and other things.-- This requires the C curses dev libaries, which makes POSIX- installation slightly harder; if it causes problems you can- disable terminfo support with the new `curses` cabal flag, eg:- cabal install -f-curses ... (or cabal might try this- automatically, I'm not sure).--- register: use the full terminal width, respect COLUMNS, allow column width adjustment-- On POSIX systems, register now uses the full terminal width by- default. Specifically, the output width is set from:-- 1. a --width option- 2. or a COLUMNS environment variable (NB: not the same as a bash shell var)- 3. or on POSIX (non-windows) systems, the current terminal width- 4. or the default, 80 characters.-- Also, register's --width option now accepts an optional- description column width following the overall width (--width- WIDTH\[,DESCWIDTH\]). This also sets the account column width, since- the available space (WIDTH-41) is divided up between these two- columns. Here's a diagram:-- <--------------------------------- width (W) ---------------------------------->- date (10) description (D) account (W-41-D) amount (12) balance (12)- DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA-- Examples:-- $ hledger reg # use terminal width on posix- $ hledger reg -w 100 # width 100, equal description/account widths- $ hledger reg -w 100,40 # width 100, wider description- $ hledger reg -w $COLUMNS,100 # terminal width and set description width--- balance: new -T/--row-total and -A/--average options-- In multicolumn balance reports, -T/--row-total now shows a row totals- column and -A/--average shows a row averages column.- This helps eg to see monthly average expenses (hledger bal \^expenses -MA).-- NB our use of -T deviates from Ledger's UI, where -T sets a custom- final total expression.--- balance: -N is now short for --no-total-- balance: fix partially-visible totals row with --no-total-- A periodic (not using --cumulative or --historical) balance report- with --no-total now hides the totals row properly.--- journal, csv: comment lines can also start with *-- As in Ledger. This means you can embed emacs org/outline-mode nodes in- your journal file and manipulate it like an outline.--0.24.1 (2015/3/15)--- journal: fix balance accumulation across assertions (#195)-- A sequence of balance assertions asserting first one commodity, then- another, then the first again, was not working.--- timelog: show hours with two decimal places instead of one (#237)-- in weekly reports, simplify week 52's heading like the others-- disallow trailing garbage in a number of parsers-- Trailing garbage is no longer ignored when parsing the following:- balance --format option, register --width option, hledger-rewrite- options, hledger add's inputs, CSV amounts, posting amounts,- posting dates in tags.--- allow utf8-string-1 (fpco/stackage/#426)--0.24 (2014/12/25)--General:--- fix redundant compilation when cabal installing the hledger packages-- switch to Decimal for representing amounts (#118)-- report interval headings (eg in balance, register reports) are shown- compactly when possible-- general speedups--Journal format:--- detect decimal point and digit groups more robustly (#196)-- check that transaction dates are followed by whitespace or newline-- check that dates use a consistent separator character-- balance assertions now are specific to a single commodity, like- Ledger (#195)-- support multi-line comments using "comment", "end comment"- directives, like Ledger--CSV format:--- reading CSV data from stdin now works better-- the rules file include directive is now relative to the current- file's directory (#198)-- the original order of same-day transactions is now usually preserved- (if the records appear to be in reverse date order, we reverse them- before finally sorting by transaction date)-- CSV output is now built in to the balance, print, and register- commands, controlled by -O/--output-format (and -o/--output-file,- see below)--CLI:--- the --width and --debug options now require their argument (#149)-- when an option is repeated, the last value takes precedence (#219).- This is helpful eg for customising your reporting command aliases on- the fly.-- smart dates (used in -p/-b/-e/date:/date2:) now must use a- consistent separator character, and must be parseable to the end-- output destination and format selection is now built in to the- balance, print and register commands, controlled by -o/--output-file- and -O/--output-format options. Notes:- - -o - means stdout- - an output file name suffix matching a supported format will also- set the output format, unless overridden by --output-format- - commands' supported output formats are listed in their- command-line help. Two formats are currently available:- txt (the default) and csv.-- balance assertions can be disabled with --ignore-assertions--Account aliases:--- all matching account aliases are now applied, not just one directive- and one option-- account aliases now match by case insensitive regular expressions- matching anywhere in the account name-- account aliases can replace multiple occurrences of the pattern- within an account name-- an account alias replacement pattern can reference matched groups- with \N--Queries:--- date:/date2: with a malformed date now reports an error instead of- being ignored-- amt: now supports >= or <=-- clarify status: docs and behaviour; \"*\" is no longer a synonym for- "1" (fixes #227)--balance:--- fix: in tree mode, --drop is ignored instead of showing empty account names-- a depth limit of 0 now shows summary items with account name "...",- instead of an empty report (#206)-- in multicolumn balance reports, -E now also shows posting-less- accounts with a non-zero balance during the period (in addition to- showing leading & trailing empty columns)-- in multicolumn reports, multi-commodity amounts are rendered on one- line for better layout (#186)-- multicolumn reports' title now includes the report span--register:--- runs faster with large output-- supports date2:, and date:/date2: combined with --date2, better (fixes- #201, #221, #222)-- a depth limit of 0 now shows summary items (see balance)-- -A/--average now implies -E/--empty-- postings with multi-commodity amounts are now top-aligned, like- Ledger--Extra commands:--- hledger-equity: fix end date in title; print closing entry too-- hledger-check-dates: added--0.23.3 (2014/9/12)--- allow text 1.2+ (#207)--0.23.2 (2014/5/8)--- register: also fix date sorting of postings (#184)--0.23.1 (2014/5/7)--- register: fix a refactoring-related regression that the tests- missed: if transactions were not ordered by date in the journal,- register could include postings before the report start date in the- output. (#184)-- add: don't apply a default commodity to amounts on entry (#138)-- cli: options before the add-on command name are now also passed to it (#182)-- csv: allow the first name in a fields list to be empty (#178)-- csv: don't validate fields count in skipped lines (#177)--0.23 (2014/5/1)--Journal format:--- A # (hash) in column 0 is now also supported for starting a top-level journal comment, like Ledger.-- The "too many missing amounts" error now reminds about the 2-space rule.-- Fix: . (period) is no longer parsed as a valid amount.-- Fix: default commodity directives no longer limit the maximum display precision (#169).-- Fix: + before an amount is no longer parsed as part of the commodity (#181).--CLI:--- Command-line help cleanups, layout improvements.-- Descriptions are shown for known add-ons in the command list.-- Command aliases have been simplified.-- Add-ons can now have any of these file extensions:- none, hs, lhs, pl, py, rb, rkt, sh, bat, com, exe.-- Add-ons are displayed without their file extensions when possible.-- Add-ons with the same name as a built-in command or alias are ignored.-- Fix: add-on detection and invocation now works on windows.-- Fix: add-ons with digits in the name are now found.-- Fix: add-on arguments containing a single quote now work.-- Fix: when -- is used to hide add-on options from the main program,- it is no longer passed through as an add-on argument.--Queries:--- The currency/commodity query prefix (sym:) has been renamed to cur:.-- Currency/commodity queries are applied more strongly in register and- balance reports, filtering out unwanted currencies entirely. Eg- hledger balance cur:'$' now reports only the dollar amounts even if- there are multi-currency transactions or postings.-- Amount queries like amt:N, amt:<N and amt:>N, where N is not 0, now do an unsigned- comparison of the amount and N. That is, they compare the absolute magnitude.- To do a signed comparison instead, write N with its sign (eg amt:+N, amt:<+N, amt:>-N).-- Fix: amount queries no longer give false positives on multi-commodity amounts.--accounts:--- An accounts command has been added, similar to Ledger's, for listing account names- in flat or hierarchical mode.--add:--- Tab completion now works at all prompts, and will insert the default if the input area is empty.-- Account and amount defaults are more robust and useful.-- Transactions may also be completed by the enter key, when there are no more default postings.-- Input prompts are displayed in a different colour when supported.--balance:--- Balance reports in flat mode now always show exclusive (subaccount-excluding) balances.-- Balance reports in flat mode with --depth now aggregate deeper accounts at the depth limit instead of excluding them.-- Multicolumn reports in flat mode now support --drop.-- Multicolumn balance reports can now show the account hierarchy with --tree.-- Multicolumn report start/end dates are adjusted to encompass the displayed- report periods, so the first and last periods are "full" and comparable to the others.-- Fix: zero-balance leaf accounts below a non-zero-balance parent are no longer always shown (#170).-- Fix: multicolumn reports now support --date2 (cf #174).--balancesheet, cashflow, incomestatement:--- These commands now support --flat and --drop.--print:--- Tag queries (tag:) will now match a transaction if any of its postings match.--register:--- The --display option has been dropped. To see an accurate running total which- includes the prior starting balance, use --historical/-H (like balance).-- With a report interval, report start/end dates are adjusted to encompass the displayed- periods, so the first and last periods are "full" and comparable to the others.-- Fix: --date2 now works with report intervals (fixes #174).--Miscellaneous:--- Default report dates now derive from the secondary dates when --date2 is in effect.-- Default report dates now notice any posting dates outside the transaction dates' span.-- Debug output improvements.-- New add-on example: extra/hledger-rewrite.hs, adds postings to matched entries.-- Compatible with GHC 7.2 (#155) - GHC 7.8, shakespeare 2--0.22.2 (2014/4/16)--- display years before 1000 with four digits, not three-- avoid pretty-show to build with GHC < 7.4-- allow text 1.1, drop data-pprint to build with GHC 7.8.x--0.22.1 (2014/1/6) and older: see http://hledger.org/release-notes or doc/release-notes.md.+<!--+ _ _+ ___| (_)+ / __| | |+| (__| | |+ \___|_|_|++Breaking changes++Fixes++Features++Improvements++Docs++Examples++Scripts/addons++API++-->++User-visible changes in the hledger command line tool and library.+++# 1.52.1 2026-04-28++Breaking changes++- The `Gain` (`G`) account type is no longer auto-detected from account names like+ `revenue:gains` or `income:capital gains`; it must now be declared explicitly with `; type: G`.+ Also, the `UnrealisedGain` (`U`) account type, a subtype of Equity, has been added+ (spellings `U`, `UnrealisedGain`, and `UnrealizedGain` are all accepted).+ These improve compatibility between hledger 1 and 2.++Docs++- The "Cost basis / lot syntax" section has been renamed to "Cost basis",+ and updated to mention hledger 2.+++# 1.52 2026-03-20++Features++- `aregister` and `register` now support `--drop` for trimming leading account name components,+ like the `balance` command.+ (Caleb Maclennan)++- `print` now preserves and reproduces Ledger-style lot syntax (cost basis annotations) in text and json output,+ and (converted to Beancount syntax) in beancount output.++- Tags can now be declared on commodities, and you can query for postings by their commodity's tags.++- A new `Gain` (`G`) account type has been added, as a subtype of Revenue.+ Certain account names, like `income:gains`, `revenue:capital-gains`, `income:losses`,+ are auto-detected as Gain type.+ This provides a language-independent way of matching capital gain/loss accounts specifically.+ (It is used more in hledger 2.)+ (g. nicholas d'andrea) [#2522]++Fixes++- The `add` and `import` commands once again read all `-f` files, not just the first. + This fixes a regression in 1.51.2 which broke autocompletion in `add`,+ and multi-file reading in `import`, when multiple `-f` options were given.+ [#2553]++- In balance reports, accounts revealed by `--empty --declared` now respect account display order, instead of being shown last.+ (Juliano Solanho) [#2564]++- `balance --budget`'s csv/tsv output now properly suppresses digit group marks (eg thousands separators),+ preserving valid CSV structure.+ [#2555]++- The `run` command now properly returns a non-zero exit code if there's an error while commands are being provided on standard input.+ (Previously it always returned exit code 0 in this mode.)+ [#2557]++- Options requiring a value (like `--round` or `-f`) now give a clear error if the value is missing+ (rather than trying to consume a following flag).+ [#2556]++- Postings generated by `--infer-equity` no longer inherit the source posting's tags, comment, or real/virtual type.+ (The posting's date and status are still inherited.)+ [#2535]++Improvements++- When converting to value, price lookups are now optimised with pre-built indexes. + This replaces O(n log n) re-sorting on every valuation date with O(log n) indexed lookups,+ significantly improving performance for `--value=end,COMM` with daily reports+ over long periods and large price databases.+ (Oleg Bulatov) [#2511]++- `date:` queries can now include a report interval, eg `date:weekly` or `date:'weekly from last month'`,+ like the `-p/--period` option.++- Smart dates now understand `last|this|next WEEKDAY` and `last|this|next MONTHNAME`.++- When `add` or `import` are autocreating a requested journal file that did not exist,+ they will also create any required parent directories.++- The less pager is now invoked more robustly; we catch and report more kinds of failure clearly,+ and/or fall back to unpaged output with a warning.+ [#2544]++- The `--quit-at-eof` flag is no longer added when running the less pager (and our less flags are better documented).++- Improvements to the `setup` command:+ - improve top info's layout+ - show the OS version, architecture, and compiler version+ - show if hledger is wrongly built without OS thread support+ - show the value of $LESS more accurately+ - test that it runs with the configured options+ - print a warning before making a http request+ - show more compact output if the http request fails++Docs++- Account tags: new separate section+- COMMON TASKS: Setting LEDGER_FILE: updates+- Cost basis / lot syntax: new section and edits+- Costs: rewrite+- csv: if: field matchers: clarify+- Inferring equity conversion postings: note account tags limitation+- journal: code: mention valid characters, recommend tags [#2563]+- Regular expressions: note no lazy quantifiers+- Tag names: clarify --verbose-tags++Examples++- csv: Fidelity, Open Collective updates+- csv: Interactive Brokers example CSV rules files [#2508] (Ilja Kocken)+- csv/cctax: notes and sample files related to exporting to cryptocurrency tax calculators+- debconf: DebConf ledger files 2017-2025, adapted for hledger+- investing/export-lots-workflow: doc and examples for exporting to Beancount, Ledger or rustledger for lots/gains calculation++Scripts/addons++- bashrc: drop clashy month aliases; fix LEDGER_FILE typo; cleanup.+- fix compilation errors in bin/ scripts (Dmitry Astapov) [#2497]+- `hledger-smooth`: accept ACCTPAT, matching case-insensitively as infix (like `aregister`).+- `hledger-fancyassertions`: use `showMixedAmount` for properly formatted output. (Joshua Chapman)+- `ledgereval`: evaluate Ledger value expressions at the command line++[#2508]: https://github.com/simonmichael/hledger/issues/2508+[#2511]: https://github.com/simonmichael/hledger/issues/2511+[#2522]: https://github.com/simonmichael/hledger/issues/2522+[#2535]: https://github.com/simonmichael/hledger/issues/2535+[#2544]: https://github.com/simonmichael/hledger/issues/2544+[#2553]: https://github.com/simonmichael/hledger/issues/2553+[#2555]: https://github.com/simonmichael/hledger/issues/2555+[#2556]: https://github.com/simonmichael/hledger/issues/2556+[#2557]: https://github.com/simonmichael/hledger/issues/2557+[#2563]: https://github.com/simonmichael/hledger/issues/2563+[#2564]: https://github.com/simonmichael/hledger/issues/2564+++# 1.51.2 2026-01-08++Fixes++- The `add` and `import` commands now once again auto-create the journal file+ if it does not exist yet, fixing a regression in 1.50.3.+ Also they now create it lazily, only when they have data to write,+ not unconditionally at the start.+ [#2514]++- The `roi` command has some more sanity checks, and some error messages+ have been clarified.+ (Dmitry Astapov, [#2505])++Improvements++- The `-f` option now reports an error if you give it a glob pattern+ (a path containing `[`, `{`, `*`, or `?`) that matches nothing.+ This makes it consistent with `LEDGER_FILE`.++- Journal format's `include` directive no longer unnecessarily reads+ the attributes of all files in a directory. This works better with+ build tools like tup which detect filesystem operations.++- Journal format's `include` directive has been optimised,+ repairing a slight slowdown introduced in 1.50.3.+ It no longer calls `canonicalizePath` unnecessarily.+ This might be noticeable with many includes on a slow filesystem.++- Allow base 4.22 / ghc 9.14.++API++- Hledger.Cli.Utils:+ withPossibleJournal++[#2505]: https://github.com/simonmichael/hledger/issues/2505+[#2514]: https://github.com/simonmichael/hledger/issues/2514+++# 1.51.1 2025-12-08++Fixes++- Relative includes from a symbolically-linked journal file now work again.+ This was fallout from 1.50.4's fixes.+ [#2503]++- When journal's include directive has an IO error, like trying to+ include an existing but unreadable file, or failing to find a home+ directory when expanding ~, it now shows the problematic include+ directive (previously the line number was off by one).++- `aregister`: respect the order of -f options when showing same-day transactions from multiple files.+ If transactions on the same date are coming from two files specified+ with -f options, we expect them to be displayed in parse order, ie+ respecting the order of the -f options. This wasn't always the case,+ now it is.++- `aregister`: show "ACCTPAT matches no account" error on just one line.++- Fix build failures with the scripts in bin/.+ (Dmitry Astapov, [#2497])++[#2503]: https://github.com/simonmichael/hledger/issues/2503+[#2497]: https://github.com/simonmichael/hledger/issues/2497+++# 1.51 2025-12-05++Breaking changes++Fixes++- HTML output no longer contains invalid nested tables (Joschua Kesper). This may cause some visual changes, hopefully all for the better.+- `stats`: `-o` now redirects all output, including the performance stats.++Features++- `commodities`, `payees` and `tags` commands now have a `--find` mode for finding the best match (like the `accounts` command).+- `stats`: A new `-1` flag prints a single line of output in machine-friendly tab-separated format, including the program version, journal file name, and performance stats.++Improvements++- In journal format, an empty `{}` pair is now allowed (and ignored) in amounts, slightly improving Ledger/Beancount compatibility.+- `accounts` in `--tree` mode, when showing a subset of accounts, now shows parent accounts for context, like the `balance` command.+ (Sam Almahri, [#2427])+- `accounts --types` no longer shows value-less type tags; untyped accounts are shown without a `type` tag.+- When pivoting on account type with `--pivot=type`, account types will be normalised to their short spelling (`A` instead of `Assets`, etc).+- `accounts`: the `--positions` flag has been renamed to `--locations`.+- `print`: the `--location` flag has been renamed to `--locations`.+- `setup`: tidier output for missing LEDGER_FILE or default file; wording improvements++Docs++- Account names: rewrite, emphasise the two space delimiter+- accounts: improve/sync options order+- add: balance assertions/assignments: clarify, fix [#2494]+- aregister: clarify arguments+- argument files: corrections+- check: drop obsolete note about transaction balancing+- close: customisation: clarify [#2492]+- commodity directive: add info about the -c command line option (Ooker)+- COMMON TASKS: demote subheadings+- csv: "CSV fields and hledger fields"; "Regular expressions in CSV rules"; link the `if`-specific `skip` and `end` rules more clearly+- depth: rewrite, note combining issue+- Editor configuration -> Editors+- print: clarify amount styling; note more parseability breakers+- Setting LEDGER_FILE: rewrite, new windows procedures+- Special characters: rewrite (Simon Michael, Caleb Maclennan, [#2468])+- Tags: rewrite [hledger_site#141]+- Value reporting: more advice, examples for COMM, warn about -V/emphasise -X++Examples++- Organise/rename examples/csv/ as the [CSV rules library](https://github.com/simonmichael/hledger/tree/master/examples/csv)++Scripts/addons++- `hledger-check-buynothing`: check Buy Nothing Day compliance+- `hledgerj1`: example of a wrapper for reading a custom data format+- `sortandmergepostings`: Overhaul for more robust determinism (Caleb Maclennan)+ - Avoids non-deterministic flip-flopping when the alphabetical account sort has multiple commodities+ - Sorts postings commodities so commodities are in the same order across transactions+ - Sorts postings with matching commodity by posting amount++API++- Hledger.Cli.Utils:+ - stop exporting pivotByOpts, anonymiseByOpts+ - renamed withJournalDo -> withJournal. The old name is still available but deprecated.+++# 1.50.5 2025-12-08++Fixes++- Relative includes from a symlinked file work again, fixing some fallout from 1.50.4's fixes.+ [#2503]++[#2503]: https://github.com/simonmichael/hledger/issues/2503+++# 1.50.4 2025-12-04++Fixes++- An `include` directive with no argument now gives consistent error messages.++- journal format's `include` directive no longer excludes paths containing dotted directories/files.+ 1.50-1.50.3 contained an overzealous workaround that sometimes wrongly excluded paths containing a dot dir or dot file.+ Now the pre-1.50 behaviour is restored+ (`*` and `**` generally avoid dot files and dot directories, except `**` will search non-top-level dot directories).+ [#2498]++- Symbolic links found by `include` directives are once again shown as-is, not dereferenced.+ (1.50-1.50.3 showed them dereferenced, eg in `hledger files` output.)++ There is some related new behaviour: each time an include directive is parsed,+ all the parent file paths and the new include file path(s) are re-canonicalised.+ Previous hledger versions did not do this; it's expected to be unnoticeable,+ but if you notice any slowdown caused by having many include directives and a slow filesystem,+ please report it.++[#2498]: https://github.com/simonmichael/hledger/issues/2498+++# 1.50.3 2025-11-18++Fixes++- hledger versions 1.50-1.50.2 ran much slower than normal (depending on the speed of your hard drive).+ This 1.50.3 release fixes that; so please upgrade, and avoid those older 1.50 releases.+ [#2493]++- A regression in 1.50, where very large dates could produce wrong reports, has been fixed.+ (Affecting dates outside the range -25252734927764696-04-22..25252734927768413-06-12+ on 64 bit machines, or -5877752-05-08..5881469-05-27 on 32 bit machines.)+ [#2479]++- If the `LEDGER_FILE` environment variable is set to a nonexistent file, we now report an error+ rather than silently falling back on a default file path, which was confusing.+ Also, we no longer support the legacy `LEDGER` environment variable as a fallback.+ [#2485]++- `setup` now shows tidier output when a LEDGER_FILE or default file is not found,++- `add` now checks balance assertions more robustly, with awareness of how everything is ordered in the journal.+ Also, it now allows adding balance assignments.+ [#2478]++- `check accounts` no longer garbles non-ascii account names in its output.+ [#2469]++- We now escape special characters properly when passing arguments to addons+ (with just one level of quoting/escaping, not two).+ And related docs have been improved.+ (Caleb Maclennan, Simon Michael, [#2468])++- Internal report code which could produce certain date-related errors has been made robust again.+ (Stephen Morgan)++- The old "threaded" build flag, which cabal could turn off, has been dropped.+ This will hopefully prevent wrong builds like Debian's #1120833.+ [#2495]++- Docs updated: add, areg, argument files, check, close, csv, depth, print, print, Special characters, Value reporting+++# 1.50.2 2025-09-26++Fixes++- The CSV `encoding` rule is now respected when using the rules file as input file. This was a regression in 1.50.+ Also, the text decoding error message has been clarified; it now mentions a possible CSV encoding.+ [#2465]++- The doc for `--depth` has been clarified, and now mentions the use of quotes.+ (Lý Minh Nhật, Simon Michael, [hledger_site#140])++- A typo was fixed in the --depth example in `register`'s doc.+ ([hledger_site#140], reported by Lý Minh Nhật)++- Our package bounds now avoid hashtables 1.3.x, which fails to build with some gcc versions+ (see https://github.com/gregorycollins/hashtables/issues/97)).+ (hseg, [#2463])++[#2463]: https://github.com/simonmichael/hledger/issues/2463+[#2465]: https://github.com/simonmichael/hledger/issues/2465+++# 1.50.1 2025-09-16++Fixes++- Balance commands now show an empty report instead of an error when+ no transactions are matched, fixing a regression in 1.50.+ (Stephen Morgan, [#2452])++- The `print` command's help no longer shows an unused --show-costs flag.+ And the command-specific flags are now mostly ordered alphabetically.++- Whitespace in the `setup` command's "undeclared commodities" output has been fixed.++Doc updates++- Text encoding+- bin/README: paypal\*, simplefin\* usage examples, doc link++API++- Hledger.Cli.Utils:+ add withJournal alias for withJournalDo,+ pivotByOpts -> maybePivot,+ anonymiseByOpts -> maybeWarnAboutAnon,+ stop exporting pivotByOpts, anonymiseByOpts++- Hledger.UI.ErrorScreen:+ uiReloadJournal -> uiReload,+ uiReloadJournalIfChanged -> uiReloadIfFileChanged++[#2452]: https://github.com/simonmichael/hledger/issues/2452++# 1.50 2025-09-03++## Breaking changes++- Transaction balancing is now done in a more robust way, using local precisions only (like Ledger) [#2402].+ Until now, a transaction was required to balance using its commodities's global display precisions.+ Small imbalances were tolerated by configuring display precisions for the whole journal (with `commodity` directives).++ Now, a transaction is required to balance using the precisions in its journal entry only.+ This means each entry can use the precision it needs, and balancing precision and display precision are independent.+ (So eg, increasing the display precision with `-c` no longer breaks the journal.)++ In practice this requires journal entries to be more accurate, and you will probably need to fix some old entries.+ There are three main ways to fix an entry:+ - reduce the amounts' precision (use fewer decimal digits, so a lower balancing precision is inferred)+ - make the amounts more accurate (use better decimal digits, so the amounts sum to zero more closely)+ - or (easiest) add an amountless "expenses:rounding" posting (this is not a cheat, it's a more accurate record of what your bank/broker is doing).++ You can also keep the old transaction-balancing behaviour with `--txn-balancing=old`, for now.+ But updating your entries is recommended. ++ The old behaviour could allow small remainders to accumulate over time, + in accounts that often have an inexact posting amount or cost amount and are never reconciled -+ typically equity, revenues, and expenses.+ You can check for this in your old journals with a command like++ hledger bal cur:\\$ -c '$1.000000000000' | grep -E '\...0*[1-9]'++ (show $ account balances, with many decimals, which have a non-zero decimal in the 3rd place or beyond)+ +- Timeclock format has had various changes:+ - Timeclock syntax and parsing is now more robust (when not using --old-timeclock):+ - Semicolon always starts a comment (and timeclock account names may not include semicolons).+ - Trailing spaces are ignored.+ - Clock-ins now require an account name.+ - Clock-outs now can have a comment and tags.+ - Timeclock entries are processed in parse order.+ - Some order-related bugs in 1.43 have been fixed.+ - Concurrent/overlapping sessions are now fully supported, even if they have the same account name.+ - The timeclock doc has been rewritten.+ - The --old-timeclock hidden flag has been renamed, documented, and now also affects included files.+ [#2141], [#2365], [#2400], [#2417]++- The `import` command now shows info messages (such as the dry run "; would import .." message)+ on stderr, not stdout.+ Also the "no new transactions" output is more compact, showing file names not file paths;+ and it no longer prints an extra newline.++- Some edge cases in balance report behaviour were changed for internal consistency:+ - --declared now treats parent accounts consistently.+ - --flat --empty now ensures that implied accounts with no postings are not displayed,+ but accounts with zero balance and actual postings are.+ (Stephen Morgan, [#2360], [#2395])++- hledger now requires at least GHC 9.6 (and base 4.18), to ease maintenance.++## Fixes++- Paging long output no longer gives an error when `LESS` is undefined and+ `less` does not have mouse support (as on some FreeBSD systems).++- The `all:` query now requires at least one posting to match.+ (Previously, matching no postings at all was also considered a success.)++- When using journal format's `include` directive, several kinds of+ error (read failure, cyclic include..) could show an off-by-one line+ number or excerpt, confusingly. This has been fixed.+ Also, attempting to include a rules file now gives a better error message.++- In CSV `if` rules, match group references like `\1` no longer get confused+ by differing case.+ (Jay Neubrand, [#2419])++- `add`, `commodities`, and `diff` now support the --conf and -n/--no-conf flags,+ like other commands.+ [#2446]++- On Windows machines, the `add` command now properly shows green prompts instead of ANSI codes.+ [#2410]++- Balance reports now properly show the historical balance even when the report period is empty.+ [#2403]++- Balance reports' csv output, and the `balance --budget` report, now respect the --summary-only flag.+ (Stephen Morgan, [#2411], [#2443])++- The `demo` command no longer mentions `-- ASCIINEMAOPTS` in help.+ Also it shows a better error message when asciinema is not installed.++- `hledger help -m TOPIC` or `hledger help -i TOPIC` now show the help for TOPIC, as intended.+ [#2399]++- Since hledger 1.32.1, the `import` command, when importing multiple files at once,+ would write an empty .latest file for data files with no new transactions+ (causing all transactions in those data files to appear new on next import).+ This is now fixed.+ [#2444]++## Features++- CSV rules files can now run a shell command to clean the data:++ # read the latest foo*.csv file, and replace "USD" with "$"+ source foo*.csv | sed -e 's/USD/$/g'++ or to generate the data:++ # fetch JSON from simplefin.org, then transform it to CSV+ source | simplefinjson | simplefincsv++ Whenever hledger runs one of these commands, it will echo the command on stderr.++- The `import` command can now automatically archive imported CSV data files,+ saving a dated copy in a `data/` directory. This can be useful for troubleshooting,+ or for regenerating entries later with improved rules.+ To enable it, add `archive` to the rules file.++ This and the previous feature can simplify file management and reduce the need for support scripts.++## Improvements++- In command line help, flag group headings have been simplified.+ And the help for -f/--file, `add`, and `import` is now clearer.++- When given both an unknown command and an unknown flag, hledger now gives+ a clearer error message (about the command, not the flag).+ [#2388]++- A long standing awkwardness with addon commands has been solved:+ you can now use addon options freely in a hledger command line;+ you don't need to write a `--` argument first.+ [#458]+ +- In smart dates and period expressions, quarter syntax like `2025q1` or `Q2` is now fully supported.++- In end-value reports where the end date is unspecified, market prices+ in the future can no longer influence the report end date and valuation date.+ (Market prices on or before today, still can.)+ [#2445]++- A `tag:` query with the `accounts` command now only matches account tags, not posting tags.+ Eg, `hledger accounts tag:t` now lists only account a from this journal:++ account a ; t:++ 2025-01-01+ a 1+ b -1 ; t:++- Journal format's `include` directive now has more robust and convenient glob patterns:+ - `**` can match both directories and filenames+ - `**` now automatically ignores anything under dotted directories, like .git/, foo/.secret/, etc.+ (If you do want it to search dotted directories, + you can use the --old-glob flag for now to restore the old behaviour. See also Glob#49.)+ - Glob patterns with wildcards now automatically exclude the current file.+ Eg `include **.journal` will include all other .journal files in this directory and below.++- `include`'s error messages and debug messages have been improved.+ Eg, the including file paths are also shown.++- Journal format's auto posting rules can now use `%account` to insert the account name+ from the matched posting.+ (Stephen Morgan, [#1975], [#2412])++- The `aregister` command no longer abbreviates account names+ when producing `csv`, `html`, or `fods` output.+ (savanto, [#1995], [#2416])++- The `commodities`, `payees` and `tags` commands now have --used/--declared/--undeclared/--unused flags, like `accounts`.+ And there has been a general cleanup of options and help across these four commands.++- The `setup` command's output has been improved.+ Lack of a pager is now reported as info, not warning (there's no default pager on Windows).+ Shell completions are ignored for now.++## Docs++- add: clarify that add is for journal format only+- addon commands: edits, drop `--` argument from all examples [#458]+- areg: clarification+- bin: README updates+- COMMANDS: mention general options+- completions: README updates+- config files: no longer experimental+- csv: date-format: mention lack of support for local time formats [#1874]+- csv: source, archive: rewrite, add examples+- Depth: fix typo+- github release docs: simplify install commands+- import: use windows-compatible quotes in watchexec example+- include directive: update docs; clarify effect, glob limitations+- note fish LEDGER_FILE setup+- options: mention that flag+value can't combine with other flags [#2059]+- print: improve --location help+- smart dates: fix typo++## Examples++- CSV rules for Eternl cryptocurrency wallet+- VAT example++## Scripts/addons++- renamed paypaljson2csv to paypaljson+- simplefinjson, simplefincsv: new helpers for downloading/converting data from simplefin.org bank aggregator+++# 1.43.2 2025-06-13++- hledger no longer shows an error message or exits with error status+ when its output is truncated in a piped command. (This broke in 1.43.) [#2405]++- The `add` command's doc now describes how it interacts with balance assertions+ and balance assignments. [#2406]++- `aregister` now consistently rounds amounts to display precision again.+ (This broke in 1.32.) [#2407]++- Changelog, release notes: mention improved decoding errors [#73];+ add missing issue numbers+++# 1.43.1 2025-06-04++Fixes++- `cur:` in posting-based reports like `balance` and `register` once again+ filters multicommodity amounts as it should. [#2396]+- More error messages were made consistent, hiding call stack etc. [#2367]++Docs++- Query types: clarify that amt: filters postings [#2396]+- More text encoding corrections/cleanups [#2394]+++# 1.43 2025-06-01++## Breaking changes++- Timeclock format now supports multiple simultaneous clocked-in sessions.+ A clockout entry can reference the account name of the clockin it is ending,+ otherwise it will end the most recent clockin.++ This is a potentially breaking change, because we previously ignored+ the description on clockout entries. For now, you can restore the+ old behaviour by adding the `--timeclock-old` flag. This may be+ removed later, so if you needed it, please let us know!+ (Michael Rees, [#2141])++## Fixes++- For a long time, hledger docs stated that hledger's input and output had to be UTF-8 encoded.+ In fact this was wrong; hledger has always used the system locale's encoding for both.+ Docs like [Install: Text encoding](install.md#text-encoding)+ and [hledger: Text encoding](hledger.md#text-encoding)+ have been updated.+ [#2394]++- Some boolean queries involving `amt:` or `cur:` did not match correctly; now they do.+ (Simon Michael, Stephen Morgan, [#2371], [#2373], [#2387])++- The `roi` command has fixed a bug with PnL attributed to the wrong period.+ (Dmitry Astapov, [#2391])++- CLI error messages now have consistent format independent of the GHC+ version hledger was compiled with. [#2367]++## Features++- A new `setup` command checks your hledger installation and shows information+ useful for troubleshooting. It will do more in future.+ For now, `setup` should be reliable and accurate;+ please test it on all your machines and share the results with us.+ Experimental.++ When you run this command, hledger attempts one HTTP request, with a 10s timeout,+ to hledger.org, to detect the current release version.++- New `any:"BOOLEANQUERY"` and `all:"BOOLEANQUERY"` queries can be+ used with transaction-matching commands like `print` and `import`.++ Unlike `expr:"BOOLEANQUERY"`, where the parts of the boolean query+ are allowed to match different postings in the transaction,+ with `any:` and `all:` the entire boolean query must match a single posting.+ `any:` matches the transaction if any posting is matched,+ `all:` matches the transaction if all postings are matched.++- The `add` command now allows balance assertions to be added, after an amount.+ Also, whenever you enter an amount, it now checks the journal's balance assertions+ and will not allow adding an amount that would cause assertion failure+ (unless you use the `-I/--ignore-assertions` flag).+ (Michael Rees, [#2355], [#2356])++- The hledger-print-location script, which shows transactions' file positions, + is now built in to `print` as the `--location` flag.+ (Sam Almahri, [#2368])++## Improvements++- Core data types are now more strict, which in some cases reduces memory and time usage by up to 15%.+ (Stephen Morgan, [#2381], [#2385], [#2387])++- Config files (and maybe timedot files) no longer require a final newline.++- In journal format, `include` directives can now have same-line comments.++- CSV `if` rules now produce more `--debug=2` output, useful for troubleshooting.++- CSV debug output now displays records as the `if` matchers see them.+ (Comma separated and with quotes and outer whitespace removed.)++- A number of error messages have been updated to show a consistent format.+ (reading a nonexistent data file,+ reading an unsafe dotted file name on Windows,+ demo not found,+ demo asciinema error,+ diff bad arguments,+ print --match with no match,+ register --match with no match,+ roi with no investment transactions).+ [#2367]++- When unicode/non-ascii text can't be decoded by the system locale's text encoding,+ we now show a consistent informative error message explaining it. [#73]++- Support GHC 9.12.++## Docs++- Account types: rewrite+- Assertions and multiple files: edits+- Balance assertions and multiple files+- balance: edits+- Beancount output: edits+- check: edits+- Config file: drop the s+- CSV: clarify that CSV means delimiter-separated values, link to wikipedia DSV page+- CSV:description field: fix link [hledger_site#133]+- Fix broken hledger-iadd link+- Fix various broken "Commodity display style" links (JB Rainsberger, Simon Michael, [hledger_site/#132])+- How CSV rules are evaluated: clarify+- Journal: cheatsheet edits+- print: simplify [#2368]+- Queries: discuss transaction vs posting queries; cleanups+- Queries: fix the explanation of boolean queries and space-separated terms++## Examples++- examples/csv/nps.csv.sh updated (Pranesh Prakash)+- examples/forecast-budget* -> examples/goal-budget*+- examples/i18n/\*.journal: top level account declarations in several languages.+- examples/quickstart.journal: the quickstart journal from the home page++## Scripts/addons++- bin/balance-as-budget-multi.hs (Dmitry Astapov)+- bin/bashrc: command alias updates+- bin/hledger-sankeymatic++## API++- Hledger.Cli.Conf: make getConf total, add getConf'+- Hledger.Cli.Version: add more version helpers, rename HledgerBinaryInfo+++# 1.42.2 2025-05-16++Fixes++- The test command can pass options to tasty again (this broke in 1.42).+ Also, any arguments before -- are now passed to tasty as test-selecting -p options.+ [#2386]++- Require extra >= 1.7.11, fixing the stack8.10.yaml build. (Thomas Miedema)++Docs++- CSV encoding: fix inaccurate list of encoding names. [#2354]+- Fix broken links to "Commodity display style". (Simon Michael, J.B. Rainsberger [hledger_site#132])+- Misc. edits/fixes: beancount output, commands list, balance command, hledger-iadd link, csv tutorial link+++# 1.42.1 2025-03-12++Fixes++- Fix a regression in the parsing of single ampersands (&) in csv rules.+ (Thomas Miedema, [#2352])++- The run and repl commands no longer cache data wrongly when using the --forecast option.+ (Dmitry Astapov, [#2345])++- The run and repl commands no longer miss a caching opportunity when using --forecast with a period argument.+ (Stephen Morgan)++Docs++- run, repl: doc fixes (Pranesh Prakash, Simon Michael)+++# 1.42 2025-03-07++Fixes++- hledger's default options for the `less` pager no longer include --use-color,+ which caused older less versions (eg 551) to break. [#2335]++- In balance --budget reports, costs no longer prevent display of percentages. [#2327]++- In the balance command's HTML output, -H/--historical now suppresses the total heading.++- print --help now shows the correct default for --round. [#2318]++- close --infer-costs no longer implies the -x/--explicit flag. [#1826]++- add: Account names provided on the command line are no longer ignored. [#2305]++- bs/bse/cf/is no longer show the unsupported --budget option in their help. [#2302]++- The print command now ignores --depth entirely. Previously, a depth+ limit caused it to show only transactions referencing accounts as+ deep or deeper than that.++- Week periods beginning in the previous year are now shown correctly.+ Eg the week beginning 2024-12-30 (which is week 1 of 2025 because the+ thursday falls in 2025) was previously shown as 2024-W01, and is now shown as 2025-W01.+ [#2304]++Features++- `run` and `repl` are new commands which run multiple commands+ without re-parsing data files, so they run faster.+ `run` runs a sequence of commands from files or command line arguments,+ and `repl` provides an interactive prompt with readline-style history.+ (Dmitry Astapov, Simon Michael, [#2323], [#2328])++- `commands` is a new explicit command for showing the commands list; it's useful in the REPL.+ With --builtin, it shows only the builtin commands.++- hledger can now read CSV/SSV/TSV data in encodings other than UTF8,+ using the new `encoding` CSV rule. (Joschua Kesper, [#2319])++- `if` matchers in CSV rules can now be combined on the same line,+ separated by `&&` (AND) or `&& !` (AND NOT). This makes `if` tables more expressive.+ Examples:++ if %description amazon && %date 2025-02-22+ account2 expenses:books++ if,account2+ %description amazon && %date 2025-02-22, expenses:books++ The next-line `&` operator also may now be written as `&&`, for consistency.+ (Thomas Miedema, [#2333])++Improvements++- Terminal width is now detected more robustly, using the POSIX API.+ This means that register commands will more reliably use the proper terminal width,+ eg when $TERM or $COLUMNS do not have a correct value, and on Windows.+ hledger no longer uses $COLUMNS.+ (gesh, [#2332], [#2340])++- Error messages (first line) in the terminal are now shown in red (and bold),+ and warning messages are shown in yellow,+ when ANSI codes are supported and permitted.++- --pivot can now also pivot on amount quantity (`amt`),+ amount cost (`cost`), and/or commodity symbol (`comm` or `cur`).++- The close command's --migrate flag has been renamed to `--clopen`.+ The start: tag has been renamed to `clopen:`,+ and its default value now excludes the new file's extension.+ And close --assign's tag has been renamed to `assign:`.++- The print command now supports the --invert flag. [#2314]++- The roi command is now faster:+ it no longer checks every day with P directive,+ and the "one period per report interval" case has been optimised.+ (Dmitry Astapov)++- Two more file extensions are now recognised as possible hledger addon+ commands: `.osh` and `.ysh`.++Docs++- aregister: Drop an inconsistent newline from options help.+- balance: improve --layout option help.+- close: doc rewrites+- shell completions: mention zsh; cleanups+- cost/lot notations: clarify+- cost, value reporting: edits+- Directive effects: fix account types link [#126]+- commodity styles: fix typo [hledger_site#123]+- commodity directive: clarify+- close: mention the balance assertions+- pager: mention --pager=no+- Aliases and account types: better troubleshooting command+- Beancount output: mention limitations: P and balance assignments+- Balance report output: drop outdated note about --tree and HTML [#1846]+- new/updated: ACHIEVEMENTS, CREDITS, FINANCE, MOCKUPS, REGRESSIONS, RELEASING, Scripts+- examples/csv: pooltool-rewards.csv.rule cleanup+- examples: some sample hledger run scripts+- examples: test files for CSV encoding [#2319]++Scripts/addons++- hledger-balance-as-budget properly applies commodity styles now. (Dmitry Astapov)++- hledger-git now runs pass-through git commands in the right repo.++- hledger-git now checks for a git repo more robustly. (Lars Kellogg-Stedman)++- hledger-jj is another easy CLI for keeping hledger files in version control,+ using newer tech (jujutsu and oil shell's ysh).++- hledger-script-example.hs has had some cleanup.+++# 1.41 2024-12-09++Breaking changes++- Accounts named "equity:conversion", "equity:trading", or "equity:trade(s)",+ which are detected as type `V`/`Conversion`, will now revert to type `E`/`Equity` instead+ if any other account has been declared as type `V`/`Conversion`.++- When built with ghc 9.10.1, hledger shows two extra newlines after any error message.++Fixes++- A somewhat severe, though hopefully rare, valuation bug has been fixed.+ In certain circumstances, values could be calculated inaccurately,+ because of display-rounding occurring inappropriately during calculations. [#2254]++ Specifically:+ when there was no direct P price for the target commodity,+ so that hledger had to convert via a chain of prices,+ and if all of those price amounts had too few decimal places,+ then the result could be inaccurate.+ An example:++ P 2000-01-01 A 10.5 B+ P 2000-01-01 B 100.5 C++ 2000-01-01+ (a) 100 A+ + $ hledger-1.40 print -X C+ 2000-01-01+ (a) 105520 C ; wrong++ $ hledger-1.41 print -X C+ 2000-01-01+ (a) 105525 C ; right+ +- `bs`/`bse`/`cf`/`is`'s HTML output no longer includes excess heading cells,+ and `bs`/`bse`'s HTML output no longer shows an inappropriate Total heading with `-T`.+ (`balancesheet` does not support `-T`.)+ (Henning Thielemann)++- Balance commands' HTML, CSV and FODS output now show tree mode properly indented+ (using no-break spaces).+ (Henning Thielemann)++- In the HTML output of `bs`/`bse`/`cf`/`is` reports, Net amounts in the Net row are now formatted like the others.+ (Bas van Dijk)++- In `bs`/`bse`/`cf`/`is` HTML output, some unnecessary TH cells have been fixed.+ [#2225] (Henning Thielemann)++- The `print` command now ignores a depth limit entirely.+ Previously, a depth limit caused it to show only transactions referencing accounts as deep or deeper than that.++- In the `roi` command, a division by zero error (when all assets were sold) has been fixed.+ [#2281] (Dmitry Astapov) ++- In a multi-line comment generated by CSV rules, tags on all lines now work (ie, can be matched).+ Posting dates in comments generated from CSV also now [work](https://hledger.org/hledger.html#comment-field).+ [#2241]++- hledger's bash shell completions are now up to date with the latest CLI.+ [#986]++- When showing output with a pager, if `$PAGER` is set to something not found in PATH,+ we now ignore it instead of raising an error.++- `hledger --color=yes | less -R` now shows bold headings as you'd expect.++Features++- The `print`, `register` and `aregister` commands now support HTML and FODS output,+ and the `bs`/`bse`/`cf`/`is` commands now support FODS output.+ This means all of the "STANDARD REPORTS" commands, and the `balance` command, now support text, HTML, CSV, TSV, or FODS output.+ (Henning Thielemann)++- When generating HTML output with the register or balance commands,+ the `--base-url` option will add hyperlinks to hledger-web,+ allowing you to view the detailed transactions if you have hledger-web running.+ (Henning Thielemann)++- Reports can now specify different display depths for certain accounts,+ rather than showing all accounts with the same depth limit.+ Multiple `--depth=ACCTREGEX=DEPTH` options (or `depth:ACCTREGEX=DEPTH` arguments can be used.+ For example, this will clip all accounts matching "assets" to depth 3,+ all accounts matching "expenses" to depth 2, and all other accounts to depth 1:+ `--depth assets=3 --depth expenses=2 --depth 1`+ (Stephen Morgan, #2292)++- In unix-like environments, hledger now uses a pager (`$PAGER`, `less`, or `more`)+ for all large terminal output, not just for help.+ You can override this with the new `--pager` option.+ The pager is expected to handle hledger's ANSI colour output (unless you disable that).+ If `less` is used, it will be configured automatically,+ or you can override this by setting options in a `HLEDGER_LESS` environment variable.++- The `print` command's `beancount` output is now much more Beancount-compatible [#2295].+ Other than using `--alias` to provide the top-level account names Beancount requires,+ you should rarely have to do anything special to produce a journal that `bean-check` accepts.+ hledger will automatically adjust problematic names, encode unsupported characters, and so on.+ See [hledger: Beancount output](https://hledger.org/dev/hledger.html#beancount-output) for the full details.++ This supersedes the `ledger2beancount` tool, and makes using Beancount tools,+ especially Fava, practical for hledger users. In many cases this should just work:+ ```+ hledger [ALIASES] print -o tmp.beancount; fava tmp.beancount+ ```++Improvements++- `if` blocks in CSV rules now allow `& !` (AND NOT) on the same line.++- When reading `.latest` files, whitespace is now ignored, and any date parse failure+ is reported with the file and line number.++- In journal format, P directives now require a space after the first symbol,+ preventing surprises like `P 2024-10-31 a0 1` parsed as `P 2024-10-31 a 01`.+ [#2280]++- `aregister` has a new `--heading=YN` option, for disabling the report heading. (Henning Thielemann)++- `aregister` now supports the `--invert` and `--cumulative` flags, like the `register` command. (Henning Thielemann)++- The balance commands' HTML and FODS output now shows table borders consistently.+ (Henning Thielemann)++- In the balance commands' HTML output, row headings now span multiple rows when appropriate, rather than being repeated.+ (Henning Thielemann)++- Balance commands now support `--transpose` when generating HTML output.+ (Henning Thielemann)++- The `balance` command's `--layout=tidy` now affects HTML and FODS output at least to some extent (not just CSV output).+ And it always disables the totals row. (Henning Thielemann)++- The `balance` command's FODS output now picks a report title based on the report mode:+ "Balance Report", "Multi-period Balance Report", or "Budget Report". (Henning Thielemann)++- `balance` and `aregister`'s HTML output will now use a hledger.css file if present, like `bs`/`bse`/`cf`/`is`.++- `bs`/`bse`/`cf`/`is` now support the `--count` (postings count) report type, like `balance`.++- The balance commands' options help has had some cleanup.++- The error messages from `check accounts` and `check recentassertions` are now clearer.++- The `check commodities` command now also checks commodities used in P directives. [#2280]++- The `commodities` command now also list commodities mentioned in P directives. [#2280]++- All of hledger's internal hidden (but searchable) tags can now be made visible + by `print --verbose-tags`, which is useful for troubleshooting `--infer-equity`,+ `--infer-costs`, and the detection of redundant costs and conversion postings.+ Also,++ - Some hidden tags have been renamed for clarity:+ `_modified` is now `_modified-transaction`,+ `_cost-matched` is now `_cost-posting`,+ `_conversion-matched` is now `_conversion-posting`.+ - The `generated-posting:` tag added by `--infer-equity` is now valueless.+ - The `modified-transaction:` tag added by `--auto` now appears on its own line.++- Using the `-NUM` shortcut (for `--depth NUM`) in a config file now works.++- Setting the `--color` option in a config file now works+ (except it does not affect `--debug` output, currently).++- The `--color` option's suggested values are now `yes`/`y`, `no`/`n`, or `auto`/`a`.+ `always` and `never` are no longer documented, though still supported.++- More compact and informative `--debug=2` output during valuation.+ Market prices are now shown using one line each, the known prices+ are listed, and the status of `--infer-market-prices` is shown.+ [#2287]++- More informative `--debug=7` output from CSV rules.++- The hledger packages have a new `debug` build flag. Builds made with ghc 9.10+ and this flag+ will show some kind of stack trace if the program exits with an error.+ (These will improve in future ghc versions.)++- Disabled the unused `ghcdebug` build flag and ghc-debug support, for now.++- Allow megaparsec 9.7.++- ghc 9.10 / base 4.20 are now supported.++Docs++- Windows: added tips for setting `LEDGER_FILE` (Amadeusz Wieczorek, hledger_site#119)+- csv: if blocks: explain matchers and field names better [#2289]+- import: rewrite; rename "date skipping" to "overlap detection"+- import: added tips for first import+- assertions: mention their behaviour with posting status+- journal: rewrite the Tags section+- pager: note that `help -p TOPIC` uses less; link to less FAQ+- query types: updates, add headings, mention tag:'s infix matching+- Regular expressions: note possible RTL/bidi limitation (?)+- Special characters: rewrite, more precision, mention some Windows differences+- Output formats: expand, document beancount and FODS output+- Text output: expand/consolidate terminal topics+- FODS output: describe the advantages over CSV (Henning Thielemann)+- Debug output: note that the --debug option doesn't work in config files.+- bal: improve --layout doc+- bal: also mention hledger.css and text encoding in balance doc+- html: note safari text encoding issue+- timedot: mention the common journal+timedot file setup [#2238]+- Install, manual: new shell completions doc. [#986]+- Config files: rewrite [#2231]+- examples/csv: an example of YNAB 4 data, and RTL text, with a workaround+- examples: hledger2beancount.conf++Scripts/addons++- bin/*: remove obsolete _FLAGS markers from --help+- examples/csv/csv-hledger-1.py: a python-based CSV converter script++API++- Hledger.Utils.IO's ansi color helpers now respect the --color option.+- Hledger.Utils.IO.rgb' now takes Float arguments instead of Word8.+- Hledger.Cli.Commands.Balance: export budgetReportAs* functions, for use in scripts.+ (Dmitry Astapov)+++# 1.40 2024-09-09++Fixes++- Account tags (and type declarations) declared in multiple files are now combined correctly. [#2202]++- Several kinds of report interval now choose a better start date:+ - `every Nth day of month from DATE` with periodic transactions [#2218]+ - `every M/D from DATE`+ - `every Nth WEEKDAY from DATE`++- The balance commands' HTML output no longer repeats the "Total" and+ "Net" headings when the totals row has multiple lines.+ And the layout has been improved and made more consistent with the+ text output.++- The `--tldr` flag now also works with the `tealdeer` tldr client.+ +- `hledger check tags` no longer warns about the internal `_price-matched` tag+ being undeclared (and that tag has been renamed to `_cost-matched`).+ [#2247]++- `hledger check accounts` no longer warns about the special `equity:conversion` account+ being undeclared (the default account used by `--infer-equity`).++Features++- You can now save command line options in a [config file](https://hledger.org/hledger.html#config-file),+ to be added to your hledger commands either on demand or automatically.+ (This supersedes the older arguments files feature.)++ This much-requested new feature has pros and cons, and is experimental;+ your testing and feedback is welcome.+ It changes the nature of hledger somewhat, which I have marked by+ giving this release a more memorable version number (1.40).++- The balance commands can now output in FODS format, an XML spreadsheet+ file format readable by LibreOffice. (Henning Thielemann)++- The `register` report can now be sorted by date, account, amount,+ absolute amount, description, or a combination of these. (Michael Rees, [#2211])++Improvements++- All the balance-like commands now support FODS output, not just `balance`.+ (Henning Thielemann)++- Config files can now also provide the command name.+ If the first thing in a config file's general section is a non-flag argument,+ that will be used as the command name argument,+ taking precedence over any command line arguments.+ This makes config files strictly more powerful than the older argument files.++- Improved debug output for command line and config file processing.++- The print command's beancount output is now better at producing Beancount-ready data,+ converting hledger account names and commodity names to Beancount-compatible ones.++- Command line processing has been overhauled and should be more robust+ in certain cases, with tweaked error messages and debug output.+ Command-specific flags can now optionally appear before the command name.+ (Though writing them afterward is usually more readable.+ Addon-specific flags must still come last, after `--`.)++- The `--rules-file` option has been renamed to `--rules`.+ The old spelling is still supported as a hidden option.++- Weekly reports' week headings are now more compact, especially in+ single-year balance reports. ([#2204], Victor Mihalache)++- The `balance` command with no report interval, and also `balance --budget`,+ now support html output. (Henning Thielemann)++- In balance commands' html and csv output, "Total:" and "Net:" headings+ are now capitalised consistently.++- `bs`/`cf`/`is` reports now show the report interval in their title.++- The balance commands' text output with the `--pretty` flag now shows+ an outer table border and inter-column borders.++- The `check recentassertions` error message is now more readable.++- Timedot format now allows comment lines to be indented.++- When running the `tldr-node-client` client, auto-update of the tldr+ database is now suppressed.++- When running a tldr client fails, the warning now mentions the required+ `--render` flag. [#2201]++- The error message for unsupported regular expressions like `(?:foo)` has+ been improved.++- `--debug` has moved to "General help flags", making it available in+ more situations.++- Some verbose debug output from command line processing has been demoted to level 2.++- Parsing timedot files now gives debug output at level 9.++- Allow doclayout 0.5.++Docs++- The hledger/hledger-ui/hledger-web manuals now list all command options as shown by `--help`.+- Added an example config file, `hledger.conf.sample`.+- The `diff` and `prices` commands' help layout has been improved.+- `add`'s doc described the effect of `D` wrongly, now fixed.+- Date adjustments: rewrites and corrections+- Period headings: added+- Input: clarify that multiple -f options are allowed+- Scripts and add-ons: edits, list add-ons again+- Timeclock: edits, fix `ti`/`to` scripts+- Fixed "hledger and Ledger" links [hledger_site#112]+- examples/csv: Monzo CSV rules added+- examples/csv: Tiller CSV rules added+- examples/csv: Nordea CSV rules added (Arto Jonsson)++Scripts/addons++- `bin/bashrc` updates; add years, eachyear scripts+- `bin/hledger-simplebal`: ignore config files+- `bin/hledger-script-example`: explain shebang commands better+- `bin/hledger-register-max`: update/fix++++# 1.34 2024-06-01++Breaking changes++- `check ordereddates` no longer supports `--date2`.+ Also (not a breaking change): `--date2` and secondary dates are now officially+ [deprecated](https://hledger.org/1.34/hledger.html#secondary-dates) in hledger,+ though kept for compatibility.++Features++- You can now get a quick list of example command lines for hledger or+ its most useful subcommands by adding the `--tldr` flag (or just+ `--tl`). For best appearance you should install the [`tldr`][tldr] client,+ though it's not required.++ These short "tldr pages" are a great counterbalance to verbose PTA docs.+ You can also use `tldr` without hledger to view the latest versions, or translations:\+ `tldr hledger[-COMMAND]`.+ Or you can [browse tldr pages online](https://tldr.inbrowser.app/search?query=hledger+).+ Consider contributing translations!+ More tips at <https://github.com/simonmichael/hledger/tree/master/doc/tldr>.++[tldr]: https://tldr.sh++Improvements++- The `hledger` commands list has been reorganised,+ with commands listed roughly in the order you'll need them.++- The general flags descriptions in `--help` have been updated and grouped.++- Correctness checks now run in a documented order. `commodities` are+ now checked before `accounts`, and `tags` before `recentassertions`.+ When both `ordereddates` and `assertions` checks are enabled,+ `ordereddates` now runs first, giving more useful error messages.++- `-I`/`--ignore-assertions` is now overridden by `-s`/`--strict`+ (or `check assertions`), enabling more flexible workflows.+ Eg you can `alias hl="hledger -I"` to delay balance assertions+ checking until you add `-s` to commands.++- `--color` and `--pretty` now also accept `y` or `n` as argument.++- When built with the `ghcdebug` flag and started with `--debug=-1`,+ hledger can be controlled by [ghc-debug] clients like+ ghc-debug-brick or a ghc-debug query script, for analysing+ memory/profile info.++[ghc-debug]: https://gitlab.haskell.org/ghc/ghc-debug++Fixes++- `hledger COMMAND --man` and `hledger help TOPIC --man` now properly scroll+ the man page to the TOPIC or COMMAND heading.+ The exact/prefix matching behaviour has been clarified in `help --help`.++- In journal files, `include` directives with trailing whitespace are now parsed correctly.++- The help command's help flags are now consistent with other commands+ (and it has `--debug` as a hidden flag).++- Build errors with GHC 8.10 have been fixed. [#2198]++Docs++- The tables of contents on hledger.org pages now just list top-level headings,+ (and the hledger manual structure has been adjusted for this).+ This makes the hledger manual on hledger.org more scannable and less scary.+- add: drop lengthy transcript, add simpler example commands (from tldr)+- Amount formatting: move down, it's not the best first topic+- balance: mention the `--summary-only` flag+- check: expand check descriptions+- examples: CSV rules: vanguard, fidelity, paypal updates+- Generating data: rewrite+- JSON output: link to OpenAPI spec+- manuals: synopsis, options cleanup/consistency+- Options: correction, NO_COLOR does not override --color+- PART 4: COMMANDS: reorganise into groups, like the CLI commands list.+- Period expressions: mention last day of month adjusting [#2005]+- Secondary dates: expand, and declare them deprecated.+- Time periods cleanup, simplify markup+- Unicode characters: mention UTF-8 on windows++Scripts/addons++- Added `hledger-pricehist`, an alias for the `pricehist` market price+ fetcher so that it can appear in hledger's commands list.++[#2005]: https://github.com/simonmichael/hledger/issues/2005+[#2198]: https://github.com/simonmichael/hledger/issues/2198+++# 1.33.1 2024-05-02++- process >=1.6.19.0 seems not strictly needed and is no longer required,+ improving installability.+ [#2149]++- `print` and `close` now show a trailing decimal mark on cost amounts also,+ when needed to disambiguate a digit group mark.++- The balance commands' HTML output now includes digit group marks when+ appropriate (fixes a regression in 1.25).+ [#2196]++- The add command no longer shows ANSI escape codes in terminals that+ don't support them.++- Doc updates:+ - import: Skipping -> Date skipping, discuss commodity styles more+ - csv: Amount decimal places: expand, note import behaviour++[#2149]: https://github.com/simonmichael/hledger/issues/2149+[#2196]: https://github.com/simonmichael/hledger/issues/2196+++# 1.33 2024-04-18+++Breaking changes++- `expr:` boolean queries, introduced in hledger 1.30 (2023),+ no longer allow `date:` to be used within an `OR` expression,+ avoiding unclear semantics which confuse our reports.+ If you'd like to improve this, see #2178. [#2177] [#2178]++- Some error messages (date parse errors, balance assertion failures) have changed,+ which might affect error-parsing add-ons like flycheck-hledger.++++Fixes++- `add`, `import`, `web`:+ On MS Windows, don't allow writing to files whose name ends with a period,+ since it can cause data loss; raise an error instead.+ I made this change in hledger 1.15 (2019), but it never worked; now it does.+ [#1056]++- `balance --budget`:+ The budget report in tree mode was omitting parent accounts with no actual or goal amounts+ and a single child, instead of showing them as a prefix of the child's name.+ Now it always shows them, on a line of their own (a bit like `--no-elide`).+ It's not a perfect fix, but the budget report code is twisty.+ [#2071]++- `check tags`:+ The special `date` and `date2` tags,+ and the `modified` and `_modified` tags generated by `--auto`,+ are now also implicitly declared.+ [#2148], [#2119]++- Regular expression match group references in CSV `if` rules,+ added in hledger 1.32, did not work right when multiple if conditions matched a CSV record.+ This is now fixed; match group references are now scoped to their local `if` block.+ [#2158] (Jonathan Dowland)++- `roi` now correctly interacts with `--value`.+ [#2190] (Dmitry Astapov)++- hledger now requires process-1.6.19.0+ to avoid any vulnerabilities on Windows from+ [HSEC-2024-0003](https://haskell.github.io/security-advisories/advisory/HSEC-2024-0003.html).++++Features++- `close` has had some enhancements for usability ([#2151]):++ - It now excludes equity accounts by default; and always excludes the balancing account.++ - It has new `--assert` and `--assign` modes, for generating transactions which+ make balance assertions or balance assignments.+ There is also a `--assertion-type` option for changing the assertion/assignment type.++ - It adds a tag to generated transactions, named `start`, `assert` or `retain`+ depending on the mode.++ - The `start` tag's value will be a guess of the new file's name,+ inferred by incrementing a year number in the current file name.+ Eg, `hledger close --migrate` on `2024.journal` will add the tag+ `start:2025.journal` to both transactions.+ Tags like this can be helpful when reading multiple files,+ for excluding closing and opening balances transactions+ (eg with `not:tag:start=2025`).++ - You can set different tag values by writing the mode option with an argument.+ Eg: `hledger close --migrate=NEWFILENAME`.++ - `close` now supports `--round` for controlling display of decimal places, like `print`.++ - `examples/multi-year/` is examples/tutorial for managing multiple files with the `close` command.++++Improvements++- `stats` has had some improvements:++ - It now also shows some information about memory usage, when hledger is built or is running+ with the GHC Run Time System available. (Try `hledger stats +RTS -T`.)++ - The default output is now more private, hiding file paths and commodity symbols.+ Those can be added by the new `-v/--verbose` flag.++ - Output is now more compact and more likely to fit in 80-character lines.++ - When generating multiple outputs with a report interval, reports are now+ separated by an empty line.++- Several more kinds of Unicode space are allowed for separating digit groups in numbers.+ We now support (my guess of the ones that might show up in real world CSV files):+ space,+ no-break space,+ en space,+ em space,+ punctuation space,+ thin space,+ narrow no-break space,+ medium mathematical space.++- Glob patterns in `$LEDGER_FILE` are now respected.+ Eg, setting it to `*.journal` or `2???.journal` now works as expected.++- When hledger is reading a symbolically-linked journal file,+ relative paths in include directives are now evaluated+ relative to the directory of the real linked file,+ not the directory containing the symbolic link.++- Date parse errors are now simpler and clearer.+ They no longer try to repeat (a reconstruction of) the problem date,+ since the actual problem date is already visible in the highlighted file excerpt.++- Balance assertion error messages are clearer,+ and show the difference between expected and actual balance again.+ With --debug=2 they also show costs.++- `tsv:` and `ssv:` file name prefixes are now supported in addition to `csv:`.+ They force the file to be read as a .tsv (tab separated values) or .ssv (semicolon-separated values) file.+ [#2164] (Michael Rees)++- In CSV rules files, commented lines are now allowed within "if tables". (Dmitry Astapov)++- `balance --budget`'s CSV and TSV output now shows zeroes instead of nothing when there's no amount.++- `bs`,`bse`,`cf`,`is`:+ Report sections which are empty now show zero as their subtotal. (aragaer)++- `print` and `close` add a trailing decimal mark when needed to disambiguate a single digit group mark.+ They now also do this for balance assertion and balance assignment amounts.+ [#2176]++- hledger can now be built with GHC 9.8.++- hledger now requires safe >=0.3.20.++++Docs++- add version annotations for features added in 1.32 (hamzashezad)+- add Text encoding section, mention UTF-8 BOM support [#2189]+- journal: note that `payee` and `tag` directives can't have tags in comments, unlike `account`.+- journal: clarify how auto postings work.+- journal: list built-in special tag names+- journal: description/payee/note: clarify+- journal: amounts/commodities/numbers: cleanups+- journal: move intro before cheatsheet+- journal: transactions: explain transaction balancing [#2135]+- journal: transactions: mention debits, credits and sign+- journal: commodity directive: clarify & fix scope of effects [#2135]+- journal: D directive: clarify scope [#2191]+- journal: split Decimal marks, Digit group marks+- journal: move complex commodity styles, lot notation topics later+- journal: drop redundant/wrong Querying with cost or value section+- journal: cheatsheet: cleanups+- journal: assertions and ordering/commodities/subaccounts: cleanups+- csv: matchers: clarify, mention !/& limitation [#2088]+- csv: if tables: explain comments and order of application (Dmitry Astapov)+- add: document the effect of D default commodity directive [#815]+- balance: cleanups+- balance: budget report: moved "Budgets and subaccounts" to the Cookbook.+- bs,bse,cf,is: update sample output+- bse: note requirements for checking the accounting equation+- close: rewrite, give a better technique for excluding opening/closing balance txns [#2151]+- import: rename "deduplication" to "skipping", and rewrite+- examples: expand READMEs, clarify status for examples+- examples: invoicing: cleanups, renames+- examples: invoicing: pandoc-make-invoice: don't write to $LEDGER_FILE; remove the REMOVE THIS LINE line+- examples: csv: daedalus-transactions: update for current daedalus [#2171]+- examples: shared-finances/++++Scripts/addons++- hledger-bar, hledger-simplebal: shellcheck fixes, cleanups (Colin Dean)++- hledger-bar: Fix an error when NO_COLOR is not defined [#2159].+ Also, it's now more compliant with the no-color.org spec:++ Command-line software which adds ANSI color to its output by default+ should check for a NO_COLOR environment variable that, when present+ and not an empty string (regardless of its value), prevents the+ addition of ANSI color.++ so one can now temporarily override $NO_COLOR=1 in the environment by+ setting it empty: NO_COLOR= hledger ...++- hledger-txnsbycat: added++++API++- move readFileStrictly to hledger-lib:Hledger.Utils.IO++++[#815]: https://github.com/simonmichael/hledger/issues/815+[#1056]: https://github.com/simonmichael/hledger/issues/1056+[#2071]: https://github.com/simonmichael/hledger/issues/2071+[#2088]: https://github.com/simonmichael/hledger/issues/2088+[#2119]: https://github.com/simonmichael/hledger/issues/2119+[#2135]: https://github.com/simonmichael/hledger/issues/2135+[#2135]: https://github.com/simonmichael/hledger/issues/2135+[#2148]: https://github.com/simonmichael/hledger/issues/2148+[#2151]: https://github.com/simonmichael/hledger/issues/2151+[#2151]: https://github.com/simonmichael/hledger/issues/2151+[#2158]: https://github.com/simonmichael/hledger/issues/2158+[#2159]: https://github.com/simonmichael/hledger/issues/2159+[#2164]: https://github.com/simonmichael/hledger/issues/2164+[#2171]: https://github.com/simonmichael/hledger/issues/2171+[#2176]: https://github.com/simonmichael/hledger/issues/2176+[#2177]: https://github.com/simonmichael/hledger/issues/2177+[#2178]: https://github.com/simonmichael/hledger/issues/2178+[#2189]: https://github.com/simonmichael/hledger/issues/2189+[#2190]: https://github.com/simonmichael/hledger/issues/2190+[#2191]: https://github.com/simonmichael/hledger/issues/2191+++# 1.32.3 2024-01-28++Fixes++- A performance slowdown since 1.29, especially noticeable with many+ accounts and transactions, has been fixed. [#2153]++- Balance assertions involving mixed-cost balances are checked correctly again+ (a regression in 1.30). [#2072], [#2137], [#2150]++- import --catchup works again (a regression in 1.32). [#2156]++- --anon is now a deprecated hidden flag that raises an error,+ but is still usable as --obfuscate (also hidden). [#2133]++- Balance assertion error messages are clearer, and show the diff again.++++[#2156]: https://github.com/simonmichael/issue/2156++++# 1.32.2 2023-12-31++Fixes++- In CSV field assignments, %FIELD interpolation and `\n` can be used together again. [#2134]++- In timedot data, numbers beginning with a decimal point are accepted again. [#2130]++- In a `balance --budget` report, `--layout=tall` no longer hides commodity symbols.++- Value reports seeing a pathological price chain with 1000 or more+ steps now write their warning to the console, not a debug log file.++Improvements++- Allow megaparsec 9.6++Docs++- Updated: + Queries,+ Periodic transactions,+ Auto postings,+ Assertions and costs,+ Budget report++# 1.32.1 2023-12-07++- Fixed: `import` with multiple files now updates .latest files correctly. (#2125)++- Fixed: `print --round=hard` now properly pads/rounds amounts with inferred costs. (#2123)++- CSV matcher syntax: mention that ! and & can't be used in the same line yet. (#2088)++- Drop the "a difference of ..." line from balance assertion failure output.+ I feel it made the message harder to read and isn't really necessary.++- Declaring the empty payee name with `payee ""` now works,+ to let `hledger check payees` accept payee-less transactions.+ (#2119)++- Built-in tags with special meaning like `type:` and `t:` are now implicitly declared,+ so using type: in account declarations or generating t: with timedot letters + won't cause `hledger check tags` to fail.+ (#2119)++# 1.32 2023-12-01++Breaking changes++- Display styles and display precision are now managed more carefully+ during calculations and output, fixing a number of issues (#2111,+ "Precisiongeddon"). In brief:++ - Cost and value reports, such as `print -V`, now (1) consistently+ apply commodity display styles, and (2) do not add or discard+ decimal digits unnecessarily. (#2105)+ + - When "infinite decimals" arise during calculations (eg in value+ reports, or in `prices` or `roi` output), these are now shown+ limited to 8 decimal digits rather than 255.+ + - Non-print-like reports no longer add trailing decimal marks to+ disambiguate digit group marks (this was an unintended regression+ in 1.31). (#2115)+ + - We now document number formatting adjustments made in certain+ reports and output formats (hledger manual > REPORTING CONCEPTS >+ Amount formatting, parseability).+++Features++- Timedot format supports a new letters syntax for easier tagged time logging.+ (#2116)++- `print` has a new `beancount` output format for exporting to Beancount.+ This prints journal output more likely (though not guaranteed) to+ be readable by Beancount.++- In CSV rules, matchers using regular expressions can now interpolate+ their matched texts into the values they assign to fields (field+ assignment values can reference match groups).+ (#2009) (Jonathan Dowland)+ +- In CSV rules, matchers can be negated by prepending `!`.+ (#2088) (bobobo1618)++- Multi-column balance reports (from `bal`, `bs`, `is` etc.) can use+ the new `--summary-only` flag (`--summary` also works) to display+ just the Total and Average columns (if enabled by `--row-total` and+ `-A/--average`) and hide the rest.+ (#1012) (Stephen Morgan)++- All commands that suport csv output now also support `tsv`+ (tab-separated values) output. The data is identical, but the fields+ are separated by tab characters and there is no quoting or+ escaping. Tab, carriage return, and newline characters in data are+ converted to spaces (this should rarely if ever happen in practice).+ (#869) (Peter Sagerson).+++Improvements++- Journal format no longer fails to parse Ledger-style lot costs with spaces+ after the `{`, improving Ledger compatibility.++- `import` now does not update any .latest files until it has run+ without error (no failing strict checks, no failure while writing+ the journal file). This makes it more idempotent, so you can run it+ again after fixing problems.++- `print` now shows zeros with a commodity symbol and decimal digits+ when possible, preserving more information.++- `print` has a new option for controlling amount rounding (#2085):+ + - `--round=none` - show amounts with original precisions (default;+ like 1.31; avoids implying less or more precision than was+ recorded)++ - `--round=soft` - add/remove decimal zeros in non-cost amounts+ (like 1.30 but also affects balance assertion amounts)++ - `--round=hard` - round non-cost amounts (can hide significant digits)++ - `--round=all` - round all amounts and costs++ For the record:+ `print` shows four kinds of amount: posting amounts,+ balance assertion amounts, and costs for each of those.+ Past hledger versions styled and rounded these inconsistently.+ Since 1.31 they are all styled, and since 1.32 they are rounded as follows:+ + | hledger-1.32 print | amt | cost | bal | balcost |+ |--------------------|------|------|------|---------|+ | (default) | none | none | none | none |+ | --round=soft | soft | none | soft | none |+ | --round=hard | hard | none | hard | none |+ | --round=all | hard | hard | hard | hard |++- The `prices` command has had a number of fixes and improvements (#2111):++ - It now more accurately lists the prices that hledger would use+ when calculating value reports (similar to what you'd see with+ `hledger bal -V --debug=2`).+ + - The --infer-reverse-prices flag was confusing, since we always+ infer and use reverse prices; it has been renamed to `--show-reverse`.+ + - `--show-reverse` and `--infer-market-prices` flags now combine properly.+ + - `--show-reverse` now ignores zero prices rather than giving an error.+ + - Price amounts are now shown styled.+ + - Price amounts are now shown with all their decimal digits; or with+ 8 decimal digits if they appear to be infinite decimals (which can+ arise with reverse prices).+ + - Filtering prices with `cur:` or `amt:` now works properly.+ ++Fixes++- `print` now styles balance assertion costs consistently, like other+ amounts.++- `import` now works with `-s/--strict`.+ And more generally, when reading multiple input files, eg with+ multiple `-f` options, strict checks are done only for the overall+ combined journal (not for each individual file).+ (#2113)++- `tag:` queries now work when reading CSV files. (#2114)++- Using a `.json` or `.sql` file extension with `-o`/`--outputfile`+ now properly selects those output formats.++- Auto postings no longer break redundant equity/cost detection and+ transaction balancing. (#2110)+ +- Amounts set by balance assignment now affect commodity styles again.+ (#2091, a regression in 1.30)++- Timedot quantities with units are parsed more accurately.+ Eg a quantity like "15m" was evaluated as 0.249999999 not 0.25,+ and since hledger 1.21, it was printed that way also.+ Now we round such quantities to two places during parsing to get+ exact quarter-hour amounts. (#2096)++- The `demo` command no longer triggers a JSON decode error in asciinema+ 2.3.0. It now also shows a better error message if asciinema fails+ (#2094).++- Failing balance assertions with a cost now show correct markers in+ the error message. (#2083)+++Docs++- New:+ + - Amount formatting, parseability+ - Started new code docs for developers, based in the Hledger module's haddock++- Updated:+ + - aregister+ - commodity directive+ - Commodity display style+ - if table+ - Decimal marks, digit group marks+ - Regular expressions+ - Timedot++ +# 1.31 2023-09-03++Features++- Multi-pivot: the --pivot option now accepts multiple arguments,+ colon-delimited, to construct account names from multiple fields.+ (#2050, Eric Mertens)++Improvements++- The `print` command now more closely replicates the original journal+ amount styles, which is helpful when round-tripping / cleaning up+ journal files:++ - Amounts in conversion transactions could be displayed rounded to a+ lower precision; this no longer happens.+ (#2079)++ - Amounts could be displayed with extra zeros after the decimal mark;+ this no longer happens.++ - Amounts could display with a different precision if the journal+ included a timedot file; this no longer happens.++ - Costs in balance assertions were not displayed with standard+ styles like other amounts; now they are.++ - Zero amounts were always shown as just "0"; now they are shown+ with their original commodity symbol and style. (And if an+ inferred amount has multiple zeros in different commodities, a+ posting is displayed for each of these.)+ +- `print` no longer displays numbers with a single digit group mark+ and no decimal mark, which are ambiguous and hard to re-parse. Now+ if a number has digit group marks the decimal mark will always be+ shown also. Eg `1,000` (where the comma is a thousands separator)+ is now shown as `1,000.`.++- The check command's + `balancedwithautoconversion` and `balancednoautoconversion` checks+ have been renamed to `autobalanced` and `balanced`.++- `hledger check recentassertions` now reports failures at the first+ posting that's more than 7 days later than the latest balance+ assertion (rather than at the balance assertion). This is the thing+ actually triggering the error, and it is more likely to be visible+ or at least closer when you are working at the end of a journal+ file.++ Also, the suggested sample balance assertion now uses the same+ commodity symbol as in the failing posting (the first, if there are+ more than one); and, no longer includes a cleared mark.++- The import command now shows the file path being imported to.++- With --pivot, `desc` is now the preferred spelling for pivoting on+ description.++- The demo command now ignores an invalid journal file, like the other+ HELP commands.++- Debug output for equity conversion postings has been improved,+ making troubleshooting easier.++- Allow aeson 2.2, megaparsec 9.5.++Fixes++- In journal files, valid multicommodity transactions where the+ matching non-equity postings can't be auto-detected are no longer+ considered an error (as they were in hledger 1.29 and 1.30). Now,+ such transactions are accepted, and --infer-cost has no effect on+ them. This is similar to the behaviour of --cost, --infer-equity,+ and --infer-market-prices. (#2045)++- In journal files, equity conversion postings are now detected more+ tolerantly, using the same precision as the conversion posting's+ amount (#2041). Eg, the following transaction is now accepted:++ 2023-01-01+ Assets -8401USD @ 2.495 GEL+ ; ^ 209.60495 GEL, recognised as a match for the 209.60 below+ Equity:Conversion 84.01 USD+ Equity:Conversion -209.60 GEL+ Assets 209.60 GEL++- The roi command now reports TWR per period and overall TWR for+ multi-period reports.+ (#2068, Dmitry Astapov)++- The commands list no longer shows bar when hledger-bar is not installed (#2065),+ and had a few other cleanups.++# 1.30.1 2023-06-02++Fixes++- Add missing files to Hackage release, making it buildable.++Docs++- Replace note about repeated options.++# 1.30 2023-06-01++Breaking changes++- The CSV reader now properly skips all empty lines, as specified by docs.+ Previously, inner empty lines were not being skipped automatically.+ You might need to adjust the `skip` count in some CSV rules files.+ (#2024)++- Timedot format now generates a single multi-posting transaction per+ date line, and supports comments and tags on all lines.+ (#1754)++- Timeclock format now supports comments and tags.+ Descriptions can no longer contain semicolons.+ (#1220)++Features++- CSV rules files can now be read directly, as in+ `hledger -f foo.csv.rules CMD`. By default this will read data+ from foo.csv in the same directory.+ +- CSV rules files can use a new `source FILE` rule to specify the data file,+ with some convenience features:++ - If the data file does not exist, it is treated as empty, not an+ error.++ - If FILE is a relative path, it is relative to the rules file's+ directory. If it is just a file name with no path, it is relative+ to `~/Downloads/`.++ - If FILE is a glob pattern, the most recently modified matched file+ is used.++ This helps remove some of the busywork of managing CSV downloads.+ Most of your financial institutions's default CSV filenames are+ different and can be recognised by a glob pattern. So you can put a+ rule like `source Checking1*.csv` in foo-checking.csv.rules,+ periodically download CSV from Foo's website accepting your browser's+ defaults, and then run `hledger import checking.csv.rules` to import+ any new transactions. The next time, if you have done no cleanup, your+ browser will probably save it as something like Checking1-2.csv, and+ hledger will still see that because of the * wild card. You can choose+ whether to delete CSVs after import, or keep them for a while as+ temporary backups, or archive them somewhere.+ (Experimental)++- The balance command has a new --count report type+ which reports posting counts instead of amounts.++- Full boolean queries, allowing arbitrary use of AND, OR, NOT+ (case insensitive) and parentheses for grouping, are now supported.+ For backward compatibility, these require an `expr:` prefix.+ Existing queries work as before, and you can mix and match the+ old and new styles if you like.+ (Chris Lemaire)+ +- demo: This new command plays brief asciinema screencasts explaining+ various features and use cases. We will add more of these over time.+ (Experimental)++Improvements++- Add-on commands can now have `.js`, `.lua`, or `.php` file extensions.++- Generated and modified transactions and postings have the same hidden+ tags (beginning with underscore) as before, but no longer have visible+ tags added by default. Use `--verbose-tags` if you want them added.++- We now try harder to ensure `less` (and its `more` mode) show our+ ANSI formatting properly in help output.+ If you use some other $PAGER, you may have to configure it yourself+ to show ANSI (or disable ANSI entirely, eg by setting NO_COLOR=1).+ This is now documented in hledger manual > Paging.+ (#2015)++- The print command's `--match` mode has been refined.+ Previously, similarity completely outweighed recency, so a+ slightly-more-similar transaction would always be selected no matter+ how old it was. Now similarity and recency are more balanced,+ and it should produce the desired transaction more often.+ There is also new debug output (at debug level 1) for troubleshooting.++- Miscellaneous commands list updates.+ Help has been added for all published add-on commands (like hledger-lots).++- The help command's documentation now mentions an issue caused by+ a too-old `info` program, as on mac.+ (#1770)++Fixes++- Unbalanced virtual postings with no amount always infer a zero amount.+ This is fixing and clarifying the status quo; they always did this,+ but print always showed them with no amount, even with -x, and+ the behaviour was undocumented.++- On windows systems with multiple drive letters, the commands list+ could fail to show all installed add-ons.+ (#2040)++- Balancing a transaction with a balance assignment now properly respects costs.+ (#2039)++- The commands list no longer lists non-installed addons.+ (#2034)++- Since hledger 1.25, "every Nth day of month" period rules with N > 28 could+ be calculated wrongly by a couple of days when given certain forecast start dates.+ Eg `~ every 31st day of month` with `--forecast='2023-03-30..'`.+ This is now fixed.+ (#2032)++- Postings are now processed in correct date order when inferring balance assignments.+ (#2025)++- Posting comment lines no longer disrupt the underline position in error messages.+ (#1927)++- Debug output is now formatted to fit the terminal width.++Docs++- Miscellaneous manual cleanups.++- Rewrite introductory sections,+ Date adjustment,+ Directives,+ Forecasting,+ etc.++- Add Paging section.++- Remove archaic mentions of `setenv`.++API++- Renamed: Hledger.Cli.Commands: findCommand -> findBuiltinCommand++# 1.29.2 2023-04-07++Breaking changes++- 1.29's cleanup of the `close` command has been continued.+ Here are all the changes to `close` since hledger 1.28:++ - The default behaviour is now to print only one transaction: a closing transaction.++ - To print both closing and opening transactions as before,+ use the new `--migrate` flag.++ - The accounts closed by default are now just the ALE accounts+ (accounts declared or inferred as type `Asset`, `Liability`, or `Equity`).+ If you don't have account types configured, or+ to close some other set of accounts, provide query arguments that match them.+ To close all accounts as before, use a `.` argument to match them all.++ - To print a retain earnings transaction for RX accounts (accounts+ of type `Revenue` or `Expense`), use the new `--retain` flag.++ - The `equity` command alias, removed in 1.29, has been restored.++ - The `--open-acct` option, removed in 1.29, has been restored.++ - The `--closing` and `--opening` flags have been renamed to `--close` and `--open`.+ (`--close` had been removed in 1.29 and is now restored.)++ - The docs have been rewritten. Also the 1.29 release notes now mention+ the breaking change.++ - The command is marked experimental again.++ (#2020)++Fixes++- `type:` queries now "see through" account aliases and pivots,+ as they did in hledger <1.27, and as `acct:` queries do.+ (#2018)++- The corruption in 1.29's info manual is fixed. (#2023)++- The 1.29 release notes for periodic reports'/periodic transactions' start dates+ have been improved. Also the hledger manual's "Date adjustment" section+ has been corrected and clarified.+++# 1.29.1 2023-03-16++Improvements++- Hledger.Cli.Script now also exports++ Control.Applicative+ Control.Concurrent+ Data.Char+ Data.Functor+ System.IO+ System.IO.Error++ and new string helpers++ strip1Char+ stripBy+ strip1By++- Allow building with GHC 9.6.1 (#2011)++Fixes++- The stats report no longer displays "Exact" in front of dates. (#2012)++Docs++- remove duplicate in `hledger close` docs (Yehoshua Pesach Wallach)++# 1.29 2023-03-11++Breaking changes++- Periodic reports will now start exactly at the start date you have specified,+ rather than being adjusted to a natural period boundary; see below.++- The `close` command's CLI and default behaviour was changed; see below+ (and fixes in hledger 1.29.2+).++Features++- Periodic transactions and periodic reports can now start on any date.+ Eg, `hledger reg -M -b 1/15` now starts exactly on jan 15th, and a periodic rule+ like `~ monthly from 2023-01-15` now works as you'd expect instead of raising an error.+ This also improves our ability to read Ledger files.+ Inferred start/end dates, eg obtained from the journal instead of the command line,+ are still automatically adjusted to period boundaries, as before.++ Upgrade notes: in report commands which specify a start date, you might need to+ adjust that date to see the same periods as before. Eg:+ + - `-p 'weekly from 202304'` (equivalent to `-p 'weekly from 20230401'`)+ now gives periods like `2023-04-01..2023-04-07`.+ Change it to start on a monday (eg `-p 'weekly from 20230403`) to restore+ simple week periods like `2023-04-03W14`.++ - `-M -b 2023/1/15` now gives periods like `2023-01-15..2023-02-14 2023-02-15..2023-03-14`.+ Change it to start on a first of month (eg `-M -b 2023/1`) to restore+ simple month periods like `Jan Feb Mar`.++ (#1982)++- You can now freely combine @/@@ notation and conversion postings+ in a single transaction. This can help readability, and also allows+ more flexibility when recording cost. hledger will check that the+ two notations are in agreement, and ignore the redundancy if they are.+ (Conversion postings are postings to accounts with type `V`/`Conversion`+ or name `equity:conversion`/`equity:trade`/`equity:trading`,+ or subaccounts of these. See also COST.)++- In journal format there is now a `tag` directive for declaring tag names,+ and the check command now has a `tags` check to enforce use of declared tag names.++Improvements++- hledger's commands list has been reorganised for clarity.+ More add-on commands are now recognised and categorised,+ and unrecognised add-on commands are listed in a more compact+ multi-column layout.+ (Simon Michael, Michael Grünewald)++- hledger's commands list and command line help now use ANSI (bold+ headings) when supported.+ +- hledger's commands list and command line help now use a pager+ (respecting $PAGER) for long output except on MS Windows.++- hledger's `--version` output no longer shows `+` for dev builds made+ in dirty repos (it was buggy).++- The add command's Description completions now also include payee names+ (declared with `payee` or recorded in transactions with `|`),+ not just full descriptions.++- aregister now supports HTML output.+ (#1996) (Jonathan Dowland)++- aregister now shows a " (matching query)" hint in report title + when extra query args (other than date: or depth:) are used,+ to reduce confusion.++- The `close` command's CLI and default behaviour were changed,+ attempting to make it easier to understand and use. Some of its+ legacy flags and aliases were also dropped, without sufficient+ warning. For the full details, including subsequent cleanups,+ see hledger 1.29.2's change notes.++- register-match is now the `--match` mode of the register command.+ (This command was used by ledger-autosync at one point; if you still+ need it, hopefully `register --match` works similarly.)++- print-unique has been dropped, because it doesn't+ support print's options, it disorders same-day transactions, I don't+ know of any users or use cases, and it could easily be recreated as+ an addon script.++- print's JSON output now also includes source positions for `--forecast` transactions.+ (Chris Lemaire)++- Journal format now allows the empty commodity symbol to be written+ as `""`, so it's now possible to declare market prices for it:+ `P 2022-01-01 "" $100`. This can be useful for timedot data.++- Inferring costs from equity now happens after transaction balancing,+ not before. As a result, `--infer-costs` now works in transactions+ where an amount is left blank.++- `account` declarations now reject parenthesised account names,+ reducing confusion.+ (Chris Lemaire)++- Our journal reader now accepts more Ledger syntax, improving Ledger+ file compatibility (#1962). We now test our ability to at least+ read the sample journals from Ledger's baseline functional tests,+ and our success rate has improved from 80% to 90% since 1.28.+ + - `since` is accepted as synonym of `from` in period expressions+ - `apply year` and `year` are accepted as synonyms of `Y`+ - `(lot notes)` in amounts and `((valuation expressions))` after amounts are now ignored+ - directives + `A`, `assert`, `bucket`, `capture`, `check`, `define`,+ `expr`, `eval`, `python`, `value`,+ `apply fixed`, `apply tag`,+ `end apply fixed`, `end apply tag`, `end apply year`+ are now ignored+ - subdirectives of `payee`, `tag`, and `commodity` (other than `format`) are now ignored+ - `pop` directive is no longer supported++- When reading CSV, we now check that assigned account names are valid (parseable).+ (#1978)++Fixes++- aregister now handles an extra account query correctly. (#2007)++- balance's `--help` now mentions `--layout=tidy`++- Balance commands with `--layout=bare` now generate proper table+ layout in HTML output.++- register's `-w`/`--width` option no longer gives ugly parse error messages.++- stats's `--help` no longer wrongly claims to support -O/--output-format.++- Balance assignments with a cost now generate a correct balance assertion. (#1965)++- The CSV reader now properly skips header lines before attempting to parse records. (#1967)++Scripts/addons++- Scripts can now use Hledger.Cli.Script, a convenient new prelude which+ helps reduce import boilerplate. It currently re-exports:++ Control.Monad+ Data.Either+ Data.List+ Data.Maybe+ Data.Ord+ Data.Time+ Text.Printf hiding (formatString)+ Data.Text (Text, pack, unpack)+ Safe hiding (at)+ System.Directory+ System.Environment+ System.Exit+ System.FilePath+ System.Process+ Hledger+ Hledger.Cli+ Hledger.Cli.Main (argsToCliOpts)++ (Not much of Data.Text/Data.Text.IO because those need to be qualified.)++Docs++- chunk the hledger manual into parts, rename and rearrange sections for better structure/flow+- add a cheatsheet demonstrating all the main journal features that I recommend+- move a number of my not-so-recommended journal features into a less visible "Other syntax" section+- add: payees/descriptions completion+- areg: more advice on account-matching+- bal: --budget: clarify use of print --forecast+- bal: budget: compare with forecasting; add some tips+- balance cleanups/reorder+- check: adjacentconversionpostings was dropped+- cli: balance: fix link to Budgeting page+- cli: fix all links to Journal > Tags / Commands > tags+- codes: improve example suggested by Rob Nielsen+- csv, timeclock, timedot: clarify comment lines (#1953)+- csv: add new coinbase example+- csv: clarify amount-in/amount-out docs (#1970)+- csv: clarify skip/valid csv semantics (#1967)+- csv: clarify valid CSV requirements and issues (fix #1966)+- csv: cleanup, reorder, CSV rules tips -> Working with CSV+- csv: fix wrong if tables doc; rewrite several sections (#1977)+- csv: flatten, clean up CSV sections+- csv: improve Amount field / Setting amounts+- csv: note -in and -out are used together for one posting (#1970)+- csv: rules factoring tips+- csv: try to clarify how CSV fields and hledger fields work+- document --infer-market-prices with signed costs (#1870)+- fix duplicate market prices heading breaking info navigation+- import: note a pitfall with multifile import+- improve Directives summaries+- introduction/input/output improvements+- journal: cheatsheet: clarify date tag+- journal: rewrite Account names, mention brackets/parentheses (#1915)+- mention pivoting on a tag with multiple values (#1950)+- more cost notation docs; describe Ledger and Beancount cost notation+- more mention of posting order effect on inferring cost (#1959)+- period expressions doc updates+- Removed redundant paragraph in documentation. (J. B. Rainsberger)+- rename directive sections, fix many links+- reorganise commands list, like the CLI+- reorganise bin/README & the Scripts page, add entries for recent scripts+- replace "transaction prices" terminology with "costs"+- tags: discuss multi-values/overriding (#1950)+- update market price inference docs per sol+- Updated section on pivoting. Used synonyms for "member" in cases where there could be confusion with the tag named "member." (Robert Nielsen)+- use more standard and consistent boilerplate in hledger, ui, web man pages+- virtual postings: improve wording per Robert Nielsen+++# 1.28 2022-12-01++Features++- The `accounts` command has new flags: `--undeclared` (show accounts used but not declared), `--unused` (show accounts declared but not used), and `--find` (find the first account matched by the first command argument, a convenience for scripts). Also `-u` and `-d` short flags have been added for `--used` and `--declared`.++- A new CSV rule `intra-day-reversed` helps generate transactions in correct order with CSVs where records are reversed within each day.++- CSV rules can now correctly convert CSV date-times with a implicit or explicit timezone to dates in your local timezone. Previously, CSV date-times with a different time zone from yours could convert to off-by-one+ dates, because the CSV's timezone was ignored.+ Now,++ 1. When a CSV has date-times with an implicit timezone different from yours, you can use the `timezone` rule to declare it.++ 2. CSV date-times with a known timezone (either declared by `timezone` or parsed with `%Z`) will be localised to the system timezone+ (or to the timezone set with the `TZ` environment variable).++ (#1936)+ +Improvements++- print --match now respects -o and -O.++- print --match now returns a non-zero exit code when there is no acceptable match.++- Support megaparsec 9.3. (Felix Yan)++- Support GHC 9.4.++Fixes++- In CSV rules, when assigning a parenthesised account name to `accountN`, extra whitespace is now ignored, allowing unbalanced postings to be detected correctly.++Scripts/addons++- bin/hledger-move helps record transfers involving subaccounts and costs,+ eg when withdrawing some or all of an investment balance containing many lots and costs.++- bin/hledger-git no longer uses the non-existent git record command.+ (#1942) (Patrick Fiaux)++- bin/watchaccounts is a small shell script for watching the account tree as you make changes.++# 1.27.1 2022-09-18++Fixes++- Balance commands using `-T -O html` no longer fail with an error+ when there is no data to report.+ (#1933)++# 1.27 2022-09-01++Features++- `hledger check recentassertions` (and flycheck-hledger in Emacs if+ you enable this check) requires that all balance-asserted accounts+ have a balance assertion within 7 days before their latest posting.++ This helps remind you to not only record transactions, but also to+ regularly check account balances against the real world, to catch+ errors sooner and avoid a time-consuming hunt.++- The --infer-costs general flag has been added, as the inverse+ operation to --infer-equity. --infer-costs detects commodity+ conversion transactions which have been written with equity+ conversion postings (the traditional accounting notation) and adds+ PTA cost notation (@@) to them (allowing cost reporting).+ See https://hledger.org/hledger.html#equity-conversion-postings .+ (Stephen Morgan)++Improvements++- Many error messages have been improved. Most error messages now use+ a consistent, more informative format. + (#1436)++- The accounts command has a new --directives flag which makes it+ show valid account directives which you can paste into a journal.++- The accounts command has a new --positions flag which shows where+ accounts were declared, useful for troubleshooting.+ (#1909)++- Bump lower bounds for Diff and githash. (Andrew Lelechenko)++- GHC 8.6 and 8.8 are no longer supported. Building hledger now+ requires GHC 8.10 or greater.++Fixes++- Account display order is now calculated correctly even when accounts+ are declared in multiple files.+ (#1909)++- At --debug 5 and up, account declarations info is logged.+ (#1909)++- hledger aregister and hledger-ui now show transactions correctly+ when there is a type: query.+ (#1905)++- bal: Allow cumulative gain and valuechange reports.+ Previously, --cumulative with --gain or --valuechange would produce an+ empty report. This fixes this issue to produce a reasonable report.+ (Stephen Morgan)++- bal: budget goal amounts now respect -c styles (fixes #1907)++- bal: budget goals now respect -H (#1879)++- bal: budget goals were ignoring rule-specified start date++- cf/bs/is: Fixed non-display of child accounts when there is an+ intervening account of another type.+ (#1921) (Stephen Morgan)++- roi: make sure empty cashflows are skipped when determining first cashflow (Charlotte Van Petegem)+ Empty cashflows are added when the begin date of the report is before the first+ transaction.++Scripts/addons++- https://hledger.org/scripts.html - an overview of scripts and addons in bin/.++- paypaljson, paypaljson2csv - download txns from paypal API++- hledger-check-postable.hs - check that no postings are made to accounts with a postable:(n|no) tag++- hledger-addon-example.hs - script template+++# 1.26.1 2022-07-11++- require safe 0.3.19+ to avoid deprecation warning++# 1.26 2022-06-04++Improvements++- `register` and `aregister` have been made faster, by ++ - considering only the first 1000 items for choosing column+ widths. You can restore the old behaviour (guaranteed alignment+ across all items) with the new `--align-all` flag.+ ([#1839](https://github.com/simonmichael/hledger/issues/1839), Stephen Morgan)++ - discarding cost data more aggressively, giving big speedups for+ large journals with many costs.+ ([#1828](https://github.com/simonmichael/hledger/issues/1828), Stephen Morgan)++- Most error messages from the journal reader and the `check` command now use+ a consistent layout, with an "Error:" prefix, line and column numbers,+ and an excerpt highlighting the problem. Work in progress.+ ([#1436](https://github.com/simonmichael/hledger/issues/1436)) (Simon Michael, Stephen Morgan)++- `hledger check ordereddates` now always checks all transactions+ (previously it could be restricted by query arguments).++- The `--pivot` option now supports a `status` argument, to pivot on transaction status.++- Update bash completions (Jakob Schöttl)++Fixes++- Value reports with `--date2` and a report interval (like `hledger bal -VM --date2`)+ were failing with a "expected all spans to have an end date" error since 1.22;+ this is now fixed.+ ([#1851](https://github.com/simonmichael/hledger/issues/1851), Stephen Morgan)++- In CSV rules, interpolation of a non-existent field like `%999` or `%nosuchfield`+ is now ignored (previously it inserted that literal text).+ Note this means such an error will not be reported; + Simon chose this as the more convenient behaviour when converting CSV.+ Experimental.+ ([#1803](https://github.com/simonmichael/hledger/issues/1803), [#1814](https://github.com/simonmichael/hledger/issues/1814)) (Stephen Morgan)++- `--infer-market-price` was inferring a negative price when selling.+ ([#1813](https://github.com/simonmichael/hledger/issues/1813), Stephen Morgan)++- Allow an escaped forward slash in regular expression account aliases.+ ([#982](https://github.com/simonmichael/hledger/issues/982), Stephen Morgan)++- The `tags` command now also lists tags from unused account declarations.+ It also has improved command-line help layout.+ ([#1857](https://github.com/simonmichael/hledger/issues/1857))++- `hledger accounts` now shows its debug output at a more appropriate level (4).++# 1.25 2022-03-04++Breaking changes++- Journal format's `account NAME TYPECODE` syntax, deprecated in 1.13, has been dropped.+ Please use `account NAME ; type:TYPECODE` instead.+ (Stephen Morgan)++- The rule for auto-detecting "cash" (liquid asset) accounts in the `cashflow` report + has changed: it's now "all accounts under a top-level `asset` account, with + `cash`, `bank`, `checking` or `saving` in their name" (case insensitive, variations allowed). + So if you see a change in your `cashflow` reports, you might need to add+ `account` directives with `type:C` tags, declaring your top-most cash accounts.++Features++- The new `type:TYPECODES` query matches accounts by their accounting type.+ Account types are declared with a `type:` tag in account directives,+ or inferred from common english account names, or inherited from parent accounts,+ as described at [Declaring accounts > Account types].+ This generalises the account type detection of `balancesheet`, `incomestatement` etc.,+ so you can now select accounts by type without needing fragile account name regexps.+ Also, the `accounts` command has a new `--types` flag to show account types.+ Eg:++ hledger bal type:AL # balance report showing assets and liabilities+ hledger reg type:x # register of all expenses+ hledger acc --types # list accounts and their types++ ([#1820](https://github.com/simonmichael/hledger/issues/1820), + [#1822](https://github.com/simonmichael/hledger/issues/1822)) + (Simon Michael, Stephen Morgan)++- The `tag:` query can now also match account tags, as defined in account directives.+ Subaccounts inherit tags from their parents.+ Accounts, postings and transactions can be filtered by account tag.+ ([#1817](https://github.com/simonmichael/hledger/issues/1817))++- The new `--infer-equity` flag replaces the `@`/`@@` price notation in commodity+ conversion transactions with more correct equity postings (when not using `-B/--cost`).+ This makes these transactions fully balanced, and preserves the accounting equation.+ For example:++ 2000-01-01+ a 1 AAA @@ 2 BBB+ b -2 BBB++ $ hledger print --infer-equity+ 2000-01-01+ a 1 AAA+ equity:conversion:AAA-BBB:AAA -1 AAA+ equity:conversion:AAA-BBB:BBB 2 BBB+ b -2 BBB++ + `equity:conversion` is the account used by default. To use a different account,+ declare it with an account directive and the new `V` (`Conversion`) account type.+ Eg:+ + account Equity:Trading ; type:V++ ([#1554](https://github.com/simonmichael/hledger/issues/1554)) (Stephen Morgan, Simon Michael)++- Balance commands (`bal`, `bs` etc.) can now generate easy-to-process "tidy" CSV data + with `-O csv --layout tidy`.+ In tidy data, every variable is a column and each row represents a single data point + (cf <https://vita.had.co.nz/papers/tidy-data.html>).+ ([#1768](https://github.com/simonmichael/hledger/issues/1768), + [#1773](https://github.com/simonmichael/hledger/issues/1773), + [#1775](https://github.com/simonmichael/hledger/issues/1775)) + (Stephen Morgan)++Improvements++- Strict mode (`-s/--strict`) now also checks periodic transactions (`--forecast`) + and auto postings (`--auto`). + ([#1810](https://github.com/simonmichael/hledger/issues/1810)) (Stephen Morgan)++- `hledger check commodities` now always accepts zero amounts which have no commodity symbol. + ([#1767](https://github.com/simonmichael/hledger/issues/1767)) (Stephen Morgan)++- Relative [smart dates](hledger.html#smart-dates) may now specify an arbitrary number of some period into the future or past).+ Some examples:+ - `in 5 days`+ - `in -6 months`+ - `5 weeks ahead`+ - `2 quarters ago`+ + (Stephen Morgan)++- CSV output now always disables digit group marks (eg, thousands separators),+ making it more machine readable by default. + ([#1771](https://github.com/simonmichael/hledger/issues/1771)) (Stephen Morgan)++- Unicode may now be used in field names/references in CSV rules files.+ ([#1809](https://github.com/simonmichael/hledger/issues/1809)) (Stephen Morgan)++- Error messages improved:+ - Balance assignments+ - aregister+ - Command line parsing (less "user error")++Fixes++- `--layout=bare` no longer shows a commodity symbol for zero amounts. + ([#1789](https://github.com/simonmichael/hledger/issues/1789)) (Stephen Morgan)++- `balance --budget` no longer elides boring parents of unbudgeted accounts + if they have a budget. + ([#1800](https://github.com/simonmichael/hledger/issues/1800)) (Stephen Morgan)++- `roi` now reports TWR correctly++ - when there are several PnL changes occurring on a single day+ - and also when investment is fully sold/withdrawn/discounted at the end of a particular reporting period.++ ([#1791](https://github.com/simonmichael/hledger/issues/1791)) (Dmitry Astapov)++Documentation++- There is a new CONVERSION & COST section, replacing COSTING. + ([#1554](https://github.com/simonmichael/hledger/issues/1554))++- Some problematic interactions of account aliases with other features have been noted. + ([#1788](https://github.com/simonmichael/hledger/issues/1788))++- Updated: [Declaring accounts > Account types](https://hledger.org/hledger.html#account-types)++# 1.24.1 2021-12-10++Fixes++- `balance --declared` is now filtered correctly by a `not:ACCT` query.+ (#1783)++- More reliable --version output, with commit date and without patch level.++API changes:++- new type synonyms ProgramName, PackageVersion, VersionString+- versionStringForProgname -> versionString with extra argument+- versionStringFor -> versionStringWith with extra argument++# 1.24 2021-12-01++Features++- balance commands provide more control over how multicommodity amounts+ are displayed. (And they no longer elide too-wide amounts by default.)+ The --commodity-column flag has been deprecated and replaced by a new+ --layout option, with three values:+ + - wide (the default, shows amounts on one line unelided, like older hledger versions)+ - tall (a new display mode, shows one amount per line)+ - bare (like the old --commodity-columm, shows one commodity per line with symbols in their own column)+ + (Stephen Morgan)++- The balance commands have a new `--declared` flag, causing them to+ include leaf (ie, non-parent) accounts declared by account directives,+ even if they contain no transactions yet. Together with `-E`, this shows+ a balance for both used and declared accounts.+ The idea is to be able to see a useful "complete" balance report, even+ when you don't have transactions in all of your declared accounts yet.+ (#1765)++- journal files now support a `decimal-mark` directive as a more+ principled way (than `commodity` directives) to specify the decimal character+ in use in that file, to ensure accurate number parsing.+ (#1670, Lawrence Wu)++Improvements++- The stats command now shows rough but useful performance stats: run+ time and processing speed in transactions per second.++- balance: support the --related flag, like register, showing the+ other postings from the transactions. (#1469, Stephen Morgan)++- roi now uses posting dates when available, and honors the --date2+ flag. This will not change the results computed for the typical+ use-case, it just makes "roi" more thorough/consistent.+ (Dmitry Astapov)++- aregister now shows transactions' secondary date if the --date2 flag is used.+ (#1731)++- timedot: a D default commodity (and style) declared in a parent+ journal file will now be applied to timedot amounts. This means they+ can be priced and valued/converted.++- cli: The --pretty and --forecast options can now be written after the+ command name, like other general options.+ (Stephen Morgan)++- register -V -H with no interval now values at report end date, like balance.+ (#1718, Stephen Morgan)++- Allow megaparsec 9.2.++- Drop the base-compat-batteries dependency. (Stephen Morgan)++Fixes++- prices: Do not include zero amounts when calculating amounts for balance assignments. (#1736) (Stephen Morgan)+ This is not usually a problem, but can get in the way of auto-inferring prices.++- csv: Successfully parse an empty csv file. (#1183) (Stephen Morgan)++- balance: Balance reports with --depth=0 properly report aggregated+ values, not zero everywhere. (#1761) (Stephen Morgan)++- prices: Do not try to generate prices when there would be a zero+ denominator. Also correctly generate reverse prices for zero+ amounts. (Stephen Morgan)++- csv: Allow both amount-in and amount-out fields to contain a zero.+ (#1733, Stephen Morgan)++- balance: Balance reports should consider date: queries when+ calculating report span with --date2. (#1745, Stephen Morgan)++- print: auto: The print command should always display inferred+ amounts for --auto generated postings. (#1276, Stephen Morgan)+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +++# 1.23 2021-09-21++Features++- The balance command has a new `--gain` report type, showing+ unrealised capital gains/losses. Essentially, this is the difference+ between the amounts' costs and their total present value. More+ precisely, between the value of the amounts' costs and the value of+ the amounts on the valuation date(s). (Ie, you can report gain in a+ different currency.)+ ([#1623](https://github.com/simonmichael/hledger/issues/1623),+ [#1432](https://github.com/simonmichael/hledger/issues/1432),+ Stephen Morgan, Charlotte Van Petegem)++- The new `-c/--commodity-style` option makes it easy to override+ commodity display styles at runtime, eg to adjust the number of+ decimal places or change the position of the symbol.+ ([#1593](https://github.com/simonmichael/hledger/issues/1593), Arjen Langebaerd)++- The balance commands have a new `--commodity-column` flag that+ displays commodity symbols in a dedicated column, showing one line+ per commodity and all amounts as bare numbers.+ ([#1559](https://github.com/simonmichael/hledger/issues/1559),+ [#1626](https://github.com/simonmichael/hledger/issues/1626),+ [#1654](https://github.com/simonmichael/hledger/issues/1654),+ Lawrence Wu, Simon Michael, Stephen Morgan)++- The `balance --budget` option can now take an argument,+ a case insensitive description substring which selects a subset of+ the journal's periodic transactions for setting budget goals. + This makes it possible to keep multiple named budgets in one journal, + and select the one you want with --budget's argument. + ([#1612](https://github.com/simonmichael/hledger/issues/1612))++- Period expressions now support `every weekday`, `every weekendday` and+ `every mon,wed,...` (multiple days of the week).+ This is intended for periodic transaction rules used with+ `--forecast` (or `bal --budget`).+ ([#1632](https://github.com/simonmichael/hledger/issues/1632), Lawrence Wu)++- The new `--today=DATE` option allows overriding today's date. This+ can be useful in tests and examples using relative dates, to make+ them reproducible.+ ([#1674](https://github.com/simonmichael/hledger/issues/1674), Stephen Morgan)++- In CSV rules, multi-line comments are now supported. Newlines in CSV+ data are preserved, or newlines can be added by writing `\n` when+ assigning to `comment`, `comment1` etc. + (Malte Brandy)++Improvements++- Incremental performance improvements; hledger 1.23 is the fastest+ hledger yet, about 10% faster than 1.22. + (Stephen Morgan)++- `register` no longer slows down when there are many report intervals.+ ([#1683](https://github.com/simonmichael/hledger/issues/1683), Stephen Morgan)++- Numbers in SQL output now always use decimal period (`.`),+ independent of commodity display styles. + (Stephen Morgan)++- `--sort` now gives a more intuitive sort oder when there are+ multiple commodities. Negative numbers in one commodity are always+ less than positive numbers in another commodity.+ ([#1563](https://github.com/simonmichael/hledger/issues/1563), Stephen Morgan)++- `--infer-market-price` has been renamed to `--infer-market-prices`.+ (The old spelling still works, since we accept flag prefixes.)++- Our pretty-printed JSON now orders object attributes alphabetically,+ across all GHC and haskell lib versions.++- register with a report interval starting on custom dates+ (eg: `hledger reg -p "every 15th day of month") now makes the + date column wide enough to show the start and end dates.+ It also wastes less whitespace after the column.+ ([#1655](https://github.com/simonmichael/hledger/issues/1655), Stephen Morgan)++- The --forecast option will now reject a report interval in its+ argument, instead of silently ignoring it.++- In JSON output, object attributes are now ordered alphabetically,+ consistently for all GHC and haskell lib versions. + ([#1618](https://github.com/simonmichael/hledger/issues/1618), Stephen Morgan)++- JSON output now indents with 2 spaces rather than 4. + (Stephen Morgan)++- The balance commands' `-S/--sort-amount` flag now behaves more+ predictably and intuitively with multiple commodities.+ Multi-commodity amounts are sorted by comparing their amounts in+ each commodity, with alphabetically-first commodity symbols being+ most significant, and assuming zero with alphabetically-first commodity symbols being+ most significant, and assuming zero when a commodity is missing.+ ([#1563](https://github.com/simonmichael/hledger/issues/1563), + [#1564](https://github.com/simonmichael/hledger/issues/1564), Stephen Morgan)+ +- The close command now uses the later of today or journal's last day+ as default closing date, providing more intuitive behaviour when+ closing a journal with future transactions. Docs have been improved.+ ([#1604](https://github.com/simonmichael/hledger/issues/1604))++- Rules for selecting the forecast period (within with --forecast+ generates transactions) have been tweaked slightly, and+ some disagreement between docs and implementation has been fixed.+ Now, the forecast period begins on:+ - the start date supplied to the `--forecast` argument, if any+ - otherwise, the later of+ - the report start date if specified with -b/-p/date:+ - the day after the latest normal (non-periodic) transaction in the journal, if any+ - otherwise today.++ It ends on:+ - the end date supplied to the `--forecast` argument, if any+ - otherwise the report end date if specified with -e/-p/date:+ - otherwise 180 days (6 months) from today.++ This is more intuitive in some cases. (Eg:+ `hledger reg --forecast -b 2020-01-01` on a journal containing + only periodic transaction rules now shows forecast transactions + starting from 2020-01-01, rather than from today.)+ ([#1648](https://github.com/simonmichael/hledger/issues/1648), + [#1665](https://github.com/simonmichael/hledger/issues/1665),+ [#1667](https://github.com/simonmichael/hledger/issues/1667), + Stephen Morgan, Simon Michael)++- Require base >=4.11, prevent red squares on Hackage's build matrix.+ (We officially support GHC 8.6+, which means base 4.12, + but Hackage shows all packages building successfully with + base 4.11/GHC 8.4+ somehow, so it's still allowed..)++Fixes++- A rare bug causing incorrect balances to be reported by the+ cf/bs/bse/is commands, since hledger 1.19, has been fixed.+ (cf/bs/bse/is with --tree --no-elide --begin DATE and certain+ account directives could show wrong balances).+ ([#1698](https://github.com/simonmichael/hledger/issues/1698), Stephen Morgan)++- aregister now aligns multicommodity amounts properly (broken since 1.21).+ ([#1656](https://github.com/simonmichael/hledger/issues/1656), Stephen Morgan)++- `balance -E` (and hledger-ui Z) now correctly show zero parent accounts,+ fixing a bug introduced in hledger 1.19.+ ([#1688](https://github.com/simonmichael/hledger/issues/1688), Stephen Morgan)++- The `roi` command no longer gives an ugly error in a certain case+ with PnL applied on the first day of investment. (Dmitry Astapov)++- `--forecast` now generates transactions up to the day before the+ specified report end date (instead of two days before).+ ([#1633](https://github.com/simonmichael/hledger/issues/1633), Stephen Morgan)++- Certain errors in CSV conversion, such as a failing balance assertion,+ were always being reported as line 2.++# 1.22.2 2021-08-07++Breaking changes++- aregister no longer hides future transactions by default.+ This is a consequence of the fix for + [#1638](https://github.com/simonmichael/hledger/issues/1638). + It makes aregister consistent, so we think it's a reasonable change.+ So if you have future-dated transactions in your journal which you+ don't want reported, you now must exclude them with `-e tomorrow` or+ `date:-tomorrow` in the command, as with other reports.+ (Stephen Morgan)++Improvements++- Timedot format's doc has been rewritten.++Fixes++- Make balance assignments in forecasted transactions work again+ (broken in 1.22.1).+ Forecast transactions are now generated early and processed+ in the same way as other transactions.+ ([#1638](https://github.com/simonmichael/hledger/issues/1638), Stephen Morgan)++- aregister preserves the order of same-day transactions again+ (broken in 1.22.1).+ ([#1642](https://github.com/simonmichael/hledger/issues/1642), Stephen Morgan)++# 1.22.1 2021-08-02++Improvements++- Bash shell completions (for hledger, hledger-ui, hledger-web) are+ now included in the hledger package's release tarballs, making them+ more likely to be installed by system packages. (Jakob Schöttl)++- roi docs now discuss how to quote multi-word queries. (#1609, Dmitry+ Astapov)++- Allow megaparsec 9.1++Fixes++- `cur:` and `amt:` queries now match the original amounts before+ valuation and cost conversion, as they did before hledger 1.22. We+ believe this is the more useful behaviour in practice. (#1625)+ (Stephen Morgan)++- Queries now work better with `register --related`, no longer showing+ duplicate postings when more than one posting in a transaction is+ matched. (#1629) (Stephen Morgan)++- Valuation now works with `register --related`. (#1630) (Stephen+ Morgan)++- Auto posting rules now also see inferred amounts,+ not just explicit amounts. (#1412) (Stephen Morgan)++- Our info manuals now have more robust directory metadata (no+ subdirectory path), making them more likely to be linked in your+ top-level Info directory by system packages. (#1594) (Simon Michael,+ Damien Cassou)++- The error message for a non-existent input file no longer shows+ excess double quotes. (#1601, Stephen Morgan)++- Journal format docs: The commodity directive's scope is now+ correctly described (lasts until end of current file).++- The aregister command now properly ignores a `depth:` argument. + It might now also behave more correctly with valuation or `--txn-dates`.+ (#1634, Stephen Morgan)++# 1.22 2021-07-03++Features++- check: A new `balancednoautoconversion` check requires transactions+ to balance without the use of inferred transaction prices. (Explicit+ transaction prices are allowed.) This check is included in `--strict`+ mode. The old `autobalanced` check has been renamed to+ `balancedwithautoconversion`. (Stephen Morgan)++Improvements++- Many internal optimisations have been applied (cf hledger-lib+ changelog). Overall, you can expect most reports to be about 20%+ faster. The register report is more than 2x faster and uses 4x less+ memory. (Stephen Morgan)++ ~/src/hledger$ quickbench -w hledger-1.21,hledger+ Running 5 tests 1 times with 2 executables at 2021-06-29 13:13:26 HST:+ + Best times:+ +----------------------------------------------------++--------------+---------++ | || hledger-1.21 | hledger |+ +====================================================++==============+=========++ | -f examples/10000x1000x10.journal print || 1.18 | 0.90 |+ | -f examples/10000x1000x10.journal register || 12.82 | 5.95 |+ | -f examples/10000x1000x10.journal balance || 1.38 | 0.86 |+ | -f examples/1000x1000x10.journal balance --weekly || 0.96 | 0.78 |+ | -f examples/10000x1000x10.journal balance --weekly || 13.07 | 10.79 |+ +----------------------------------------------------++--------------+---------+++- ANSI color is now disabled automatically (on stdout) when the+ `-o/--output-file` option is used (with a value other than `-`).+ (#1533)++- ANSI color is now also available in debug output, determined in the+ usual way by `--color`, `NO_COLOR`, and whether the output (stderr)+ is interactive.+ +- The --version flag shows more details of the build, when known: git+ tag, number of commits since the tag, commit hash, platform and+ architecture. (Stephen Morgan)++- balance: Capitalisation of "account" and "total" (and lack of a+ colon in the latter) in CSV output is now consistent for single- and+ multi-period reports.++- balance reports' CSV output now includes full account names. (#1566)+ (Stephen Morgan)++- csv: We now accept spaces when parsing amounts from CSV. (Eric+ Mertens)++- json: Avoid adding unnecessary decimal places in JSON output. (Don't+ increase them all to 10 decimal places.) (Stephen Morgan)+ +- json: Simplify amount precision (asprecision) in JSON output.+ It is now just the number of decimal places, rather than an object.+ (Stephen Morgan)++- GHC 9.0 is now officially supported, and GHC 8.0, 8.2, 8.4 are not;+ building hledger now requires GHC 8.6 or greater.++- Added a now-required lower bound on containers. (#1514)++Fixes++- Auto posting rules now match postings more precisely, respecting+ `cur:` and `amt:` queries. (#1582) (Stephen Morgan)++- balance reports: Fix empty cells when amounts are too wide to fit+ (broken since 1.20) (#1526). (Stephen Morgan)++- csv: Fix the escaping of double quotes in CSV output (broken in+ 1.21). (Stephen Morgan, #1508)++- register: Fix the running total when there is a report interval+ (broken since 1.19) (#1568). (Stephen Morgan)++- stats: No longer gets confused by posting dates. (#772) (Stephen Morgan)++- timeclock: `hledger print` shows timeclock amounts with just 2+ decimal places again (broken in 1.21). (#1527)++- When all transaction amounts have the same sign, the error message+ no longer adds an inferred price. (#1551) (Stephen Morgan)++- Cleaned up some references to old man pages. (Felix Yan)++# 1.21 2021-03-10++## general++- hledger is now generally about 10% more memory- and time-efficient,+ and significantly more so in certain cases, eg journals with many+ total transaction prices. (Stephen Morgan)++- The `--help/-h` and `--version` flags are no longer position-sensitive;+ if there is a command argument, they now always refer to the command+ (where applicable).++- The new `--info` flag opens the hledger info manual, if "info" is in $PATH.+ `hledger COMMAND --info` will open COMMAND's info node.++- The `--man` flag opens the hledger man page, if "man" is in $PATH.+ `hledger COMMAND --man` will scroll the page to CMD's section, if "less"+ is in $PATH. (We force the use of "less" in this case, overriding any+ $PAGER or $MAN_PAGER setting.)++- Some command aliases, considered deprecated, have been removed:+ `txns`, `equity`, and the single-letter command aliases `a`, `b`,+ `p`, and `r`. This was discussed at+ https://github.com/simonmichael/hledger/pull/1423 and on the hledger+ mail list. It might annoy some folks; please read the issue and do+ follow up there if needed.+ +- Notable documentation updates:+ the separate file format manuals have been merged into the hledger manual,+ the topic hierarchy has been simplified,+ the `balance` command docs and "commands" section have been rewritten.++## valuation++- Costing and valuation are now independent, and can be combined.+ `--value=cost` and `--value=cost,COMM` are still supported+ (equivalent to `--cost` and `--cost --value=then,COMM` respectively), + but deprecated. (Stephen Morgan)++- `-V` is now always equivalent to `--value=end`. (Stephen Morgan)++- `--value=end` now includes market price directives as well as+ transactions when choosing a valuation date for single-period+ reports. (#1405, Stephen Morgan)++- `--value=end` now picks a consistent valuation date for single- and+ and multi-period reports. (#1424, Stephen Morgan)++- `--value=then` is now supported with all reports, not just register. (Stephen Morgan)++- The too-vague `--infer-value` flag has been renamed to `--infer-market-price`.+ Tip: typing `--infer-market` or even `--infer` is sufficient.+ The old spelling still works, but is now deprecated.++## commands++- add: Infix matches are now scored higher. If the search pattern+ occurs in full within the other description, that match gets a +0.5+ score boost.++- add: `--debug` now shows transaction matching results, useful when+ troubleshooting.++- balance: To accomodate new report types, the+ `--change|--cumulative|--historical|--budget` flags have been split+ into two groups: report type (`--sum|--budget|...`) and accumulation+ type (`--change|--cumulative|--historical`). `--sum` and `--change`+ are the defaults, and your balance commands should still work as+ before. (Stephen Morgan et al, #1353)++- balance: The `--valuechange` report type has been added, showing the+ changes in period-end values. (Stephen Morgan, #1353)++- balance: With `--budget`, the first and last subperiods are enlarged+ to whole intervals for calculating the budget goals also. (Stephen+ Morgan)++- balance: In multi-period balance reports, specifying a report period+ now also forces leading/trailing empty columns to be displayed,+ without having to add `-E`. This is consistent with `balancesheet`+ etc. (#1396, Stephen Morgan)++- balancesheet, cashflow: declaring just a Cash account no longer+ hides other Asset accounts.++- check: Various improvements:++ - check name arguments may be given as case-insensitive prefixes+ - `accounts` and `commodities` may also be specified as arguments+ - `ordereddates` now checks each file separately (#1493)+ - `ordereddates` no longer supports the `--unique` flag or query arguments+ - `payees` is a new check requiring payee declarations+ - `uniqueleafnames` now gives a fancy error message like the others+ - the old `checkdates`/`checkdupes` commands have been dropped++- help: The `help` command now shows only the hledger (CLI) manual,+ its `--info/--man/--pager` flags have been renamed to `-i/-m/-p`,+ and `--cat` has been dropped.++- help: With a TOPIC argument (any heading or heading prefix, case+ insensitive), it will open the manual positioned at this topic if+ possible. (Similar to the new `--man` and `--info` flags described above.)+ <!-- `hledger help print` will show `print`'s doc with the best available viewer (usually info). -->+ <!-- `hledger help print -m` is equivalent to `hledger print --man`.) -->++- payees: Add `--used`/`--declared` flags, like the `accounts` command.++- print: Now always shows amounts with all decimal places,+ unconstrained by commodity display style. This ensures more+ parseable and sensible-looking output in more cases, and behaves+ more like Ledger's print. (There may be a cosmetic issue with+ trailing zeroes.) (#931, #1465)++- print: With `--match`, infix matches are now scored higher, as with+ the add command.++- print: `--match` now provides debug output useful for troubleshooting.++ If you forget to give `--match` an argument, it can confusingly+ consume a following flag. Eg if you write:++ hledger print --match -x somebank # should be: hledger print --match=somebank -x++ it gets quietly parsed as:++ hledger print --match="-x"++ Now you can at least use --debug to figure it out:++ hledger print --match -x somebank --debug+ finding best match for description: "-x"+ similar transactions:+ ...++- roi: Now supports the valuation options (#1417), and uses commodity display styles.+ Also the manual has been simplified, with some content moved to the Cookbook.+ (Dmitry Astapov):++## journal format++- The `commodity` directive now properly sets the display style of the+ no-symbol commodity. (#1461)++## csv format++- More kinds of malformed signed numbers are now ignored, in+ particular just a sign without a number, which simplifies sign+ flipping with amount-in/amount-out.++## API++- API changes include:+ ```+ Hledger.Cli.Utils:+ +journalSimilarTransaction+ + Hledger.Cli.Commands.Add:+ transactionsSimilarTo -> Hledger.Data.Journal.journalTransactionsSimilarTo+ and now takes a number-of-results argument+ ```+++# 1.20.4 2021-01-29++- aregister: ignore a depth limit, as in 1.19 (#1468).+ In 1.20-1.20.3, aregister had stopped showing transactions in subaccounts + below a depth limit. Now it properly shows all subaccount transactions, + ensuring that the register's final total matches a balance report with + similar arguments.++# 1.20.3 2021-01-14++- When searching for price chains during valuation/currency conversion:++ - It no longer hangs when there are price loops. (And in case of+ future bugs, it will give up rather than search forever.) (#1439)+ - It now really finds the shortest path. (#1443)+ - Useful progress info is displayed with `--debug=1` or `--debug=2`.++- balance, incomestatement: End-valued multi-period balance change+ reports (eg: `bal -MV`) have been reverted to show value-of-change,+ as in previous hledger versions, rather than change-of-value, for+ now. (#1353, #1428) (Stephen Morgan)++- balance: End-valued balance change reports now choose the same final+ valuation date and show consistent results whether single-period or+ multi-period. (#1424) (Stephen Morgan)++- balance: the `--drop` option now works with `csv` and `html` output.+ (#1456) (Ilya Konovalov)++- check: the `commodities` check, and `-s`/`--strict` mode, now ignore+ the "AUTO" internal pseudo-commodity. (#1419) (Ilya Konovalov)++- register: Then-valued multi-period register reports+ (eg: `register -M --value=then`) now calculate the correct values.+ (#1449) (Stephen Morgan)++- roi: now shows a better error message when required prices are+ missing. (#1446) (Dmitry Astapov)++- The no-symbol commodity's input number format can now be set by a+ `commodity` directive, like other commodities. (#1461)++# 1.20.2 2020-12-28++- help: Fix loss of capitalisation in part of the hledger-ui manual. ++- Fix the info manuals' node structure.++- Drop unused parsec dependency.++# 1.20.1 2020-12-15++- bal, bs, cf, is: In amount-sorted balance reports, equal-balance accounts + are now reliably sorted by name. (Simon Michael, Stephen Morgan)++- help: Fix the topic hierarchy in Info manuals.++# 1.20 2020-12-05++## general++- strict mode: with -s/--strict, hledger requires that+ all accounts and commodities are declared with directives.++- Reverted a stripAnsi change in 1.19.1 that caused a 3x slowdown of amount rendering+ in terminal reports. (#1350)++- Amount and table rendering has been improved, so that stripAnsi is no longer needed.+ This speeds up amount rendering in the terminal, speeding up some reports by 10% or more since 1.19.+ (Stephen Morgan)++- Amount eliding no longer displays corrupted ANSI codes (#1352, Stephen Morgan)++- Eliding of multicommodity amounts now makes better use of available space,+ avoiding unnecessary eliding (showing as many amounts as possible within+ 32 characters). (Stephen Morgan)++- Command line help for --no-elide now mentions that it also disables eliding of+ multicommodity amounts.++- Query terms containing quotes (eg to match account names containing quotes)+ now work properly. (#1368, Stephen Morgan)++- cli, journal: Date range parsing is more robust, fixing failing/incorrect cases such as: (Stephen Morgan)++ - a hyphenated range with just years (`2017-2018`)+ - a hyphenated date with no day in a hyphenated range (`2017-07-2018`)+ - a dotted date with no day in a dotted range (`2017.07..2018.02`)+ +- Debug output is prettier (eg, in colour), using pretty-simple instead of pretty-show.++- csv, timedot, timeclock files now respect command line --alias options,+ like journal files. (#859)++- Market price lookup for value reports is now more robust, fixing several bugs+ (and debug output is more informative).+ There has been a slight change in functionality: when chaining prices,+ we now prefer chains of all "forward" prices, even if longer, with chains+ involving reverse prices being the last resort.+ (#1402)++## commands++- add: number style (eg thousands separators) no longer disturbs the value+ that is offered as default. (#1378)++- bal: --invert now affects -S/--sort-amount, reversing the order. (#1283, #1379) (Stephen Morgan)++- bal: --budget reports no longer insert an extra space inside the brackets. (Stephen Morgan)++- bal: --budget reports now support CSV output (#1155)++- bal, is, bs --change: + Valued multiperiod balance change reports now show changes of value, + rather than the value of changes. (#1353, Stephen Morgan)++- bal: clearer debug output, following debug levels policy++- check: A new command which consolidating the various check-* commands.+ It runs the default, strict, or specified checks and produces+ no output and a zero exit code if all is well.++- check-dates: this command is deprecated and will be removed+ in next release; use "hledger check ordereddates" instead.++- check-dupes: this command is deprecated and will be removed+ in next release; use "hledger check uniqueleafnames" instead.++- import: The journal's commodity styles (declared or inferred) are now applied+ to imported amounts, overriding their original number format.++- roi: TWR now handles same-day pnl changes and cashflows,+ calculation failure messages have been improved, and+ the documentation includes more detail and examples.+ (#1398) (Dmitry Astapov)++## journal format++- The journal's commodity styles are now applied to forecasted transactions. (#1371)++- journal, csv: commodity style is now inferred from the first amount, as documented,+ not the last. This was "working wrongly" since hledger 1.12..++- A zero market price no longer causes "Ratio has zero denominator" error+ in valued reports. (#1373)++## csv format++- The new `decimal-mark` rule allows reliable number parsing+ when CSV numbers contain digit group marks (eg thousands separators).++- The CSV reader's verbose "assignment" debug output is now at level 9.+++# 1.19.1 2020-09-07++- Fix alignment of coloured numbers (#1345, #1349, Stephen Morgan)++- Fix a regression in account type autodetection for accounts with+ capitalised names. (#1341)++- Allow megaparsec 9++# 1.19 2020-09-01++## general++- When parsing dates, the year is now required to have at least four+ digits. So eg we no longer accept `200/1/1` as a valid date, it+ would need to be written `0200/1/1`. This was done for.. reasons,+ and is experimental; let us know if it causes you trouble.++- The --color/--colour=WHEN command line option, support for the+ NO_COLOR environment variable, and smarter autodetection of colour+ terminals have been added (#1296)++- Command line options taking a numeric argument are now validated+ more carefully, preventing issues with unexpected negatives or Int+ overflow. (Stephen Morgan)++- In queries, you can now specify a quarter like `2020q1` or `q4`+ (the q is case-insensitive). (#1247, Henning Thieleman, Stephen Morgan)++- In report intervals, `fortnightly` has been added as a synonym for+ `biweekly`. (Stephen Morgan)++- -t and -l command line flags have been added as short forms of+ --tree and --flat (#1286)++- All reports displaying accounts now choose flat mode by default+ (Stephen Morgan)++- Reports now show at most 2 commodities of multicommodity amounts,+ unless the --no-elide flag is used. This helps keep them readable by+ default, since multicolumn, multicommodity balance reports otherwise+ tend to become very wide, especially in tree mode.++- Numbers with more than 255 decimal places, which we do not support,+ now give an error instead of silently misparsing. (#1326)++- Digit groups are now limited to at most 255 digits each. (#1326)++- Account aliases (on command line or in journal) containing a bad+ regular expression now give a more detailed error message.++- A tab character could get parsed as part of a commodity symbol, with+ confusing results. This no longer happens. (#1301, Dmitry Astapov)++- Debug output is now organised better by debug level.+ The levels are:++ 0. normal command output only (no warnings)+ 1. useful warnings & most common troubleshooting info (valuation, eg)+ 2. common troubleshooting info, more detail+ 3. report options selection+ 4. report generation+ 5. report generation, more detail+ 6. input file reading+ 7. input file reading, more detail+ 8. command line parsing+ 9. any other rarely needed or more in-depth info++- Added a missing lower bound for aeson, making cabal installs more+ reliable. (#1268)++- lib: parseAmountQueryTerm: allow whitespace around arg parts (#1312)+ Whitespace around the operator, sign, or number is now tolerated.++## commands++- account,bal,bs,cf,is: --drop now also works in tree mode (Stephen Morgan)++- add: fix an error in the command line help (arguments are inputs,+ not a query)++- aregister: a new command showing a transaction-oriented account+ register, like hledger-ui, hledger-web, or your bank statement. + Each line represents a whole transaction in one account, unlike+ the register command which shows individual postings possibly from+ multiple accounts. You might prefer aregister when reconciling+ real-world asset/liability accounts, and register when reviewing+ detailed revenues/expenses. (#1294)++- bal,bs,cf,is: boring parents are now elided by default in tabular+ balance reports too, like single-column reports. (Stephen Morgan)++- bal,bs,cf,is: monthly column headings are no longer elided to just+ the short month name, if multiple years are being displayed.++- bal --budget's column headings are now end dates rather than+ periods when appropriate (ie with --cumulative or --historical).++- bs,cf,is: -%/--no-total no longer forces --no-total (Stephen Morgan)++- bs,cf,is: --no-total now hides subtotals as well as the grand total+ (Stephen Morgan)++- codes: a new command for listing transaction codes++- print: a new `sql` output format has been added (Dmitry Astapov)++- roi: errors are now shown without a call stack++- tags: add --parsed flag, hide empties without --empty. With the+ --parsed flag, all tags or values are shown in the order they are+ parsed from the input data, including duplicates. With -E/--empty,+ any blank/empty values will also be shown, otherwise they are+ omitted.++## journal format++- account directives can specify a new `Cash` account type. This is a+ subtype of `Asset`, denoting accounts which should be displayed+ in `cashflow` reports. + +- The built-in regular expressions for choosing default account types+ have been tweaked, and documentation for account types has been+ improved.++## csv format++- Inferring the appropriate default field separator based on file+ extension (, for .csv, ; for .ssv, \t for .tsv) now works as+ documented.++- Conditional rule patterns can now be grouped with the `&` (AND) operator,+ allowing more powerful matching. (Michael Sanders)++- Invalid csv rules files now give clearer parse error messages.+ (Dmitry Astapov)++- "If tables", a compact bulk format for conditional rules, have been+ added. (Dmitry Astapov)++- csv conversion with a lot of conditional rules is now faster (Dmitry Astapov)+++# 1.18.1 2020-06-21++- journal: document recursive wildcards++- by default, value reports work as in 1.17; to infer market prices from+ transactions, add the new --infer-value flag. (#1239, #1253)++- organise debug output better++- print: amounts in csv output now have commodity symbol, digit group+ separators and prices removed (Dmitry Astapov)+++# 1.18 2020-06-07++## General++- The --forecast flag now takes an optional argument+ (--forecast=PERIODICEXPR), allowing periodic transactions to+ start/end on any date and to overlap recorded transactions.+ (#835, #1236) (Dmitry Astapov)++- An upper case file extension no longer confuses file format+ detection. (#1225)++- In the commands list, redundant source scripts are now hidden+ properly when a corresponding .com/.exe file exists. (#1225)++- We now show `..` instead of `-` to indicate date ranges, eg in+ report titles, to stand out more from hyphenated dates. + (Stephen Morgan)+ +- Period expressions (eg in -p, date:, and periodic rules) now accept+ `to`, `until`, `-`, or `..` as synonyms. (Stephen Morgan)++- When parsing amounts, whitespace between sign and number is now allowed.++- A clearer error message is shown on encountering a malformed regular+ expression.++## commands++- commands allowing different output formats now list their supported+ formats accurately in --help (#689)++- commands allowing JSON output now actually produce JSON (#689)++- bal, bs: show .. (not ,,) in report titles, like other reports++## journal format++- We now also infer market prices from transactions, like Ledger.+ See https://hledger.org/hledger.html#market-prices (#1239). + + Upgrade note: this means value reports (-V, -X etc.) can give+ different output compared to hledger 1.17. If needed, you can+ prevent this by adding a P directive declaring the old price, on or+ after the date of the transaction causing the issue.++- The include directive now accepts a file format prefix, like the+ -f/--file option. This works with glob patterns too, applying the+ prefix to each path. This can be useful when included files don't+ have the standard file extension, eg:++ include timedot:2020*.md++- We now accept (and ignore) Ledger-style lot dates+ (`[DATE]`) and four lot price forms (`{PRICE}`, `{{PRICE}}`,+ `{=PRICE}`, `{{=PRICE}}`), anywhere after the posting amount but+ before any balance assertion.++- We now accept Ledger-style parenthesised "virtual posting+ costs" (`(@)`, `(@@)`). In hledger these are equivalent to the+ unparenthesised form.++- The unbalanced transaction error message is clearer, especially when+ postings all have the same sign, and is split into multiple lines+ for readability.++## csv format++- You can now generate up to 99 postings in a transaction. (Vladimir Sorokin)++- You can now generate postings with an explicit 0 amount. (#1112)++- For each posting, when both numbered and unnumbered amount+ assignments are active (eg: both `amount` and `amount1`), we ignore+ the unnumbered ones. This makes it easier to override old `amount`+ rules.+ +- Fix a 1.17.1 regression involving amount-in/amount-out. (#1226)++- Assigning too many non-zero or zero values to a posting amount now+ gives a clearer error. (#1226)+++# 1.17.1.1 2020-03-19++- update bounds after some belated hledger-* version bumps++# 1.17.1 2020-03-19++- csv: amount1 no longer forces a second posting or second posting amount.+ The "special handling for pre 1.17 rules" should now be less+ noticeable. amount1/amount2 no longer force a second posting or+ explicit amounts on both postings. (Only amount/amount-in/amount-out+ do that.) Error messages and handling of corner cases may be more+ robust, also.++- journal: a commodity directive without decimal mark now gives a more+ verbose error message with examples++- journal: inclusive balance assignments now work (#1207)++- require newer Decimal, math-functions libs to ensure consistent+ rounding behaviour, even when built with old GHCs/snapshots. + hledger uses banker's rounding (rounds to nearest even number, eg+ 0.5 displayed with zero decimal places is "0").++# 1.17 2020-03-01++## General++- hledger's default date format is now YYYY-MM-DD (ISO-8601 dates).+ (Brian Wignall, Jakob Schöttl, Simon Michael)++- Drop the file format auto-detection feature.++ For a long time hledger has auto-detected the file format when it's+ not known, eg when reading from a file with unusual extension (like+ .dat or .txt), or from standard input (-f-), or when using the+ include directive (which currently ignores file extensions). This+ was done by trying all readers until one succeeded. This worked+ well in practice. But recent changes to timedot format have made+ this kind of auto-detection unreliable. (timedot and journal formats+ overlap).++ For predictability and to minimise confusion, hledger will no longer+ guess; when there's no file extension or reader prefix available, it+ always assumes journal format.++ To specify one of the other formats, you must use its standard file+ extension (`.timeclock`, `.timedot`, `.csv`, `.ssv`, `.tsv`), or a+ reader prefix (`-f csv:foo.txt`, `-f timedot:-`).++ Experimental, feedback welcome.++- Fix extra $ symbol (Mateus Furquim)++- --output-format now rejects invalid formats++- Numbers in JSON output now provide a floating point Number+ representation as well as our native Decimal object representation,+ since the later can sometimes contain 255-digit integers. The+ floating point numbers can have up to 10 decimal digits (and an+ unbounded number of integer digits.)+ Experimental, suggestions needed. (#1195)++- Fix finding latest date in queryEndDate Or queries and simplify+ date comparison code. (Stephen Morgan)++- Fix issue 457. (Jacek Generowicz)+ Issue #457 pointed out that commands such as++ hledger ui 'amt:>200'++ failed. This was because the process of dispatching from `hledger ui`+ to `hledger-ui` (note addition of `-`) lost the quotes around+ `amt:>20` and the `>` character was interpreted as a shell redirection+ operator, rather than as part of the argument.++ The machinery for quoting or escaping arguments which contain+ characters which require quoting or escaping (thus far whitespace and+ quotes) already existed. This solution simply adds shell stdio+ redirection characters to this set.++## commands++- add: you can use `<` to undo and redo previous inputs (Gaith Hallak)++- bs, cf, is, bal, print, reg: support json output++- bs, cf, is: fix excess subreport columns in csv output++- bs, cf, is, bal: fix an issue with border intersections in+ --pretty-tables output. (Eric Mertens)++- close: fix a rounding bug that could generate unbalanced transactions. (#1164)++- close: hide cost prices by default, show them with --show-costs.+ close no longer preserves costs (transaction prices) unless you ask+ it to, since that can generate huge entries when there are many+ foreign currency/investment transactions. (#1165)++- close: equity amounts are omitted by default, for simpler entries;+ -x/--explicit shows them (usually causing more postings). (#1165)++- close: --interleaved generates equity postings alongside each closed+ account, making troubleshooting easier.++- close: "equity:opening/closing balances" is now the default+ closing and opening account.++- close: --close-desc/--open-desc customise the closing/opening+ transaction descriptions. (#1165)++- close: some --open*/--close* flags have been simplified for memorability:++ --closing -> --close+ --opening -> --open+ --close-to -> --close-acct+ --open-from -> --open-acct++ The old flags are accepted as hidden aliases, and deprecated. (#1165)++- print, register: a new valuation type, --value=then, shows the+ market value at each posting's date.++- print: -V/-X/--value now imply -x/--explicit, as -B/--cost does.+ This avoids a bug where print -V of a transaction with an implicit+ commodity conversion would convert only some of its postings to value.++## journal format++- The include directive no longer tries all readers. It now picks+ just one, based on the included file's extension, defaulting to+ journal. (It doesn't yet handle a reader prefix.)++- The default commodity (D) directive now limits display precision too. (#1187)+ D directives are now fully equivalent to commodity directives for+ setting a commodity's display style. (Previously it couldn't limit+ the number of decimal places.) When both kinds of directive exist,+ commodity directives take precedence. When there are multiple D+ directives in the journal, only the last one affects display style.++## csv format++- Conditional blocks can now match single fields. \o/++- The experimental --separator command line option has been dropped,+ replaced a new `separator` directive in CSV rule files. (Aleksandar Dimitrov)+ Also the `.tsv` and `.ssv` file extensions are now recognised,+ and set the default `separator` to TAB and semicolon respectively.+ (#1179)++- Allow manual assignment of the "expenses:unknown" account name. (#1192)++- CSV rule keywords are now case insensitive. (Aleksandar Dimitrov)++## timeclock format++- Misc. fixes making parsing more robust. (Jakob Schöttl)++## timedot format++- More support for org mode: org headlines can now be used for date+ lines and timelog items (the stars are ignored). Also, any org+ headlines before the first date line are ignored.++- You can now write a description after a date, which will be used in+ all of that day's transactions.+++# 1.16.2 2020-01-14++- add support for megaparsec 8 (#1175)+ +- close: mention --close-to/--open-from in docs+ +# 1.16.1 2019-12-03++- Drop unnecessary mtl-compat dependency++- Fix building with GHC 8.0, 8.2++# 1.16 2019-12-01++## General++- add support for GHC 8.8, base-compat 0.11 (#1090)++- drop support for GHC 7.10++- The benchmark suite has been disabled.++- The --anon flag now also anonymises transaction codes and account+ names declared with account directives. (Mykola Orliuk) (#901)++## commands++- balance/bs/cf/is: balance commands now support the -%/--percent flag+ to show amounts as percentages of the column's total. (Michael Kainer)++ If there are multiple commodities involved in a report hledger bails+ with an error message. This can be avoided by using -B/--cost. Also note+ that if one uses -% with the balance command the chances are high that+ all numbers are 0. This is due to the fact that by default balance sums+ up to zero. If one wants to use -% in a meaningful way with balance one+ has to add a query.++ In order to keep the implementation as simple as possible --tree has no+ influence over how the percentages are calculated, i.e., the percentages+ always represent the fraction of the columns total. If one wants to know+ the percentages relative to a parent account, one has to use a query to+ narrow down the accounts.++- balance: --budget no longer errors when there is neither budget nor+ transactions in the report period (Dmitry Astapov)++- balance: --budget has improved debug output (shows budget txns)+ (Dmitry Astapov)++- check-dates: now sets the exit status code (Amitai Burstein)++- close: no longer strips zeroes after the decimal mark, and preserves+ parseable output (#1137)++- close: the --close-to, --open-from options allow closing/opening+ account names to be chosen++- import: create the journal if missing, like the add command+ Streamlines import/migration instructions.++- import: --catchup marks all transactions imported, without importing++- import: more informative output: mention the input files, also show+ a message when nothing was imported++- prices: show price amounts with proper display style; always show+ full precision++- roi: don't give an error with empty input data (Dmitry Astapov)++- tests: unit tests are now run by tasty, and show coloured output by default (#1090).+ Test running options have changed, see the command help. + Some unit tests have been collapsed, so the reported test count has+ dropped a little.++## journal format++- Fixed: wrong dates generated by certain periodic transaction rules,+ eg "~ every 12 months from 2019/04". (Dmitry Astapov) (#1085)++## csv format++CSV conversion is now more powerful (#1095, Dmitry Astapov, Simon Michael):++- A variable number of postings can be generated, from zero to nine. (#627, #1095)++- In conditional blocks, `skip` can be used to skip one or more+ records after a pattern match, or the new `end` rule can be used to+ skip all remaining records. (#1076)++- The new `balance-type` CSV rule controls which kind of balance+ assertions are generated (=, ==, =*, ==*)++- Postings with balance assignments can be generated. (#1000)++- Both the amount-in/amount-out fields having a non-empty value is now+ accepted, as long as one of them is zero. (#570)++- Line feeds/carriage returns in (quoted) CSV values are now converted+ to spaces during conversion. (#416, #841)++- Field assignments can now unset a field (eg a posting can be+ suppressed by assigning no value to its account).++- CSV records with varying lengths are now allowed; short records will+ be padded with empty fields as needed. This allows us to handle eg+ exported Google spreadsheets, where trailing empty fields are omitted.++- Journals generated from CSV are now finalised and checked like+ ordinary journals (#1000). So invalid transactions generated from+ CSV will be rejected, amount styles will be standardised etc.++- Fixed: we no longer add an extra (third) space between description and comment.++- Fixed: whitespace on the line after an if block no longer causes misparsing. (#1120)++- Fixed: an empty field assignment no longer consumes the next line. (#1001)++- Fixed: interpolation of field names containing punctuation now works.++- Docs have been rewritten and clarified.++Migration notes:++- When `print`ing from CSV, there is now one less space between+ transaction descriptions and comments, which may generate noisy+ diffs if you are comparing old and new reports. diff -w+ (--ignore-all-space) will filter these out.++- CSV rules now give you more freedom to generate any journal+ entries you want, including malformed or unbalanced ones. + The csv reader now checks the journal after conversion,+ so it will report any problems with the generated entries.++- Balance assertions generated from CSV are not checked, currently.+ This is appropriate when you are downloading partial CSV data to+ be merged into your main journal. If you do need to check balance+ assertions right away, you can pipe through hledger again:++ $ hledger -f a.csv print | hledger -f- print++++# 1.15.2 2019-09-05++- -V and -X now respect a report end date (set with -e or -p or date:)+ when choosing the valuation date (which determines the market prices+ used). This is how -V works in hledger 1.14 and Ledger, and it means+ that -V isn't exactly equivalent to either --value=end or+ --value=now. Possibly some other corner cases in valuation have been+ fixed as well. "Effect of --value on reports" in the hledger manual+ has been updated and is more accurate.++# 1.15.1 2019-09-02++- add commodities, descriptions, diff, notes, payees commands to manual++# 1.15 2019-09-01++## General++- There is a new valuation option `--value=TYPE[,COMM]`, with+ backwards-compatible `-B/--cost`, `-V/--market`, `-X/--exchange=COMM`+ variants. These provide control over valuation date (#329), and+ inference of indirect market prices (similar to Ledger's -X) (#131).+ Experimental.+ +- Market valuation (-V/-X/--value) is now much faster (#999):++ +-------------------------------------------++--------------+--------------++ | || hledger-1.14 | hledger-1.15 |+ +===========================================++==============+==============++ | -f examples/10000x1000x10.journal bal -Y || 2.43 | 2.44 |+ | -f examples/10000x1000x10.journal bal -YV || 44.91 | 6.48 |+ | -f examples/10000x1000x10.journal reg -Y || 4.60 | 4.15 |+ | -f examples/10000x1000x10.journal reg -YV || 61.09 | 7.21 |+ +-------------------------------------------++--------------+--------------+++- How date options like `-M` and `-p` interact has been updated and clarified.+ (Jakob Schöttl) (#1008, #1009, #1011)++- Restore `--aux-date` and `--effective` as `--date2` aliases (#1034).+ These Ledger-ish spellings were dropped over the years, to improve+ `--help`'s layout. Now we support them again, as semi-hidden flags+ (`--help` doesn't list them, but they are mentioned in `--date2`'s help).++## commands++- add, web: on Windows, trying to add transactions to a file path+ containing trailing periods (eg `hledger add -f Documents.\.hledger.journal`) + now gives an error, since this could cause data loss otherwise (#1056).+ This affects the add command and hledger-web's add form.++- bal: --budget: don't always convert to cost.++- bal: --budget: don't show a percentage when budgeted and actual+ amounts are in different commodities.++- bal/bs/bse: `-H/--historical` or `--cumulative` now disables `-T/--row-total` (#329).+ Multiperiod balance reports which show end balances (eg, `bal -MH` or `bs -M`)+ no longer show a Totals column, since summing end balances generally+ doesn't make sense.++- bs: show end date(s) in title, not transactions date span (#1078)+ Compound balance reports showing ending balances (eg balancesheet),+ now show the ending date (single column) or range of ending+ dates (multi column) in their title. ,, (double comma) is used+ rather than - (hyphen) to suggest a sequence of discrete dates+ rather than a continuous span.++- close: preserve transaction prices (costs) accurately (#1035).+ The generated closing/opening transactions were collapsing/misreporting+ the costs in balances involving multiple costs.+ Now, each separately-priced amount gets its own posting.+ (And only the last of these (for each commodity) gets a balance assertion.)+ Also the equity posting's amount is now always shown explicitly, + which in multicommodity situations means that multiple equity postings are shown. + The upshot is that a balance -B report will be unchanged after+ the closing & opening transactions generated by the close command.++- descriptions, payees, notes commands added (Caleb Maclennan)++- diff: Gabriel Ebner's hledger-diff is now a built in command,+ and https://github.com/gebner/hledger-diff is deprecated.++- help: don't require a journal file++- print: now also canonicalises the display style of balance assertion amounts (#1042)++- reg: show negative amounts in red, like balance and Ledger++- reg: fix `--average`, broken since 1.12 (#1003)++- stats: show count of market prices (P directives), and the commodities covered++- tags: add --values flag to list tag values.++- tags: now runs much faster when there many tags++## journal format++- Transactions and postings generated/modified by periodic transaction+ rules and/or transaction modifier rules are now marked with tags+ (`generated-transaction`, `generated-posting`, `modified`) for+ easier troubleshooting and filtering.++## csv format++- When interpolating CSV values, outer whitespace is now stripped.+ This removes a potential snag in amount field assignments (#1051),+ and hopefully is harmless and acceptable otherwise.++- We no longer add inter-field spaces in CSV error messages.+ Some CSV errors would show the problem record, eg:++ 2000-01-01,a,"1"+ + with extra spaces added, eg:++ the CSV record is: "2000-01-01", "a", "1"++ which was inaccurate and not valid RFC-4180 CSV format.++- CSV parse errors are human-readable again (broken since 1.11) (#1038)++- CSV rules now allow the amount to be unassigned, if there is an+ assignment to "balance" (generating a balance assignment in this+ case). (#1000)+++# 1.14.2 2019-03-20++- require easytest <0.3 to fix build issue++- fix some CSV parse errors which weren't in human readable format++# 1.14.1 2019-03-01++- fix missing Commodities.txt build error++# 1.14 2019-03-01++- journal: subaccount-including balance assertions have been+ added, with syntax =* and ==* (experimental) (#290)++- new commodities command lists commodity symbols++- new --invert option flips sign of amounts in reports++# 1.13.2 2019-02-04++- print, register: restore the accidentally dropped -o, -O flags (#967)++# 1.13.1 2019-02-02++- stop depending on here to avoid haskell-src-meta/stackage blockage.++# 1.13 2019-02-01++- cli: reorganised commands list. Addons now have a + prefix.++- cli: the command line help and manual section for all hledger's+ commands are now consistent, and generated from the same source.++- cli: comprehensive bash completion support is now provided (in+ shell-completion/). See how-to in the Cookbook. (Jakob Schöttl)++- balance --budget: budget amounts now aggregate hierarchically, like+ account balances. Unbudgeted accounts can be shown with -E/--empty+ (along with zero-balance accounts), and the --show-budgeted flag has+ been dropped. (Dmitry Astapov)++- balance: new --transpose flag switches the rows and columns of+ tabular balance reports (in txt and csv output formats). (Dmitry+ Astapov)++- close: generated balance assertions now have exact amounts with all+ decimal digits, ignoring display precision. Also, balance assertion+ amounts will no longer contain prices. (#941, #824, #958)++- files: now shows up in the commands list++- import: be silent when there's nothing to import++- roi: percentages smaller than 0.01% are displayed as zero (Dmitry+ Astapov)++- stats, ui: correct file order is preserved when using --auto (#949)++- journal: account directive: the account name can now be followed by+ a comment on the same line++- journal: account directive: account types for the bs/bse/cf/is+ commands can now be set with a `type:` tag, whose value is `Asset`,+ `Liability`, `Equity`, `Revenue`, `Expense`, `A`, `L`, `E`, `R` or+ `X` (case-insensitive). The previous syntax (`account assets A`) is+ now deprecated.++- journal: account directive: account sort codes like `account 1000`+ (introduced in 1.9, deprecated in 1.11) are no longer supported.++- journal: transaction modifiers (auto postings) can affect periodic+ transactions (--auto can add postings to transactions generated with+ --forecast). (Dmitry Astapov)++- journal: balance assertion errors now show exact amounts with all+ decimal digits. Previously it was possible, in case of a commodity+ directive limiting the display precision, to have a balance+ assertion error with asserted and actual amounts looking the+ same. (#941)++- journal: fixed a periodic transaction parsing failure (#942) (Dmitry+ Astapov)++# 1.12.1 2018-12-03++- roi: use math-functions lib instead of statistics,+ be more stackage nightly compatible++# 1.12 2018-12-02++- install script: ensure a new-enough version of stack; more informative output++- build with GHC 8.6/base-4.12 (Peter Simons)++- add required upper bound for statistics (Samuel May)++- --anon anonymises more thoroughly (including linked original postings) (Moritz Kiefer)++- unbalanced transaction errors now include location info (Mykola Orliuk)++- accounts command: --drop also affects the default flat output, without needing an explicit --flat flag++- accounts command: the --codes flag has been dropped++- accounts command: filtering by non-account-name queries now works++- add command: fix transaction rendering regression during data entry and in journal file++- balance command: fix wrongful eliding of zero-balance parent accounts in tree mode (Dmitry Astapov)++- journal format, bs/bse/cf/is commands: account directives can declare account types (#877)+ Previously you had to use one of the standard english account names+ (assets, liabilities..) for top-level accounts, if you wanted them to+ appear in the right place in the balancesheet, balancesheetequity,+ cashflow or incomestatement reports.++ Now you can use your preferred account names, and use account directives+ to declare which accounting class (Asset, Liability, Equity, Revenue or+ eXpense) an account (and its subaccounts) belongs to, by writing one of+ the letters A, L, E, R, X after the account name, after two or more+ spaces. This syntax may change (see issue). Experimental.++ Currently we allow unlimited account type declarations anywhere in the+ account tree. So you could declare a liability account somewhere under+ assets, and maybe a revenue account under that, and another asset account+ even further down. In such cases you start to see oddities like accounts+ appearing in multiple places in a tree-mode report. I have left it this+ way for now in case it helps with, eg, modelling contra accounts, or+ combining multiple files each with their own account type+ declarations. (In that scenario, if we only allowed type declarations on+ top-level accounts, or only allowed a single account of each type,+ complications seem likely.)++- journal format: periodic transaction rules now require a double space separator.+ In periodic transaction rules which specify a transaction description or+ same-line transaction comment, this must be separated from the period+ expression by two or more spaces, to prevent ambiguous parsing. Eg+ this will parse correctly as "monthly" thanks to the double space:++ ~ monthly In 2020 we'll end this monthly transaction.++- journal format: exact/complete balance assertions (Samuel May).+ A stronger kind of balance assertion, written with a double equals sign,+ asserts an account's complete account balance, not just the balance in+ one commodity. (But only if it is a single-commodity balance, for now.)+ Eg:++ 1/1+ (a) A 1+ (a) B 1+ (a) 0 = A 1 ; commodity A balance assertion, succeeds+ (a) 0 == A 1 ; complete balance assertion, fails++- journal format: account directives now allow whitespace or a comment after the account name++- journal format: using \~ for home directory in include directives now works (#896) (Mykola Orliuk)++- journal format: prevent misleading parse error messages with cyclic include directives (#853) (Alex Chen)++- journal format: transaction modifier multipliers handle total-priced amounts correctly (#928).+ Multipliers (*N) in transaction modifier rules did not multiply+ total-priced amounts properly. Now the total prices are also multiplied,+ keeping the transaction balanced.++- journal format: do amount inference/balance assignments/assertions before transaction modifiers (#893, #908) (Jesse Rosenthal)+ Previously, transaction modifier (auto postings) rules were applied+ before missing amounts were inferred. This meant amount multipliers could+ generate too many missing-amount postings, making the transaction+ unbalanceable (#893).++ Now, missing amount inference (and balance assignments, and balance+ assertions, which are interdependent) are done earlier, before+ transaction modifier rules are applied (#900, #903).++ Also, we now disallow the combination of balance assignments and+ transaction modifier rules which both affect the same account, which+ could otherwise cause confusing balance assertion failures (#912).+ (Because assignments now generate amounts to satisfy balance assertions+ before transaction modifier rules are applied (#908).)++- journal format: periodic transaction rules are now aware of Y default year directives. (#892)+ Ie when a default year Y is in effect, they resolve partial or relative+ dates using Y/1/1 as the reference date, rather than today's date.++# 1.11.1 2018-10-06++- fix wrong transaction rendering in balance assertion errors and when+ using the add command++# 1.11 2018-09-30++- The default display order of accounts is now influenced by+ the order of account directives. Accounts declared by account+ directives are displayed first (top-most), in declaration order,+ followed by undeclared accounts in alphabetical order. Numeric+ account codes are no longer used, and are ignored and considered+ deprecated.++ So if your accounts are displaying in a weird order after upgrading,+ and you want them alphabetical like before, just sort your account+ directives alphabetically.++- Account sorting (by name, by declaration, by amount) is now more+ robust and supported consistently by all commands (accounts,+ balance, bs..) in all modes (tree & flat, tabular & non-tabular).++- close: new --opening/--closing flags to print only the opening or+ closing transaction++- files: a new command to list included files++- prices: query arguments are now supported. Prices can be filtered by+ date, and postings providing transaction prices can also be filtered.++- rewrite: help clarifies relation to print --auto (#745)++- roi: a new command to compute return on investment, based on hledger-irr++- test: has more verbose output, more informative failure messages,+ and no longer tries to read the journal++- csv: We use a more robust CSV lib (cassava) and now support+ non-comma separators, eg --separator ';' (experimental, this flag+ will probably become a CSV rule) (#829)++- csv: interpolated field names in values are now properly case insensitive, so+ this works:++ fields ...,Transaction_Date,...+ date %Transaction_Date++- journal: D (default commodity) directives no longer break multiplier+ amounts in transaction modifiers (AKA automated postings) (#860)++- journal: "Automated Postings" have been renamed to "Transaction Modifiers".++- journal: transaction comments in transaction modifier rules are now parsed correctly. (#745)++- journal: when include files form a cycle, we give an error instead+ of hanging.++- upper-case day/month names in period expressions no longer give an error (#847, #852)++# 1.10 2018-06-30++- journal: many parse error messages have become more informative, and+ some now show the source line and error location.++- journal: ;tag: is no longer parsed as a tag named ";tag" (#655)++- journal: transaction price amounts having their own price amounts is+ now a parse error++- journal: amounts with space as digit group separator and trailing whitespace+ now parse correctly (#780)++- journal: in amounts containing digits and a single space, the space+ is now interpreted as a digit group separator, not a decimal separator (#749)++- journal: in commodity/format/D directives, the amount must now include a decimal separator.++ When more precise control is needed over number parsing, our+ recommended solution is commodity directives. Commodity directives+ that don't specify the decimal separator leave things ambiguous,+ increasing the chance of misparsing numbers. In some cases it could+ cause amounts with a decimal point to be parsed as if with a digit+ group separator, so 1.234 became 1234.++ It seems the simple and really only way to do this reliably is to require+ an explicit decimal point character. Most folks probably do this already.+ Unfortunately, it makes another potential incompatibility with ledger and+ beancount journals. But the error message will be clear and easy to+ work around.++- journal: directives currently have diverse and somewhat tricky+ semantics, especially with multiple files. The manual now describes+ their behaviour precisely.++- journal: `alias` and `apply account` directives now affect `account` directives (#825)++- journal: periodic transactions can now have all the usual transaction fields+ (status mark, code, description, comment), for generating more expressive+ forecast transactions.++- journal: forecast transactions now have the generating period+ expression attached as a tag named "recur".++- journal: periodic transactions now start on the first instance of the+ recurring date, rather than the day after the last regular transaction (#750)++- journal: periodic transaction rules now allow period expressions relative to today's date++- csv: amount-in/amount-out errors are more detailed++- balance: --drop is now ignored when not in flat mode,+ rather than producing a corrupted report (#754)++- budget: --drop now preserves the <unbudgeted> top-level account in --budget reports++- register: in CSV output, the code field is now included (#746)++- smart dates now allow the YYYYMM format, and are better documented++- use hledger-lib 1.10++# 1.9.1 2018-04-30++- use hledger-lib 1.9.1++- budget (balance --budget): monthly columns are displayed in the+ proper order. This fixes a regression in 1.9.++- budget: budgets can be built from periodic transactions with+ different intervals again. In 1.9, budgets were restricted to a+ single interval, but this was a mistake. This restores the 1.5+ behaviour.++- budget: budget reports are more intuitive and much less likely to+ produce no output.++- budget: when no report interval is specified, a budget report for+ the whole journal period is shown.++- budget: periodic transactions and the requested report period can+ each have their own start/end dates, and the resulting report will+ span the union of those periods, showing zeroes where data is+ missing.++- budget: total row and total/average columns are now calculated correctly++- budget: actual, percentage, and goal amounts are now aligned in+ columns for better readability (usually, unless numbers get huge).++- budget: combining --budget and --sort-amount is not yet supported+ and now gives an error.++- csv: handle "-%amount" in a rule when the CSV amount is parenthesised (#736)++- journal: automated postings are now generated early, before journal finalisation,+ so they are present for amount inference, transaction balancing, and balance assertions+ (#729)++- journal: automated postings are now inserted right after the posting that triggered them+ (#729)++- cli: command-line account aliases are now applied early, before journal finalisation,+ so they are equivalent to alias directives in the journal (#730)++- journal: inferred amounts now have the appropriate standard amount style applied+ (setting the precision correctly, eg). (#737)++- journal: when checking for balanced transactions, amount styles declared with+ commodity directives are also used (previously only inferred amount styles were).++# 1.9 2018-03-31++- support ghc 8.4, latest deps++- journal: account directives can define a numeric account code to+ customize sorting. bal/bs/cf/is will sort accounts by account code,+ if any, then account name.++- journal: support scientific number notation (#704, #706)++- csv: reading a CSV file containing no records is no longer an error++- cli: when the system text encoding is UTF-8, ignore any UTF-8 BOM+ prefix found when reading files. (Paypal's new CSV has this BOM+ prefix, causing a confusing parse error.)++- cli: tabular reports no longer have a trailing blank line added.+ (This allows omitting the ">=0" delimiters in our functional tests,+ making them easier to read and maintain.)++- acc: the accounts command now has --declared and --used flags++- bal: the --invert flag flips all signs++- bal: --drop now works with CSV output++- bal/bs/bse/cf/is: show overall report span in title++- bal/bs/bse/cf/is: show short month names as headings in monthly reports++- bal/bs/bse/cf/is: these commands can now generate HTML output++- bal/bs/is/cf: drop short name and indent fields from multicolumn CSV++- bs/bse/cf/is: these, the "financial statement" commands, now show+ normal income, liability and equity balances as positive numbers.+ Negative numbers now indicate a contra-balance (eg an overdrawn+ checking account), a net loss, or a negative net worth. This makes+ these reports more like conventional financial statements, and easier+ to read and share with others. (Other commands, like balance, have not+ changed.) (experimental)++- bs/cf/is: always show a tabular report, even with no report+ interval. Previously you would get a simple borderless report like+ the original balance command. Less code, fewer bugs.++- bs/bse/cf/is: in CSV output, don't repeat the headings row for each subreport++- budget: warn that CSV output with bal --budget is unimplemented++- budget: bal --budget shows budget goals even with no or zero actual amounts.+ Makes budget reports more intuitive, at the cost of a temporary hack+ which may misorder columns in some cases (if actual and budget+ activity occur in a different range of columns).++- budget: --budget uses only periodic txns with the selected interval.\+ Budgets with different interval, eg a daily and weekly budget, are independent.++- budget: show mostly fixed-width columns for readability++- budget: fix bug where a budget report could include budget goals+ ending on the day before the report start date (splitSpan issue)++- close: the equity command has been renamed to close. It now ignores+ any begin date (it always closes historical end balances). It also+ ignores --date2.++# 1.5 2017-12-31++- --auto adds Ledger-style automated postings to transactions (Dmitry Astapov, Mykola Orliuk)++- --forecast generates Ledger-style periodic transactions in the future (Dmitry Astapov, Mykola Orliuk)++- -V/--value uses today's market prices by default, not those of last transaction date. #683, #648++- add: suggest implied (parent) and declared (by account directives) account names also++- bal: --budget shows performance compared to budget goals defined+ with periodic transactions. Accounts with budget goals are+ displayed folded (depth-clipped) at a depth matching the budget+ specification. Unbudgeted accounts are hidden, or with+ --show-unbudgeted, shown at their usual depth. (Dmitry Astapov)++- import: the output of --dry-run is now valid journal format++- print: -B shows converted amounts again, as in 1.1, even without+ -x. #551 (Mykola Orliuk, Simon Michael)++- tag: the first argument now filters tag names, additional arguments+ filter transactions (#261)++- remove upper bounds on all but hledger* and base (experimental)++# 1.4 2017-09-30++- cli: a @FILE argument reads flags & args from FILE, one per line++- cli: reorganized commands list, added some new command aliases:++ - accounts: a+ - balance: b+ - print: p, txns+ - register: r++- cli: accept -NUM as a shortcut for --depth=NUM (eg: -2)++- cli: improve command-line help for --date2 (#604)++- cli: make --help and -h the same, drop --man and --info for now (#579)++- help: offers multiple formats, accepts topic substrings.+ The separate info/man commands have been dropped. help now+ chooses an appropriate documentation format as follows:++ - it uses info if available,+ - otherwise man if available,+ - otherwise $PAGER if defined,+ - otherwise less if available,+ - otherwise it prints on stdout+ - (and it always prints on stdout when piped).++ You can override this with the `--info`/`--man`/`--pager`/`--cat` flags.+ (#579)++- bal/bs/cf/is: --sort-amount/-S sorts by largest amount instead of+ account name++- bs/cf/is: support --output-file and --output-format=txt\|csv+ The CSV output should be reasonably ok for dragging into a+ spreadsheet and reformatting.++- bal/bs/cf/is: consistent double space between columns, consistent+ single final blank line. Previously, amounts wider than the column+ headings would be separated by only a single space.++- bs/is: don't let an empty subreport disable the grand totals (fixes #588)++- cf: exclude asset accounts with ":fixed" in their name (Christian G. Warden, Simon Michael, #584)++- new balancesheetequity command: like balancesheet but also shows+ equity accounts (Nicholas Niro)++- new import command: adds new transactions seen in one or more input+ files to the main journal file++- print: --new shows only transactions added since last time+ (saves state in .latest.JOURNALFILE file)++- new tags command: lists tags in matched transactions++- most addons formerly shipped in bin/ are now builtin commands. These+ include: check-dates, check-dupes, equity, prices, print-unique,+ register-match, rewrite.++- refactor: new Commands module and subdirectory.+ Builtin commands are now gathered more tightly in a single module,+ Hledger.Cli.Commands, facilitating change. The legacy "convert"+ command has been dropped.++- refactor: BalanceView -> CompoundBalanceCommand++- deps: drop support for directory < 1.2++- deps: allow ansi-terminal 0.7++- deps: drop oldtime flag, require time 1.5+++- deps: simplify shakespeare bounds++- deps: remove ghc < 7.6 support++# 1.3.1 2017-08-25++- bs/is: don't let an empty subreport disable the grand totals (#588)++- allow megaparsec 6 (#594)++- allow megaparsec-6.1 (Hans-Peter Deifel)++- restore upper bounds on hledger packages++# 1.3 2017-06-30++The "uncleared" transaction/posting status, and associated UI flags+and keys, have been renamed to "unmarked" to remove ambiguity and+confusion. This means that we have dropped the `--uncleared` flag,+and our `-U` flag now matches only unmarked things and not pending+ones. See the issue and linked mail list discussion for more+background. (#564)++Also the -P short flag has been added for --pending, and the -U/-P/-C+flags can be combined.++bs/is: fix "Ratio has zero denominator" error (#535)++bs/is/cf: fix --flat (#552) (Justin Le, Simon Michael)++bal/bs/is/cf: show negative amounts in red (Simon Michael, Justin Le).+These commands now shows negative amounts in red, when hledger detects+that ANSI codes are supported, (ie when TERM is not "dumb" and stdout+is not being redirected or piped).++print: show pending mark on postings (fixes #563).+A pending mark on postings is now displayed, just like a cleared mark.+Also there will now be a space between the mark and account name.++print: amounts are now better aligned, eg when there are posting+status marks or virtual postings++# 1.2 2017-03-31++## CLI++"hledger" and "hledger -h" now print a better organised commands list+and general usage message respectively (#297).++The common reporting flags can now be used anywhere on the command line.++Fixed deduplication of addons in commands list.++Fixed ugly stack traces in command line parse error messages.++The -V/--value flag is now a global report flag, so it works with+balance, print, register, balancesheet, incomestatement, cashflow,+etc. (Justin Le)++The `--pivot` global reporting option replaces all account names with+the value of some other field or tag. It has been improved, eg:++- we don't add the field/tag name name as a prefix+- when pivoting on a tag, if the tag is missing we show a blank+ (rather than showing mixed tag values and account names)+- a pipe character delimiter may be used in descriptions to get a more accurate+ and useful payee report (`hledger balance --pivot payee`)++options cleanups++## Addons++Easier installation:+move add-ons and example scripts to bin/,+convert to stack scripts,+add a build script to install all deps,+add some functional tests,+test add-ons with Travis CI,+add installation docs to download page.++Improved docs:+all addons now contain their own documentation. Most of them (all but+hledger-budget) use a new reduced-boilerplate declaration format+and can show short (-h) and long (--help) command line help.+(Long help is declared with pre and postambles to the generated+options help, short help is that truncated at the start of the hledger+common flags.)++`hledger` now shows a cleaner list of addon commands, showing only the+compiled version of an addon when both source and compiled versions+are in $PATH. (Addons with .exe extension or no extension are+considered compiled. Modification time is not checked, ie, an old+compiled addon will override a newer source version. If there are+three or more versions of an addon, all are shown. )++New addons added/included:++- autosync - example symlink to ledger-autosync+- budget - experimental budget reporting command supporting Ledger-like periodic transactions and automated transactions (Mykola Orliuk)+- chart - pie-chart-generating prototype, a repackaging of the old hledger-chart tool+- check - more powerful balance assertions (Michael Walker)+- check-dupes - find accounts sharing the same leaf name (Stefano Rodighiero)+- prices - show all market price records (Mykola Orliuk)+- register-match - a helper for ledger-autosync's deduplication, finds best match for a transaction description++The equity command now always generates a valid journal transaction,+handles prices better, and adds balance assertions (Mykola Orliuk).++The rewrite command is more robust and powerful (Mykola Orliuk):++- in addition to command-line rewrite options, it understands rewrite rules+ defined in the journal, similar to Ledger's automated transactions (#99).+ Eg:++ = ^income+ (liabilities:tax) *.33++ = expenses:gifts+ budget:gifts *-1+ assets:budget *1++- it can generate diff output, allowing easier review of the proposed+ changes, and safe modification of original journal files (preserving+ file-level comments and directives). Eg:++ hledger-rewrite --diff Agency --add-posting 'Expenses:Taxes *0.17' | patch++- rewrites can affect multiple postings in a transaction, not just one.++- posting-specific dates are handled better++## balance++A new --pretty-tables option uses unicode characters for rendering+table borders in multicolumn reports (#522) (Moritz Kiefer)++## balancesheet/cashflow/incomestatement++These commands are now more powerful, able to show multicolumn reports+and generally having the same features as the balance command. (Justin Le)++balancesheet has always ignored a begin date specified with a `-b` or+`-p` option; now it also ignores a begin date specified with a `date:`+query. (Related discussion at #531)++## print++The output of print is now always a valid journal (fixes #465) (Mykola Orliuk).++print now tries to preserves the format of implicit/explicit balancing+amounts and prices, by default. To print with all amounts explicit,+use the new `--explicit/-x` flag (fixes #442). (Mykola Orliuk)++Don't lose the commodity of zero amounts/zero balance assertions (fixes #475) (Mykola Orliuk)++## Misc++Fix a regression in the readability of option parsing errors (#478) (Hans-Peter Deifel)++Fix an example in Cli/Main.hs (Steven R. Baker)++Allow megaparsec 5.2 (#503)++# 1.1 2016-12-31++## balance++- with -V, don't ignore market prices in the future (#453, #403)++- with -V and multiple same-date market prices, use the last parsed not the highest price (#403)++## misc++- fix non-existent "oldtime" dependency (#431)++- extra/hledger-equity.hs now generates valid journal format when there are multiple commodities++# 1.0.1 2016-10-27++- allow megaparsec 5.0 or 5.1++- fix benchmark build failure (#423)++# 1.0 2016-10-26++## add++- suggest only one commodity at a time as default amount (#383)++ (since we currently can't input more than one at a time)++## balance++- added --change flag for consistency++- -H/--historical now also affects single-column balance reports with a start date (#392).++ This has the same effect as just omitting the start date, but adds consistency.++- in CSV output, render amounts in one-line format (#336)++## balancesheet++- fix an infinite loop (#393)++## print++- in CSV output, fix and rename the transaction id field++## register++- fix a sorting regression with --date2 (#326)++- --average/-A is now affected by --historical/-H++- added --cumulative flag for consistency++- in CSV output, include the transaction id and rename the total field (#391)++## stats++- fixed an issue with ordering of include files++## misc++- --pivot option added, groups postings by tag instead of account (#323) (Malte Brandy)++- --anon option added, obfuscates account names and descriptions (#265) (Brian Scott)++ (Only affects the hledger tool, for now.)++- try to clarify balance/register's various report modes,++ kinds of "balance" displayed, and related options and language.++- with multiple --change/--cumulative/--historical flags, use the last one instead of complaining++- don't add the "d" suffix when displaying day periods++- stack-ify extra/hledger-rewrite.hs++## misc++- added GHC 8 support, dropped GHC 7.6 and 7.8 support.++ GHC 7.8 support could be restored with small code changes and a maintainer.++- a cabal.project file has been added (Moritz Kiefer)++- use hpack for maintaining cabal files (#371).++ Instead of editing cabal files directly, we now edit the less+ verbose and less redundant package.yaml files and let stack (or+ hpack) update the cabal files. We commit both the .yaml and+ .cabal files.++- clean up some old cabal flags++- tools/simplebench has been spun off as the quickbench package.++- add Appveyor CI builds, provide up-to-date binaries for Windows++- extra: add a bunch of CSV rules examples++## docs++- the website is simpler, clearer, and more mobile-friendly.++ Docs are now collected on a single page and organised by type: getting started, reference, more.++- reference docs have been split into one manual for each executable and file format.++ This helps with maintenance and packaging and also should make it+ easier to see what's available and to read just what you need.++- manuals are now provided in html, plain text, man and info formats++ generated from the same source by a new Shake-based docs build system. (#292)++- versioned manuals are provided on the website, covering recent releases and the latest dev version (#385, #387)++- manuals are built in to the hledger executables, allowing easy offline reading on all platforms.++ PROG -h shows PROG's command-line usage+ PROG --help shows PROG's manual (fixed width)+ PROG --man shows PROG's manual with man (formatted/paged)+ PROG --info shows PROG's manual with info (hypertext)+ hledger help [TOPIC] shows any manual+ hledger man [TOPIC] shows any manual with man+ hledger info [TOPIC] shows any manual with info++- the general and reporting options are now listed in all executable manuals.++ We assume any of them which are unsupported are harmlessly ignored.++- demo.hledger.org is using beancount's example journal.++ This is the somewhat realistic example journal from the beancount+ project, tweaked for hledger.++- minor copyedits (jungle-boogie)++## cli++- parsing multiple input files is now robust.++ When multiple -f options are provided, we now parse each file+ individually rather than just concatenating them, so they can+ have different formats (#320). Note this also means that+ directives (like \`Y\` or \`alias\`) no longer carry over from one+ file to the next.++- -I has been added as the short flag for --ignore-assertions++ (this is different from Ledger's CLI, but useful for hledger-ui).++- parsing an argument-less --debug option is more robust++# 0.27 2015-10-30++Account aliases:++- Regular expression account aliases are now fast enough that you can+ use lots of them without slowing things down. They now take+ O(aliases x accounts) time, instead of O(aliases x transactions);+ also, regular expressions are no longer recompiled unnecessarily.++Documentation:++- Each hledger package now includes one or more man pages, generated+ from markdown by the mighty pandoc. Currently there are six: one+ for each main executable and each input file format. Currently these+ somewhat duplicate the manual on the website; this will be resolved+ somehow. (#282).++- The site is now built with hakyll-std, a generic hakyll script.++- hledger once again has a HCAR entry.++Tools:++- The hledger cabal files are now generated from package.yaml files by+ hpack, in principle, removing a lot of error-prone duplication and+ boilerplate. (In practice, both files are being updated manually+ for the moment, until hpack supports flags and conditional blocks.)++- Time/allocation and heap profiling is working again, and easier:++ - `make quickprof-CMD` generates a profile for CMD, which runs+ against one of the sample journals. (CMD must be one word,+ enclosing in double quotes isn't working here for some reason).++ - `make quickheap-CMD` generates a heap profile for CMD, in+ hledgerprof.ps, and tries to open it in a viewer (currently the+ mac-friendly "open" executable, so you may need to adjust this in+ the makefile). As with quickprof, CMD must be one word and runs+ against one of the sample journals.++ - `make hledgerprof` builds the hledgerprof executable used for+ time/allocation profiling. `make hledgercov` builds the hledgercov+ executable used for coverage reports.++- Travis CI now tests the build on each github push and announces+ status changes by email and on #hledger.++Journal format:++- Dates must now begin with a digit (not /, eg).++- The comment directive longer requires an end comment, and will+ extend to the end of the file(s) without it.++Command-line interface:++- Output (balance reports, register reports, print output etc.)+ containing wide characters, eg chinese/japanese/korean characters,+ should now align correctly, when viewed in apps and fonts that show+ wide characters as double width (#242).++- The argument for --depth or depth: must now be positive.++add:++- Journal entries are now written with all amounts explicit, to avoid+ losing price info (#283).++- Fixed a bug which sometimes (when the same letter pair was repeated)+ caused it not to pick the most similar past transaction for defaults.++balance:++- There is now a -V/--value flag to report current market value (as in Ledger).+ It converts all reported amounts using their "default market price".+ "Market price" is the new name for "historical prices", defined with the P directive.+ The default market price for a commodity is the most recent one found in the journal on or before the report end date.++ Unlike Ledger, hledger's -V uses only the market prices recorded+ with P directives; it does not use the "transaction prices"+ recorded as part of posting amounts (which are used by -B/--cost).+ Also, using both -B and -V at the same time is supported.++- Fixed a bug in amount normalization which caused amount styles+ (commodity symbol placement, decimal point character, etc.) to be+ lost in certain cases (#230, #276).++- The balance command's --format option can now adjust the rendering+ style of multi-commodity amounts, if you begin the format string+ with one of:++ %_ - renders amounts on multiple lines, bottom-aligned (the default)+ %^ - renders amounts on multiple lines, top-aligned+ %, - renders amounts on one line, comma-separated++- The balance report's final total (and the line above it) now adapt+ themselves to a custom --format.++print:++- The --match option prints the journal entry that best matches a+ description (ie whose description field is most similar to the value+ given, and if there are several equally similar, the most recent).+ This was originally an add-on I used to guess account names for+ ledger-autosync. It's nice for quickly looking up a recent+ transaction from a guessed or partial description.++- print now always right-aligns the amounts in an entry, even when+ they are wider than 12 characters. (If there is a price, it's+ considered part of the amount for right-alignment.)++register:++- Amount columns now resize automatically, using more space if it's+ needed and available.++# 0.26 2015-07-12++Account aliases:++- Account aliases are once again non-regular-expression-based, by default. (#252)++ The regex account aliases added in 0.24 trip up people switching between+ hledger and Ledger. (Also they are currently slow).++ This change makes the old non-regex aliases the default; they are+ unsurprising, useful, and pretty close in functionality to Ledger's.++ The new regex aliases are still available; they must be enclosed+ in forward slashes. (Ledger effectively ignores these.)++Journal format:++- We now parse, and also print, journal entries with no postings, as+ proposed on the mail lists. These are not well-formed General+ Journal entries/transactions, but here is my rationale:++ - Ledger and beancount parse them+ - if they are parsed, they should be printed+ - they provide a convenient way to record (and report) non-transaction events+ - they permit more gradual introduction and learning of the concepts.+ So eg a beginner can keep a simple journal before learning about accounts and postings.++- Trailing whitespace after a `comment` directive is now ignored.++Command-line interface:++- The -f/file option may now be used multiple times.+ This is equivalent to concatenating the input files before running hledger.+ The add command adds entries to the first file specified.++Queries:++- real: (no argument) is now a synonym for real:1++- tag: now matches tag names with a regular expression, like most other queries++- empty: is no longer supported, as it overlaps a bit confusingly with+ amt:0. The --empty flag is still available.++- You can now match on pending status (#250)++ A transaction/posting status of ! (pending) was effectively equivalent+ to * (cleared). Now it's a separate state, not matched by --cleared.+ The new Ledger-compatible --pending flag matches it, and so does+ --uncleared.++ The relevant search query terms are now status:*, status:! and+ status: (the old status:1 and status:0 spellings are deprecated).++ Since we interpret --uncleared and status: as "any state except cleared",+ it's not currently possible to match things which are neither cleared+ nor pending.++activity:++- activity no longer excludes 0-amount postings by default.++add:++- Don't show quotes around the journal file path in the "Creating..."+ message, for consistency with the subsequent "Adding..." message.++balancesheet:++- Accounts beginning with "debt" or now also recognised as liabilities.++print:++- We now limit the display precision of inferred prices. (#262)++ When a transaction posts to two commodities without specifying the+ conversion price, we generate a price which makes it balance (cf+ https://hledger.org/hledger.html#prices). The print command showed+ this with full precision (so that manual calculations with the+ displayed numbers would look right), but this sometimes meant we+ showed 255 digits (when there are multiple postings in the+ commodity being priced, and the averaged unit price is an+ irrational number). In this case we now set the price's display+ precision to the sum of the (max) display precisions of the+ commodities involved. An example:++ hledgerdev -f- print+ <<<+ 1/1+ c C 10.00+ c C 11.00+ d D -320.00+ >>>+ 2015/01/01+ c C 10.00 @ D 15.2381+ c C 11.00 @ D 15.2381+ d D -320.00++ >>>=0++ There might still be cases where this will show more price decimal+ places than necessary.++- We now show inferred unit prices with at least 2 decimal places.++ When inferring prices, if the commodities involved have low+ display precisions, we don't do a good job of rendering+ accurate-looking unit prices. Eg if the journal doesn't use any+ decimal places, any inferred unit prices are also displayed with+ no decimal places, which makes them look wrong to the user. Now,+ we always give inferred unit prices a minimum display precision of+ 2, which helps a bit.++register:++- Postings with no amounts could give a runtime error in some obscure case, now fixed.++stats:++- stats now supports -o/--outputfile, like register/balance/print.+- An O(n\^2) performance slowdown has been fixed, it's now much faster on large journals.++ +--------------------------------------++--------+--------++ | || 0.25 | 0.26 |+ +======================================++========+========++ | -f data/100x100x10.journal stats || 0.10 | 0.16 |+ | -f data/1000x1000x10.journal stats || 0.45 | 0.21 |+ | -f data/10000x1000x10.journal stats || 58.92 | 2.16 |+ +--------------------------------------++--------+--------+++Miscellaneous:++- The June 30 day span was not being rendered correctly; fixed. (#272)++- The bench script invoked by "cabal bench" or "stack bench" now runs+ some simple benchmarks.++ You can get more accurate benchmark times by running with --criterion.+ This will usually give much the same numbers and takes much longer.++ Or with --simplebench, it benchmarks whatever commands are+ configured in bench/default.bench. This mode uses the first+ "hledger" executable in $PATH.++- The deprecated shakespeare-text dependency has been removed more thoroughly.++# 0.25.1 2015-04-29++- timelog: support the description field (#247)++# 0.25 2015-04-07++- GHC 7.10 compatibility (#239)++- build with terminfo support on POSIX systems by default++ On non-windows systems, we now build with terminfo support by+ default, useful for detecting terminal width and other things.++ This requires the C curses dev libraries, which makes POSIX+ installation slightly harder; if it causes problems you can+ disable terminfo support with the new `curses` cabal flag, eg:+ cabal install -f-curses ... (or cabal might try this+ automatically, I'm not sure).++- register: use the full terminal width, respect COLUMNS, allow column width adjustment++ On POSIX systems, register now uses the full terminal width by+ default. Specifically, the output width is set from:++ 1. a --width option+ 2. or a COLUMNS environment variable (NB: not the same as a bash shell var)+ 3. or on POSIX (non-windows) systems, the current terminal width+ 4. or the default, 80 characters.++ Also, register's --width option now accepts an optional+ description column width following the overall width (--width+ WIDTH\[,DESCWIDTH\]). This also sets the account column width, since+ the available space (WIDTH-41) is divided up between these two+ columns. Here's a diagram:++ <--------------------------------- width (W) ---------------------------------->+ date (10) description (D) account (W-41-D) amount (12) balance (12)+ DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA++ Examples:++ $ hledger reg # use terminal width on posix+ $ hledger reg -w 100 # width 100, equal description/account widths+ $ hledger reg -w 100,40 # width 100, wider description+ $ hledger reg -w $COLUMNS,100 # terminal width and set description width++- balance: new -T/--row-total and -A/--average options++ In multicolumn balance reports, -T/--row-total now shows a row totals+ column and -A/--average shows a row averages column.+ This helps eg to see monthly average expenses (hledger bal \^expenses -MA).++ NB our use of -T deviates from Ledger's UI, where -T sets a custom+ final total expression.++- balance: -N is now short for --no-total+- balance: fix partially-visible totals row with --no-total++ A periodic (not using --cumulative or --historical) balance report+ with --no-total now hides the totals row properly.++- journal, csv: comment lines can also start with *++ As in Ledger. This means you can embed emacs org/outline-mode nodes in+ your journal file and manipulate it like an outline.++# 0.24.1 2015-03-15++- journal: fix balance accumulation across assertions (#195)++ A sequence of balance assertions asserting first one commodity, then+ another, then the first again, was not working.++- timelog: show hours with two decimal places instead of one (#237)+- in weekly reports, simplify week 52's heading like the others+- disallow trailing garbage in a number of parsers++ Trailing garbage is no longer ignored when parsing the following:+ balance --format option, register --width option, hledger-rewrite+ options, hledger add's inputs, CSV amounts, posting amounts,+ posting dates in tags.++- allow utf8-string-1 (fpco/stackage/#426)++# 0.24 2014-12-25++General:++- fix redundant compilation when cabal installing the hledger packages+- switch to Decimal for representing amounts (#118)+- report interval headings (eg in balance, register reports) are shown+ compactly when possible+- general speedups++Journal format:++- detect decimal point and digit groups more robustly (#196)+- check that transaction dates are followed by whitespace or newline+- check that dates use a consistent separator character+- balance assertions now are specific to a single commodity, like+ Ledger (#195)+- support multi-line comments using "comment", "end comment"+ directives, like Ledger++CSV format:++- reading CSV data from stdin now works better+- the rules file include directive is now relative to the current+ file's directory (#198)+- the original order of same-day transactions is now usually preserved+ (if the records appear to be in reverse date order, we reverse them+ before finally sorting by transaction date)+- CSV output is now built in to the balance, print, and register+ commands, controlled by -O/--output-format (and -o/--output-file,+ see below)++CLI:++- the --width and --debug options now require their argument (#149)+- when an option is repeated, the last value takes precedence (#219).+ This is helpful eg for customising your reporting command aliases on+ the fly.+- smart dates (used in -p/-b/-e/date:/date2:) now must use a+ consistent separator character, and must be parseable to the end+- output destination and format selection is now built in to the+ balance, print and register commands, controlled by -o/--output-file+ and -O/--output-format options. Notes:+ - -o - means stdout+ - an output file name suffix matching a supported format will also+ set the output format, unless overridden by --output-format+ - commands' supported output formats are listed in their+ command-line help. Two formats are currently available:+ txt (the default) and csv.+- balance assertions can be disabled with --ignore-assertions++Account aliases:++- all matching account aliases are now applied, not just one directive+ and one option+- account aliases now match by case insensitive regular expressions+ matching anywhere in the account name+- account aliases can replace multiple occurrences of the pattern+ within an account name+- an account alias replacement pattern can reference matched groups+ with \N++Queries:++- date:/date2: with a malformed date now reports an error instead of+ being ignored+- amt: now supports >= or <=+- clarify status: docs and behaviour; \"*\" is no longer a synonym for+ "1" (fixes #227)++balance:++- fix: in tree mode, --drop is ignored instead of showing empty account names+- a depth limit of 0 now shows summary items with account name "...",+ instead of an empty report (#206)+- in multicolumn balance reports, -E now also shows posting-less+ accounts with a non-zero balance during the period (in addition to+ showing leading & trailing empty columns)+- in multicolumn reports, multi-commodity amounts are rendered on one+ line for better layout (#186)+- multicolumn reports' title now includes the report span++register:++- runs faster with large output+- supports date2:, and date:/date2: combined with --date2, better (fixes+ #201, #221, #222)+- a depth limit of 0 now shows summary items (see balance)+- -A/--average now implies -E/--empty+- postings with multi-commodity amounts are now top-aligned, like+ Ledger++Extra commands:++- hledger-equity: fix end date in title; print closing entry too+- hledger-check-dates: added++# 0.23.3 2014-09-12++- allow text 1.2+ (#207)++# 0.23.2 2014-05-08++- register: also fix date sorting of postings (#184)++# 0.23.1 2014-05-07++- register: fix a refactoring-related regression that the tests+ missed: if transactions were not ordered by date in the journal,+ register could include postings before the report start date in the+ output. (#184)+- add: don't apply a default commodity to amounts on entry (#138)+- cli: options before the add-on command name are now also passed to it (#182)+- csv: allow the first name in a fields list to be empty (#178)+- csv: don't validate fields count in skipped lines (#177)++# 0.23 2014-05-01++Journal format:++- A # (hash) in column 0 is now also supported for starting a top-level journal comment, like Ledger.+- The "too many missing amounts" error now reminds about the 2-space rule.+- Fix: . (period) is no longer parsed as a valid amount.+- Fix: default commodity directives no longer limit the maximum display precision (#169).+- Fix: + before an amount is no longer parsed as part of the commodity (#181).++CLI:++- Command-line help cleanups, layout improvements.+- Descriptions are shown for known add-ons in the command list.+- Command aliases have been simplified.+- Add-ons can now have any of these file extensions:+ none, hs, lhs, pl, py, rb, rkt, sh, bat, com, exe.+- Add-ons are displayed without their file extensions when possible.+- Add-ons with the same name as a built-in command or alias are ignored.+- Fix: add-on detection and invocation now works on windows.+- Fix: add-ons with digits in the name are now found.+- Fix: add-on arguments containing a single quote now work.+- Fix: when -- is used to hide add-on options from the main program,+ it is no longer passed through as an add-on argument.++Queries:++- The currency/commodity query prefix (sym:) has been renamed to cur:.+- Currency/commodity queries are applied more strongly in register and+ balance reports, filtering out unwanted currencies entirely. Eg+ hledger balance cur:'$' now reports only the dollar amounts even if+ there are multi-currency transactions or postings.+- Amount queries like amt:N, amt:<N and amt:>N, where N is not 0, now do an unsigned+ comparison of the amount and N. That is, they compare the absolute magnitude.+ To do a signed comparison instead, write N with its sign (eg amt:+N, amt:<+N, amt:>-N).+- Fix: amount queries no longer give false positives on multi-commodity amounts.++accounts:++- An accounts command has been added, similar to Ledger's, for listing account names+ in flat or hierarchical mode.++add:++- Tab completion now works at all prompts, and will insert the default if the input area is empty.+- Account and amount defaults are more robust and useful.+- Transactions may also be completed by the enter key, when there are no more default postings.+- Input prompts are displayed in a different colour when supported.++balance:++- Balance reports in flat mode now always show exclusive (subaccount-excluding) balances.+- Balance reports in flat mode with --depth now aggregate deeper accounts at the depth limit instead of excluding them.+- Multicolumn reports in flat mode now support --drop.+- Multicolumn balance reports can now show the account hierarchy with --tree.+- Multicolumn report start/end dates are adjusted to encompass the displayed+ report periods, so the first and last periods are "full" and comparable to the others.+- Fix: zero-balance leaf accounts below a non-zero-balance parent are no longer always shown (#170).+- Fix: multicolumn reports now support --date2 (cf #174).++balancesheet, cashflow, incomestatement:++- These commands now support --flat and --drop.++print:++- Tag queries (tag:) will now match a transaction if any of its postings match.++register:++- The --display option has been dropped. To see an accurate running total which+ includes the prior starting balance, use --historical/-H (like balance).+- With a report interval, report start/end dates are adjusted to encompass the displayed+ periods, so the first and last periods are "full" and comparable to the others.+- Fix: --date2 now works with report intervals (fixes #174).++Miscellaneous:++- Default report dates now derive from the secondary dates when --date2 is in effect.+- Default report dates now notice any posting dates outside the transaction dates' span.+- Debug output improvements.+- New add-on example: extra/hledger-rewrite.hs, adds postings to matched entries.+- Compatible with GHC 7.2 (#155) - GHC 7.8, shakespeare 2++# 0.22.2 2014-04-16++- display years before 1000 with four digits, not three+- avoid pretty-show to build with GHC < 7.4+- allow text 1.1, drop data-pprint to build with GHC 7.8.x++# 0.22.1 2014-01-06 and older++See <https://hledger.org/relnotes.html> (or doc/relnotes.md).
Hledger/Cli.hs view
@@ -1,35 +1,707 @@ {-|+This is the root module of the @hledger@ package,+providing hledger's command-line interface.+The main function,+commands,+command-line options,+and utilities useful to other hledger command-line programs+are exported.+It also re-exports hledger-lib:Hledger+and cmdargs:System.Concole.CmdArgs.Explicit -Hledger.Cli re-exports the options, utilities and commands provided by-the hledger command-line program. This module also aggregates the-built-in unit tests defined throughout hledger and hledger-lib, and-adds some more which are easier to define here.+See also: +- hledger-lib:Hledger+- [The README files](https://github.com/search?q=repo%3Asimonmichael%2Fhledger+path%3A**%2FREADME*&type=code&ref=advsearch)+- [The high-level developer docs](https://hledger.org/dev.html)++hledger is a Haskell rewrite of John Wiegley's "ledger". +It generates financial reports from a plain text general journal.+You can use the command line:++> $ hledger++or ghci:++> $ make ghci+> ghci> Right j <- runExceptT $ readJournalFile definputopts "examples/sample.journal" -- or: j <- defaultJournal+> ghci> :t j+> j :: Journal+> ghci> stats defcliopts j+> Main file : examples/sample.journal+> Included files : +> Transactions span : 2008-01-01 to 2009-01-01 (366 days)+> Last transaction : 2008-12-31 (733772 days from now)+> Transactions : 5 (0.0 per day)+> Transactions last 30 days: 0 (0.0 per day)+> Transactions last 7 days : 0 (0.0 per day)+> Payees/descriptions : 5+> Accounts : 8 (depth 3)+> Commodities : 1 ($)+> Market prices : 0 ()+> +> Run time (throughput) : 1695276900.00s (0 txns/s)+> ghci> balance defcliopts j+> $1 assets:bank:saving+> $-2 assets:cash+> $1 expenses:food+> $1 expenses:supplies+> $-1 income:gifts+> $-1 income:salary+> $1 liabilities:debts+> --------------------+> 0 +> ghci> ++etc.+++SPDX-License-Identifier: GPL-3.0-or-later+Copyright (c) 2007-2025 (each year in this range) Simon Michael <simon@joyful.com> and contributors.++This program is free software: you can redistribute it and/or modify+it under the terms of the GNU General Public License as published by+the Free Software Foundation, either version 3 of the License, or+(at your option) any later version.++This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;+without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.+See the GNU General Public License for more details.+You should have received a copy of the GNU General Public License along with this program.+If not, see <https://www.gnu.org/licenses/>.+ -} -{-# LANGUAGE OverloadedStrings #-}+{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}+{-# HLINT ignore "Unused LANGUAGE pragma" #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TupleSections #-} module Hledger.Cli (- module Hledger.Cli.CliOptions,- module Hledger.Cli.Commands,- module Hledger.Cli.DocFiles,- module Hledger.Cli.Utils,- module Hledger.Cli.Version,- module Hledger,- tests_Cli,- module System.Console.CmdArgs.Explicit- )+ main,+ mainmode,+ argsToCliOpts,+ -- * Re-exports+ module Hledger.Cli.CliOptions,+ module Hledger.Cli.Conf,+ module Hledger.Cli.Commands,+ module Hledger.Cli.DocFiles,+ module Hledger.Cli.Utils,+ module Hledger.Cli.Version,+ module Hledger,+ -- ** System.Console.CmdArgs.Explicit+ module CmdArgsWithoutName+) where-import System.Console.CmdArgs.Explicit hiding (Name) -- don't clash with hledger-ui +#if MIN_VERSION_base(4,20,0)+import Control.Exception.Backtrace (setBacktraceMechanismState, BacktraceMechanism(..))+#endif+import Control.Monad (when, unless)+import Data.Bifunctor (second)+import Data.Char (isDigit)+import Data.Either (isRight)+import Data.Function ((&))+import Data.Functor ((<&>))+import Data.List+import Data.Maybe (isJust, fromMaybe, fromJust)+import Data.Text (pack, Text)+import Data.Time.Clock.POSIX (getPOSIXTime)+import Safe+import System.Console.CmdArgs.Explicit+import System.Console.CmdArgs.Explicit as CmdArgsWithoutName hiding (Name)+import System.Environment+import System.Exit+import System.Process+import Text.Megaparsec (optional, takeWhile1P, eof)+import Text.Megaparsec.Char (char)+import Text.Printf+ import Hledger import Hledger.Cli.CliOptions+import Hledger.Cli.Conf import Hledger.Cli.Commands+import Hledger.Cli.Commands.Run import Hledger.Cli.DocFiles import Hledger.Cli.Utils import Hledger.Cli.Version -tests_Cli = tests "Cli" [- tests_Hledger- ,tests_Commands- ]++verboseDebugLevel = 8++-- | The overall cmdargs mode describing hledger's command-line options and subcommands.+-- The names of known addons are provided so they too can be recognised as commands.+mainmode addons = defMode {+ modeNames = [progname ++ " [COMMAND]"]+ ,modeArgs = ([], Just $ argsFlag "[ARGS]")+ ,modeHelp = unlines ["hledger's main command line interface. Run with no ARGS to list commands."]+ ,modeGroupModes = Group {+ -- subcommands in the unnamed group, shown first:+ groupUnnamed = [+ ]+ -- subcommands in named groups:+ ,groupNamed = [+ ]+ -- subcommands handled but not shown in the help:+ ,groupHidden = map fst builtinCommands ++ map addonCommandMode addons+ }+ ,modeGroupFlags = Group {+ -- flags in named groups: (keep synced with Hledger.Cli.CliOptions.highlightHelp)+ groupNamed = cligeneralflagsgroups1+ -- flags in the unnamed group, shown last: (keep synced with dropUnsupportedOpts)+ ,groupUnnamed = confflags+ -- other flags handled but not shown in help:+ ,groupHidden = hiddenflagsformainmode+ }+ ,modeHelpSuffix = []+ -- "Examples:" :+ -- map (progname ++) [+ -- " list commands"+ -- ," CMD [--] [OPTS] [ARGS] run a command (use -- with addon commands)"+ -- ,"-CMD [OPTS] [ARGS] or run addon commands directly"+ -- ," -h show general usage"+ -- ," CMD -h show command usage"+ -- ," help [MANUAL] show any of the hledger manuals in various formats"+ -- ]+ }+-- A dummy mode just for parsing --conf/--no-conf flags.+confflagsmode = defMode{+ modeGroupFlags=Group [] confflags []+ ,modeArgs = ([], Just $ argsFlag "")+ }++------------------------------------------------------------------------------+-- | hledger CLI's main procedure.+--+-- Here we will parse the command line, read any config file,+-- and search for hledger-* addon executables in the user's PATH,+-- then choose the appropriate builtin operation or addon operation to run,+-- then run it in the right way, usually reading input data (eg a journal) first.+--+-- When making a CLI usable and robust with main command, builtin subcommands,+-- various kinds of addon commands, and config files that add general and+-- command-specific options, while balancing circular dependencies, environment,+-- idioms, legacy, and libraries with their own requirements and limitations:+-- things get crazy, and there is a tradeoff against complexity and bug risk.+-- We try to provide the most intuitive, expressive and robust CLI that's feasible+-- while keeping the CLI processing below sufficiently comprehensible, troubleshootable,+-- and tested. It's an ongoing quest.+-- See also: Hledger.Cli.CliOptions, cli.test, addons.test, --debug and --debug=8.+--+-- Probably the biggest source of complexity here is that cmdargs can't parse+-- a command line containing undeclared flags, but this arises often with our+-- addon commands and builtin/custom commands which haven't implemented all options,+-- so we have to work hard to work around this.+-- https://github.com/ndmitchell/cmdargs/issues/36 is the wishlist issue;+-- implementing that would simplify hledger's CLI processing a lot.+--+main :: IO ()+main = handleExit $ withGhcDebug' $ do++#if MIN_VERSION_base(4,20,0)+ -- Control ghc 9.10+'s stack traces.+ -- CostCentreBacktrace - collect cost-centre stack backtraces (only available when built with profiling)+ -- HasCallStackBacktrace - collect HasCallStack backtraces+ -- ExecutionBacktrace - collect backtraces from native execution stack unwinding+ -- IPEBacktrace - collect backtraces from Info Table Provenance Entries+#ifdef DEBUG+ setBacktraceMechanismState HasCallStackBacktrace True+#else+ setBacktraceMechanismState HasCallStackBacktrace False+#endif+#endif++ -- 0. let's go!++ let+ dbgio :: Show a => String -> a -> IO ()+ dbgio = dbgIO verboseDebugLevel++ dbgio "running" prognameandversion+ starttime <- getPOSIXTime+ -- give ghc-debug a chance to take control+ when (ghcDebugMode == GDPauseAtStart) $ ghcDebugPause'+ -- Search PATH for addon commands. Exclude any that match builtin command names.+ addons <- addonCommandNames++ ---------------------------------------------------------------+ dbgio "\n1. Preliminary command line parsing" ()++ -- Naming notes:+ -- "arg" often has the most general meaning, including things like: -f, --flag, flagvalue, arg, >file, &, etc.+ -- confcmdarg, clicmdarg = the first non-flag argument, from config file or cli = the subcommand name+ -- cmdname = the full unabbreviated command name, or ""+ -- confcmdargs = arguments for the subcommand, from config file++ -- Do some argument preprocessing to help cmdargs+ cliargs <- getArgs+ >>= expandArgsAt -- interpolate @ARGFILEs+ <&> replaceNumericFlags -- convert -NUM to --depth=NUM+ <&> argsAddDoubleDash -- repeat the first -- arg, as a cmdargs workaround+ let+ (clicmdarg, cliargswithoutcmd, cliargswithcmdfirst) = moveFlagsAfterCommand cliargs+ cliargswithcmdfirstwithoutclispecific = dropCliSpecificOpts cliargswithcmdfirst+ (cliargsbeforecmd, cliargsaftercmd) = second (drop 1) $ break (==clicmdarg) cliargs+ dbgio "cli args with preprocessing" cliargs+ dbg1IO "cli args with preprocessing and options moved after command" cliargswithcmdfirst+ dbgio "cli command argument found" clicmdarg+ dbgio "cli args before command" cliargsbeforecmd+ dbgio "cli args after command" cliargsaftercmd+ -- dbgio "cli args without command" cliargswithoutcmd++ ---------------------------------------------------------------+ dbgio "\n2. Read the config file if any" ()++ -- Identify any --conf/--no-conf options.+ -- Run cmdargs on just the args that look conf-related.+ let+ cliconfargs = dropUnsupportedOpts confflagsmode cliargswithoutcmd+ cliconfrawopts = cmdargsParse "for conf options" confflagsmode cliconfargs++ -- Read extra general and command-specific args/opts from the config file, if any.+ (conf, mconffile) <-+ seq cliconfrawopts $ -- order debug output+ if clicmdarg=="setup" -- the setup command checks config files, but never uses one itself+ then return (nullconf,Nothing)+ else getConf' cliconfrawopts++ ---------------------------------------------------------------+ dbgio "\n3. Identify a command name if possible; handle version/help flags" ()++ -- Try to identify the subcommand name,+ -- from the first non-flag general argument in the config file,+ -- or if there is none, from the first non-flag argument on the command line.++ let+ confallgenargs = confLookup "general" conf & replaceNumericFlags+ -- we don't try to move flags/values preceding a command argument here;+ -- if a command name is written in the config file, it must be first+ (confcmdarg, confothergenargs) = case confallgenargs of+ a:as | not $ isFlagArg a -> (a,as)+ as -> ("",as)+ cmdarg = if not $ null confcmdarg then confcmdarg else clicmdarg+ nocmdprovided = null cmdarg++ -- The argument may be an abbreviated command name, which we need to expand.++ -- Run cmdargs on conf + cli args to get the full command name.+ -- If no command argument was provided, or if cmdargs fails because + -- the command line contains a bad flag or wrongly present/missing flag value,+ -- cmdname will be "".+ args = [confcmdarg | not $ null confcmdarg] <> cliargswithcmdfirstwithoutclispecific+ -- Actually, only scan the first non-flag argument, to avoid flag errors at this stage.+ possiblecmdarg = take 1 $ dropWhile isFlagArg args+ cmdname = stringopt "command" $ cmdargsParse "for command name" (mainmode addons) possiblecmdarg++ badcmdprovided = null cmdname && not nocmdprovided+ isaddoncmd = not (null cmdname) && cmdname `elem` addons++ -- If it's a builtin command, get its mode and action.+ mbuiltincmdaction = findBuiltinCommand cmdname+ effectivemode = maybe (mainmode []) fst mbuiltincmdaction++ when (isJust mconffile) $ do+ unless (null confcmdarg) $+ dbg1IO "using command name argument from config file" confcmdarg+ dbgio "cli args with command first and no cli-specific opts" cliargswithcmdfirstwithoutclispecific+ dbg1IO "command found" cmdname+ dbgio "no command provided" nocmdprovided+ dbgio "bad command provided" badcmdprovided+ dbgio "is addon command" isaddoncmd++ -- If a bad command was provided, show that error now, before the full cmdargsParse attempt.+ when badcmdprovided $+ error' $ "command "++clicmdarg++" is not recognized. Run with no command to see a list."++ ---------------------------------------------------------------+ dbgio "\n4. Get applicable options/arguments from config file" ()++ -- Ignore any general opts or cli-specific opts not known to be supported by the command.+ let+ addoncmdssupportinggenopts = ["ui", "web"] -- addons known to support hledger general options+ supportedgenargsfromconf+ | cmdname `elem` addoncmdssupportinggenopts =+ [a | a <- confothergenargs, not $ any (`isPrefixOf` a) addoncmdssupportinggenopts]+ | isaddoncmd = []+ | otherwise = dropUnsupportedOpts effectivemode confothergenargs+ excludedgenargsfromconf = confothergenargs \\ supportedgenargsfromconf+ confcmdargs+ | null cmdname = []+ | otherwise =+ confLookup cmdname conf+ & replaceNumericFlags+ & if isaddoncmd then ("--":) else id++ when (isJust mconffile) $ do+ dbg1IO "using general args from config file" confothergenargs+ unless (null excludedgenargsfromconf) $+ dbg1IO "excluded general args from config file, not supported by this command" excludedgenargsfromconf+ dbg1IO "using subcommand args from config file" confcmdargs++ ---------------------------------------------------------------+ dbgio "\n5. Combine config file and command line args" ()++ let+ finalargs =+ [cmdarg | not $ null cmdarg]+ <> supportedgenargsfromconf+ <> confcmdargs+ <> [clicmdarg | not $ null confcmdarg]+ <> cliargswithoutcmd+ & replaceNumericFlags -- convert any -NUM opts from the config file++ -- finalargs' <- expandArgsAt finalargs -- expand @ARGFILEs in the config file ? don't bother+ dbg1IO "final args" finalargs++ -- Run cmdargs on command name + supported conf general args + conf subcommand args + cli args to get the final options.+ -- A bad flag or flag argument will cause the program to exit with an error here.+ let rawopts = cmdargsParse "final command line" (mainmode addons) finalargs++ ---------------------------------------------------------------+ seq rawopts $ -- order debug output+ dbgio "\n6. Select an action and run it" ()++ -- We check for the help/doc/version flags first, since they are a high priority.+ -- (A perfectionist might think they should be so high priority that adding -h+ -- to an invalid command line would show help. But cmdargs tends to fail first,+ -- preventing this, and trying to detect them without cmdargs, and always do the+ -- right thing with builtin commands and addon commands, gets much too complicated.)+ let+ helpFlag = boolopt "help" rawopts+ tldrFlag = boolopt "tldr" rawopts+ infoFlag = boolopt "info" rawopts+ manFlag = boolopt "man" rawopts+ versionFlag = boolopt "version" rawopts+ -- ignoredopts cmd = error' $ cmd ++ " tried to read options but is not supposed to"+ ignoredjournal cmd = error' $ cmd ++ " tried to read the journal but is not supposed to"++ -- validate opts/args more and convert to CliOpts+ opts <- rawOptsToCliOpts rawopts >>= \opts0 -> return opts0{progstarttime_=starttime}+ dbg2IO "processed opts" opts+ dbgio "period from opts" (period_ . _rsReportOpts $ reportspec_ opts)+ dbgio "interval from opts" (interval_ . _rsReportOpts $ reportspec_ opts)+ dbgio "query from opts & args" (_rsQuery $ reportspec_ opts)++ -- Ensure that anything calling getArgs later will see all args, including config file args.+ -- Some things (--color, --debug, some checks in journalFinalise) are detected by unsafePerformIO,+ -- eg in Hledger.Utils.IO.progArgs, which means they aren't be seen in a config file+ -- (because many things before this point have forced the one-time evaluation of progArgs).+ withArgs (progname:finalargs) $+ if+ -- 6.1. no command and a help/doc flag found - show general help/docs+ | nocmdprovided && helpFlag -> runPager $ showModeUsage (mainmode []) ++ "\n"+ | nocmdprovided && tldrFlag -> runTldrForPage "hledger"+ | nocmdprovided && infoFlag -> runInfoForTopic "hledger" Nothing+ | nocmdprovided && manFlag -> runManForTopic "hledger" Nothing++ -- 6.2. --version flag found and none of these other conditions - show version+ | versionFlag && not (isaddoncmd || helpFlag || tldrFlag || infoFlag || manFlag) -> putStrLn prognameandversion++ -- 6.3. no command found, nothing else to do - show the commands list+ | nocmdprovided -> do+ dbg1IO "no command, showing commands list" ()+ commands opts (ignoredjournal "commands")++ -- 6.4. builtin command found+ | Just (cmdmode, cmdaction) <- mbuiltincmdaction -> do+ let mmodecmdname = headMay $ modeNames cmdmode+ dbg1IO "running builtin command mode" $ fromMaybe "" mmodecmdname++ -- run the builtin command according to its type+ if+ -- 6.4.1. help/doc flag - show command help/docs+ | helpFlag -> runPager $ showModeUsage cmdmode ++ "\n"+ | tldrFlag -> runTldrForPage $ maybe "hledger" (("hledger-"<>)) mmodecmdname+ | infoFlag -> runInfoForTopic "hledger" mmodecmdname+ | manFlag -> runManForTopic "hledger" mmodecmdname++ -- 6.4.2. builtin command which should not require or read the journal - run it+ | cmdname `elem` ["commands","demo","help","setup","test"] ->+ cmdaction opts (ignoredjournal cmdname)++ -- 6.4.3. builtin command which can work with a non-existent journal+ | cmdname `elem` ["add","import"] ->+ withPossibleJournal opts (cmdaction opts)++ -- 6.4.4. "run" and "repl" need findBuiltinCommands passed to it to avoid circular dependency in the code+ | cmdname == "run" -> Hledger.Cli.Commands.Run.run Nothing findBuiltinCommand addons opts+ | cmdname == "repl" -> Hledger.Cli.Commands.Run.repl findBuiltinCommand addons opts++ -- 6.4.5. all other builtin commands - read the journal and if successful run the command with it+ | otherwise -> withJournal opts $ cmdaction opts++ -- 6.5. external addon command found - run it,+ -- passing any cli arguments written after the command name+ -- and any command-specific opts from the config file.+ -- Any "--" arguments, which sometimes must be used in the command line+ -- to hide addon-specific opts from hledger's cmdargs parsing,+ -- (and are also accepted in the config file, though not required there),+ -- will be removed.+ -- (hledger does not preserve -- arguments)+ -- Arguments written before the command name, and general opts from the config file,+ -- are not passed since we can't be sure they're supported.+ | isaddoncmd -> do+ let+ addonargs0 = filter (/="--") $ supportedgenargsfromconf <> confcmdargs <> cliargswithoutcmd+ addonargs = dropCliSpecificOpts addonargs0+ shellcmd = printf "%s-%s %s" progname cmdname (unwords $ map quoteForCommandLine addonargs) :: String+ dbgio "addon command selected" cmdname+ dbgio "addon command arguments" addonargs+ dbg1IO "running addon" shellcmd+ system shellcmd >>= exitWith++ -- deprecated command found+ -- cmdname == "convert" = error' (modeHelp oldconvertmode)++ -- 6.6. something else (shouldn't happen) - show an error+ | otherwise -> usageError $+ "could not understand the arguments "++show finalargs+ <> if null confothergenargs then "" else "\ngeneral arguments added from config file: "++show confothergenargs+ <> if null confcmdargs then "" else "\ncommand arguments added from config file: "++show confcmdargs++ -- 7. And we're done.+ -- Give ghc-debug a final chance to take control.+ when (ghcDebugMode == GDPauseAtEnd) $ ghcDebugPause'++------------------------------------------------------------------------------+++-- | A helper for addons/scripts: this parses hledger CliOpts from these+-- command line arguments and add-on command names, roughly how hledger main does.+-- If option parsing/validating fails, it exits the program with usageError.+-- Unlike main, this does not read extra args from a config file+-- or search for addons; to do those things, mimic the code in main for now.+argsToCliOpts :: [String] -> [String] -> IO CliOpts+argsToCliOpts args addons = do+ let+ (_, _, args0) = moveFlagsAfterCommand args+ args1 = replaceNumericFlags args0+ rawopts = cmdargsParse "for options" (mainmode addons) args1+ rawOptsToCliOpts rawopts++-- | Parse the given command line arguments/options with the given cmdargs mode,+-- after adding values to any valueless --debug flags,+-- with debug logging showing the given description of this parsing pass+-- (useful when cmdargsParse is called more than once).+-- If parsing fails, exit the program with an informative error message.+cmdargsParse :: String -> Mode RawOpts -> [String] -> RawOpts+cmdargsParse desc m args0 = process m (ensureDebugFlagHasVal args0)+ & either+ (\e -> error' $ e <> "\n* while parsing the following args, " <> desc <> ":\n* " <> unwords (map quoteIfNeeded args0))+ (dbgMsg verboseDebugLevel ("cmdargs: parsing " <> desc <> ": " <> show args0))+ -- XXX better error message when cmdargs fails (eg spaced/quoted/malformed flag values) ?++-- | cmdargs does not allow options to appear before the subcommand argument.+-- We prefer to hide this restriction from the user, providing a more forgiving CLI.+-- So this helper tries to move any pre-command flags/options, and their values if any, after the command argument.+-- If there is a "--"" argument, only the preceding args are rearranged.+-- To be precise: pre-command options will be moved to the end of the part of the command line preceding the first -- argument.+-- The pre-command options' relative order will be preserved, but since they may be moved after post-command options,+-- the overall order of options may change.+-- XXX moving them right after the command would probably be better.+--+-- For convenience of the caller, this currently returns a triple:+-- (+-- the command, if one was found (or ""),+-- the rearranged args without the command,+-- the command followed by the rearranged args+-- )+--+-- Notes:+--+-- Detecting the command argument is tricky because of the flexibility of traditional flag syntax.+-- Short flags can be joined together, some flags can have a value or no value,+-- flags and values can be separated by =, a space, or nothing, etc.+--+-- In this context, a "flag" is an argument beginning with - or --, followed by one or more non-space characters.+-- We decide if a flag, and possibly its subsequent value argument, are movable+-- by checking these cases in order:+--+-- - it exactly matches a known short or long no-value flag; move it+-- - it exactly matches a short or long requires-value flag; move it and the following argument+-- - it exactly matches a short optional-value flag; assume these don't exist or we don't have any+-- - it exactly matches a long optional-value flag; assume there's no value, move it+-- - it begins with a short requires-value flag; the value is joined to it, move it+-- - it begins with a long requires-value flag followed by =; likewise+-- - it begins with a long optional-value flag followed by =; likewise+--+-- This hackery increases the risk of misleading errors, bugs, and confusion.+-- It should be fairly robust now, being aware of all builtin flags.+-- The main tests are in hledger/test/cli/cli.test, but they are not exhaustive.+--+-- All general and builtin command flags (and their values) will be moved. It's clearer to+-- write command flags after the command, but if not we'll handle it (for greater robustness).+--+-- Long flags should be spelled in full; abbreviated long flags might not get moved.+--+-- Unknown flags (from addons) are assumed to be valueless or have a joined value,+-- and will be moved - but later rejected by cmdargs.+-- Instead these should be written to the right of a "--" argument, which hides them.+--+moveFlagsAfterCommand :: [String] -> (String, [String], [String])+moveFlagsAfterCommand args =+ case moveFlagAndVal (as1, []) of+ ([],as1') -> ("", as, as) where as = as1' <> as2+ (unmoved@(('-':_):_), moved) -> ("", as, as) where as = moved <> unmoved <> as2+ (cmdarg:unmoved, moved) -> (cmdarg, as, cmdarg:as) where as = moved <> unmoved <> as2+ where+ (as1, as2) = break (== "--") args+ -- Move the next argument to the end if it is a movable flag, along with its subsequent value argument if any.+ moveFlagAndVal :: ([String], [String]) -> ([String], [String])+ moveFlagAndVal ((a:b:cs), moved) =+ case isMovableFlagArg a (Just b) of+ 2 -> dbgMsg lvl ("moving 2: "<>a<>" "<>b) $ moveFlagAndVal (cs, moved++[a,b])+ 1 -> dbgMsg lvl ("moving 1: "<>a) $ moveFlagAndVal (b:cs, moved++[a])+ _ -> (a:b:cs, moved)+ moveFlagAndVal ([a], moved) =+ case isMovableFlagArg a Nothing of+ 1 -> dbgMsg lvl ("moving 1: "<>a) ([], moved++[a])+ _ -> ([a], moved)+ moveFlagAndVal ([], moved) = ([], moved)+ lvl = 8++-- Is this a short or long flag argument that should be moved,+-- and is its following argument a value that also should be moved ?+-- Returns:+-- 0 (not a flag; don't move this argument)+-- 1 (a valueless flag, or a long flag with joined argument, or multiple joined valueless short flags; move this argument)+-- 2 (a short or long flag with a value in the next argument; move this and next argument).+isMovableFlagArg :: String -> Maybe String -> Int+isMovableFlagArg a1 ma2+ | a1 `elem` noValFlagArgs = 1 -- short or long no-val flag+ | a1 == "--debug" && isJust ma2 && not (isDebugValue $ fromJust ma2) = 1 --debug without a value+ | a1 `elem` reqValFlagArgs = 2 -- short or long req-val flag (or --debug) with a separate value+ | a1 `elem` optValFlagArgs = 1 -- long (or short ?) opt-val flag, assume no value+ | any (`isPrefixOf` a1) shortReqValFlagArgs = 1 -- short req-val flag with a joined value+ -- or possibly multiple joined valueless short flags, we won't move those correctly+ | any (`isPrefixOf` a1) longReqValFlagArgs_ = 1 -- long req-val flag (or --debug) with a joined value+ | any (`isPrefixOf` a1) longOptValFlagArgs_ = 1 -- long opt-val flag with a joined value+ -- | isLongFlagArg a1 && any (takeWhile (/='=') `isPrefixOf`) longReqValFlagArgs_ ... -- try to move abbreviated long flags ?+ | isFlagArg a1 = 1 -- an addon flag (or mistyped flag) we don't know, assume no value or value is joined+ | otherwise = 0 -- not a flag++-- Is this string a valid --debug value ?+isDebugValue s = isRight $ parsewith isdebugvalp $ pack s+ where isdebugvalp = optional (char '-') >> takeWhile1P Nothing isDigit <* eof :: TextParser m Text++-- Flag arguments are command line arguments beginning with - or --+-- (followed by a short of long flag name, and possibly joined short flags or a joined value).+isFlagArg, isShortFlagArg, isLongFlagArg :: String -> Bool+isFlagArg a = isShortFlagArg a || isLongFlagArg a++isShortFlagArg ('-':c:_) = c /= '-'+isShortFlagArg _ = False++isLongFlagArg ('-':'-':_:_) = True+isLongFlagArg _ = False++-- | Add the leading hyphen(s) to a short or long flag name.+toFlagArg :: Name -> String+toFlagArg f = if length f == 1 then "-"++f else "--"++f++-- | Flatten a possibly multi-named Flag to (name, FlagInfo) pairs.+toFlagInfos :: Flag RawOpts -> [(Name, FlagInfo)]+toFlagInfos f = [(n,i) | let i = flagInfo f, n <- flagNames f]++-- | Is this flag's value optional ?+isOptVal :: FlagInfo -> Bool+isOptVal = \case+ FlagOpt _ -> True+ FlagOptRare _ -> True+ _ -> False++-- | All the general flags defined in hledger's main mode.+generalFlags :: [Flag RawOpts]+generalFlags = concatMap snd groupNamed <> groupHidden <> groupUnnamed+ where Group{..} = modeGroupFlags $ mainmode [] ++-- | All the general flag names.+generalFlagNames :: [Name]+generalFlagNames = concatMap flagNames generalFlags++-- | All hledger's builtin subcommand-specific flags.+commandFlags :: [Flag RawOpts]+commandFlags = concatMap (groupUnnamed.modeGroupFlags) commandModes+ where+ commandModes = concatMap snd groupNamed <> groupUnnamed <> groupHidden+ where Group{..} = modeGroupModes $ mainmode []++-- | The names of general options flags, grouped by whether they expect a value.+-- There may be some overlaps with command flag names.+noValGeneralFlagNames, reqValGeneralFlagNames, optValGeneralFlagNames :: [Name]+noValGeneralFlagNames = [f | (f,i) <- concatMap toFlagInfos generalFlags, i == FlagNone]+reqValGeneralFlagNames = [f | (f,i) <- concatMap toFlagInfos generalFlags, i == FlagReq]+optValGeneralFlagNames = [f | (f,i) <- concatMap toFlagInfos generalFlags, isOptVal i]++-- | The names of builtin subcommand flags, grouped by whether they expect a value.+-- There may be some overlaps with general flag names.+noValCommandFlagNames, reqValCommandFlagNames, optValCommandFlagNames :: [Name]+noValCommandFlagNames = [f | (f,i) <- concatMap toFlagInfos commandFlags, i == FlagNone]+reqValCommandFlagNames = [f | (f,i) <- concatMap toFlagInfos commandFlags, i == FlagReq]+optValCommandFlagNames = [f | (f,i) <- concatMap toFlagInfos commandFlags, isOptVal i]++-- All flag arguments understood by hledger cli and builtin commands, grouped by whether they expect a value.+-- Any command flags which have the same name as a general flag are excluded.+noValFlagArgs = map toFlagArg $ noValGeneralFlagNames `union` (noValCommandFlagNames \\ generalFlagNames)+reqValFlagArgs = map toFlagArg $ reqValGeneralFlagNames `union` (reqValCommandFlagNames \\ generalFlagNames)+optValFlagArgs = map toFlagArg $ optValGeneralFlagNames `union` (optValCommandFlagNames \\ generalFlagNames)++-- Short flag args that expect a required value.+shortReqValFlagArgs = filter isShortFlagArg reqValFlagArgs++-- Long flag args that expect a required value, with = appended.+longReqValFlagArgs_ = map (++"=") $ filter isLongFlagArg reqValFlagArgs++-- Long flag args that expect an optional value, with = appended.+longOptValFlagArgs_ = map (++"=") $ filter isLongFlagArg optValFlagArgs ++ ["--debug"]++-- Drop any arguments which look like cli-specific options (--no-conf, --conf CONFFILE, etc.)+-- Keep synced with mainmode's groupUnnamed.+dropCliSpecificOpts :: [String] -> [String]+dropCliSpecificOpts = \case+ "--conf":_:as -> dropCliSpecificOpts as+ a:as | "--conf=" `isPrefixOf` a -> dropCliSpecificOpts as+ "--no-conf":as -> dropCliSpecificOpts as+ "-n":as -> dropCliSpecificOpts as+ a:as -> a:dropCliSpecificOpts as+ [] -> []++-- | Given a hledger cmdargs mode and a list of command line arguments, try to drop any of the+-- arguments which seem to be flags not supported by this mode. Also drop their values if any.+--+-- >>> dropUnsupportedOpts confflagsmode ["--debug","1","-f","file"]+-- []+-- >>> dropUnsupportedOpts confflagsmode ["--debug","-f","file"]+-- []+dropUnsupportedOpts :: Mode RawOpts -> [String] -> [String]+dropUnsupportedOpts m = \case+ [] -> []+ "--debug":a:as | not (m `supportsFlag` "debug") ->+ go $ if isDebugValue a then as else a:as+ a:as -> if+ | isLongFlagArg a,+ let f = takeWhile (/='=') a,+ let as' = if isReqValFlagArg f && '=' `notElem` a then drop 1 as else as+ -> if m `supportsFlag` f then a : go as else go as'+ | isShortFlagArg a,+ let f = take 2 a,+ let as' = if isReqValFlagArg f && length a == 2 then drop 1 as else as+ -> if m `supportsFlag` f then a : go as else go as'+ | otherwise -> a : dropUnsupportedOpts m as+ where+ go = dropUnsupportedOpts m+ isReqValFlagArg = (`elem` reqValFlagArgs)+ supportsFlag m1 flagarg = elem flagarg $ map toFlagArg $ concatMap flagNames $ modeAndSubmodeFlags m1++-- | Get all the flags defined in a mode or its immediate subcommands,+-- whether in named, unnamed or hidden groups.+-- Does not recurse into subsubcommands,+-- and does not deduplicate (general flags are repeated on all hledger subcommands).+modeAndSubmodeFlags :: Mode a -> [Flag a]+modeAndSubmodeFlags m@Mode{modeGroupModes=Group{..}} =+ modeFlags m <> concatMap modeFlags (concatMap snd groupNamed <> groupUnnamed <> groupHidden)++-- unit tests (tests_Hledger_Cli) are defined in Hledger.Cli.Commands
+ Hledger/Cli/Anchor.hs view
@@ -0,0 +1,96 @@+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE QuasiQuotes #-}+module Hledger.Cli.Anchor (+ setAccountAnchor,+ dateCell,+ dateSpanCell,+ headerDateSpanCell,+ ) where++import Data.Text qualified as Text+import Data.Text (Text)+import Data.Time (Day)+import Data.Maybe (fromMaybe)++import Text.URI qualified as Uri+import Text.URI.QQ qualified as UriQQ++import Hledger.Write.Spreadsheet qualified as Spr+import Hledger.Write.Spreadsheet (headerCell)+import Hledger.Utils.IO (error')+import Hledger.Utils.Text (quoteIfSpaced)+import Hledger.Data.Dates (showDateSpan, showDate)+import Hledger.Data.Types (DateSpan)+++registerQueryUrl :: [Text] -> Text+registerQueryUrl query =+ Uri.render $+ [UriQQ.uri|register|] {+ Uri.uriQuery =+ [Uri.QueryParam [UriQQ.queryKey|q|] $+ fromMaybe (error' "register URI query construction failed") $+ Uri.mkQueryValue $ Text.unwords $+ map quoteIfSpaced $ filter (not . Text.null) query]+ }++{- |+>>> composeAnchor Nothing ["date:2024"]+""+>>> composeAnchor (Just "") ["date:2024"]+"register?q=date:2024"+>>> composeAnchor (Just "/") ["date:2024"]+"/register?q=date:2024"+>>> composeAnchor (Just "foo") ["date:2024"]+"foo/register?q=date:2024"+>>> composeAnchor (Just "foo/") ["date:2024"]+"foo/register?q=date:2024"+-}+composeAnchor :: Maybe Text -> [Text] -> Text+composeAnchor Nothing _ = mempty+composeAnchor (Just baseUrl) query =+ baseUrl <>+ (if all (('/'==) . snd) $ Text.unsnoc baseUrl then "" else "/") <>+ registerQueryUrl query++-- cf. Web.Widget.Common+removeDates :: [Text] -> [Text]+removeDates =+ filter (\term_ ->+ not $ Text.isPrefixOf "date:" term_ || Text.isPrefixOf "date2:" term_)++replaceDate :: Text -> [Text] -> [Text]+replaceDate prd query = "date:"<>prd : removeDates query++headerDateSpanCell ::+ Maybe Text -> [Text] -> DateSpan -> Spr.Cell () Text+headerDateSpanCell base query spn =+ let prd = showDateSpan spn in+ (headerCell prd) {+ Spr.cellAnchor = composeAnchor base $ replaceDate prd query+ }+++dateQueryCell ::+ (Spr.Lines border) =>+ Maybe Text -> [Text] -> Text -> Text -> Spr.Cell border Text+dateQueryCell base query acct dateTerm =+ (Spr.defaultCell dateTerm) {+ Spr.cellAnchor =+ composeAnchor base $ "inacct:"<>acct : replaceDate dateTerm query+ }++dateCell ::+ (Spr.Lines border) =>+ Maybe Text -> [Text] -> Text -> Day -> Spr.Cell border Text+dateCell base query acct = dateQueryCell base query acct . showDate++dateSpanCell ::+ (Spr.Lines border) =>+ Maybe Text -> [Text] -> Text -> DateSpan -> Spr.Cell border Text+dateSpanCell base query acct = dateQueryCell base query acct . showDateSpan++setAccountAnchor ::+ Maybe Text -> [Text] -> Text -> Spr.Cell border text -> Spr.Cell border text+setAccountAnchor base query acct cell =+ cell {Spr.cellAnchor = composeAnchor base $ "inacct:"<>acct : query}
+ Hledger/Cli/Anon.hs view
@@ -0,0 +1,58 @@+{-|++Instances for obfuscating sensitive data (mainly text, not numbers) in various types.++Currently this is deterministic and does not provide much privacy.+It has been moved to a hidden --obfuscate flag, with the old --anon flag+now raising an error. See https://github.com/simonmichael/hledger/issues/2133 .++-}++module Hledger.Cli.Anon+ ( Anon(..)+ , anonAccount+ )+where++import Control.Arrow (first)+import Data.Hashable (hash)+import Data.Word (Word32)+import Numeric (showHex)+import Data.Text qualified as T++import Hledger.Data+import Data.Map (mapKeys)++class Anon a where+ -- | Consistent converter to structure with sensitive data anonymized+ anon :: a -> a++instance Anon Journal where+ -- Apply the anonymisation transformation on a journal after finalisation+ anon j = j { jtxns = map anon . jtxns $ j+ , jparseparentaccounts = map anonAccount $ jparseparentaccounts j+ , jparsealiases = [] -- already applied+ , jdeclaredaccounts = map (first anon) $ jdeclaredaccounts j+ , jdeclaredaccounttags = mapKeys anon $ jdeclaredaccounttags j+ , jdeclaredaccounttypes = (map anon) <$> jdeclaredaccounttypes j+ }++instance Anon Posting where+ anon p = p { paccount = anonAccount . paccount $ p+ , pcomment = T.empty+ , ptransaction = fmap anon . ptransaction $ p -- Note that this will be overridden+ , poriginal = anon <$> poriginal p+ }++instance Anon Transaction where+ anon txn = txnTieKnot $ txn { tpostings = map anon . tpostings $ txn+ , tdescription = anon . tdescription $ txn+ , tcode = anon . tcode $ txn+ , tcomment = T.empty+ }++-- | Anonymize account name preserving hierarchy+anonAccount :: AccountName -> AccountName+anonAccount = T.intercalate (T.pack ":") . map anon . T.splitOn (T.pack ":")++instance Anon T.Text where anon = T.pack . flip showHex "" . (fromIntegral :: Int -> Word32) . hash
Hledger/Cli/CliOptions.hs view
@@ -5,21 +5,43 @@ -} -{-# LANGUAGE CPP, ScopedTypeVariables, DeriveDataTypeable, FlexibleContexts, TypeFamilies, OverloadedStrings, PackageImports #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeFamilies #-}+{-# LANGUAGE TypeOperators #-}+{-# LANGUAGE NamedFieldPuns #-} module Hledger.Cli.CliOptions (+ progname,+ prognameandversion,+ binaryinfo, -- * cmdargs flags & modes- helpflags,- detailedversionflag, inputflags, reportflags,- outputflags,+ helpflags,+ terminalflags,+ helpflagstitle,+ flattreeflags,+ confflags,+ hiddenflags,+ hiddenflagsformainmode,+ -- outputflags, outputFormatFlag, outputFileFlag, generalflagsgroup1, generalflagsgroup2, generalflagsgroup3,+ mkgeneralflagsgroups1,+ mkgeneralflagsgroups2,+ mkgeneralflagsgroups3,+ cligeneralflagsgroups1,+ cligeneralflagsgroups2,+ cligeneralflagsgroups3, defMode, defCommandMode, addonCommandMode,@@ -28,38 +50,40 @@ showModeUsage, withAliases, likelyExecutablesInPath,- hledgerExecutablesInPath, -- * CLI options CliOpts(..),+ HasCliOpts(..), defcliopts, getHledgerCliOpts,- decodeRawOpts,+ getHledgerCliOpts', rawOptsToCliOpts,- checkCliOpts,+ cliOptsDropArgs,+ argsAddDoubleDash, outputFormats, defaultOutputFormat,- defaultBalanceLineFormat,- CommandDoc,+ CommandHelpStr,+ parseCommandHelp, -- possibly these should move into argsToCliOpts -- * CLI option accessors -- | These do the extra processing required for some options. journalFilePathFromOpts,+ journalFilePathFromOptsNoDefault, rulesFilePathFromOpts, outputFileFromOpts, outputFormatFromOpts, defaultWidth,- widthFromOpts, replaceNumericFlags,+ ensureDebugFlagHasVal, -- | For register: registerWidthsFromOpts,- -- | For balance:- lineFormatFromOpts, -- * Other utils- hledgerAddons, topicForMode,+ DeclarablesSelector(..),+ declarablesSelectorFromOpts,+ findMatchedByArgument, -- -- * Convenience re-exports -- module Data.String.Here,@@ -67,108 +91,285 @@ ) where -import Prelude ()-import "base-compat-batteries" Prelude.Compat-import qualified Control.Exception as C+import Control.Exception qualified as C import Control.Monad (when) import Data.Char import Data.Default-import Data.Functor.Identity (Identity)-import "base-compat-batteries" Data.List.Compat-import Data.List.Split (splitOneOf)-import Data.Ord+import Data.List.Extra (intercalate, isInfixOf, nubSort)+import Data.List.NonEmpty qualified as NE (NonEmpty, fromList, nonEmpty)+import Data.List.Split (splitOn) import Data.Maybe --import Data.String.Here -- import Data.Text (Text)-import qualified Data.Text as T+import Data.Text qualified as T import Data.Void (Void)+import GitHash (tGitInfoCwdTry) import Safe+import String.ANSI import System.Console.CmdArgs hiding (Default,def) import System.Console.CmdArgs.Explicit import System.Console.CmdArgs.Text-#ifndef mingw32_HOST_OS-import System.Console.Terminfo-#endif import System.Directory import System.Environment import System.Exit (exitSuccess) import System.FilePath+import System.Info (os) import Text.Megaparsec import Text.Megaparsec.Char import Hledger import Hledger.Cli.DocFiles import Hledger.Cli.Version+import Data.Time.Clock.POSIX (POSIXTime)+import Data.List (find, isPrefixOf, isSuffixOf)+import Data.Function ((&)) --- common cmdargs flags+-- | The name of this program's executable.+progname :: ProgramName+progname = "hledger" --- | Common help flags: --help, --debug, --version...-helpflags :: [Flag RawOpts]-helpflags = [- flagNone ["help","h"] (setboolopt "help") "show general usage (or after CMD, command usage)"- -- ,flagNone ["browse-args"] (setboolopt "browse-args") "use a web UI to select options and build up a command line"- ,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[N]" "show debug output (levels 1-9, default: 1)"- ,flagNone ["version"] (setboolopt "version") "show version information"- ]+-- | Generate the version string for this program.+-- The template haskell call is here rather than in Hledger.Cli.Version to avoid wasteful recompilation.+prognameandversion :: String+prognameandversion =+ versionStringWith+ $$tGitInfoCwdTry+#ifdef GHCDEBUG+ True+#else+ False+#endif+ progname+ packageversion --- | A hidden flag, just for the hledger executable.-detailedversionflag :: Flag RawOpts-detailedversionflag = flagNone ["version+"] (setboolopt "version+") "show version information with extra detail"+binaryinfo :: HledgerBinaryInfo+Right binaryinfo = parseHledgerVersion prognameandversion+-- ui and web use nullbinaryinfo for a parse failure here to silence an inexhaustive pattern warning.+-- I can't reproduce that warning right now, so here I've stuck with the original approach,+-- which will force a compile error if prognameandversion is ever malformed, eg from unexpected+-- git output. --- | Common input-related flags: --file, --rules-file, --alias...+-- Common options.+-- keep synced: the docs macro in doc/common.m4++-- | Common input-related flags: --file, --rules, --conf, --alias... inputflags :: [Flag RawOpts] inputflags = [- flagReq ["file","f"] (\s opts -> Right $ setopt "file" s opts) "FILE" "use a different input file. For stdin, use - (default: $LEDGER_FILE or $HOME/.hledger.journal)"- ,flagReq ["rules-file"] (\s opts -> Right $ setopt "rules-file" s opts) "RFILE" "CSV conversion rules file (default: FILE.rules)"- ,flagReq ["separator"] (\s opts -> Right $ setopt "separator" s opts) "SEPARATOR" "CSV separator (default: ,)"- ,flagReq ["alias"] (\s opts -> Right $ setopt "alias" s opts) "OLD=NEW" "rename accounts named OLD to NEW"- ,flagNone ["anon"] (setboolopt "anon") "anonymize accounts and payees"- ,flagReq ["pivot"] (\s opts -> Right $ setopt "pivot" s opts) "TAGNAME" "use some other field/tag for account names"- ,flagNone ["ignore-assertions","I"] (setboolopt "ignore-assertions") "ignore any balance assertions"- ]+ flagReq ["file","f"] (\s opts -> Right $ setopt "file" s opts) "[FMT:]FILE" $ unwords [+ "Use this as the journal file (- means stdin)."+ ,"If not specified, $LEDGER_FILE or ~/.hledger.journal will be used."+ ,"If specified more than once, the files will be read in order."+ ,"Each file's format (journal, csv, timeclock, timedot, rules..) is inferred from the file extension or a FMT: prefix."+ ,"Some commands (add, import) write to the (first) file,"+ ,"and expect it to be in journal format."+ ]+ ,flagReq ["rules"] (\s opts -> Right $ setopt "rules" s opts) "RULESFILE" "Use rules defined in this rules file for converting subsequent CSV/SSV/TSV files. If not specified, uses FILE.csv.rules for each FILE.csv." -- see also hiddenflags + ,flagReq ["alias"] (\s opts -> Right $ setopt "alias" s opts) "A=B|/RGX/=RPL" "transform account names from A to B, or by replacing regular expression matches"+ ,flagNone ["auto"] (setboolopt "auto") "generate extra postings by applying auto posting rules (\"=\") to all transactions"+ ,flagOpt "" ["forecast"] (\s opts -> Right $ setopt "forecast" s opts) "PERIOD" (unwords+ [ "Generate extra transactions from periodic rules (\"~\"),"+ , "from after the latest ordinary transaction until 6 months from now. Or, during the specified PERIOD (the equals is required)."+ , "Auto posting rules will also be applied to these transactions."+ , "In hledger-ui, also make future-dated transactions visible at startup."+ ])+ ,flagNone ["ignore-assertions","I"] (setboolopt "ignore-assertions") "don't check balance assertions by default"+ ,flagReq ["txn-balancing"] (\s opts -> Right $ setopt "txn-balancing" s opts) "..." (unlines [+ "how to check that transactions are balanced:"+ ,"'old': - use global display precision"+ ,"'exact': - use transaction precision (default)"+ ])+ ,flagNone ["infer-costs"] (setboolopt "infer-costs") "infer conversion equity postings from costs"+ ,flagNone ["infer-equity"] (setboolopt "infer-equity") "infer costs from conversion equity postings"+ -- history of this flag so far, lest we be confused:+ -- originally --infer-value+ -- 2021-02 --infer-market-price added, --infer-value deprecated+ -- 2021-09+ -- --infer-value hidden+ -- --infer-market-price renamed to --infer-market-prices, old spelling still works+ -- ReportOptions{infer_value_} renamed to infer_prices_, BalancingOpts{infer_prices_} renamed to infer_transaction_prices_+ -- some related prices command changes+ -- --costs deprecated and hidden, uses --infer-market-prices instead+ -- --inverted-costs renamed to --infer-reverse-prices+ ,flagNone ["infer-market-prices"] (setboolopt "infer-market-prices") "infer market prices from costs"+ ,flagReq ["pivot"] (\s opts -> Right $ setopt "pivot" s opts) "TAGNAME" "use a different field or tag as account names"+ ,flagNone ["strict","s"] (setboolopt "strict") "do extra error checks (and override -I)"++ -- generating transactions/postings+ ,flagNone ["verbose-tags"] (setboolopt "verbose-tags") "add tags indicating generated/modified data"+ ]+ -- | Common report-related flags: --period, --cost, etc. reportflags :: [Flag RawOpts] reportflags = [- flagReq ["begin","b"] (\s opts -> Right $ setopt "begin" s opts) "DATE" "include postings/txns on or after this date"- ,flagReq ["end","e"] (\s opts -> Right $ setopt "end" s opts) "DATE" "include postings/txns before this date"- ,flagNone ["daily","D"] (setboolopt "daily") "multiperiod/multicolumn report by day"- ,flagNone ["weekly","W"] (setboolopt "weekly") "multiperiod/multicolumn report by week"- ,flagNone ["monthly","M"] (setboolopt "monthly") "multiperiod/multicolumn report by month"- ,flagNone ["quarterly","Q"] (setboolopt "quarterly") "multiperiod/multicolumn report by quarter"- ,flagNone ["yearly","Y"] (setboolopt "yearly") "multiperiod/multicolumn report by year"- ,flagReq ["period","p"] (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set start date, end date, and/or report interval all at once (overrides the flags above)"- ,flagNone ["date2"] (setboolopt "date2") "match the secondary date instead (see command help for other effects)" - ,flagNone ["unmarked","U"] (setboolopt "unmarked") "include only unmarked postings/txns (can combine with -P or -C)"- ,flagNone ["pending","P"] (setboolopt "pending") "include only pending postings/txns"- ,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/txns"- ,flagNone ["real","R"] (setboolopt "real") "include only non-virtual postings"- ,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "NUM" "(or -NUM): hide accounts/postings deeper than this"- ,flagNone ["empty","E"] (setboolopt "empty") "show items with zero amount, normally hidden (and vice-versa in hledger-ui/hledger-web)"- ,flagNone ["cost","B"] (setboolopt "cost") "convert amounts to their cost at transaction time (using the transaction price, if any)"- ,flagNone ["value","V"] (setboolopt "value") "convert amounts to their market value on the report end date (using the most recent applicable market price, if any)"- ,flagNone ["auto"] (setboolopt "auto") "apply automated posting rules to modify transactions"- ,flagNone ["forecast"] (setboolopt "forecast") "apply periodic transaction rules to generate future transactions, to 6 months from now or report end date"+ -- report period, interval, dates+ flagReq ["begin","b"] (\s opts -> Right $ setopt "begin" s opts) "DATE" "include postings/transactions on/after this date"+ ,flagReq ["end","e"] (\s opts -> Right $ setopt "end" s opts) "DATE" "include postings/transactions before this date (with a report interval, will be adjusted to following subperiod end)"+ ,flagNone ["daily","D"] (setboolopt "daily") "set report interval: 1 day"+ ,flagNone ["weekly","W"] (setboolopt "weekly") "set report interval: 1 week"+ ,flagNone ["monthly","M"] (setboolopt "monthly") "set report interval: 1 month"+ ,flagNone ["quarterly","Q"] (setboolopt "quarterly") "set report interval: 1 quarter"+ ,flagNone ["yearly","Y"] (setboolopt "yearly") "set report interval: 1 year"+ ,flagReq ["period","p"] (\s opts -> Right $ setopt "period" s opts) "PERIODEXP" "set begin date, end date, and/or report interval, with more flexibility"+ ,flagReq ["today"] (\s opts -> Right $ setopt "today" s opts) "DATE" "override today's date (affects relative dates)"+ ,flagNone ["date2"] (setboolopt "date2") "match/use secondary dates instead (deprecated)" -- see also hiddenflags++ -- status/realness/zero/depth filters+ ,flagNone ["unmarked","U"] (setboolopt "unmarked") "include only unmarked postings/transactions"+ ,flagNone ["pending","P"] (setboolopt "pending") "include only pending postings/transactions"+ ,flagNone ["cleared","C"] (setboolopt "cleared") "include only cleared postings/transactions\n(-U/-P/-C can be combined)"+ ,flagNone ["real","R"] (setboolopt "real") "include only non-virtual postings"+ ,flagNone ["empty","E"] (setboolopt "empty") "Show zero items, which are normally hidden.\nIn hledger-ui & hledger-web, do the opposite."+ ,flagReq ["depth"] (\s opts -> Right $ setopt "depth" s opts) "DEPTHEXP" "if a number (or -NUM): show only top NUM levels of accounts. If REGEXP=NUM, only apply limiting to accounts matching the regular expression."++ -- valuation+ ,flagNone ["B","cost"] (setboolopt "B") "convert amounts to their cost/sale amount (@/@@)"+ -- ^ no "valuation mode:" prefix for this one, it's not mutually exclusive+ ,flagNone ["V","market"] (setboolopt "V")+ (unwords+ [valuationprefix ++ "show amounts converted to market value at period end(s) in their default valuation commodity."+ ,"Short for --value=end."+ ])+ ,flagReq ["X","exchange"] (\s opts -> Right $ setopt "X" s opts) "COMM"+ (unwords+ [valuationprefix ++ "show amounts converted to market value at period end(s) in the specified commodity."+ ,"Short for --value=end,COMM."+ ])+ ,flagReq ["value"] (\s opts -> Right $ setopt "value" s opts) "WHEN[,COMM]"+ (unlines+ [valuationprefix ++ "show amounts converted to market value on the specified date(s) in their default valuation commodity or a specified commodity. WHEN can be:"+ ,"'then': value on transaction dates"+ ,"'end': value at period end(s)"+ ,"'now': value today"+ ,"YYYY-MM-DD: value on given date"+ ])++ -- display+ ,flagReq ["commodity-style", "c"] (\s opts -> Right $ setopt "commodity-style" s opts) "S"+ "Override a commodity's display style.\nEg: -c '$1000.' or -c '1.000,00 EUR'"+ ,flagOpt "yes" ["pretty"] (\s opts -> Right $ setopt "pretty" s opts) "YN"+ "Use box-drawing characters in text output? The optional 'y'/'yes' or 'n'/'no' arg requires =." ]+ where+ valuationprefix = "valuation mode: " +helpflags :: [Flag RawOpts]+helpflags = [+ flagNone ["help","h"] (setboolopt "help") "show command line help"+ ,flagNone ["tldr"] (setboolopt "tldr") "show command examples with tldr"+ ,flagNone ["info"] (setboolopt "info") "show the manual with info"+ ,flagNone ["man"] (setboolopt "man") "show the manual with man"+ ,flagNone ["version"] (setboolopt "version") "show version information"+ -- flagOpt would be more correct for --debug, showing --debug[=LVL] rather than --debug=[LVL] in help.+ -- But flagReq plus special handling in Cli.hs makes the = optional, removing a source of confusion.+ ,flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[1-9]" "show this much debug output (default: 1)"+ ] -- XXX why are these duplicated in defCommandMode below ?+ <> terminalflags++-- Low-level flags affecting terminal output.+-- These are included in helpflags so they appear everywhere.+terminalflags = [+ flagReq ["pager"] (\s opts -> Right $ setopt "pager" s opts) "YN"+ "use a pager when needed ? y/yes (default) or n/no"++ -- keep synced with hledger-lib:colorOption:+ ,flagReq ["color","colour"] (\s opts -> Right $ setopt "color" s opts) "YNA"+ "use ANSI color ? y/yes, n/no, or auto (default)"+ ]++-- | Flags for selecting flat/tree mode, used for reports organised by account.+-- With a True argument, shows some extra help about inclusive/exclusive amounts.+flattreeflags :: Bool -> [Flag RawOpts]+flattreeflags showamounthelp = [+ flagNone ["flat","l"] (setboolopt "flat")+ (prefix ++ "show accounts as a flat list (default)"+ ++ if showamounthelp then ". Amounts exclude subaccount amounts, except where the account is depth-clipped." else "")+ ,flagNone ["tree","t"] (setboolopt "tree")+ (prefix ++ "show accounts as a tree" ++ if showamounthelp then ". Amounts include subaccount amounts." else "")+ ]+ where+ prefix = "list/tree mode: "++-- | hledger CLI's --conf/--no-conf flags.+confflags = [+ flagReq ["conf"] (\s opts -> Right $ setopt "conf" s opts) "CONFFILE"+ "Use extra options defined in this config file. If not specified, searches upward and in XDG config dir for hledger.conf (or .hledger.conf in $HOME)."+ ,flagNone ["no-conf","n"] (setboolopt "no-conf") "ignore any config file"+ ]++-- | Common legacy flags that are accepted but not shown in --help, when running the main mode.+hiddenflagsformainmode :: [Flag RawOpts]+hiddenflagsformainmode = [+ flagNone ["effective","aux-date"] (setboolopt "date2") "Ledger-compatible aliases for --date2"+ ,flagNone ["infer-value"] (setboolopt "infer-market-prices") "legacy flag that was renamed"+ ,flagNone ["pretty-tables"] (setopt "pretty" "always") "legacy flag that was renamed"+ ,flagNone ["anon"] (setboolopt "anon") "deprecated, renamed to --obfuscate" -- #2133, handled by anonymiseByOpts+ ,flagNone ["obfuscate"] (setboolopt "obfuscate") "slightly obfuscate hledger's output. Warning, does not give privacy. Formerly --anon." -- #2133, handled by maybeObfuscate+ ,flagNone ["old-timeclock", "timeclock-old"] (setboolopt "oldtimeclock") "don't pair timeclock entries by account name"+ ,flagNone ["old-glob"] (setboolopt "oldglob") "deprecated, no longer used as of 1.50.4" -- #2498+ ,flagReq ["rules-file"] (\s opts -> Right $ setopt "rules" s opts) "RULESFILE" "was renamed to --rules"+ ]++-- Hidden flags accepted but not shown, when running subcommand or addon command modes.+-- Here we add the confflags, so their presence won't cause an error,+hiddenflags :: [Flag RawOpts]+hiddenflags = hiddenflagsformainmode ++ confflags+ -- | Common output-related flags: --output-file, --output-format...-outputflags = [outputFormatFlag, outputFileFlag]-outputFormatFlag = flagReq ["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT" "select the output format. Supported formats:\ntxt, csv, html."-outputFileFlag = flagReq ["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE. A file extension matching one of the above formats selects that format." +-- outputflags = [outputFormatFlag, outputFileFlag]++outputFormatFlag :: [String] -> Flag RawOpts+outputFormatFlag fmts = flagReq+ ["output-format","O"] (\s opts -> Right $ setopt "output-format" s opts) "FMT"+ ("select the output format. Supported formats:\n" ++ intercalate ", " fmts ++ ".")++-- This has special support in hledger-lib:outputFileOption, keep synced+outputFileFlag :: Flag RawOpts+outputFileFlag = flagReq+ ["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE"+ "write output to FILE. A file extension matching one of the above formats selects that format."+ argsFlag :: FlagHelp -> Arg RawOpts-argsFlag desc = flagArg (\s opts -> Right $ setopt "args" s opts) desc+argsFlag = flagArg (\s opts -> Right $ setopt "args" s opts) generalflagstitle :: String generalflagstitle = "\nGeneral flags" +-- Several subsets of the standard general flags, as a single list. Old API used by some addons. generalflagsgroup1, generalflagsgroup2, generalflagsgroup3 :: (String, [Flag RawOpts]) generalflagsgroup1 = (generalflagstitle, inputflags ++ reportflags ++ helpflags) generalflagsgroup2 = (generalflagstitle, inputflags ++ helpflags) generalflagsgroup3 = (generalflagstitle, helpflags) +-- Helpers to make several subsets of the standard general flags, in separate groups. The help flags are parameterised. 2024.+mkgeneralflagsgroups1, mkgeneralflagsgroups2, mkgeneralflagsgroups3 :: [Flag RawOpts] -> [(String, [Flag RawOpts])]+mkgeneralflagsgroups1 helpflags' = [+ (inputflagstitle, inputflags)+ ,(outputflagstitle, reportflags)+ ,(helpflagstitle, helpflags')+ ]+mkgeneralflagsgroups2 helpflags' = [+ (inputflagstitle, inputflags)+ ,(helpflagstitle, helpflags')+ ]+mkgeneralflagsgroups3 helpflags' = [+ (helpflagstitle, helpflags')+ ]++inputflagstitle = "\nGeneral input flags"+outputflagstitle = "\nGeneral output flags (affecting some commands)"+helpflagstitle = "\nGeneral help flags"++-- Several subsets of the standard general flags plus CLI help flags, as separate groups.+cligeneralflagsgroups1, cligeneralflagsgroups2, cligeneralflagsgroups3 :: [(String, [Flag RawOpts])]+cligeneralflagsgroups1 = mkgeneralflagsgroups1 helpflags+cligeneralflagsgroups2 = mkgeneralflagsgroups2 helpflags+cligeneralflagsgroups3 = mkgeneralflagsgroups3 helpflags++ -- cmdargs mode constructors -- | An empty cmdargs mode to use as a template.@@ -186,7 +387,7 @@ ,groupHidden = [] -- flags not displayed in the usage } ,modeArgs = ([], Nothing) -- description of arguments accepted by the command- ,modeValue = [] -- value returned when this mode is used to parse a command line+ ,modeValue = def -- value returned when this mode is used to parse a command line ,modeCheck = Right -- whether the mode's value is correct ,modeReform = const Nothing -- function to convert the value back to a command line arguments ,modeExpandAt = True -- expand @ arguments for program ?@@ -202,20 +403,21 @@ ,modeGroupFlags = Group { groupNamed = [] ,groupUnnamed = [- flagNone ["help"] (setboolopt "help") "Show usage."- -- ,flagNone ["help"] (setboolopt "help") "Show long help."+ flagNone ["help"] (setboolopt "help") "show command-line help"+ ,flagNone ["man"] (setboolopt "man") "show this program's user manual with man"+ ,flagNone ["info"] (setboolopt "info") "show this program's user manual with info" ] ,groupHidden = [] -- flags not displayed in the usage } ,modeArgs = ([], Just $ argsFlag "[QUERY]")- ,modeValue=[("command", headDef "" names)]+ ,modeValue=setopt "command" (headDef "" names) def } -- | A cmdargs mode representing the hledger add-on command with the -- given name, providing hledger's common input/reporting/help flags. -- Just used when invoking addons. addonCommandMode :: Name -> Mode RawOpts-addonCommandMode name = (defCommandMode [name]) {+addonCommandMode nam = (defCommandMode [nam]) { modeHelp = "" -- XXX not needed ? -- fromMaybe "" $ lookup (stripAddonExtension name) [@@ -231,28 +433,38 @@ -- ] ,modeGroupFlags = Group { groupUnnamed = []- ,groupHidden = []- ,groupNamed = [generalflagsgroup1]+ ,groupHidden = hiddenflags+ ,groupNamed = cligeneralflagsgroups1 } } +-- | A command's name, optional official abbreviation, and help preamble & postamble,+-- as a specially formatted single string. Used to generate the CLI help, and also+-- the command's doc in the hledger manual. See parseCommandHelp for the format.+type CommandHelpStr = String+ -- | A command's documentation. Used both as part of CLI help, and as--- part of the hledger manual. See parseCommandDoc.-type CommandDoc = String+-- part of the hledger manual. See parseCommandHelpStr.+data CommandHelp = CommandHelp {+ cmdName :: Name -- the official command name+ ,mcmdShortName :: Maybe Name -- optional official name abbreviation+ ,cmdHelpPreamble :: String -- help preamble, shown before flags help+ ,cmdHelpPostamble :: String -- help postamble, shown after flags help+} deriving (Show) -- | Build a cmdarg mode for a hledger command, -- from a help template and flag/argument specifications. -- Reduces boilerplate a little, though the complicated cmdargs -- flag and argument specs are still required.-hledgerCommandMode :: CommandDoc -> [Flag RawOpts] -> [(String, [Flag RawOpts])] +hledgerCommandMode :: CommandHelpStr -> [Flag RawOpts] -> [(String, [Flag RawOpts])] -> [Flag RawOpts] -> ([Arg RawOpts], Maybe (Arg RawOpts)) -> Mode RawOpts-hledgerCommandMode doc unnamedflaggroup namedflaggroups hiddenflaggroup argsdescr =- case parseCommandDoc doc of- Nothing -> error' $ "Could not parse command doc:\n"++doc++"\n"- Just (names, shorthelp, longhelplines) ->- (defCommandMode names) {- modeHelp = shorthelp- ,modeHelpSuffix = longhelplines+hledgerCommandMode helpstr unnamedflaggroup namedflaggroups hiddenflaggroup argsdescr =+ case parseCommandHelp helpstr of+ Nothing -> error' $ "could not parse command doc:\n"++helpstr++"\n" -- PARTIAL:+ Just CommandHelp{cmdName, mcmdShortName, cmdHelpPreamble, cmdHelpPostamble} ->+ (defCommandMode $ cmdName : maybeToList mcmdShortName) {+ modeHelp = cmdHelpPreamble+ ,modeHelpSuffix = lines cmdHelpPostamble ,modeGroupFlags = Group { groupUnnamed = unnamedflaggroup ,groupNamed = namedflaggroups@@ -261,43 +473,80 @@ ,modeArgs = argsdescr } --- | Parse a command's documentation, as follows:+-- | Parse a command's embedded help text (@Somecommand.txt@).+-- That text is generated by @Shake cmdhelp@ from the command's doc source (@Somecommand.md@).+-- @Somecommand.md@ should be formatted as follows: ----- - First line: the command name then any aliases, as one or more space or comma-separated words+-- - First line: the command name, as a markdown heading. ----- - Second line to a line containing just _FLAGS_, or the end: the short help+-- - Optional third line: the command's official abbreviated name, parenthesised. ----- - Any lines after _FLAGS_: the long help (split into lines for cmdargs)+-- - From third or fifth line to a @```flags@ line: the command help preamble.+-- Usually one sentence or paragraph; any blank lines will not be rendered. ----- The CLI help displays the short help, then the cmdargs-generated--- flags list, then the long help (which some day we might make--- optional again). The manual displays the short help followed by--- the long help, with no flags list.+-- - A fenced code block beginning with @```flags@, containing a @Flags:@ line,+-- followed by a snapshot of the command-specific flags help as generated by cmdargs+-- or "none" if there are no command-specific flags.+-- This should contain no blank lines (no extra newlines in the cmdargs command mode help strings).+-- This is shown as-is in manuals, and regenerated at runtime for --help output. ---parseCommandDoc :: CommandDoc -> Maybe ([Name], String, [String])-parseCommandDoc t =+-- - Any remaining lines: the command help postamble.+--+-- (Note the difference between+-- @Somecommand.md@, which is the markdown source file, and+-- @Somecommand.txt@, which is the plain text file generated by @Shake cmdhelp@,+-- which this function parses.)+--+parseCommandHelp :: CommandHelpStr -> Maybe CommandHelp+parseCommandHelp t = case lines t of [] -> Nothing- (l:ls) -> Just (names, shorthelp, longhelplines)+ (l1:_:l3:ls) -> Just $ CommandHelp cmdname (if null cmdalias then Nothing else Just cmdalias) preamble postamble where- names = words $ map (\c -> if c `elem` [',','\\'] then ' ' else c) l- (shorthelpls, longhelpls) = break (== "_FLAGS_") ls- shorthelp = unlines $ reverse $ dropWhile null $ reverse shorthelpls- longhelplines = dropWhile null $ drop 1 longhelpls+ cmdname = l1+ (cmdalias, rest) =+ if "(" `isPrefixOf` l3 && ")" `isSuffixOf` l3+ then (drop 1 $ init l3, ls)+ else ([], l3:ls)+ (preamblels, rest2) = break (== "Flags:") $ dropWhile null rest+ postamblels = dropWhile null $ dropWhile (not.null) rest2+ preamble = unlines $ reverse $ dropWhile null $ reverse preamblels+ postamble = unlines postamblels+ _ -> Nothing -- error' "misformatted command help text file" -- | Get a mode's usage message as a nicely wrapped string. showModeUsage :: Mode a -> String-showModeUsage = (showText defaultWrap :: [Text] -> String) .- (helpText [] HelpFormatDefault :: Mode a -> [Text])+showModeUsage =+ highlightHelp .+ (showText defaultWrap :: [Text] -> String) .+ (helpText [] HelpFormatDefault :: Mode a -> [Text]) +-- | Add some ANSI decoration to cmdargs' help output.+highlightHelp+ | not useColorOnStdoutUnsafe = id -- XXX unsafe boldening help headings - seems to work, even respecting config file+ | otherwise = unlines . zipWith (curry f) [1..] . lines+ where+ f (n,l)+ | n==1 = bold l+ | isHelpHeading l = bold l+ | otherwise = l+ -- keep synced with Hledger.Cli.mainmode:+ isHelpHeading l = isAlphaNum (headDef ' ' l) && (lastDef ' ' l == ':')+ -- any s (`isPrefixOf` s) [+ -- "General input flags"+ -- ,"General reporting flags"+ -- ,"General help flags"+ -- ,"Flags"+ -- ,"General flags"+ -- ,"Examples"+ -- ] -- | Get the most appropriate documentation topic for a mode.--- Currently, that is either the hledger, hledger-ui, hledger-web or--- hledger-api manual.+-- Currently, that is either the hledger, hledger-ui or hledger-web+-- manual. topicForMode :: Mode a -> Topic topicForMode m | n == "hledger-ui" = "ui" | n == "hledger-web" = "web"- -- | n == "hledger-api" = lookupDocTxt "api" -- hledger-api uses docopt | otherwise = "cli" where n = headDef "" $ modeNames m @@ -309,15 +558,6 @@ -- s `withAliases` as = s ++ " (aliases: " ++ intercalate ", " as ++ ")" --- help_postscript = [--- -- "DATES can be Y/M/D or smart dates like \"last month\"."--- -- ,"PATTERNS are regular"--- -- ,"expressions which filter by account name. Prefix a pattern with desc: to"--- -- ,"filter by transaction description instead, prefix with not: to negate it."--- -- ,"When using both, not: comes last."--- ]-- -- CliOpts -- | Command line options, used in the @hledger@ package and above.@@ -329,95 +569,114 @@ ,command_ :: String ,file_ :: [FilePath] ,inputopts_ :: InputOpts- ,reportopts_ :: ReportOpts+ ,reportspec_ :: ReportSpec ,output_file_ :: Maybe FilePath ,output_format_ :: Maybe String+ ,pageropt_ :: Maybe Bool -- ^ --pager+ ,coloropt_ :: Maybe YNA -- ^ --color. Controls use of ANSI color and ANSI styles. ,debug_ :: Int -- ^ debug level, set by @--debug[=N]@. See also 'Hledger.Utils.debugLevel'. ,no_new_accounts_ :: Bool -- add ,width_ :: Maybe String -- ^ the --width value provided, if any ,available_width_ :: Int -- ^ estimated usable screen width, based on- -- 1. the COLUMNS env var, if set- -- 2. the width reported by the terminal, if supported- -- 3. the default (80)- } deriving (Show, Data, Typeable)+ -- 1. the width reported by the terminal, if supported+ -- 2. the default (80)+ ,progstarttime_ :: POSIXTime -- system POSIX time at start+ } deriving (Show) instance Default CliOpts where def = defcliopts defcliopts :: CliOpts defcliopts = CliOpts- def- def- def- def- def- def- def- def- def- def- defaultWidth---- | Convert possibly encoded option values to regular unicode strings.-decodeRawOpts :: RawOpts -> RawOpts-decodeRawOpts = map (\(name',val) -> (name', fromSystemString val))+ { rawopts_ = def+ , command_ = ""+ , file_ = []+ , inputopts_ = definputopts+ , reportspec_ = def+ , output_file_ = Nothing+ , output_format_ = Nothing+ , pageropt_ = Nothing+ , coloropt_ = Nothing+ , debug_ = 0+ , no_new_accounts_ = False+ , width_ = Nothing+ , available_width_ = defaultWidth+ , progstarttime_ = 0+ } -- | Default width for hledger console output, when not otherwise specified. defaultWidth :: Int defaultWidth = 80 -- | Replace any numeric flags (eg -2) with their long form (--depth 2),--- as I'm guessing cmdargs doesn't support this directly. +-- as I'm guessing cmdargs doesn't support this directly. replaceNumericFlags :: [String] -> [String] replaceNumericFlags = map replace where replace ('-':ds) | not (null ds) && all isDigit ds = "--depth="++ds replace s = s +-- Convert a valueless --debug flag to one with a value.+-- See also the --debug flag definition in CliOptions.hs.+-- This makes an equals sign unnecessary with this optional-value flag.+ensureDebugFlagHasVal :: [String] -> [String]+ensureDebugFlagHasVal as = case break (=="--debug") as of+ (bs,"--debug":c:cs) | null c || not (all isDigit c) -> bs++"--debug=1" : ensureDebugFlagHasVal (c:cs)+ (bs,["--debug"]) -> bs++["--debug=1"]+ _ -> as+ -- | Parse raw option string values to the desired final data types. -- Any relative smart dates will be converted to fixed dates based on -- today's date. Parsing failures will raise an error. -- Also records the terminal width, if supported. rawOptsToCliOpts :: RawOpts -> IO CliOpts-rawOptsToCliOpts rawopts = checkCliOpts <$> do- let iopts = rawOptsToInputOpts rawopts- ropts <- rawOptsToReportOpts rawopts- mcolumns <- readMay <$> getEnvSafe "COLUMNS"- mtermwidth <--#ifdef mingw32_HOST_OS- return Nothing-#else- setupTermFromEnv >>= return . flip getCapability termColumns- -- XXX Throws a SetupTermError if the terminfo database could not be read, should catch-#endif- let availablewidth = head $ catMaybes [mcolumns, mtermwidth, Just defaultWidth]+rawOptsToCliOpts rawopts = do+ currentDay <- getCurrentDay+ let+ day = case maybestringopt "today" rawopts of+ Nothing -> currentDay+ Just d -> either (const err) fromEFDay $ fixSmartDateStrEither' currentDay (T.pack d)+ where err = error' $ "Unable to parse date \"" ++ d ++ "\""+ command = stringopt "command" rawopts+ moutputformat = maybestringopt "output-format" rawopts+ -- if printing beancount format, don't propagate account and commodity tags to postings+ autopostingtags = not $ command == "print" && moutputformat == Just "beancount"+ usecolor <- useColorOnStdout+ let iopts = rawOptsToInputOpts day usecolor autopostingtags rawopts+ rspec <- either error' pure $ rawOptsToReportSpec day usecolor rawopts -- PARTIAL:+ mtermwidth <- getTerminalWidth+ let availablewidth = fromMaybe defaultWidth mtermwidth return defcliopts { rawopts_ = rawopts- ,command_ = stringopt "command" rawopts- ,file_ = map (T.unpack . stripquotes . T.pack) $ listofstringopt "file" rawopts+ ,command_ = command+ ,file_ = listofstringopt "file" rawopts ,inputopts_ = iopts- ,reportopts_ = ropts+ ,reportspec_ = rspec ,output_file_ = maybestringopt "output-file" rawopts- ,output_format_ = maybestringopt "output-format" rawopts- ,debug_ = intopt "debug" rawopts+ ,output_format_ = moutputformat+ ,pageropt_ = maybeynopt "pager" rawopts+ ,coloropt_ = maybeynaopt "color" rawopts+ ,debug_ = posintopt "debug" rawopts ,no_new_accounts_ = boolopt "no-new-accounts" rawopts -- add ,width_ = maybestringopt "width" rawopts ,available_width_ = availablewidth } --- | Do final validation of processed opts, raising an error if there is trouble.-checkCliOpts :: CliOpts -> CliOpts-checkCliOpts opts =- either usageError (const opts) $ do- -- XXX move to checkReportOpts or move _format to CliOpts- case lineFormatFromOpts $ reportopts_ opts of- Left err -> Left $ "could not parse format option: "++err- Right _ -> Right ()- -- XXX check registerWidthsFromOpts opts+-- | Drop the arguments ("args") from this CliOpts' rawopts field.+cliOptsDropArgs :: CliOpts -> CliOpts+cliOptsDropArgs copts@CliOpts{rawopts_} = copts{rawopts_ = dropRawOpt "args" rawopts_} --- | A helper for addon commands: this parses options and arguments from --- the current command line using the given hledger-style cmdargs mode, --- and returns a CliOpts. Or, with --help or -h present, it prints --- long or short help, and exits the program. +-- | cmdargs eats the first double-dash (--) argument when parsing a command line,+-- which causes problems for the run and repl commands.+-- Sometimes we work around this by duplicating that first -- argument.+-- This doesn't break anything that we know of yet.+argsAddDoubleDash args'+ | "--" `elem` args' = let (as,bs) = break (=="--") args' in as <> ["--"] <> bs+ | otherwise = args'++-- | A helper for addon commands: this parses options and arguments from+-- the current command line using the given hledger-style cmdargs mode,+-- and returns a CliOpts. Or, with --help or -h present, it prints+-- long or short help, and exits the program. -- When --debug is present, also prints some debug output. -- Note this is not used by the main hledger executable. --@@ -434,17 +693,16 @@ -- hledger options not displayed. -- -- Tips:--- Empty lines in the pre/postamble are removed by cmdargs; +-- Empty lines in the pre/postamble are removed by cmdargs; -- add a space character to preserve them. ---getHledgerCliOpts :: Mode RawOpts -> IO CliOpts-getHledgerCliOpts mode' = do- args' <- getArgs >>= expandArgsAt- let rawopts = either usageError decodeRawOpts $ process mode' args'+getHledgerCliOpts' :: Mode RawOpts -> [String] -> IO CliOpts+getHledgerCliOpts' mode' args0 = do+ let rawopts = either usageError id $ process mode' args0 opts <- rawOptsToCliOpts rawopts- debugArgs args' opts- when ("help" `inRawOpts` rawopts_ opts) $ putStr shorthelp >> exitSuccess- -- when ("help" `inRawOpts` rawopts_ opts) $ putStr longhelp >> exitSuccess+ debugArgs args0 opts+ when (boolopt "help" $ rawopts_ opts) $ putStr shorthelp >> exitSuccess+ -- when (boolopt "help" $ rawopts_ opts) $ putStr longhelp >> exitSuccess return opts where longhelp = showModeUsage mode'@@ -456,16 +714,21 @@ ," See also hledger -h for general hledger options." ] -- | Print debug info about arguments and options if --debug is present.+ -- XXX use standard dbg helpers debugArgs :: [String] -> CliOpts -> IO ()- debugArgs args' opts =- when ("--debug" `elem` args') $ do+ debugArgs args1 opts =+ when ("--debug" `elem` args1) $ do progname' <- getProgName putStrLn $ "running: " ++ progname'- putStrLn $ "raw args: " ++ show args'+ putStrLn $ "raw args: " ++ show args1 putStrLn $ "processed opts:\n" ++ show opts- d <- getCurrentDay- putStrLn $ "search query: " ++ show (queryFromOpts d $ reportopts_ opts)+ putStrLn $ "search query: " ++ show (_rsQuery $ reportspec_ opts) +getHledgerCliOpts :: Mode RawOpts -> IO CliOpts+getHledgerCliOpts mode' = do+ args' <- getArgs >>= expandArgsAt+ getHledgerCliOpts' mode' args'+ -- CliOpts accessors -- | Get the (tilde-expanded, absolute) journal file path from@@ -473,38 +736,47 @@ -- Actually, returns one or more file paths. There will be more -- than one if multiple -f options were provided. -- File paths can have a READER: prefix naming a reader/data format.-journalFilePathFromOpts :: CliOpts -> IO [String]+journalFilePathFromOpts :: CliOpts -> IO (NE.NonEmpty String) journalFilePathFromOpts opts = do- f <- defaultJournalPath+ mbpaths <- journalFilePathFromOptsNoDefault opts+ case mbpaths of+ Just paths -> return paths+ Nothing -> do+ f <- defaultExistingJournalPath+ return $ NE.fromList [f]++-- | Like journalFilePathFromOpts, but does not use defaultJournalPath+journalFilePathFromOptsNoDefault :: CliOpts -> IO (Maybe (NE.NonEmpty String))+journalFilePathFromOptsNoDefault opts = do d <- getCurrentDirectory- case file_ opts of- [] -> return [f]- fs -> mapM (expandPathPreservingPrefix d) fs+ case NE.nonEmpty $ file_ opts of+ Nothing -> return Nothing+ Just paths -> Just <$> mapM (expandPathPreservingPrefix d) paths expandPathPreservingPrefix :: FilePath -> PrefixedFilePath -> IO PrefixedFilePath expandPathPreservingPrefix d prefixedf = do let (p,f) = splitReaderPrefix prefixedf- f' <- expandPath d f+ f' <- expandPathOrGlob d f return $ case p of- Just p -> p ++ ":" ++ f'+ Just p' -> (show p') ++ ":" ++ f' Nothing -> f' --- | Get the expanded, absolute output file path from options,--- or the default (-, meaning stdout).-outputFileFromOpts :: CliOpts -> IO FilePath+-- | Get the expanded, absolute output file path specified by an+-- -o/--output-file options, or nothing, meaning stdout.+outputFileFromOpts :: CliOpts -> IO (Maybe FilePath) outputFileFromOpts opts = do d <- getCurrentDirectory case output_file_ opts of- Just p -> expandPath d p- Nothing -> return "-"+ Nothing -> return Nothing+ Just f -> Just <$> expandPath d f +defaultOutputFormat :: String defaultOutputFormat = "txt" -outputFormats =- [defaultOutputFormat] ++- ["csv"- ,"html"- ]+-- | All the output formats known by any command, for outputFormatFromOpts.+-- To automatically infer it from -o/--output-file, it needs to be listed here.+outputFormats :: [String]+outputFormats = [defaultOutputFormat, "beancount", "csv", "json", "html", "sql", "tsv", "fods"] -- | Get the output format from the --output-format option, -- otherwise from a recognised file extension in the --output-file option,@@ -533,24 +805,11 @@ d <- getCurrentDirectory maybe (return Nothing) (fmap Just . expandPath d) $ mrules_file_ $ inputopts_ opts --- | Get the width in characters to use for console output.--- This comes from the --width option, or the COLUMNS environment--- variable, or (on posix platforms) the current terminal width, or 80.--- Will raise a parse error for a malformed --width argument.-widthFromOpts :: CliOpts -> Int-widthFromOpts CliOpts{width_=Nothing, available_width_=w} = w-widthFromOpts CliOpts{width_=Just s} =- case runParser (read `fmap` some digitChar <* eof :: ParsecT Void String Identity Int) "(unknown)" s of- Left e -> usageError $ "could not parse width option: "++show e- Right w -> w---- for register:- -- | Get the width in characters to use for the register command's console output, -- and also the description column width if specified (following the main width, comma-separated). -- The widths will be as follows: -- @--- no --width flag - overall width is the available width (COLUMNS, or posix terminal width, or 80); description width is unspecified (auto)+-- no --width flag - overall width is the available width (or terminal width, or 80); description width is unspecified (auto) -- --width W - overall width is W, description width is auto -- --width W,D - overall width is W, description width is D -- @@@ -559,7 +818,7 @@ registerWidthsFromOpts CliOpts{width_=Nothing, available_width_=w} = (w, Nothing) registerWidthsFromOpts CliOpts{width_=Just s} = case runParser registerwidthp "(unknown)" s of- Left e -> usageError $ "could not parse width option: "++show e+ Left e -> usageError $ "could not parse width option: "++errorBundlePretty e Right ws -> ws where registerwidthp :: (Stream s, Char ~ Token s) => ParsecT Void s m (Int, Maybe Int)@@ -569,111 +828,71 @@ eof return (totalwidth, descwidth) --- for balance, currently:+-- Some common ways to select items from a list of declarable things.+-- Used by the accounts, commodities, payees, tags commands, eg.+data DeclarablesSelector+ = Used+ | Declared+ | Undeclared+ | Unused+ | Find+ deriving (Show, Eq) --- | Parse the format option if provided, possibly returning an error,--- otherwise get the default value.-lineFormatFromOpts :: ReportOpts -> Either String StringFormat-lineFormatFromOpts = maybe (Right defaultBalanceLineFormat) parseStringFormat . format_+-- Get the flag of this kind from opts, or raise an error if there's more than one.+declarablesSelectorFromOpts :: CliOpts -> Maybe DeclarablesSelector+declarablesSelectorFromOpts CliOpts{rawopts_=rawopts} =+ case ( boolopt "used" rawopts+ , boolopt "declared" rawopts+ , boolopt "undeclared" rawopts+ , boolopt "unused" rawopts+ , boolopt "find" rawopts+ ) of+ (False, False, False, False, False) -> Nothing+ (True, False, False, False, False) -> Just Used+ (False, True, False, False, False) -> Just Declared+ (False, False, True, False, False) -> Just Undeclared+ (False, False, False, True, False) -> Just Unused+ (False, False, False, False, True ) -> Just Find+ _ -> error' "please pick at most one of --used, --declared, --undeclared, --unused, --find" --- | Default line format for balance report: "%20(total) %2(depth_spacer)%-(account)"-defaultBalanceLineFormat :: StringFormat-defaultBalanceLineFormat = BottomAligned [- FormatField False (Just 20) Nothing TotalField- , FormatLiteral " "- , FormatField True (Just 2) Nothing DepthSpacerField- , FormatField True Nothing Nothing AccountField- ]+-- | A helper for the --find mode offered by commands like accounts, commodities, payees, tags (see also 'DeclarablesSelector').+-- Interpret the first command argument found in rawopts as a case insensitive regular expression,+-- then return the first of the provided items that it matches;+-- or raise an error if there's no valid argument or no matched item.+-- This function's second argument describes the items' type, for the error message.+findMatchedByArgument :: RawOpts -> String -> [T.Text] -> T.Text+findMatchedByArgument rawopts itemtype items =+ let+ arg = headDef err $ listofstringopt "args" rawopts+ where err = error' $ "With --find, please provide a " ++ itemtype ++ " name or\n" +++ itemtype ++ " pattern (case-insensitive, infix, regexp) as first command argument."+ firstmatch = case toRegexCI $ T.pack arg of -- keep synced with aregister's matching+ Right re -> find (regexMatchText re)+ Left _ -> const Nothing+ in firstmatch items+ & fromMaybe (error' $ show arg ++ " did not match any " ++ itemtype ++ ".") -- Other utils --- | Get the sorted unique canonical names of hledger addon commands--- found in the current user's PATH. These are used in command line--- parsing and to display the commands list.------ Canonical addon names are the filenames of hledger-* executables in--- PATH, without the "hledger-" prefix, and without the file extension--- except when it's needed for disambiguation (see below).------ When there are exactly two versions of an executable (same base--- name, different extensions) that look like a source and compiled--- pair (one has .exe, .com, or no extension), the source version will--- be excluded (even if it happens to be newer). When there are three--- or more versions (or two versions that don't look like a--- source/compiled pair), they are all included, with file extensions--- intact.--- -hledgerAddons :: IO [String]-hledgerAddons = do- -- past bug generator- as1 <- hledgerExecutablesInPath -- ["hledger-check","hledger-check-dates","hledger-check-dates.hs","hledger-check.hs","hledger-check.py"]- let as2 = map stripPrognamePrefix as1 -- ["check","check-dates","check-dates.hs","check.hs","check.py"]- let as3 = sortBy (comparing takeBaseName) as2 -- ["check","check.hs","check.py","check-dates","check-dates.hs"]- let as4 = groupBy (\a b -> takeBaseName a == takeBaseName b) as3 -- [["check","check.hs","check.py"],["check-dates","check-dates.hs"]]- let as5 = concatMap dropRedundantSourceVersion as4 -- ["check","check.hs","check.py","check-dates"]- return as5--stripPrognamePrefix = drop (length progname + 1)--dropRedundantSourceVersion [f,g]- | takeExtension f `elem` compiledExts = [f]- | takeExtension g `elem` compiledExts = [g]-dropRedundantSourceVersion fs = fs--compiledExts = ["",".com",".exe"] ----- | Get all sorted unique filenames in the current user's PATH. +-- None of https://hackage.haskell.org/package/directory-1.3.8.1/docs/System-Directory.html#g:5+-- do quite what we need (find all the executables in PATH with a filename prefix).+-- | Get all sorted unique filenames in the current user's PATH. -- We do not currently filter out non-file objects or files without execute permission. likelyExecutablesInPath :: IO [String] likelyExecutablesInPath = do- pathdirs <- splitOneOf "[:;]" `fmap` getEnvSafe "PATH"+ pathdirs <- splitOn pathsep `fmap` getEnvSafe "PATH" pathfiles <- concat `fmap` mapM getDirectoryContentsSafe pathdirs- return $ nub $ sort pathfiles- -- exclude directories and files without execute permission.- -- These will do a stat for each hledger-*, probably ok.- -- But they need paths, not just filenames- -- exes' <- filterM doesFileExist exe'- -- exes'' <- filterM isExecutable exes'- -- return exes''---- | Get the sorted unique filenames of all hledger-* executables in--- the current user's PATH. These are files in any of the PATH directories,--- named hledger-*, with either no extension (and no periods in the name) --- or one of the addonExtensions. --- We do not currently filter out non-file objects or files without execute permission.-hledgerExecutablesInPath :: IO [String]-hledgerExecutablesInPath = filter isHledgerExeName <$> likelyExecutablesInPath---- isExecutable f = getPermissions f >>= (return . executable)--isHledgerExeName :: String -> Bool-isHledgerExeName = isRight . parsewith hledgerexenamep . T.pack- where- hledgerexenamep = do- _ <- string $ T.pack progname- _ <- char '-'- _ <- some $ noneOf ['.']- optional (string "." >> choice' (map (string . T.pack) addonExtensions))- eof---- stripAddonExtension :: String -> String--- stripAddonExtension = regexReplace re "" where re = "\\.(" ++ intercalate "|" addonExtensions ++ ")$"--addonExtensions :: [String]-addonExtensions =- ["bat"- ,"com"- ,"exe"- ,"hs"- ,"lhs"- ,"pl"- ,"py"- ,"rb"- ,"rkt"- ,"sh"- -- ,""- ]+ return $ nubSort pathfiles+ where pathsep = if os == "mingw32" then ";" else ":"+--+-- Exclude directories and files without execute permission:+-- this would do a stat for each hledger-* file found, which is probably ok.+-- But it needs file paths, not just file names.+--+-- exes' <- filterM doesFileExist exe'+-- exes'' <- filterM isExecutable exes'+-- return exes''+-- where isExecutable f = getPermissions f >>= (return . executable) getEnvSafe :: String -> IO String getEnvSafe v = getEnv v `C.catch` (\(_::C.IOException) -> return "") -- XXX should catch only isDoesNotExistError e@@ -682,15 +901,22 @@ getDirectoryContentsSafe d = (filter (not . (`elem` [".",".."])) `fmap` getDirectoryContents d) `C.catch` (\(_::C.IOException) -> return []) --- not used:--- -- | Print debug info about arguments and options if --debug is present.--- debugArgs :: [String] -> CliOpts -> IO ()--- debugArgs args opts =--- when ("--debug" `elem` args) $ do--- progname <- getProgName--- putStrLn $ "running: " ++ progname--- putStrLn $ "raw args: " ++ show args--- putStrLn $ "processed opts:\n" ++ show opts--- d <- getCurrentDay--- putStrLn $ "search query: " ++ (show $ queryFromOpts d $ reportopts_ opts)+-- ** Lenses++makeHledgerClassyLenses ''CliOpts++instance HasInputOpts CliOpts where+ inputOpts = inputopts++instance HasBalancingOpts CliOpts where+ balancingOpts = inputOpts.balancingOpts++instance HasReportSpec CliOpts where+ reportSpec = reportspec++instance HasReportOptsNoUpdate CliOpts where+ reportOptsNoUpdate = reportSpec.reportOptsNoUpdate++instance HasReportOpts CliOpts where+ reportOpts = reportSpec.reportOpts
Hledger/Cli/Commands.hs view
@@ -3,85 +3,108 @@ New built-in commands should be added in four places below: the export list, the import list, builtinCommands, commandsList.+ -} -{-# LANGUAGE CPP #-}+-- Note: commands list rendering is intensely sensitive to change,+-- very easy to break in ways that tests currently do not catch.++{-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE TemplateHaskell #-} module Hledger.Cli.Commands (- findCommand+ commands ,testcmd ,builtinCommands ,builtinCommandNames+ ,addonCommandNames+ ,knownAddonCommandNames+ ,findBuiltinCommand+ ,knownCommands ,printCommandsList- ,tests_Commands+ ,tests_Hledger_Cli ,module Hledger.Cli.Commands.Accounts ,module Hledger.Cli.Commands.Activity ,module Hledger.Cli.Commands.Add+ ,module Hledger.Cli.Commands.Aregister ,module Hledger.Cli.Commands.Balance ,module Hledger.Cli.Commands.Balancesheet ,module Hledger.Cli.Commands.Balancesheetequity ,module Hledger.Cli.Commands.Cashflow- ,module Hledger.Cli.Commands.Checkdates- ,module Hledger.Cli.Commands.Checkdupes ,module Hledger.Cli.Commands.Close+ ,module Hledger.Cli.Commands.Codes ,module Hledger.Cli.Commands.Commodities+ ,module Hledger.Cli.Commands.Demo+ ,module Hledger.Cli.Commands.Descriptions+ ,module Hledger.Cli.Commands.Diff ,module Hledger.Cli.Commands.Help ,module Hledger.Cli.Commands.Import ,module Hledger.Cli.Commands.Incomestatement+ ,module Hledger.Cli.Commands.Notes+ ,module Hledger.Cli.Commands.Payees ,module Hledger.Cli.Commands.Prices ,module Hledger.Cli.Commands.Print- ,module Hledger.Cli.Commands.Printunique ,module Hledger.Cli.Commands.Register- ,module Hledger.Cli.Commands.Registermatch ,module Hledger.Cli.Commands.Rewrite+ ,module Hledger.Cli.Commands.Run+ ,module Hledger.Cli.Commands.Setup ,module Hledger.Cli.Commands.Stats ,module Hledger.Cli.Commands.Tags ) where -import Data.Char (isSpace)-import Data.Default+import Data.Char (isAlphaNum, isSpace, toLower)+import Data.Either (isRight) import Data.List-#if !(MIN_VERSION_base(4,11,0))-import Data.Monoid ((<>))-#endif+import Data.List.Extra (groupSortOn, nubSort) import Data.Text (Text)-import qualified Data.Text as T+import Data.Text qualified as T import Data.Time.Calendar-import qualified EasyTest+import Safe (headErr)+import String.ANSI import System.Console.CmdArgs.Explicit as C-import System.Exit+import System.Environment (withArgs)+import System.FilePath (dropExtension, takeBaseName, takeExtension)+import Test.Tasty (defaultMain)+import Text.Megaparsec+import Text.Megaparsec.Char -import Hledger +import Hledger import Hledger.Cli.CliOptions-import Hledger.Cli.Version import Hledger.Cli.Commands.Accounts import Hledger.Cli.Commands.Activity import Hledger.Cli.Commands.Add+import Hledger.Cli.Commands.Aregister import Hledger.Cli.Commands.Balance import Hledger.Cli.Commands.Balancesheet import Hledger.Cli.Commands.Balancesheetequity import Hledger.Cli.Commands.Cashflow-import Hledger.Cli.Commands.Checkdates-import Hledger.Cli.Commands.Checkdupes+import Hledger.Cli.Commands.Check import Hledger.Cli.Commands.Close+import Hledger.Cli.Commands.Codes import Hledger.Cli.Commands.Commodities+import Hledger.Cli.Commands.Demo+import Hledger.Cli.Commands.Descriptions+import Hledger.Cli.Commands.Diff import Hledger.Cli.Commands.Files import Hledger.Cli.Commands.Help import Hledger.Cli.Commands.Import import Hledger.Cli.Commands.Incomestatement+import Hledger.Cli.Commands.Notes+import Hledger.Cli.Commands.Payees import Hledger.Cli.Commands.Prices import Hledger.Cli.Commands.Print-import Hledger.Cli.Commands.Printunique import Hledger.Cli.Commands.Register-import Hledger.Cli.Commands.Registermatch import Hledger.Cli.Commands.Rewrite import Hledger.Cli.Commands.Roi+import Hledger.Cli.Commands.Run+import Hledger.Cli.Commands.Setup import Hledger.Cli.Commands.Stats import Hledger.Cli.Commands.Tags+import Hledger.Cli.Utils (tests_Cli_Utils)+import Data.Functor ((<&>)) -- | The cmdargs subcommand mode (for command-line parsing) -- and IO action (for doing the command's work) for each builtin command.@@ -91,34 +114,79 @@ (accountsmode , accounts) ,(activitymode , activity) ,(addmode , add)+ ,(aregistermode , aregister) ,(balancemode , balance)- ,(balancesheetmode , balancesheet) ,(balancesheetequitymode , balancesheetequity)+ ,(balancesheetmode , balancesheet) ,(cashflowmode , cashflow)- ,(checkdatesmode , checkdates)- ,(checkdupesmode , checkdupes)+ ,(checkmode , check) ,(closemode , close)+ ,(codesmode , codes)+ ,(commandsmode , commands) ,(commoditiesmode , commodities)+ ,(demomode , demo)+ ,(descriptionsmode , descriptions)+ ,(diffmode , diff)+ ,(filesmode , files) ,(helpmode , help') ,(importmode , importcmd)- ,(filesmode , files) ,(incomestatementmode , incomestatement)+ ,(notesmode , notes)+ ,(payeesmode , payees) ,(pricesmode , prices) ,(printmode , print')- ,(printuniquemode , printunique) ,(registermode , register)- ,(registermatchmode , registermatch) ,(rewritemode , rewrite) ,(roimode , roi)+ ,(runmode , runOrReplStub)+ ,(replmode , runOrReplStub)+ ,(setupmode , setup) ,(statsmode , stats) ,(tagsmode , tags) ,(testmode , testcmd) ] +-- figlet -f FONTNAME hledger, then escape backslashes+_banner_slant = drop 1 [""+ -----------------------------------------80-------------------------------------+ ," __ __ __ "+ ," / /_ / /__ ____/ /___ ____ _____"+ ," / __ \\/ / _ \\/ __ / __ `/ _ \\/ ___/"+ ," / / / / / __/ /_/ / /_/ / __/ / "+ ,"/_/ /_/_/\\___/\\__,_/\\__, /\\___/_/ "+ ," /____/ "+ ]++_banner_smslant = drop 1 [""+ ," __ __ __ "+ ," / / / /__ ___/ /__ ____ ____"+ ," / _ \\/ / -_) _ / _ `/ -_) __/"+ ,"/_//_/_/\\__/\\_,_/\\_, /\\__/_/ "+ ," /___/ "+ ]++_banner_speed = drop 1 [""+ ,"______ ______ _________ "+ ,"___ /____ /__________ /______ _____________"+ ,"__ __ \\_ /_ _ \\ __ /__ __ `/ _ \\_ ___/"+ ,"_ / / / / / __/ /_/ / _ /_/ // __/ / "+ ,"/_/ /_//_/ \\___/\\__,_/ _\\__, / \\___//_/ "+ ," /____/ "+ ]++-- | Choose and apply an accent color for hledger output, if possible+-- picking one that will contrast with the current terminal background colour.+accent :: String -> String+accent+ | not useColorOnStdoutUnsafe = id -- XXX unsafe accenting the title banner - seems to work, even respecting config file+ | terminalIsLight == Just False = brightWhite+ | terminalIsLight == Just True = brightBlack+ | otherwise = id+ -- | The commands list, showing command names, standard aliases, -- and short descriptions. This is modified at runtime, as follows: ----- PROGVERSION is replaced with the program name and version.+-- progversion is the program name and version. -- -- Lines beginning with a space represent builtin commands, with format: -- COMMAND (ALIASES) DESCRIPTION@@ -133,206 +201,382 @@ -- -- TODO: generate more of this automatically. -- -commandsList :: String-commandsList = unlines [+commandsList :: String -> [String] -> [String]+commandsList progversion othercmds =+ map (bold'.accent) _banner_smslant ++ -- XXX not showing bold, why ?+ [+ -- Keep the following synced with:+ -- commands.m4+ -- hledger.m4.md -> Commands+ -- commandsFromCommandsList. Only commands should begin with space or plus.+ -- IN PARTICULAR KEEP SYNCED WITH commandsListExtractCommands, + -- it needs checking/updating after any wording/layout changes here "-------------------------------------------------------------------------------"- ,"PROGVERSION"- ,"Usage: hledger COMMAND [OPTIONS] [-- ADDONCMDOPTIONS]"- ,"Commands (+ addons found in $PATH):"+ ,progversion+ ,"Usage: hledger [COMMAND] [OPTIONS] [ARGS]"+ -- ,"Commands (builtins + addons):" -- XXX adapt for commands --builtin+ ,"Commands:" ,""- ,"Data entry (these commands modify the journal file):"- ," add add transactions using guided prompts"- ,"+iadd add transactions using curses ui"- ," import add any new transactions from other files (eg csv)"+ -----------------------------------------80-------------------------------------+ ,bold' "HELP (docs, demos..)"+ ," commands show the commands list (default)"+ ," demo [DEMO] show brief demos in the terminal"+ ," help [-i|-m|-p] [TOPIC] show the hledger manual with info/man/pager"+ ," --tldr [COMMAND] show command examples [for command] with tldr"+ ," --help/-h [COMMAND] show command line help [for command]"+ ," --info [COMMAND] show the hledger manual [for command] with info"+ ," --man [COMMAND] show the hledger manual [for command] with man"+ ," more help: https://hledger.org" ,""- ,"Data management:"- ,"+autosync download/deduplicate/convert OFX data"- ,"+check check more powerful balance assertions"- ," check-dates check transactions are ordered by date"- ," check-dupes check for accounts with the same leaf name"- ," close (equity) generate balance-resetting transactions"- ,"+diff compare account transactions in two journal files"- ,"+interest generate interest transactions"- ," rewrite generate automated postings/diffs (old, use --auto)"+ -----------------------------------------80-------------------------------------+ ,bold' "USER INTERFACES (alternate UIs)"+ ," repl run commands from an interactive prompt"+ ," run run command scripts from files or arguments"+ ,"+ui run a terminal UI (hledger-ui)"+ ,"+web run a web UI (hledger-web)"+ -- see also: MoLe, https://hledger.org/mobile.html ,""- ,"Financial reports:"- ," balancesheet (bs) show assets, liabilities and net worth"+ -----------------------------------------80-------------------------------------+ ,bold' "ENTERING DATA (add or edit transactions)"+ ," add add transactions using interactive prompts"+ ,"+iadd add transactions using a TUI (hledger-iadd)"+ ," import add new transactions from other files, eg CSV files"+ ,"+edit edit specific transactions with $EDITOR" -- hledger-utils+ ,""+ -----------------------------------------80-------------------------------------+ ,bold' "BASIC REPORTS (simple lists)"+ ," accounts show account names"+ ," codes show transaction codes"+ ," commodities show commodity/currency symbols"+ ," descriptions show transaction descriptions"+ ," files show data files in use"+ ," notes show note part of transaction descriptions"+ ," payees show payee part of transaction descriptions"+ ," prices show historical market prices"+ ," stats show journal statistics"+ ," tags show tag names"+ ,""+ -----------------------------------------80-------------------------------------+ ,bold' "STANDARD REPORTS (the most useful financial reports)"+ ," print show full transaction entries, or export journal data"+ ," aregister (areg) show transactions & running balance in one account"+ ," register (reg) show postings & running total in one or more accounts"+ ," balancesheet (bs) show assets and liabilities" ," balancesheetequity (bse) show assets, liabilities and equity" ," cashflow (cf) show changes in liquid assets" ," incomestatement (is) show revenues and expenses"- ,"+irr calculate internal rate of return (old, use roi)"+ ,""+ -----------------------------------------80-------------------------------------+ ,bold' "ADVANCED REPORTS (more versatile/advanced reports)"+ ," balance (bal) show balance changes, end balances, gains, budgets.."+ ,"+lots show a commodity's lots" -- hledger-lots ," roi show return on investments" ,""- ,"Low-level reports:"- ," accounts (a) show account names"- ," activity show postings-per-interval bar charts"- ," balance (b, bal) show balance changes/end balances/budgets in accounts"- ," commodities show commodity/currency symbols"- ," files show input file paths"- ," prices show market price records"- ," print (p, txns) show transactions (journal entries)"- ," print-unique show only transactions with unique descriptions"- ," register (r, reg) show postings in one or more accounts & running total"- ," register-match show a recent posting that best matches a description"- ," stats show journal statistics"- ," tags show tag names"- ," test run self tests"+ -----------------------------------------80-------------------------------------+ ,bold' "CHARTS (bar charts, line graphs..)"+ ," activity show posting counts as a bar chart"+ ,"+bar show balances or changes as a bar chart" -- hledger-bar+ ,"+plot show advanced matplotlib charts as gui/svg/png/pdf.." -- hledger-utils ,""- ,"Alternate user interfaces:"- ,"+ui run curses ui"- ,"+web run web ui"- ,"+api run http api server"+ -----------------------------------------80-------------------------------------+ ,bold' "GENERATING DATA (generate or download journal entries; less common)"+ ,"+autosync download/deduplicate/show OFX data as transactions" -- ledger-autosync+ ," close generate transactions to zero/restore/assert balances"+ ,"+interest generate transactions transferring accrued interest" -- hledger-interest+ ,"+lots sell generate a lot-selling transaction" -- hledger-lots+ ,"+pricehist download historical market prices" -- pricehist+ ," rewrite add postings to transactions, like print --auto" ,""- ,"Other:"- ,"OTHER"- ,"Help:"- ," (no arguments) show this commands list"- ," -h show general flags"- ," COMMAND -h show flags & docs for COMMAND"- ," help [MANUAL] show hledger manuals in various formats"+ -----------------------------------------80-------------------------------------+ ,bold' "MAINTENANCE (error checking, data management..)"+ ," check run any of hledger's built-in correctness checks"+ ,"+check-fancyassertions check more powerful balance assertions" -- hledger-check-fancyassertions+ ,"+check-tagfiles check that files referenced in tag values exist" -- hledger-check-tagfiles+ ," diff compare an account's transactions in two journals"+ ,"+git save or view journal file history simply in git" -- hledger-git+ ,"+pijul save or view journal file history simply in pijul" -- hledger-pijul+ ," setup check and show the status of the hledger installation"+ ," test run some self tests" ,""+ -----------------------------------------80-------------------------------------+ ,bold' "OTHER ADDONS (more hledger-* commands found in PATH):" ]--- commands show brief commands list--- edit open a text editor on some part of the journal--- aregister (ar, areg) show transactions in a single account+ ++ map (' ':) (lines $ multicol 79 othercmds)+ ++ [""] +-- | Extract just the command names from the default commands list above,+-- (the first word of lines between "Usage:" and "OTHER" beginning with a space or plus sign),+-- in the order they occur. With a true first argument, extracts only the addon command names.+commandsListExtractCommands :: Bool -> [String] -> [String]+commandsListExtractCommands addonsonly l =+ [ cmdname | prefixchar:line@(firstchar:_) <- + takeWhile (not . isInfixOf "OTHER") $ dropWhile (not . isInfixOf "Usage:") l+ , prefixchar `elem` '+':[' '|not addonsonly]+ , isAlphaNum firstchar+ , not $ "https://" `isInfixOf` line+ , let cmdname:_ = words line+ ]+ -- Keep synced with commandsList. --- | All names and aliases of builtin commands.+commandsmode =+ hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Commands.txt")+ [flagNone ["builtin"] (setboolopt "builtin") "show only builtin commands, not addons"+ ]+ [(helpflagstitle, helpflags)]+ []+ -- flagReq ["debug"] (\s opts -> Right $ setopt "debug" s opts) "[N]" "show debug output (levels 1-9, default: 1)"++ ([], Nothing)++-- | Display the commands list.+commands :: CliOpts -> Journal -> IO ()+commands opts _ = do+ addons <- if boolopt "builtin" (rawopts_ opts) then return [] else addonCommandNames+ printCommandsList prognameandversion addons++{- | Print the commands list, with a pager if appropriate, customising the+commandsList template above with the given version string and the installed addons.+Uninstalled known addons will be removed from the list,+installed known addons will have the + prefix removed,+and installed unknown addons will be added under Misc.+-}+printCommandsList :: String -> [String] -> IO ()+printCommandsList progversion installedaddons =+ seq (length $ dbg8 "uninstalledknownaddons" uninstalledknownaddons) $ -- for debug output+ seq (length $ dbg8 "installedknownaddons" installedknownaddons) $+ seq (length $ dbg8 "installedunknownaddons" installedunknownaddons) $+ runPager $+ unlines $+ map unplus $+ filter (not . isuninstalledaddon) $+ commandsList progversion installedunknownaddons+ where+ knownaddons = knownAddonCommandNames+ uninstalledknownaddons = knownaddons \\ installedaddons+ installedknownaddons = knownaddons `intersect` installedaddons+ installedunknownaddons = installedaddons \\ knownaddons+ unplus ('+' : cs) = ' ' : cs+ unplus s = s+ isuninstalledaddon =+ \case+ ('+' : l)+ | cmd `notElem` installedaddons ->+ dbg9With (const $ "hiding uninstalled addon: " <> cmd) $+ True+ where+ cmd = takeWhile (not . isSpace) l+ _ -> False++-- | Canonical names of all commands which have a slot in the commands list, in alphabetical order.+-- These include the builtin commands and the known addon commands.+knownCommands :: [String]+knownCommands = nubSort . commandsListExtractCommands False $ commandsList progname []++-- | All names and aliases of the builtin commands. builtinCommandNames :: [String] builtinCommandNames = concatMap (modeNames . fst) builtinCommands --- | Look up a builtin command's mode and action by exact command name or alias. -findCommand :: String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ()) -findCommand cmdname = find (elem cmdname . modeNames . fst) builtinCommands +-- | Look up a builtin command's mode and action by exact command name or alias.+findBuiltinCommand :: String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ()) +findBuiltinCommand cmdname = find (elem cmdname . modeNames . fst) builtinCommands --- | Extract the command names from commandsList: the first word--- of lines beginning with a space or + sign.-commandsFromCommandsList :: String -> [String]-commandsFromCommandsList s =- [w | c:l <- lines s, c `elem` [' ','+'], let w:_ = words l]+{- | Canonical names of the known addon commands which have a slot in the commands list,+in alphabetical order.+-}+knownAddonCommandNames :: [String]+knownAddonCommandNames = nubSort . commandsListExtractCommands True $ commandsList progname [] -knownCommands :: [String]-knownCommands = sort $ commandsFromCommandsList commandsList+-- Search PATH for names of addon commands, that aren't shadowed by builtin commands.+addonCommandNames :: IO [String]+addonCommandNames = installedAddonCommandNames <&> filter (not . (`elem` builtinCommandNames) . dropExtension) --- | Print the commands list, modifying the template above based on--- the currently available addons. Missing addons will be removed, and--- extra addons will be added under Misc.-printCommandsList :: [String] -> IO ()-printCommandsList addonsFound =- putStr $- regexReplace "PROGVERSION" (prognameandversion) $- regexReplace "OTHER" (unlines $ (map ('+':) unknownCommandsFound)) $- unlines $ concatMap adjustline $ lines $- cmdlist- where- cmdlist = commandsList- commandsFound = map (' ':) builtinCommandNames ++ map ('+':) addonsFound- unknownCommandsFound = addonsFound \\ knownCommands+-- | Get the sorted unique canonical names of hledger addon commands+-- found in the current user's PATH. These are used in command line+-- parsing and to display the commands list.+--+-- Canonical addon names are the filenames of hledger-* executables in+-- PATH, without the "hledger-" prefix, and without the file extension+-- except when it's needed for disambiguation (see below).+--+-- When there are exactly two versions of an executable (same base+-- name, different extensions) that look like a source and compiled+-- pair (one has .exe, .com, or no extension), the source version will+-- be excluded (even if it happens to be newer). When there are three+-- or more versions (or two versions that don't look like a+-- source/compiled pair), they are all included, with file extensions+-- intact.+--+installedAddonCommandNames :: IO [String]+installedAddonCommandNames = do+ -- past bug generator+ as1 <- hledgerExecutablesInPath -- ["hledger-check","hledger-check-dates","hledger-check-dates.hs","hledger-check.hs","hledger-check.py"]+ let as2 = map stripPrognamePrefix as1 -- ["check","check-dates","check-dates.hs","check.hs","check.py"]+ let as3 = groupSortOn takeBaseName as2 -- [["check","check.hs","check.py"],["check-dates","check-dates.hs"]]+ let as4 = concatMap dropRedundantSourceVersion as3 -- ["check","check.hs","check.py","check-dates"]+ return as4 - adjustline l | " hledger " `isPrefixOf` l = [l]- adjustline l@('+':_) | cmd `notElem` commandsFound = []- where- cmd = takeWhile (not . isSpace) l- adjustline l = [l]+stripPrognamePrefix = drop (length progname + 1) +dropRedundantSourceVersion [f,g]+ | map toLower (takeExtension f) `elem` compiledExts = [f]+ | map toLower (takeExtension g) `elem` compiledExts = [g]+dropRedundantSourceVersion fs = fs --- The test command is defined here for easy access to other modules' tests.+compiledExts = ["",".com",".exe"] +-- | Get the sorted unique filenames of all hledger-* executables in+-- the current user's PATH. These are files in any of the PATH directories,+-- named hledger-*, with either no extension (and no periods in the name)+-- or one of the addonExtensions.+-- We do not currently filter out non-file objects or files without execute permission.+hledgerExecutablesInPath :: IO [String]+hledgerExecutablesInPath = filter isHledgerExeName <$> likelyExecutablesInPath++isHledgerExeName :: String -> Bool+isHledgerExeName = isRight . parsewith hledgerexenamep . T.pack+ where+ hledgerexenamep = do+ _ <- string $ T.pack progname+ _ <- char '-'+ _ <- some $ noneOf ['.']+ optional (string "." >> choice' (map (string . T.pack) addonExtensions))+ eof++-- stripAddonExtension :: String -> String+-- stripAddonExtension = regexReplace re "" where re = "\\.(" ++ intercalate "|" addonExtensions ++ ")$"++addonExtensions :: [String]+addonExtensions =+ ["bat"+ ,"com"+ ,"exe"+ ,"hs"+ ,"js"+ ,"lhs"+ ,"lua"+ ,"php"+ ,"pl"+ ,"py"+ ,"rb"+ ,"rkt"+ ,"sh"+ ,"osh"+ ,"ysh"+ ]++-- The test command is also defined here for easy access to other modules' tests.+ testmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Test.txt") [] [generalflagsgroup3] []- ([], Just $ argsFlag "[TESTPATTERN] [SEED]")+ ([], Just $ argsFlag "[-- TASTYOPTS]") --- | The test command.+-- | The test command, which runs the hledger and hledger-lib packages' unit tests.+-- Arguments following a -- argument will be passed to the tasty test runner,+-- and any arguments before -- will be passed as test-selecting -p patterns.+-- -- Unlike most hledger commands, this one does not read the user's journal. -- A 'Journal' argument remains in the type signature, but it should -- not be used (and would raise an error).+-- testcmd :: CliOpts -> Journal -> IO ()-testcmd opts _undefined = do - let args = words' $ query_ $ reportopts_ opts- -- workaround for https://github.com/joelburget/easytest/issues/11 --- import System.IO (hSetEncoding, stdout, stderr, utf8)--- hSetEncoding stdout utf8--- hSetEncoding stderr utf8- e <- runEasytests args $ EasyTest.tests [tests_Hledger, tests_Commands]- if e then exitFailure else exitSuccess-+testcmd opts _undefined = do+ let+ args = listofstringopt "args" $ rawopts_ opts+ (hledgerargs, tastyargs0) = break (== "--") args+ tastyargs = dbg1 "tastyargs" $ ["-p " <> a | a <- hledgerargs] ++ drop 1 tastyargs0+ withArgs tastyargs $+ Test.Tasty.defaultMain $ testGroup "hledger" [+ tests_Hledger+ ,tests_Hledger_Cli+ ] --- unit tests of hledger command-line executable+-- All unit tests for Hledger.Cli, defined here rather than+-- Hledger.Cli so testcmd can use them.+tests_Hledger_Cli = testGroup "Hledger.Cli" [+ tests_Cli_Utils+ ,tests_Commands+ ] -tests_Commands = tests "Commands" [+tests_Commands = testGroup "Commands" [ tests_Balance ,tests_Register+ ,tests_Aregister -- some more tests easiest to define here:- - ,test "apply account directive" $ do - let ignoresourcepos j = j{jtxns=map (\t -> t{tsourcepos=nullsourcepos}) (jtxns j)}- let sameParse str1 str2 = do j1 <- io $ readJournal def Nothing str1 >>= either error' (return . ignoresourcepos)- j2 <- io $ readJournal def Nothing str2 >>= either error' (return . ignoresourcepos)- j1 `is` j2{jlastreadtime=jlastreadtime j1, jfiles=jfiles j1} --, jparsestate=jparsestate j1}- sameParse- ("2008/12/07 One\n alpha $-1\n beta $1\n" <>- "apply account outer\n2008/12/07 Two\n aigh $-2\n bee $2\n" <>- "apply account inner\n2008/12/07 Three\n gamma $-3\n delta $3\n" <>- "end apply account\n2008/12/07 Four\n why $-4\n zed $4\n" <>- "end apply account\n2008/12/07 Five\n foo $-5\n bar $5\n"- )- ("2008/12/07 One\n alpha $-1\n beta $1\n" <>- "2008/12/07 Two\n outer:aigh $-2\n outer:bee $2\n" <>- "2008/12/07 Three\n outer:inner:gamma $-3\n outer:inner:delta $3\n" <>- "2008/12/07 Four\n outer:why $-4\n outer:zed $4\n" <>- "2008/12/07 Five\n foo $-5\n bar $5\n"- ) - ,test "apply account directive should preserve \"virtual\" posting type" $ do- j <- io $ readJournal def Nothing "apply account test\n2008/12/07 One\n (from) $-1\n (to) $1\n" >>= either error' return- let p = head $ tpostings $ head $ jtxns j- paccount p `is` "test:from"- ptype p `is` VirtualPosting- - ,test "account aliases" $ do- j <- io $ readJournal def Nothing "!alias expenses = equity:draw:personal\n1/1\n (expenses:food) 1\n" >>= either error' return- let p = head $ tpostings $ head $ jtxns j- paccount p `is` "equity:draw:personal:food"+ ,testGroup "apply account directive" [+ testCase "works" $ do+ let+ ignoresourcepos j = j{jtxns=map (\t -> t{tsourcepos=nullsourcepospair}) (jtxns j)}+ sameParse str1 str2 = do+ j1 <- ignoresourcepos <$> readJournal'' str1 -- PARTIAL:+ j2 <- ignoresourcepos <$> readJournal'' str2 -- PARTIAL:+ j1 @?= j2{jlastreadtime=jlastreadtime j1, jfiles=jfiles j1} --, jparsestate=jparsestate j1}+ sameParse+ ("2008/12/07 One\n alpha $-1\n beta $1\n" <>+ "apply account outer\n2008/12/07 Two\n aigh $-2\n bee $2\n" <>+ "apply account inner\n2008/12/07 Three\n gamma $-3\n delta $3\n" <>+ "end apply account\n2008/12/07 Four\n why $-4\n zed $4\n" <>+ "end apply account\n2008/12/07 Five\n foo $-5\n bar $5\n"+ )+ ("2008/12/07 One\n alpha $-1\n beta $1\n" <>+ "2008/12/07 Two\n outer:aigh $-2\n outer:bee $2\n" <>+ "2008/12/07 Three\n outer:inner:gamma $-3\n outer:inner:delta $3\n" <>+ "2008/12/07 Four\n outer:why $-4\n outer:zed $4\n" <>+ "2008/12/07 Five\n foo $-5\n bar $5\n"+ ) - ,test "ledgerAccountNames" $- ledgerAccountNames ledger7 `is`- ["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",- "expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",- "liabilities","liabilities:credit cards","liabilities:credit cards:discover"]+ ,testCase "preserves \"virtual\" posting type" $ do+ j <- readJournal'' "apply account test\n2008/12/07 One\n (from) $-1\n (to) $1\n" -- PARTIAL:+ let p = headErr $ tpostings $ headErr $ jtxns j -- PARTIAL headErrs succeed because txns & postings provided+ paccount p @?= "test:from"+ ptype p @?= VirtualPosting+ ] - -- ,test "journalCanonicaliseAmounts" ~:+ ,testCase "alias directive" $ do+ j <- readJournal'' "!alias expenses = equity:draw:personal\n1/1\n (expenses:food) 1\n" -- PARTIAL:+ let p = headErr $ tpostings $ headErr $ jtxns j -- PARTIAL headErrs succeed because txns & postings provided+ paccount p @?= "equity:draw:personal:food"++ ,testCase "Y default year directive" $ do+ j <- readJournal'' defaultyear_journal_txt -- PARTIAL:+ tdate (headErr $ jtxns j) @?= fromGregorian 2009 1 1 -- PARTIAL headErr succeeds because defaultyear_journal_txt has a txn++ ,testCase "ledgerAccountNames" $+ (ledgerAccountNames ledger7)+ @?=+ ["assets","assets:cash","assets:checking","assets:saving","equity","equity:opening balances",+ "expenses","expenses:food","expenses:food:dining","expenses:phone","expenses:vacation",+ "liabilities","liabilities:credit cards","liabilities:credit cards:discover"]++ -- ,testCase "journalCanonicaliseAmounts" ~: -- "use the greatest precision" ~:- -- (map asprecision $ journalAmountAndPriceCommodities $ journalCanonicaliseAmounts $ journalWithAmounts ["1","2.00"]) `is` [2,2]+ -- (map asprecision $ journalAmountAndPriceCommodities $ journalCanonicaliseAmounts $ journalWithAmounts ["1","2.00"]) @?= [2,2] -- don't know what this should do- -- ,test "elideAccountName" ~: do+ -- ,testCase "elideAccountName" ~: do -- (elideAccountName 50 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"- -- `is` "aa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa")+ -- @?= "aa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa") -- (elideAccountName 20 "aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa:aaaaaaaaaaaaaaaaaaaa"- -- `is` "aa:aa:aaaaaaaaaaaaaa")-- ,test "default year" $ do- j <- io $ readJournal def Nothing defaultyear_journal_txt >>= either error' return- tdate (head $ jtxns j) `is` fromGregorian 2009 1 1-- ,test "show dollars" $ showAmount (usd 1) `is` "$1.00"+ -- @?= "aa:aa:aaaaaaaaaaaaaa") - ,test "show hours" $ showAmount (hrs 1) `is` "1.00h"+ ,testCase "show dollars" $ showAmount (usd 1) @?= "$1.00" - ]+ ,testCase "show hours" $ showAmount (hrs 1) @?= "1.00h" + ] -- test data --- date1 = parsedate "2008/11/26"+-- date1 = fromGregorian 2008 11 26 -- t1 = LocalTime date1 midday {--samplejournal = readJournal' sample_journal_str+samplejournal = readJournal'' sample_journal_str sample_journal_str = unlines ["; A sample journal file."@@ -469,7 +713,7 @@ -- ] -- journal4_str = unlines--- ["!include \"somefile\""+-- ["include \"somefile\"" -- ,"2007/01/27 * joes diner" -- ," expenses:food:dining $10.00" -- ," assets:checking $-47.18"@@ -533,8 +777,8 @@ [ txnTieKnot Transaction { tindex=0,- tsourcepos=nullsourcepos,- tdate=parsedate "2007/01/01",+ tsourcepos=nullsourcepospair,+ tdate=fromGregorian 2007 01 01, tdate2=Nothing, tstatus=Unmarked, tcode="*",@@ -550,8 +794,8 @@ , txnTieKnot Transaction { tindex=0,- tsourcepos=nullsourcepos,- tdate=parsedate "2007/02/01",+ tsourcepos=nullsourcepospair,+ tdate=fromGregorian 2007 02 01, tdate2=Nothing, tstatus=Unmarked, tcode="*",@@ -567,8 +811,8 @@ , txnTieKnot Transaction { tindex=0,- tsourcepos=nullsourcepos,- tdate=parsedate "2007/01/02",+ tsourcepos=nullsourcepospair,+ tdate=fromGregorian 2007 01 02, tdate2=Nothing, tstatus=Unmarked, tcode="*",@@ -584,8 +828,8 @@ , txnTieKnot Transaction { tindex=0,- tsourcepos=nullsourcepos,- tdate=parsedate "2007/01/03",+ tsourcepos=nullsourcepospair,+ tdate=fromGregorian 2007 01 03, tdate2=Nothing, tstatus=Unmarked, tcode="*",@@ -601,8 +845,8 @@ , txnTieKnot Transaction { tindex=0,- tsourcepos=nullsourcepos,- tdate=parsedate "2007/01/03",+ tsourcepos=nullsourcepospair,+ tdate=fromGregorian 2007 01 03, tdate2=Nothing, tstatus=Unmarked, tcode="*",@@ -618,8 +862,8 @@ , txnTieKnot Transaction { tindex=0,- tsourcepos=nullsourcepos,- tdate=parsedate "2007/01/03",+ tsourcepos=nullsourcepospair,+ tdate=fromGregorian 2007 01 03, tdate2=Nothing, tstatus=Unmarked, tcode="*",
Hledger/Cli/Commands/Accounts.hs view
@@ -14,19 +14,16 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE CPP #-} module Hledger.Cli.Commands.Accounts ( accountsmode ,accounts ) where -#if !(MIN_VERSION_base(4,11,0))-import Data.Monoid-#endif+import Control.Monad (forM_) import Data.List-import qualified Data.Text as T-import qualified Data.Text.IO as T+import Data.Text qualified as T+import Data.Text.IO qualified as T import System.Console.CmdArgs.Explicit as C import Hledger@@ -36,54 +33,107 @@ -- | Command line options for this command. accountsmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Accounts.txt")- [flagNone ["declared"] (setboolopt "declared") "show account names declared with account directives"- ,flagNone ["used"] (setboolopt "used") "show account names referenced by transactions"- ,flagNone ["tree"] (setboolopt "tree") "show short account names, as a tree"- ,flagNone ["flat"] (setboolopt "flat") "show full account names, as a list (default)"- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"+ (+ [flagNone ["used","u"] (setboolopt "used") "list accounts used"+ ,flagNone ["declared","d"] (setboolopt "declared") "list accounts declared"+ ,flagNone ["undeclared"] (setboolopt "undeclared") "list accounts used but not declared"+ ,flagNone ["unused"] (setboolopt "unused") "list accounts declared but not used"+ ,flagNone ["find"] (setboolopt "find") "list the first account matched by the first argument (a case-insensitive infix regexp)"+ ,flagNone ["directives"] (setboolopt "directives") "show as account directives, for use in journals"+ ,flagNone ["locations"] (setboolopt "locations") "also show where accounts were declared"+ ,flagNone ["types"] (setboolopt "types") "also show account types when known" ]- [generalflagsgroup1]- []- ([], Just $ argsFlag "[QUERY]")+ ++ flattreeflags False +++ [flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"]+ )+ cligeneralflagsgroups1+ (hiddenflags +++ [flagNone ["positions"] (setboolopt "locations") "deprecated, use --locations instead"+ ])+ ([], Just $ argsFlag "[QUERY..]") -- | The accounts command. accounts :: CliOpts -> Journal -> IO ()-accounts CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do+accounts opts@CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query,_rsReportOpts=ropts}} j = do -- 1. identify the accounts we'll show- d <- getCurrentDay let tree = tree_ ropts- declared = boolopt "declared" rawopts- used = boolopt "used" rawopts- q = queryFromOpts d ropts+ directives = boolopt "directives" rawopts+ locations = boolopt "locations" rawopts+ types = boolopt "types" rawopts+ -- Modified queries. These may not work with boolean queries (#2371). -- a depth limit will clip and exclude account names later, but we don't want to exclude accounts at this stage- nodepthq = dbg1 "nodepthq" $ filterQuery (not . queryIsDepth) q+ nodepthq = dbg4 "nodepthq" $ filterQuery (not . queryIsDepth) query -- just the acct: part of the query will be reapplied later, after clipping- acctq = dbg1 "acctq" $ filterQuery queryIsAcct q- depth = dbg1 "depth" $ queryDepth $ filterQuery queryIsDepth q- matcheddeclaredaccts = dbg1 "matcheddeclaredaccts" $ filter (matchesAccount nodepthq) $ map fst $ jdeclaredaccounts j- matchedusedaccts = dbg5 "matchedusedaccts" $ map paccount $ journalPostings $ filterJournalPostings nodepthq j- accts = dbg5 "accts to show" $ -- no need to nub/sort, accountTree will- if | declared && not used -> matcheddeclaredaccts- | not declared && used -> matchedusedaccts- | otherwise -> matcheddeclaredaccts ++ matchedusedaccts + acctq = dbg4 "acctq" $ filterQuery queryIsAcct query+ dep = dbg4 "depth" $ queryDepth $ filterQuery queryIsDepth query+ -- when finding accounts used by postings, we remove tags that were declared on the posting,+ -- so that a tag: query will match account tags and not posting tags.+ matchedused = dbg5 "matchedused" $ nub $ map paccount $ journalPostings $+ filterJournalPostings nodepthq $ journalPostingsKeepAccountTagsOnly j+ matcheddeclared = dbg5 "matcheddeclared" $+ nub $+ filter (matchesAccountExtra (journalAccountType j) (journalInheritedAccountTags j) nodepthq) $+ map fst $ jdeclaredaccounts j+ matchedundeclared = dbg5 "matchedundeclared" $ nub $ matchedused \\ matcheddeclared+ matchedunused = dbg5 "matchedunused" $ nub $ matcheddeclared \\ matchedused+ found = dbg5 "matchedacct" $ findMatchedByArgument rawopts "account" $ journalAccountNamesDeclaredOrImplied j+ matchedall = matcheddeclared ++ matchedused+ accts = dbg5 "accts to show" $+ case declarablesSelectorFromOpts opts of+ Nothing -> matchedall+ Just Used -> matchedused+ Just Declared -> matcheddeclared+ Just Undeclared -> matchedundeclared+ Just Unused -> matchedunused+ Just Find -> [found] - -- 2. sort them by declaration order and name, at each level of their tree structure+ -- 2. sort them by declaration order (then undeclared accounts alphabetically)+ -- within each group of siblings sortedaccts = sortAccountNamesByDeclaration j tree accts - -- 3. if there's a depth limit, depth-clip and remove any no longer useful items + -- 2a. in tree mode, add parent accounts for tree structure context+ acctswithparents =+ if tree+ then dbg4 "acctswithparents" $+ sortAccountNamesByDeclaration j tree $ -- re-sort after adding parents+ expandAccountNames sortedaccts -- add all parent accounts+ else sortedaccts++ -- 3. if there's a depth limit, depth-clip and remove any no longer useful items clippedaccts =- dbg1 "clippedaccts" $- filter (matchesAccount acctq) $ -- clipping can leave accounts that no longer match the query, remove such- nub $ -- clipping can leave duplicates (adjacent, hopefully)- filter (not . T.null) $ -- depth:0 can leave nulls- map (clipAccountName depth) $ -- clip at depth if specified - sortedaccts + dbg4 "clippedaccts" $+ (if tree then id else filter (matchesAccount acctq)) $ -- in tree mode, keep parent accounts even if they don't match+ nub $ -- clipping can leave duplicates (adjacent, hopefully)+ filter (not . T.null) $ -- depth:0 can leave nulls+ map (clipAccountName dep) $ -- clip at depth if specified+ acctswithparents -- use expanded list instead of sortedaccts - -- 4. print what remains as a list or tree, maybe applying --drop in the former case - mapM_ (T.putStrLn . render) clippedaccts- where- render a - | tree_ ropts = T.replicate (2 * (accountNameLevel a - 1)) " " <> accountLeafName a- | otherwise = accountNameDrop (drop_ ropts) a+ -- 4. print what remains as a list or tree, maybe applying --drop in the former case.+ -- Add various bits of info if enabled.+ let+ showKeyword = if directives then "account " else ""+ -- some contortions here to show types nicely aligned+ showName a = case accountlistmode_ ropts of+ ALTree -> indent <> accountLeafName droppedName+ ALFlat -> droppedName+ where+ indent = T.replicate (2 * (max 0 (accountNameLevel a - drop_ ropts) - 1)) " "+ droppedName = accountNameDrop (drop_ ropts) a+ showType a =+ case (types, journalAccountType j a) of+ (True, Just t) -> pad a <> " ; type: " <> T.pack (show t)+ _ -> ""+ showAcctDeclOrder a+ | locations =+ (if types then "," else pad a <> " ;") <>+ case lookup a $ jdeclaredaccounts j of+ Just adi ->+ " declared at " <> (T.pack $ sourcePosPretty $ adisourcepos adi) <> -- TODO: hide the column number+ ", overall declaration order " <> (T.pack $ show $ adideclarationorder adi)+ Nothing -> " undeclared"+ | otherwise = ""+ pad a = T.replicate (maxwidth - T.length (showName a)) " "+ maxwidth = maximum $ map (T.length . showName) clippedaccts + forM_ clippedaccts $ \a -> T.putStrLn $ showKeyword <> showName a <> showType a <> showAcctDeclOrder a
Hledger/Cli/Commands/Accounts.txt view
@@ -1,16 +1,49 @@-accounts, a-Show account names.+accounts -_FLAGS_+List the account names used or declared in the journal. -This command lists account names, either declared with account-directives (--declared), posted to (--used), or both (the default). With-query arguments, only matched account names and account names referenced-by matched postings are shown. It shows a flat list by default. With---tree, it uses indentation to show the account hierarchy. In flat mode-you can add --drop N to omit the first few account name components.-Account names can be depth-clipped with depth:N or --depth N or -N.+Flags:+ -u --used list accounts used+ -d --declared list accounts declared+ --undeclared list accounts used but not declared+ --unused list accounts declared but not used+ --find list the first account matched by the first+ argument (a case-insensitive infix regexp)+ --directives show as account directives, for use in journals+ --locations also show where accounts were declared+ --types also show account types when known+ -l --flat list/tree mode: show accounts as a flat list+ (default)+ -t --tree list/tree mode: show accounts as a tree+ --drop=N flat mode: omit N leading account name parts +This command lists account names - all of them by default, or just the+ones which have been used in transactions (-u/--used), or declared with+account directives (-d/--declared), or used but not declared+(--undeclared), or declared but not used (--unused), or just the first+one matched by a pattern (--find, returning a non-zero exit code if it+fails).++You can add query arguments to select a subset of transactions or+accounts.++With --directives, it shows valid account directives which could be+pasted into a journal file. This is useful together with --undeclared+when updating your account declarations to satisfy+hledger check accounts.++With --locations, it also shows the file and line number of each+account's declaration, if any, and the account's overall declaration+order; these may be useful when troubleshooting account display order.++With --types, it also shows each account's type, if it's known. (See+Declaring accounts > Account types.)++It shows a flat list by default. With --tree, it uses indentation to+show the account hierarchy. In flat mode you can add --drop N to omit+the first few account name components. Account names can be+depth-clipped with depth:N or --depth N or -N.+ Examples: $ hledger accounts@@ -22,3 +55,6 @@ income:gifts income:salary liabilities:debts++$ hledger accounts --undeclared --directives >> $LEDGER_FILE+$ hledger check accounts
Hledger/Cli/Commands/Activity.hs view
@@ -2,27 +2,25 @@ {-| -Print a bar chart of posting activity per day, or other report interval. +Print a bar chart of posting activity per day, or other report interval. -} module Hledger.Cli.Commands.Activity where -import Data.List-import Data.Maybe-import Text.Printf+import Data.List (sortOn)+import Text.Printf (printf)+import Lens.Micro ((^.), set) import Hledger import Hledger.Cli.CliOptions-import Prelude hiding (putStr)-import Hledger.Utils.UTF8IOCompat (putStr) activitymode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Activity.txt") []- [generalflagsgroup1]- []+ cligeneralflagsgroups1+ hiddenflags ([], Just $ argsFlag "[QUERY]") barchar :: Char@@ -30,24 +28,24 @@ -- | Print a bar chart of number of postings per report interval. activity :: CliOpts -> Journal -> IO ()-activity CliOpts{reportopts_=ropts} j = do- d <- getCurrentDay- putStr $ showHistogram ropts (queryFromOpts d ropts) j+activity CliOpts{reportspec_=rspec} j = putStr $ showHistogram rspec j -showHistogram :: ReportOpts -> Query -> Journal -> String-showHistogram opts q j = concatMap (printDayWith countBar) spanps- where- i = interval_ opts- interval | i == NoInterval = Days 1- | otherwise = i- span' = queryDateSpan (date2_ opts) q `spanDefaultsFrom` journalDateSpan (date2_ opts) j- spans = filter (DateSpan Nothing Nothing /=) $ splitSpan interval span'- spanps = [(s, filter (isPostingInDateSpan s) ps) | s <- spans]- -- same as Register- -- should count transactions, not postings ?- -- ps = sortBy (comparing postingDate) $ filterempties $ filter matchapats $ filterdepth $ journalPostings j- ps = sortOn postingDate $ filter (q `matchesPosting`) $ journalPostings j+showHistogram :: ReportSpec -> Journal -> String+showHistogram rspec@ReportSpec{_rsQuery=q} j =+ concatMap (printDayWith countBar) spanps+ where+ mspans = snd . reportSpan j $ case rspec ^. interval of+ NoInterval -> set interval (Days 1) rspec+ _ -> rspec+ spanps = case mspans of+ Nothing -> []+ Just x -> map (\spn -> (spn, filter (postingInRange spn) ps)) $ dayPartitionToList x+ postingInRange (b, e) p = postingDate p >= b && postingDate p <= e+ -- same as Register+ -- should count transactions, not postings ?+ -- ps = sortBy (comparing postingDate) $ filterempties $ filter matchapats $ filterdepth $ journalPostings j+ ps = sortOn postingDate $ filter (q `matchesPosting`) $ journalPostings j -printDayWith f (DateSpan b _, ps) = printf "%s %s\n" (show $ fromJust b) (f ps)+printDayWith f ((b, _), ps) = printf "%s %s\n" (show b) (f ps) countBar ps = replicate (length ps) barchar
Hledger/Cli/Commands/Activity.txt view
@@ -1,7 +1,9 @@ activity+ Show an ascii barchart of posting counts per interval. -_FLAGS_+Flags:+no command-specific flags The activity command displays an ascii histogram showing transaction counts by day, week, month or other reporting interval (by day is the
Hledger/Cli/Commands/Add.hs view
@@ -1,41 +1,48 @@ {-|-A history-aware add command to help with data entry.-|-}+A history-aware, tab-completing interactive add command to help with data entry.+-} {-# OPTIONS_GHC -fno-warn-missing-signatures -fno-warn-unused-do-bind #-}-{-# LANGUAGE ScopedTypeVariables, DeriveDataTypeable, RecordWildCards, TypeOperators, FlexibleContexts, OverloadedStrings, PackageImports #-}+{-# LANGUAGE FlexibleContexts #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TypeOperators #-} module Hledger.Cli.Commands.Add ( addmode ,add ,appendToJournalFileOrStdout ,journalAddTransaction- ,transactionsSimilarTo ) where -import Prelude ()-import "base-compat-batteries" Prelude.Compat import Control.Exception as E-import Control.Monad+import Control.Monad (when) import Control.Monad.Trans.Class import Control.Monad.State.Strict (evalState, evalStateT) import Control.Monad.Trans (liftIO) import Data.Char (toUpper, toLower)+import Data.Either (isRight) import Data.Functor.Identity (Identity(..))-import "base-compat-batteries" Data.List.Compat-import qualified Data.Set as S-import Data.Maybe+import Data.List (isPrefixOf, nub)+import Data.Maybe (fromJust, fromMaybe, isJust) import Data.Text (Text)-import qualified Data.Text as T-import Data.Time.Calendar (Day)-import Data.Typeable (Typeable)-import Safe (headDef, headMay)-import System.Console.CmdArgs.Explicit+import Data.Text qualified as T+import Data.Text.IO qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.IO qualified as TL+import Data.Time.Calendar (Day, toGregorian)+import Data.Time.Format (formatTime, defaultTimeLocale)+import Lens.Micro ((^.))+import Safe (headDef, headMay, atMay, lastMay)+import System.Console.CmdArgs.Explicit (flagNone) import System.Console.Haskeline (runInputT, defaultSettings, setComplete)-import System.Console.Haskeline.Completion-import System.Console.Wizard+import System.Console.Haskeline.Completion (CompletionFunc, completeWord, isFinished, noCompletion, simpleCompletion)+import System.Console.Wizard (Wizard, defaultTo, line, output, outputLn, retryMsg, linePrewritten, nonEmpty, parser, run) import System.Console.Wizard.Haskeline import System.IO ( stderr, hPutStr, hPutStrLn ) import Text.Megaparsec@@ -45,40 +52,64 @@ import Hledger import Hledger.Cli.CliOptions import Hledger.Cli.Commands.Register (postingsReportAsText)+import Hledger.Cli.Utils (journalSimilarTransaction) addmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Add.txt") [flagNone ["no-new-accounts"] (setboolopt "no-new-accounts") "don't allow creating new accounts"] [generalflagsgroup2]- []- ([], Just $ argsFlag "[QUERY]")+ confflags+ ([], Just $ argsFlag "[-f JOURNALFILE] [DATE [DESCRIPTION [ACCOUNT1 [ETC..]]]]]") --- | State used while entering transactions.-data EntryState = EntryState {- esOpts :: CliOpts -- ^ command line options- ,esArgs :: [String] -- ^ command line arguments remaining to be used as defaults- ,esToday :: Day -- ^ today's date- ,esDefDate :: Day -- ^ the default date for next transaction- ,esJournal :: Journal -- ^ the journal we are adding to- ,esSimilarTransaction :: Maybe Transaction -- ^ the most similar historical txn- ,esPostings :: [Posting] -- ^ postings entered so far in the current txn- } deriving (Show,Typeable)+data AddState = AddState {+ asOpts :: CliOpts -- ^ command line options+ ,asArgs :: [String] -- ^ command line arguments remaining to be used as defaults+ ,asToday :: Day -- ^ today's date+ ,asDefDate :: Day -- ^ the default date to use for the next transaction+ ,asJournal :: Journal -- ^ the journal we are adding to+ ,asSimilarTransaction :: Maybe Transaction -- ^ the old transaction most similar to the new one being entered+ ,asPostings :: [Posting] -- ^ the new postings entered so far+} deriving (Show) -defEntryState = EntryState {- esOpts = defcliopts- ,esArgs = []- ,esToday = nulldate- ,esDefDate = nulldate- ,esJournal = nulljournal- ,esSimilarTransaction = Nothing- ,esPostings = []+defAddState = AddState {+ asOpts = defcliopts+ ,asArgs = []+ ,asToday = nulldate+ ,asDefDate = nulldate+ ,asJournal = nulljournal+ ,asSimilarTransaction = Nothing+ ,asPostings = [] } -data RestartTransactionException = RestartTransactionException deriving (Typeable,Show)+data AddStep =+ GetDate+ | GetDescription (Day, Text)+ | GetPosting TxnData (Maybe Posting)+ | GetAccount TxnData+ | GetAmount TxnData String+ | Confirm Transaction++data TxnData = TxnData {+ txnDate :: Day+ , txnCode :: Text+ , txnDesc :: Text+ , txnCmnt :: Text+} deriving (Show)++type Comment = (Text, [Tag], Maybe Day, Maybe Day)++data PrevInput = PrevInput {+ prevDateAndCode :: Maybe String+ , prevDescAndCmnt :: Maybe String+ , prevAccount :: [String]+ , prevAmountAndCmnt :: [String]+} deriving (Show)++data RestartTransactionException = RestartTransactionException deriving (Show) instance Exception RestartTransactionException --- data ShowHelpException = ShowHelpException deriving (Typeable,Show)+-- data ShowHelpException = ShowHelpException deriving (Show) -- instance Exception ShowHelpException -- | Read multiple transactions from the console, prompting for each@@ -88,23 +119,23 @@ add opts j | journalFilePath j == "-" = return () | otherwise = do- hPrintf stderr "Adding transactions to journal file %s\n" (journalFilePath j)+ hPutStrLn stderr $ "Adding transactions to journal file " <> journalFilePath j showHelp- today <- getCurrentDay- let es = defEntryState{esOpts=opts- ,esArgs=map (T.unpack . stripquotes . T.pack) $ listofstringopt "args" $ rawopts_ opts- ,esToday=today- ,esDefDate=today- ,esJournal=j+ let today = opts^.rsDay+ state = defAddState{asOpts=opts+ ,asArgs=listofstringopt "args" $ rawopts_ opts+ ,asToday=today+ ,asDefDate=today+ ,asJournal=j }- getAndAddTransactions es `E.catch` (\(_::UnexpectedEOF) -> putStr "")+ addTransactionsLoop state `E.catch` (\(_::UnexpectedEOF) -> putStr "") showHelp = hPutStr stderr $ unlines [ "Any command line arguments will be used as defaults." ,"Use tab key to complete, readline keys to edit, enter to accept defaults." ,"An optional (CODE) may follow transaction dates." ,"An optional ; COMMENT may follow descriptions or amounts."- ,"If you make a mistake, enter < at any prompt to restart the transaction."+ ,"If you make a mistake, enter < at any prompt to go one step backward." ,"To end a transaction, enter . when prompted." ,"To quit, enter . at a date prompt or press control-d or control-c." ]@@ -114,191 +145,278 @@ -- ctrl-c (then raise an EOF exception). If provided, command-line -- arguments are used as defaults; otherwise defaults come from the -- most similar recent transaction in the journal.-getAndAddTransactions :: EntryState -> IO ()-getAndAddTransactions es@EntryState{..} = (do- mt <- runInputT (setComplete noCompletion defaultSettings) (System.Console.Wizard.run $ haskeline $ confirmedTransactionWizard es)+addTransactionsLoop :: AddState -> IO ()+addTransactionsLoop state@AddState{..} = (do+ let defaultPrevInput = PrevInput{prevDateAndCode=Nothing, prevDescAndCmnt=Nothing, prevAccount=[], prevAmountAndCmnt=[]}+ mt <- runInputT (setComplete noCompletion defaultSettings) (System.Console.Wizard.run $ haskeline $ transactionWizard defaultPrevInput state []) case mt of- Nothing -> fail "urk ?"+ Nothing -> error' "Could not interpret the input, restarting" -- caught below causing a restart, I believe -- PARTIAL: Just t -> do- j <- if debug_ esOpts > 0- then do hPrintf stderr "Skipping journal add due to debug mode.\n"- return esJournal- else do j' <- journalAddTransaction esJournal esOpts t- hPrintf stderr "Saved.\n"+ j <- if debug_ asOpts > 0+ then do hPutStrLn stderr "Skipping journal add due to debug mode."+ return asJournal+ else do j' <- journalAddTransaction asJournal asOpts t+ hPutStrLn stderr "Saved." return j'- hPrintf stderr "Starting the next transaction (. or ctrl-D/ctrl-C to quit)\n"- getAndAddTransactions es{esJournal=j, esDefDate=tdate t}+ hPutStrLn stderr "Starting the next transaction (. or ctrl-D/ctrl-C to quit)"+ addTransactionsLoop state{asJournal=j, asDefDate=tdate t} ) `E.catch` (\(_::RestartTransactionException) ->- hPrintf stderr "Restarting this transaction.\n" >> getAndAddTransactions es)+ hPutStrLn stderr "Restarting this transaction." >> addTransactionsLoop state) --- confirmedTransactionWizard :: (ArbitraryIO :<: b, OutputLn :<: b, Line :<: b) => EntryState -> Wizard b Transaction--- confirmedTransactionWizard :: EntryState -> Wizard Haskeline Transaction-confirmedTransactionWizard es@EntryState{..} = do- t <- transactionWizard es- -- liftIO $ hPrintf stderr {- "Transaction entered:\n%s" -} (show t)- output $ showTransaction t- y <- let def = "y" in- retryMsg "Please enter y or n." $- parser ((fmap ('y' ==)) . headMay . map toLower . strip) $- defaultTo' def $ nonEmpty $- maybeRestartTransaction $- line $ green $ printf "Save this transaction to the journal ?%s: " (showDefault def)- if y then return t else throw RestartTransactionException+-- | Interact with the user to get a Transaction.+transactionWizard :: PrevInput -> AddState -> [AddStep] -> Wizard Haskeline Transaction+transactionWizard previnput state [] = transactionWizard previnput state [GetDate]+transactionWizard previnput state@AddState{..} stack@(currentStage : _) = case currentStage of+ GetDate -> dateWizard previnput state >>= \case+ Just (efd, code) -> do+ let+ date = fromEFDay efd+ state' = state{ asArgs = drop 1 asArgs+ , asDefDate = date+ }+ dateAndCodeString = formatTime defaultTimeLocale yyyymmddFormat date+ ++ T.unpack (if T.null code then "" else " (" <> code <> ")")+ yyyymmddFormat = "%Y-%m-%d"+ transactionWizard previnput{prevDateAndCode=Just dateAndCodeString} state' (GetDescription (date, code) : stack)+ Nothing ->+ transactionWizard previnput state stack -transactionWizard es@EntryState{..} = do- (date,code) <- dateAndCodeWizard es- let es1@EntryState{esArgs=args1} = es{esArgs=drop 1 esArgs, esDefDate=date}- (desc,comment) <- descriptionAndCommentWizard es1- let mbaset = similarTransaction es1 desc- when (isJust mbaset) $ liftIO $ hPrintf stderr "Using this similar transaction for defaults:\n%s" (showTransaction $ fromJust mbaset)- let es2 = es1{esArgs=drop 1 args1, esSimilarTransaction=mbaset}- balancedPostingsWizard = do- ps <- postingsWizard es2{esPostings=[]}- let t = nulltransaction{tdate=date- ,tstatus=Unmarked- ,tcode=code- ,tdescription=desc- ,tcomment=comment- ,tpostings=ps- }- case balanceTransaction Nothing t of -- imprecise balancing (?)- Right t' -> return t'- Left err -> liftIO (hPutStrLn stderr $ "\n" ++ (capitalize err) ++ "please re-enter.") >> balancedPostingsWizard- balancedPostingsWizard+ GetDescription (date, code) -> descriptionWizard previnput state >>= \case+ Just (desc, comment) -> do+ let mbaset = journalSimilarTransaction asOpts asJournal desc+ state' = state+ { asArgs = drop 1 asArgs+ , asPostings = []+ , asSimilarTransaction = mbaset+ }+ descAndCommentString = T.unpack $ desc <> (if T.null comment then "" else " ; " <> comment)+ previnput' = previnput{prevDescAndCmnt=Just descAndCommentString}+ when (isJust mbaset) . liftIO $ do+ hPutStrLn stderr "Using this similar transaction for defaults:"+ T.hPutStr stderr $ showTransaction (fromJust mbaset)+ transactionWizard previnput' state' ((GetPosting TxnData{txnDate=date, txnCode=code, txnDesc=desc, txnCmnt=comment} Nothing) : stack)+ Nothing ->+ transactionWizard previnput state (drop 1 stack) --- Identify the closest recent match for this description in past transactions.-similarTransaction :: EntryState -> Text -> Maybe Transaction-similarTransaction EntryState{..} desc =- let q = queryFromOptsOnly esToday $ reportopts_ esOpts- historymatches = transactionsSimilarTo esJournal q desc- bestmatch | null historymatches = Nothing- | otherwise = Just $ snd $ head historymatches- in bestmatch+ GetPosting txndata@TxnData{..} p -> case (asPostings, p) of+ ([], Nothing) ->+ transactionWizard previnput state (GetAccount txndata : stack)+ (_, Just _) ->+ transactionWizard previnput state (GetAccount txndata : stack)+ (_, Nothing) -> do+ let t = nulltransaction{tdate=txnDate+ ,tstatus=Unmarked+ ,tcode=txnCode+ ,tdescription=txnDesc+ ,tcomment=txnCmnt+ ,tpostings=asPostings+ }+ bopts = balancingopts_ (inputopts_ asOpts)+ case balanceTransactionInJournal t asJournal bopts of+ Right t' ->+ transactionWizard previnput state (Confirm t' : stack)+ Left err -> do+ liftIO (hPutStrLn stderr $ "\n" ++ (capitalize err) ++ ", please re-enter.")+ let notFirstEnterPost stage = case stage of+ GetPosting _ Nothing -> False+ _ -> True+ transactionWizard previnput state{asPostings=[]} (dropWhile notFirstEnterPost stack) -dateAndCodeWizard EntryState{..} = do- let def = headDef (showDate esDefDate) esArgs- retryMsg "A valid hledger smart date is required. Eg: 2014/2/14, 14, yesterday." $- parser (parseSmartDateAndCode esToday) $+ GetAccount txndata -> accountWizard previnput state >>= \case+ Just account+ | account `elem` [".", ""] ->+ case (asPostings, postingsAreBalanced asPostings) of+ ([],_) -> liftIO (hPutStrLn stderr "Please enter some postings first.") >> transactionWizard previnput state stack+ (_,False) -> liftIO (hPutStrLn stderr "Please enter more postings to balance the transaction.") >> transactionWizard previnput state stack+ (_,True) -> transactionWizard previnput state (GetPosting txndata Nothing : stack)+ | otherwise -> do+ let prevAccount' = replaceNthOrAppend (length asPostings) account (prevAccount previnput)+ transactionWizard previnput{prevAccount=prevAccount'} state{asArgs=drop 1 asArgs} (GetAmount txndata account : stack)+ Nothing -> do+ let notPrevAmountAndNotGetDesc stage = case stage of+ GetAmount _ _ -> False+ GetDescription _ -> False+ _ -> True+ transactionWizard previnput state{asPostings=init asPostings} (dropWhile notPrevAmountAndNotGetDesc stack)++ GetAmount txndata account -> amountWizard previnput state >>= \case+ Just (mamt, assertion, (comment, tags, pdate1, pdate2)) -> do+ let mixedamt = maybe missingmixedamt mixedAmount mamt+ p = nullposting{paccount=T.pack $ stripbrackets account+ ,pamount=mixedamt+ ,pcomment=T.dropAround isNewline comment+ ,ptype=accountNamePostingType $ T.pack account+ ,pbalanceassertion = assertion+ ,pdate=pdate1+ ,pdate2=pdate2+ ,ptags=tags+ }+ amountAndCommentString = showMixedAmountOneLine mixedamt ++ T.unpack (if T.null comment then "" else " ;" <> comment)+ prevAmountAndCmnt' = replaceNthOrAppend (length asPostings) amountAndCommentString (prevAmountAndCmnt previnput)+ state' = state{asPostings=asPostings++[p], asArgs=drop 1 asArgs}+ -- Include a dummy posting to balance the unfinished transation in assertion checking+ dummytxn = nulltransaction{tpostings = asPostings ++ [p, post "" missingamt]+ ,tdate = txnDate txndata+ ,tdescription = txnDesc txndata }+ bopts = balancingopts_ (inputopts_ asOpts)+ balanceassignment = mixedamt==missingmixedamt && isJust assertion+ etxn+ -- If the new posting is doing a balance assignment,+ -- don't attempt to balance the transaction or check assertions yet+ | balanceassignment = Right dummytxn+ -- Otherwise, balance the transaction in context of the whole journal,+ -- maybe filling its balance assignments if any,+ -- and maybe checking all the journal's balance assertions.+ | otherwise = balanceTransactionInJournal dummytxn asJournal bopts++ case etxn of+ Left err -> do+ liftIO (hPutStrLn stderr err)+ transactionWizard previnput state (GetAmount txndata account : stack)+ Right _ -> + transactionWizard previnput{prevAmountAndCmnt=prevAmountAndCmnt'} state' (GetPosting txndata (Just posting) : stack)+ Nothing -> transactionWizard previnput state (drop 1 stack)++ Confirm t -> do+ output . T.unpack $ showTransaction t+ y <- let def = "y" in+ retryMsg "Please enter y or n." $+ parser ((fmap (\c -> if c == '<' then Nothing else Just c)) . headMay . map toLower . strip) $+ defaultTo' def $ nonEmpty $+ line $ green' $ printf "Save this transaction to the journal ?%s: " (showDefault def)+ case y of+ Just 'y' -> return t+ Just _ -> throw RestartTransactionException+ Nothing -> transactionWizard previnput state (drop 2 stack)+ where+ replaceNthOrAppend n newElem xs = take n xs ++ [newElem] ++ drop (n + 1) xs++-- | Interact with the user to get a transaction date (accepting smart dates), maybe followed by a " (CODE)". +-- Returns the date and the code, or nothing if the input was "<".+dateWizard :: PrevInput -> AddState -> Wizard Haskeline (Maybe (EFDay, Text))+dateWizard PrevInput{..} AddState{..} = do+ let def = headDef (T.unpack $ showDate asDefDate) asArgs+ retryMsg "A valid hledger smart date is required. Eg: 2022-08-30, 8/30, 30, yesterday." $+ parser (parseSmartDateAndCode asToday) $ withCompletion (dateCompleter def) $ defaultTo' def $ nonEmpty $ maybeExit $- maybeRestartTransaction $ -- maybeShowHelp $- line $ green $ printf "Date%s: " (showDefault def)+ linePrewritten (green' $ printf "Date%s: " (showDefault def)) (fromMaybe "" prevDateAndCode) "" where- parseSmartDateAndCode refdate s = either (const Nothing) (\(d,c) -> return (fixSmartDate refdate d, c)) edc+ parseSmartDateAndCode refdate s = if s == "<" then return Nothing else either (const Nothing) (\(d,c) -> return $ Just (fixSmartDate refdate d, c)) edc where edc = runParser (dateandcodep <* eof) "" $ T.pack $ lowercase s dateandcodep :: SimpleTextParser (SmartDate, Text) dateandcodep = do d <- smartdate c <- optional codep- skipMany spacenonewline+ skipNonNewlineSpaces eof return (d, fromMaybe "" c) -- defday = fixSmartDate today $ fromparse $ (parse smartdate "" . lowercase) defdate -- datestr = showDate $ fixSmartDate defday smtdate -descriptionAndCommentWizard EntryState{..} = do- let def = headDef "" esArgs- s <- withCompletion (descriptionCompleter esJournal def) $+-- | Interact with the user to get a transaction description, maybe followed by a "; COMMENT".+-- Returns the possibly empty description and comment, or nothing if the input is "<".+descriptionWizard :: PrevInput -> AddState -> Wizard Haskeline (Maybe (Text, Text))+descriptionWizard PrevInput{..} AddState{..} = do+ let def = headDef "" asArgs+ s <- withCompletion (descriptionCompleter asJournal def) $ defaultTo' def $ nonEmpty $- maybeRestartTransaction $- line $ green $ printf "Description%s: " (showDefault def)- let (desc,comment) = (T.pack $ strip a, T.pack $ strip $ dropWhile (==';') b) where (a,b) = break (==';') s- return (desc, comment)--postingsWizard es@EntryState{..} = do- mp <- postingWizard es- case mp of Nothing -> return esPostings- Just p -> postingsWizard es{esArgs=drop 2 esArgs, esPostings=esPostings++[p]}--postingWizard es@EntryState{..} = do- acct <- accountWizard es- if acct `elem` [".",""]- then case (esPostings, postingsBalanced esPostings) of- ([],_) -> liftIO (hPutStrLn stderr "Please enter some postings first.") >> postingWizard es- (_,False) -> liftIO (hPutStrLn stderr "Please enter more postings to balance the transaction.") >> postingWizard es- (_,True) -> return Nothing -- no more postings, end of transaction- else do- let es1 = es{esArgs=drop 1 esArgs}- (amt,comment) <- amountAndCommentWizard es1- return $ Just nullposting{paccount=T.pack $ stripbrackets acct- ,pamount=Mixed [amt]- ,pcomment=comment- ,ptype=accountNamePostingType $ T.pack acct- }--postingsBalanced :: [Posting] -> Bool-postingsBalanced ps = isRight $ balanceTransaction Nothing nulltransaction{tpostings=ps}+ linePrewritten (green' $ printf "Description%s: " (showDefault def)) (fromMaybe "" prevDescAndCmnt) ""+ if s == "<"+ then return Nothing+ else do+ let (desc,comment) = (T.pack $ strip a, T.pack $ strip $ dropWhile (==';') b) where (a,b) = break (==';') s+ return $ Just (desc, comment) -accountWizard EntryState{..} = do- let pnum = length esPostings + 1- historicalp = fmap ((!! (pnum - 1)) . (++ (repeat nullposting)) . tpostings) esSimilarTransaction+-- | Interact with the user to get an account name, possibly enclosed in "()" or "[]".+-- Returns the account name, or nothing if the input is "<".+accountWizard :: PrevInput -> AddState -> Wizard Haskeline (Maybe String)+accountWizard PrevInput{..} AddState{..} = do+ let pnum = length asPostings + 1+ historicalp = fmap ((!! (pnum - 1)) . (++ (repeat nullposting)) . tpostings) asSimilarTransaction historicalacct = case historicalp of Just p -> showAccountName Nothing (ptype p) (paccount p) Nothing -> ""- def = headDef historicalacct esArgs+ def = headDef (T.unpack historicalacct) asArgs endmsg | canfinish && null def = " (or . or enter to finish this transaction)" | canfinish = " (or . to finish this transaction)" | otherwise = "" retryMsg "A valid hledger account name is required. Eg: assets:cash, expenses:food:eating out." $ parser (parseAccountOrDotOrNull def canfinish) $- withCompletion (accountCompleter esJournal def) $+ withCompletion (accountCompleter asJournal def) $ defaultTo' def $ -- nonEmpty $- maybeRestartTransaction $- line $ green $ printf "Account %d%s%s: " pnum (endmsg::String) (showDefault def)+ linePrewritten (green' $ printf "Account %d%s%s: " pnum (endmsg::String) (showDefault def)) (fromMaybe "" $ prevAccount `atMay` length asPostings) "" where- canfinish = not (null esPostings) && postingsBalanced esPostings- parseAccountOrDotOrNull :: String -> Bool -> String -> Maybe String- parseAccountOrDotOrNull _ _ "." = dbg1 $ Just "." -- . always signals end of txn- parseAccountOrDotOrNull "" True "" = dbg1 $ Just "" -- when there's no default and txn is balanced, "" also signals end of txn- parseAccountOrDotOrNull def@(_:_) _ "" = dbg1 $ Just def -- when there's a default, "" means use that- parseAccountOrDotOrNull _ _ s = dbg1 $ fmap T.unpack $+ canfinish = not (null asPostings) && postingsAreBalanced asPostings+ parseAccountOrDotOrNull :: String -> Bool -> String -> Maybe (Maybe String)+ parseAccountOrDotOrNull _ _ "<" = dbg' $ Just Nothing+ parseAccountOrDotOrNull _ _ "." = dbg' $ Just $ Just "." -- . always signals end of txn+ parseAccountOrDotOrNull "" True "" = dbg' $ Just $ Just "" -- when there's no default and txn is balanced, "" also signals end of txn+ parseAccountOrDotOrNull def@(_:_) _ "" = dbg' $ Just $ Just def -- when there's a default, "" means use that+ parseAccountOrDotOrNull _ _ s = dbg' $ fmap (Just . T.unpack) $ either (const Nothing) validateAccount $- flip evalState esJournal $ runParserT (accountnamep <* eof) "" (T.pack s) -- otherwise, try to parse the input as an accountname+ flip evalState asJournal $ runParserT (accountnamep <* eof) "" (T.pack s) -- otherwise, try to parse the input as an accountname where validateAccount :: Text -> Maybe Text- validateAccount t | no_new_accounts_ esOpts && notElem t (journalAccountNamesDeclaredOrImplied esJournal) = Nothing+ validateAccount t | no_new_accounts_ asOpts && notElem t (journalAccountNamesDeclaredOrImplied asJournal) = Nothing | otherwise = Just t- dbg1 = id -- strace+ dbg' = id -- strace -amountAndCommentWizard EntryState{..} = do- let pnum = length esPostings + 1+-- | Interact with the user to get an amount and/or a balance assertion, maybe followed by a "; COMMENT".+-- Returns the amount, balance assertion, and/or comment, or nothing if the input is "<".+amountWizard :: PrevInput -> AddState -> Wizard Haskeline (Maybe (Maybe Amount, Maybe BalanceAssertion, Comment))+amountWizard previnput@PrevInput{..} state@AddState{..} = do+ let pnum = length asPostings + 1 (mhistoricalp,followedhistoricalsofar) =- case esSimilarTransaction of+ case asSimilarTransaction of Nothing -> (Nothing,False)- Just Transaction{tpostings=ps} -> (if length ps >= pnum then Just (ps !! (pnum-1)) else Nothing- ,all (\(a,b) -> pamount a == pamount b) $ zip esPostings ps)- def = case (esArgs, mhistoricalp, followedhistoricalsofar) of- (d:_,_,_) -> d- (_,Just hp,True) -> showamt $ pamount hp- _ | pnum > 1 && not (isZeroMixedAmount balancingamt) -> showamt balancingamtfirstcommodity- _ -> ""- retryMsg "A valid hledger amount is required. Eg: 1, $2, 3 EUR, \"4 red apples\"." $- parser parseAmountAndComment $+ Just Transaction{tpostings=ps} ->+ ( if length ps >= pnum then Just (ps !! (pnum-1)) else Nothing+ , all sameamount $ zip asPostings ps+ )+ where+ sameamount (p1,p2) = mixedAmountUnstyled (pamount p1) == mixedAmountUnstyled (pamount p2)+ def | (d:_) <- asArgs = d+ | Just hp <- mhistoricalp, followedhistoricalsofar = showamt $ pamount hp+ | pnum > 1 && not (mixedAmountLooksZero balancingamt) = showamt balancingamtfirstcommodity+ | otherwise = ""+ retryMsg "A valid hledger amount is required. Eg: 1, $2, 3 EUR, \"4 red apples\"." $ + parser' parseAmountAndComment $ withCompletion (amountCompleter def) $- defaultTo' def $ nonEmpty $- maybeRestartTransaction $- line $ green $ printf "Amount %d%s: " pnum (showDefault def)+ defaultTo' def $+ nonEmpty $+ linePrewritten (green' $ printf "Amount %d%s: " pnum (showDefault def)) (fromMaybe "" $ prevAmountAndCmnt `atMay` length asPostings) "" where- parseAmountAndComment s = either (const Nothing) Just $- runParser- (evalStateT (amountandcommentp <* eof) nodefcommodityj)- ""- (T.pack s)- nodefcommodityj = esJournal{jparsedefaultcommodity=Nothing}- amountandcommentp :: JournalParser Identity (Amount, Text)+ -- Custom parser that combines with Wizard to use IO via outputLn+ parser' f a = a >>= \input ->+ case f input of+ Left err -> do+ outputLn (customErrorBundlePretty err)+ amountWizard previnput state+ Right res -> pure res+ parseAmountAndComment s = + if s == "<" then Right Nothing else + Just <$> runParser + (evalStateT (amountandcommentp <* eof) nodefcommodityj)+ ""+ (T.pack s)+ nodefcommodityj = asJournal{jparsedefaultcommodity=Nothing}+ amountandcommentp :: JournalParser Identity (Maybe Amount, Maybe BalanceAssertion, Comment) amountandcommentp = do- a <- amountp- lift (skipMany spacenonewline)- c <- T.pack <$> fromMaybe "" `fmap` optional (char ';' >> many anySingle)- -- eof- return (a,c)- balancingamt = negate $ sum $ map pamount realps where realps = filter isReal esPostings- balancingamtfirstcommodity = Mixed $ take 1 $ amounts balancingamt- showamt =- showMixedAmountWithPrecision+ mamt <- optional amountp+ lift skipNonNewlineSpaces+ massertion <- optional balanceassertionp+ com <- T.pack <$> fromMaybe "" `fmap` optional (char ';' >> many anySingle)+ case rtp (postingcommentp (let (y,_,_) = toGregorian asDefDate in Just y)) (T.cons ';' com) of+ Left err -> fail $ customErrorBundlePretty err+ -- Keep our original comment string from the user to add to the journal+ Right (_, tags, date1', date2') -> return $ (mamt, massertion, (com, tags, date1', date2'))+ balancingamt = maNegate . sumPostings $ filter isReal asPostings+ balancingamtfirstcommodity = mixed . take 1 $ amounts balancingamt+ showamt = wbUnpack . showMixedAmountB defaultFmt . mixedAmountSetPrecision -- what should this be ? -- 1 maxprecision (show all decimal places or none) ? -- 2 maxprecisionwithpoint (show all decimal places or .0 - avoids some but not all confusion with thousands separators) ?@@ -306,32 +424,25 @@ -- 4 maximum precision entered so far in this transaction ? -- 5 3 or 4, whichever would show the most decimal places ? -- I think 1 or 4, whichever would show the most decimal places- maxprecisionwithpoint+ NaturalPrecision -- -- let -- (amt,comment) = (strip a, strip $ dropWhile (==';') b) where (a,b) = break (==';') amtcmt- -- a = fromparse $ runParser (amountp <|> return missingamt) (jparsestate esJournal) "" amt+ -- a = fromparse $ runParser (amountp <|> return missingamt) (jparsestate asJournal) "" amt -- awithoutjps = fromparse $ runParser (amountp <|> return missingamt) mempty "" amt -- defamtaccepted = Just (showAmount a) == mdefamt- -- es2 = if defamtaccepted then es1 else es1{esHistoricalPostings=Nothing}+ -- as2 = if defamtaccepted then as1 else as1{asHistoricalPostings=Nothing} -- mdefaultcommodityapplied = if acommodity a == acommodity awithoutjps then Nothing else Just $ acommodity a -- when (isJust mdefaultcommodityapplied) $ -- liftIO $ hPutStrLn stderr $ printf "using default commodity (%s)" (fromJust mdefaultcommodityapplied) -maybeExit = parser (\s -> if s=="." then throw UnexpectedEOF else Just s)--maybeRestartTransaction = parser (\s -> if s=="<" then throw RestartTransactionException else Just s)---- maybeShowHelp :: Wizard Haskeline String -> Wizard Haskeline String--- maybeShowHelp wizard = maybe (liftIO showHelp >> wizard) return $--- parser (\s -> if s=="?" then Nothing else Just s) wizard- -- Completion helpers dateCompleter :: String -> CompletionFunc IO dateCompleter = completer ["today","tomorrow","yesterday"] +-- Offer payees declared, payees used, or full descriptions used. descriptionCompleter :: Journal -> String -> CompletionFunc IO-descriptionCompleter j = completer (map T.unpack $ journalDescriptions j)+descriptionCompleter j = completer (map T.unpack $ nub $ journalPayeesDeclaredOrUsed j ++ journalDescriptions j) accountCompleter :: Journal -> String -> CompletionFunc IO accountCompleter j = completer (map T.unpack $ journalAccountNamesDeclaredOrImplied j)@@ -358,95 +469,79 @@ -- utilities +maybeExit = parser (\s -> if s == "." then throw UnexpectedEOF else Just s)++-- maybeShowHelp :: Wizard Haskeline String -> Wizard Haskeline String+-- maybeShowHelp wizard = maybe (liftIO showHelp >> wizard) return $+-- parser (\s -> if s=="?" then Nothing else Just s) wizard+ defaultTo' = flip defaultTo withCompletion f = withSettings (setComplete f defaultSettings) -green s = "\ESC[1;32m\STX"++s++"\ESC[0m\STX"- showDefault "" = "" showDefault s = " [" ++ s ++ "]" +-- | Balance and check a transaction with awareness of the whole journal it will be added to.+-- This means add it to the journal, balance it, calculate any balance assignments in it,+-- then maybe check all the journal's balance assertions,+-- then return the now fully balanced and checked transaction, or an error message.+balanceTransactionInJournal :: Transaction -> Journal -> BalancingOpts -> Either String Transaction+balanceTransactionInJournal t j bopts = do+ -- Add the transaction at the end of the journal, as the add command will.+ let j' = j{jtxns = jtxns j ++ [t]}+ -- Try to balance and check the whole journal, and specifically the new transaction.+ Journal{jtxns=ts} <- journalBalanceTransactions bopts j'+ -- Extract the balanced & checked transaction.+ maybe+ (Left "balanceTransactionInJournal: unexpected empty journal") -- should not happen+ Right+ (lastMay ts)++postingsAreBalanced :: [Posting] -> Bool+postingsAreBalanced ps = isRight $ balanceSingleTransaction defbalancingopts nulltransaction{tpostings = ps}+ -- | Append this transaction to the journal's file and transaction list. journalAddTransaction :: Journal -> CliOpts -> Transaction -> IO Journal journalAddTransaction j@Journal{jtxns=ts} opts t = do let f = journalFilePath j- appendToJournalFileOrStdout f $ showTransactionUnelided t+ appendToJournalFileOrStdout f $ showTransaction t -- unelided shows all amounts explicitly, in case there's a price, cf #283 when (debug_ opts > 0) $ do putStrLn $ printf "\nAdded transaction to %s:" f- putStrLn =<< registerFromString (showTransaction t)+ TL.putStrLn =<< registerFromString (showTransaction t) return j{jtxns=ts++[t]} -- | Append a string, typically one or more transactions, to a journal -- file, or if the file is "-", dump it to stdout. Tries to avoid -- excess whitespace.-appendToJournalFileOrStdout :: FilePath -> String -> IO ()+--+-- XXX This writes unix line endings (\n), some at least,+-- even if the file uses dos line endings (\r\n), which could leave+-- mixed line endings in the file. See also writeFileWithBackupIfChanged.+--+appendToJournalFileOrStdout :: FilePath -> Text -> IO () appendToJournalFileOrStdout f s- | f == "-" = putStr s'- | otherwise = appendFile f s'- where s' = "\n" ++ ensureOneNewlineTerminated s+ | f == "-" = T.putStr s'+ | otherwise = do+ ensureJournalFileExists f+ appendFile f $ T.unpack s'+ where s' = "\n" <> ensureOneNewlineTerminated s -- | Replace a string's 0 or more terminating newlines with exactly one.-ensureOneNewlineTerminated :: String -> String-ensureOneNewlineTerminated = (++"\n") . reverse . dropWhile (=='\n') . reverse+ensureOneNewlineTerminated :: Text -> Text+ensureOneNewlineTerminated = (<>"\n") . T.dropWhileEnd (=='\n') -- | Convert a string of journal data into a register report.-registerFromString :: String -> IO String+registerFromString :: T.Text -> IO TL.Text registerFromString s = do- d <- getCurrentDay- j <- readJournal' $ T.pack s- return $ postingsReportAsText opts $ postingsReport ropts (queryFromOpts d ropts) j+ j <- readJournal'' s+ return . postingsReportAsText opts $ postingsReport rspec j where ropts = defreportopts{empty_=True}- opts = defcliopts{reportopts_=ropts}+ rspec = defreportspec{_rsReportOpts=ropts}+ opts = defcliopts{reportspec_=rspec} capitalize :: String -> String capitalize "" = "" capitalize (c:cs) = toUpper c : cs---- | Find the most similar and recent transactions matching the given--- transaction description and report query. Transactions are listed--- with their "relevancy" score, most relevant first.-transactionsSimilarTo :: Journal -> Query -> Text -> [(Double,Transaction)]-transactionsSimilarTo j q desc =- sortBy compareRelevanceAndRecency- $ filter ((> threshold).fst)- [(compareDescriptions desc $ tdescription t, t) | t <- ts]- where- compareRelevanceAndRecency (n1,t1) (n2,t2) = compare (n2,tdate t2) (n1,tdate t1)- ts = filter (q `matchesTransaction`) $ jtxns j- threshold = 0---- | Return a similarity measure, from 0 to 1, for two transaction--- descriptions. This is like compareStrings, but first strips out--- any numbers, to improve accuracy eg when there are bank transaction--- ids from imported data.-compareDescriptions :: Text -> Text -> Double-compareDescriptions s t = compareStrings s' t'- where s' = simplify $ T.unpack s- t' = simplify $ T.unpack t- simplify = filter (not . (`elem` ("0123456789" :: String)))---- | Return a similarity measure, from 0 to 1, for two strings. This--- was based on Simon White's string similarity algorithm--- (http://www.catalysoft.com/articles/StrikeAMatch.html), later found--- to be https://en.wikipedia.org/wiki/S%C3%B8rensen%E2%80%93Dice_coefficient,--- modified to handle short strings better.--- Todo: check out http://nlp.fi.muni.cz/raslan/2008/raslan08.pdf#page=14 .-compareStrings :: String -> String -> Double-compareStrings "" "" = 1-compareStrings [_] "" = 0-compareStrings "" [_] = 0-compareStrings [a] [b] = if toUpper a == toUpper b then 1 else 0-compareStrings s1 s2 = 2 * commonpairs / totalpairs- where- pairs1 = S.fromList $ wordLetterPairs $ uppercase s1- pairs2 = S.fromList $ wordLetterPairs $ uppercase s2- commonpairs = fromIntegral $ S.size $ S.intersection pairs1 pairs2- totalpairs = fromIntegral $ S.size pairs1 + S.size pairs2--wordLetterPairs = concatMap letterPairs . words--letterPairs (a:b:rest) = [a,b] : letterPairs (b:rest)-letterPairs _ = []
Hledger/Cli/Commands/Add.txt view
@@ -1,15 +1,17 @@ add-Prompt for transactions and add them to the journal. -_FLAGS_+Add new transactions to a journal file, with interactive prompting. +Flags:+ --no-new-accounts don't allow creating new accounts+ Many hledger users edit their journals directly with a text editor, or generate them from CSV. For more interactive data entry, there is the add command, which prompts interactively on the console for new-transactions, and appends them to the journal file (if there are-multiple -f FILE options, the first file is used.) Existing transactions-are not changed. This is the only hledger command that writes to the-journal file.+transactions, and appends them to the main journal file (which should be+in journal format). Existing transactions are not changed. This is one+of the few hledger commands that writes to the journal file (see also+import). To use it, just run hledger add and follow the prompts. You can add as many transactions as you like; when you are finished, enter . or press@@ -17,46 +19,70 @@ Features: -- add tries to provide useful defaults, using the most similar (by- description) recent transaction (filtered by the query, if any) as a- template.-- You can also set the initial defaults with command line arguments.-- Readline-style edit keys can be used during data entry.-- The tab key will auto-complete whenever possible - accounts,- descriptions, dates (yesterday, today, tomorrow). If the input area- is empty, it will insert the default value.-- If the journal defines a default commodity, it will be added to any- bare numbers entered.-- A parenthesised transaction code may be entered following a date.-- Comments and tags may be entered following a description or amount.-- If you make a mistake, enter < at any prompt to restart the- transaction.-- Input prompts are displayed in a different colour when the terminal- supports it.+- add tries to provide useful defaults, using the most similar (by+ description) recent transaction (filtered by the query, if any) as a+ template.+- You can also set the initial defaults with command line arguments.+- Readline-style edit keys can be used during data entry.+- The tab key will auto-complete whenever possible - accounts,+ payees/descriptions, dates (yesterday, today, tomorrow). If the input+ area is empty, it will insert the default value.+- A parenthesised transaction code may be entered following a date.+- Comments and tags may be entered following a description or amount.+- If you make a mistake, enter < at any prompt to go one step backward.+- Input prompts are displayed in a different colour when the terminal+ supports it. -Example (see the tutorial for a detailed explanation):+Notes: -$ hledger add-Adding transactions to journal file /src/hledger/examples/sample.journal-Any command line arguments will be used as defaults.-Use tab key to complete, readline keys to edit, enter to accept defaults.-An optional (CODE) may follow transaction dates.-An optional ; COMMENT may follow descriptions or amounts.-If you make a mistake, enter < at any prompt to restart the transaction.-To end a transaction, enter . when prompted.-To quit, enter . at a date prompt or press control-d or control-c.-Date [2015/05/22]: -Description: supermarket-Account 1: expenses:food-Amount 1: $10-Account 2: assets:checking-Amount 2 [$-10.0]: -Account 3 (or . or enter to finish this transaction): .-2015/05/22 supermarket- expenses:food $10- assets:checking $-10.0+- If you enter a number with no commodity symbol, and you have declared+ a default commodity with a D directive, you might expect add to add+ this symbol for you. It does not do this; we assume that if you are+ using a D directive you prefer not to see the commodity symbol+ repeated on amounts in the journal.+- add creates entries in journal format; it won't work with timeclock or+ timedot files.+- There is a known issue on Windows if this hledger version is built+ from stackage: the prompts will show ANSI junk instead of colours+ (#2410). You can avoid this by using official hledger release binaries+ or by building it with haskeline >=0.8.4; or by running add with+ --color=no, perhaps configured in your config file. -Save this transaction to the journal ? [y]: -Saved.-Starting the next transaction (. or ctrl-D/ctrl-C to quit)-Date [2015/05/22]: <CTRL-D> $+Examples:++- Record new transactions, saving to the default journal file:++ hledger add++- Add transactions to 2024.journal, but also load 2023.journal for+ completions:++ hledger add --file 2024.journal --file 2023.journal++- Provide answers for the first four prompts:++ hledger add today 'best buy' expenses:supplies '$20'++There is a detailed tutorial at https://hledger.org/add.html.++add and balance assertions++Since hledger 1.43, you can add a balance assertion by writing+AMOUNT = BALANCE when asked for an amount. Eg 100 = 500.++Also, each time you enter a new amount, hledger re-checks all balance+assertions in the journal and rejects the new amount if it would make+any of them fail. You can run add with -I/--ignore-assertions to disable+balance assertion checking.++add and balance assignments++Since hledger 1.51, you can add a balance assignment by writing+= BALANCE (or ==, =* etc) when asked for an amount. The missing amount+will be calculated automatically.++add normally won't let you add a new posting which is dated earlier than+an existing balance assignment. (Because when add runs, existing balance+assignments have already been calculated and converted to amounts and+balance assertions.) You can allow it by disabling balance assertion+checking with -I.
+ Hledger/Cli/Commands/Aregister.hs view
@@ -0,0 +1,300 @@+{-|++The @aregister@ command lists a single account's transactions,+like the account register in hledger-ui and hledger-web,+and unlike the register command which lists postings across multiple accounts.++-}++{-# LANGUAGE CPP #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Aregister (+ aregistermode+ ,aregister+ -- ,showPostingWithBalanceForVty+ ,tests_Aregister+) where++import Data.Default (def)+import Data.List (find, nub)+import Data.Maybe (fromMaybe)+import Data.Text (Text)+import Data.Foldable (for_)+import Data.Map qualified as Map+import Data.Text qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.Builder qualified as TB+import Control.Monad (when)+import Lucid qualified as L hiding (Html)+import Safe (readMay)+import System.Console.CmdArgs.Explicit (flagNone, flagReq)+import System.IO qualified as IO+import Text.Tabular.AsciiWide hiding (render)++import Hledger+import Hledger.Cli.CliOptions+import Hledger.Cli.Utils+import Hledger.Write.Csv (CSV, printCSV, printTSV)+import Hledger.Write.Html (formatRow, htmlAsLazyText, toHtml)+import Hledger.Write.Ods (printFods)+import Hledger.Write.Spreadsheet qualified as Spr++aregistermode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Aregister.txt")+ ([+ flagNone ["txn-dates"] (setboolopt "txn-dates") + "filter strictly by transaction date, not posting date. Warning: this can show a wrong running balance."+ ,flagNone ["no-elide"] (setboolopt "no-elide") "don't show only 2 commodities per amount"+ ,flagNone ["cumulative"] (setboolopt "cumulative")+ (accumprefix ++ "show running total from report start date")+ ,flagNone ["historical","H"] (setboolopt "historical")+ (accumprefix ++ "show historical running total/balance (includes postings before report start date) (default)")+ -- ,flagNone ["average","A"] (setboolopt "average")+ -- "show running average of posting amounts instead of total (implies --empty)"+ -- ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead"+ ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"+ ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts"+ ,flagReq ["heading"] (\s opts -> Right $ setopt "heading" s opts) "YN"+ "show heading row above table: yes (default) or no"+ ,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N"+ ("set output width (default: " +++#ifdef mingw32_HOST_OS+ show defaultWidth+#else+ "terminal width"+#endif+ ++ "). -wN,M sets description width as well."+ )+ ,flagNone ["align-all"] (setboolopt "align-all") "guarantee alignment across all lines (slower)"+ ,outputFormatFlag ["txt","html","csv","tsv","json"]+ ,outputFileFlag+ ])+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "ACCTPAT [QUERY]")+ where+ accumprefix = "accumulation mode: "++-- based on Hledger.UI.RegisterScreen:++-- | Print an account register report for a specified account.+aregister :: CliOpts -> Journal -> IO ()+aregister opts@CliOpts{rawopts_=rawopts,reportspec_=rspec} j = do+ -- the first argument specifies the account, any remaining arguments are a filter query+ let help = "aregister needs an ACCTPAT argument to select an account"+ (apat,querystr) <- case listofstringopt "args" rawopts of+ [] -> error' $ help <> ".\nPlease provide an account name or a (case-insensitive, infix, regexp) pattern."+ (a:as) -> return (a, map T.pack as)+ let+ -- keep synced with findMatchedByArgument's matching+ acct = fromMaybe (error' $ help <> ", but " ++ show apat++" did not match any account.") -- PARTIAL:+ . firstMatch $ journalAccountNamesDeclaredOrImplied j+ firstMatch = case toRegexCI $ T.pack apat of+ Right re -> find (regexMatchText re)+ Left _ -> const Nothing+ -- gather report options+ inclusive = True -- tree_ ropts+ thisacctq = Acct $ (if inclusive then accountNameToAccountRegex else accountNameToAccountOnlyRegex) acct+ ropts' = (_rsReportOpts rspec) {+ -- ignore any depth limit, as in postingsReport; allows register's total to match balance reports (cf #1468)+ depth_=DepthSpec Nothing []+ , balanceaccum_ =+ case balanceaccum_ $ _rsReportOpts rspec of+ PerPeriod -> Historical+ ba -> ba+ , querystring_ = querystr+ }+ wd = whichDate ropts'+ -- and regenerate the ReportSpec, making sure to use the above+ rspec' <- either fail return $ updateReportSpec ropts' rspec+ let+ -- run the report+ -- TODO: need to also pass the queries so we can choose which date to render - move them into the report ?+ items = accountTransactionsReport rspec' j thisacctq+ items' =+ styleAmounts (journalCommodityStylesWith HardRounding j) $+ (if empty_ ropts' then id else filter (not . mixedAmountLooksZero . fifth6)) $+ reverse items+ -- select renderer+ render | fmt=="txt" = accountTransactionsReportAsText opts (_rsQuery rspec') thisacctq+ | fmt=="html" = accountTransactionsReportAsHTML opts (_rsQuery rspec') thisacctq+ | fmt=="csv" = printCSV . accountTransactionsReportAsCsv opts hd wd (_rsQuery rspec') thisacctq+ | fmt=="tsv" = printTSV . accountTransactionsReportAsCsv opts hd wd (_rsQuery rspec') thisacctq+ | fmt=="fods" =+ printFods IO.localeEncoding . Map.singleton "Aregister" .+ (,) (1,0) .+ accountTransactionsReportAsSpreadsheet opts oneLineNoCostFmt hd wd (_rsQuery rspec') thisacctq+ | fmt=="json" = toJsonText+ | otherwise = error' $ unsupportedOutputFormatError fmt -- PARTIAL:+ where+ hd = headingopt opts+ fmt = outputFormatFromOpts opts++ writeOutputLazyText opts $ render items'++accountTransactionsReportAsCsv ::+ CliOpts -> Bool -> WhichDate -> Query -> Query -> AccountTransactionsReport -> CSV+accountTransactionsReportAsCsv opts hd wd reportq thisacctq =+ Spr.rawTableContent .+ accountTransactionsReportAsSpreadsheet opts machineFmt hd wd reportq thisacctq++accountTransactionsReportAsSpreadsheet ::+ CliOpts -> AmountFormat -> Bool ->+ WhichDate -> Query -> Query -> AccountTransactionsReport ->+ [[Spr.Cell Spr.NumLines Text]]+accountTransactionsReportAsSpreadsheet opts fmt hd wd reportq thisacctq is =+ optional hd+ [Spr.addHeaderBorders $ map Spr.headerCell $+ ["txnidx","date","code","description","otheraccounts","change","balance"]]+ +++ map (accountTransactionsReportItemAsRecord opts fmt True wd reportq thisacctq) is++accountTransactionsReportItemAsRecord ::+ CliOpts -> AmountFormat -> Bool ->+ WhichDate -> Query -> Query -> AccountTransactionsReportItem ->+ [Spr.Cell Spr.NumLines Text]+accountTransactionsReportItemAsRecord+ opts fmt internals wd reportq thisacctq+ (t@Transaction{tindex,tcode,tdescription}, _, _issplit, otheraccts, change, balance)+ = (optional internals [Spr.integerCell tindex]) +++ date :+ (optional internals [cell tcode]) +++ [cell tdescription,+ cell $ T.intercalate ", " $ map dropAcct $ nub otheraccts,+ amountCell change,+ amountCell balance]+ where+ dropAcct = accountNameDrop (fromMaybe 0 $ readMay =<< maybestringopt "drop" (rawopts_ opts))+ cell = Spr.defaultCell+ date =+ (Spr.defaultCell $ showDate $+ transactionRegisterDate wd reportq thisacctq t)+ {Spr.cellType = Spr.TypeDate}+ amountCell amt =+ wbToText <$> Spr.cellFromMixedAmount fmt (Spr.Class "amount", amt)++-- | Render a register report as a HTML snippet.+accountTransactionsReportAsHTML :: CliOpts -> Query -> Query -> AccountTransactionsReport -> TL.Text+accountTransactionsReportAsHTML copts reportq thisacctq items =+ htmlAsLazyText $ do+ L.link_ [L.rel_ "stylesheet", L.href_ "hledger.css"]+ L.table_ $ do+ when (headingopt copts) $ L.thead_ $ L.tr_ $ do+ L.th_ "date"+ L.th_ "description"+ L.th_ "otheraccounts"+ L.th_ "change"+ L.th_ "balance"+ L.tbody_ $ for_ items $+ formatRow . map (fmap toHtml) .+ accountTransactionsReportItemAsRecord copts+ oneLineNoCostFmt False+ (whichDate $ _rsReportOpts $ reportspec_ copts)+ reportq thisacctq++-- | Render a register report as plain text suitable for console output.+accountTransactionsReportAsText :: CliOpts -> Query -> Query -> AccountTransactionsReport -> TL.Text+accountTransactionsReportAsText copts reportq thisacctq items = TB.toLazyText $+ (optional (headingopt copts) $ title <> TB.singleton '\n')+ <>+ postingsOrTransactionsReportAsText alignAll copts itemAsText itemamt itembal items+ where+ alignAll = boolopt "align-all" $ rawopts_ copts+ itemAsText = accountTransactionsReportItemAsText copts reportq thisacctq+ itemamt (_,_,_,_,a,_) = a+ itembal (_,_,_,_,_,a) = a++ -- show a title indicating which account was picked, which can be confusing otherwise+ title = maybe mempty (\s -> foldMap TB.fromText ["Transactions in ", s, " and subaccounts", qmsg, ":"]) macct+ where+ -- XXX temporary hack ? recover the account name from the query+ macct = case filterQuery queryIsAcct thisacctq of+ Acct r -> Just . T.drop 1 . T.dropEnd 5 $ reString r -- Acct "^JS:expenses(:|$)"+ _ -> Nothing -- shouldn't happen+ -- show a hint in the title when results are restricted by an extra query (other than depth or date or date2)+ qmsg = if hasextraquery then " (matching query)" else ""+ where+ hasextraquery =+ length (querystring_ $ _rsReportOpts $ reportspec_ copts) > 1+ && not (queryIsNull $ filterQuery (not.(\q->queryIsDepth q || queryIsDateOrDate2 q)) reportq)++headingopt :: CliOpts -> Bool+headingopt = fromMaybe True . maybeynopt "heading" . rawopts_++optional :: (Monoid p) => Bool -> p -> p+optional b x = if b then x else mempty+++-- | Render one account register report line item as plain text. Layout is like so:+-- @+-- <---------------- width (specified, terminal width, or 80) -------------------->+-- date (10) description other accounts change (12) balance (12)+-- DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA+-- @+-- If description's width is specified, account will use the remaining space.+-- Otherwise, description and account divide up the space equally.+--+-- Returns a string which can be multi-line, eg if the running balance+-- has multiple commodities.+--+accountTransactionsReportItemAsText :: CliOpts -> Query -> Query -> Int -> Int+ -> (AccountTransactionsReportItem, [WideBuilder], [WideBuilder])+ -> TB.Builder+accountTransactionsReportItemAsText+ copts@CliOpts{reportspec_=ReportSpec{_rsReportOpts=ropts}}+ reportq thisacctq preferredamtwidth preferredbalwidth+ ((t@Transaction{tdescription}, _, _issplit, otheraccts, _, _), amt, bal) =+ -- Transaction -- the transaction, unmodified+ -- Transaction -- the transaction, as seen from the current account+ -- Bool -- is this a split (more than one posting to other accounts) ?+ -- [AccountName] -- the other account(s), if any+ -- MixedAmount -- the amount posted to the current account(s) (or total amount posted)+ -- MixedAmount -- the register's running total or the current account(s)'s historical balance, after this transaction+ table <> TB.singleton '\n'+ where+ dropAcct = accountNameDrop (fromMaybe 0 $ readMay =<< maybestringopt "drop" (rawopts_ copts))+ table = renderRowB def{tableBorders=False, borderSpaces=False} . Group NoLine $ map Header+ [ textCell TopLeft $ fitText (Just datewidth) (Just datewidth) True True date+ , spacerCell+ , textCell TopLeft $ fitText (Just descwidth) (Just descwidth) True True tdescription+ , spacerCell2+ , textCell TopLeft $ fitText (Just acctwidth) (Just acctwidth) True True accts+ , spacerCell2+ , Cell TopRight $ map (pad amtwidth) amt+ , spacerCell2+ , Cell BottomRight $ map (pad balwidth) bal+ ]+ spacerCell = Cell BottomLeft [WideBuilder (TB.singleton ' ') 1]+ spacerCell2 = Cell BottomLeft [WideBuilder (TB.fromString " ") 2]+ pad fullwidth amt1 = WideBuilder (TB.fromText $ T.replicate w " ") w <> amt1+ where w = fullwidth - wbWidth amt1+ -- calculate widths+ (totalwidth,mdescwidth) = registerWidthsFromOpts copts+ (datewidth, date) = (10, showDate $ transactionRegisterDate wd reportq thisacctq t)+ where wd = whichDate ropts+ (amtwidth, balwidth)+ | shortfall <= 0 = (preferredamtwidth, preferredbalwidth)+ | otherwise = (adjustedamtwidth, adjustedbalwidth)+ where+ mincolwidth = 2 -- columns always show at least an ellipsis+ maxamtswidth = max 0 (totalwidth - (datewidth + 1 + mincolwidth + 2 + mincolwidth + 2 + 2))+ shortfall = (preferredamtwidth + preferredbalwidth) - maxamtswidth+ amtwidthproportion = fromIntegral preferredamtwidth `divideSafe` fromIntegral (preferredamtwidth + preferredbalwidth)+ adjustedamtwidth = round $ amtwidthproportion * fromIntegral maxamtswidth+ adjustedbalwidth = maxamtswidth - adjustedamtwidth++ remaining = totalwidth - (datewidth + 1 + 2 + amtwidth + 2 + balwidth)+ (descwidth, acctwidth) = (w, remaining - 2 - w)+ where w = fromMaybe ((remaining - 2) `div` 2) mdescwidth++ accts = T.intercalate ", " . map (dropAcct . accountSummarisedName) $ nub otheraccts++-- tests++tests_Aregister = testGroup "Aregister" [++ ]
+ Hledger/Cli/Commands/Aregister.txt view
@@ -0,0 +1,105 @@+aregister++(areg)++Show the transactions and running balances in one account, with each+transaction on one line.++Flags:+ --txn-dates filter strictly by transaction date, not posting+ date. Warning: this can show a wrong running+ balance.+ --no-elide don't show only 2 commodities per amount+ --cumulative accumulation mode: show running total from report+ start date+ -H --historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date) (default)+ --invert display all amounts with reversed sign+ --drop=N omit N leading account name parts+ --heading=YN show heading row above table: yes (default) or no+ -w --width=N set output width (default: terminal width). -wN,M+ sets description width as well.+ --align-all guarantee alignment across all lines (slower)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++aregister shows the overall transactions affecting a particular account+(and any subaccounts). Each report line represents one transaction in+this account. Transactions before the report start date are included in+the running balance (--historical mode is the default). You can suppress+this behaviour using the --cumulative option.++This is a more "real world", bank-like view than the register command+(which shows individual postings, possibly from multiple accounts, not+necessarily in historical mode). As a quick rule of thumb:++- aregister is best when reconciling real-world asset/liability accounts+- register is best when reviewing individual revenues/expenses.++Note this command's non-standard, and required, first argument; it+specifies the account whose register will be shown. You can write the+account's name, or (to save typing) a case-insensitive infix regular+expression matching the name, which selects the alphabetically first+matched account. (For example, if you have assets:personal checking and+assets:business checking, hledger areg checking would select+assets:business checking.)++Transactions involving subaccounts of this account will also be shown.+aregister ignores depth limits, so its final total will always match a+historical balance report with similar arguments.++Any additional arguments are standard query arguments, which will limit+the transactions shown. Note some queries will disturb the running+balance, 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":++$ hledger areg checking date:jul++Each aregister line item shows:++- the transaction's date (or the relevant posting's date if different,+ see below)+- the names of all the other account(s) involved in this transaction+ (probably abbreviated)+- the total change to this account's balance from this transaction+- the account's historical running balance after this transaction.++Transactions making a net change of zero are not shown by default; add+the -E/--empty flag to show them.++For performance reasons, column widths are chosen based on the first+1000 lines; this means unusually wide values in later lines can cause+visual discontinuities as column widths are adjusted. If you want to+ensure perfect alignment, at the cost of more time and memory, use the+--align-all flag.++By default, aregister shows a heading above the data. However, when+reporting in a language different from English, it is easier to omit+this heading and prepend your own one. For this purpose, use the+--heading=no option.++This command also supports the output destination and output format+options. The output formats supported are txt, csv, tsv (Added in 1.32),+html, fods (Added in 1.41) and json.++aregister and posting dates++aregister always shows one line (and date and amount) per transaction.+But sometimes transactions have postings with different dates. Also, not+all of a transaction's postings may be within the report period. To+resolve this, aregister shows the earliest of the transaction's date and+posting dates that is in-period, and the sum of the in-period postings.+In other words it will show a combined line item with just the earliest+date, and the running balance will (temporarily, until the transaction's+last posting) be inaccurate. Use register -H if you need to see the+individual postings.++There is also a --txn-dates flag, which filters strictly by transaction+date, ignoring posting dates. This too can cause an inaccurate running+balance.
Hledger/Cli/Commands/Balance.hs view
@@ -122,531 +122,1125 @@ hledger's balance command will show multiple columns when a reporting interval is specified (eg with @--monthly@), one column for each sub-period. -There are three kinds of multi-column balance report, indicated by the heading:--* A \"period balance\" (or \"flow\") report (the default) shows the change of account- balance in each period, which is equivalent to the sum of postings in each- period. Here, checking's balance increased by 10 in Feb:-- > Change of balance (flow):- >- > Jan Feb Mar- > assets:checking 20 10 -5--* A \"cumulative balance\" report (with @--cumulative@) shows the accumulated ending balance- across periods, starting from zero at the report's start date.- Here, 30 is the sum of checking postings during Jan and Feb:-- > Ending balance (cumulative):- >- > Jan Feb Mar- > assets:checking 20 30 25--* A \"historical balance\" report (with @--historical/-H@) also shows ending balances,- but it includes the starting balance from any postings before the report start date.- Here, 130 is the balance from all checking postings at the end of Feb, including- pre-Jan postings which created a starting balance of 100:-- > Ending balance (historical):- >- > Jan Feb Mar- > assets:checking 120 130 125--/Eliding and omitting, 2/--Here's a (imperfect?) specification for the eliding/omitting behaviour:--* Each account is normally displayed on its own line.--* An account less deep than the report's max depth, with just one-interesting subaccount, and the same balance as the subaccount, is-non-interesting, and prefixed to the subaccount's line, unless-@--no-elide@ is in effect.--* An account with a zero inclusive balance and less than two interesting-subaccounts is not displayed at all, unless @--empty@ is in effect.--* Multi-column balance reports show full account names with no eliding- (like @--flat@). Accounts (and periods) are omitted as described below.--/Which accounts to show in balance reports/--By default:--* single-column: accounts with non-zero balance in report period.- (With @--flat@: accounts with non-zero balance and postings.)--* periodic: accounts with postings and non-zero period balance in any period--* cumulative: accounts with non-zero cumulative balance in any period--* historical: accounts with non-zero historical balance in any period--With @-E/--empty@:--* single-column: accounts with postings in report period--* periodic: accounts with postings in report period--* cumulative: accounts with postings in report period--* historical: accounts with non-zero starting balance +- accounts with postings in report period--/Which periods (columns) to show in balance reports/--An empty period/column is one where no report account has any postings.-A zero period/column is one where no report account has a non-zero period balance.--Currently,--by default:--* single-column: N/A--* periodic: all periods within the overall report period,- except for leading and trailing empty periods--* cumulative: all periods within the overall report period,- except for leading and trailing empty periods--* historical: all periods within the overall report period,- except for leading and trailing empty periods--With @-E/--empty@:--* single-column: N/A--* periodic: all periods within the overall report period--* cumulative: all periods within the overall report period--* historical: all periods within the overall report period--/What to show in empty cells/--An empty periodic balance report cell is one which has no corresponding postings.-An empty cumulative/historical balance report cell is one which has no correponding-or prior postings, ie the account doesn't exist yet.-Currently, empty cells show 0.---}--{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE ExtendedDefaultRules #-}-{-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TemplateHaskell #-}-{-# LANGUAGE NamedFieldPuns #-}--module Hledger.Cli.Commands.Balance (- balancemode- ,balance- ,balanceReportAsText- ,balanceReportItemAsText- ,multiBalanceReportAsText- ,multiBalanceReportAsCsv- ,multiBalanceReportAsHtml- ,multiBalanceReportHtmlRows- ,balanceReportAsTable- ,balanceReportTableAsText- ,tests_Balance-) where--import Data.List-import Data.Maybe---import qualified Data.Map as Map-import qualified Data.Text as T-import qualified Data.Text.Lazy as TL-import System.Console.CmdArgs.Explicit as C-import Lucid as L-import Text.Printf (printf)-import Text.Tabular as T---import Text.Tabular.AsciiWide--import Hledger-import Hledger.Cli.CliOptions-import Hledger.Cli.Utils-import Hledger.Read.CsvReader (CSV, printCSV)----- | Command line options for this command.-balancemode = hledgerCommandMode- $(embedFileRelative "Hledger/Cli/Commands/Balance.txt")- ([flagNone ["change"] (setboolopt "change")- "show balance change in each period (default)"- ,flagNone ["cumulative"] (setboolopt "cumulative")- "show balance change accumulated across periods (in multicolumn reports)"- ,flagNone ["historical","H"] (setboolopt "historical")- "show historical ending balance in each period (includes postings before report start date)\n "- ,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"- ,flagNone ["flat"] (setboolopt "flat") "show accounts as a list; amounts exclude subaccounts except when account is depth-clipped (default in multicolumn reports)\n "- ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"- ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"- ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts (in flat mode)"- ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"- ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"- ,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode to display prettier tables"- ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."- ,flagNone ["budget"] (setboolopt "budget") "show performance compared to budget goals defined by periodic transactions"- ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"- ,flagNone ["transpose"] (setboolopt "transpose") "transpose rows and columns"- ]- ++ outputflags- )- [generalflagsgroup1]- []- ([], Just $ argsFlag "[QUERY]")---- | The balance command, prints a balance report.-balance :: CliOpts -> Journal -> IO ()-balance opts@CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do- d <- getCurrentDay- case lineFormatFromOpts ropts of- Left err -> error' $ unlines [err]- Right _ -> do- let format = outputFormatFromOpts opts- budget = boolopt "budget" rawopts- interval = interval_ ropts- case (budget, interval) of- (True, _) -> do- -- single or multicolumn budget report- reportspan <- reportSpan j ropts- let budgetreport = dbg1 "budgetreport" $ budgetReport ropts assrt reportspan d j- where- assrt = not $ ignore_assertions_ $ inputopts_ opts- render = case format of- "csv" -> const $ error' "Sorry, CSV output is not yet implemented for this kind of report." -- TODO- "html" -> const $ error' "Sorry, HTML output is not yet implemented for this kind of report." -- TODO- _ -> budgetReportAsText ropts- writeOutput opts $ render budgetreport- - (False, NoInterval) -> do- -- single column balance report- let report- | balancetype_ ropts `elem` [HistoricalBalance, CumulativeChange]- = let ropts' | flat_ ropts = ropts- | otherwise = ropts{accountlistmode_=ALTree}- in balanceReportFromMultiBalanceReport ropts' (queryFromOpts d ropts) j- -- for historical balances we must use balanceReportFromMultiBalanceReport (also forces --no-elide)- | otherwise = balanceReport ropts (queryFromOpts d ropts) j -- simple Ledger-style balance report - render = case format of- "csv" -> \ropts r -> (++ "\n") $ printCSV $ balanceReportAsCsv ropts r- "html" -> \_ _ -> error' "Sorry, HTML output is not yet implemented for this kind of report." -- TODO- _ -> balanceReportAsText- writeOutput opts $ render ropts report- - _ -> do- -- multi column balance report- let report = multiBalanceReport ropts (queryFromOpts d ropts) j- render = case format of- "csv" -> (++ "\n") . printCSV . multiBalanceReportAsCsv ropts- "html" -> (++ "\n") . TL.unpack . L.renderText . multiBalanceReportAsHtml ropts- _ -> multiBalanceReportAsText ropts- writeOutput opts $ render report---- rendering single-column balance reports---- | Find the best commodity to convert to when asked to show the--- market value of this commodity on the given date. That is, the one--- in which it has most recently been market-priced, ie the commodity--- mentioned in the most recent applicable historical price directive--- before this date.--- defaultValuationCommodity :: Journal -> Day -> CommoditySymbol -> Maybe CommoditySymbol--- defaultValuationCommodity j d c = mpamount <$> commodityValue j d c---- | Render a single-column balance report as CSV.-balanceReportAsCsv :: ReportOpts -> BalanceReport -> CSV-balanceReportAsCsv opts (items, total) =- ["account","balance"] :- [[T.unpack (maybeAccountNameDrop opts a), showMixedAmountOneLineWithoutPrice b] | (a, _, _, b) <- items]- ++- if no_total_ opts- then []- else [["total", showMixedAmountOneLineWithoutPrice total]]---- | Render a single-column balance report as plain text.-balanceReportAsText :: ReportOpts -> BalanceReport -> String-balanceReportAsText opts ((items, total)) = unlines $ concat lines ++ t- where- fmt = lineFormatFromOpts opts- lines = case fmt of- Right fmt -> map (balanceReportItemAsText opts fmt) items- Left err -> [[err]]- t = if no_total_ opts- then []- else- case fmt of- Right fmt ->- let- -- abuse renderBalanceReportItem to render the total with similar format- acctcolwidth = maximum' [T.length fullname | (fullname, _, _, _) <- items]- totallines = map rstrip $ renderBalanceReportItem opts fmt (T.replicate (acctcolwidth+1) " ", 0, total)- -- with a custom format, extend the line to the full report width;- -- otherwise show the usual 20-char line for compatibility- overlinewidth | isJust (format_ opts) = maximum' $ map length $ concat lines- | otherwise = defaultTotalFieldWidth- overline = replicate overlinewidth '-'- in overline : totallines- Left _ -> []--{--:r-This implementation turned out to be a bit convoluted but implements the following algorithm for formatting:--- If there is a single amount, print it with the account name directly:-- Otherwise, only print the account name on the last line.-- a USD 1 ; Account 'a' has a single amount- EUR -1- b USD -1 ; Account 'b' has two amounts. The account name is printed on the last line.--}--- | Render one balance report line item as plain text suitable for console output (or--- whatever string format is specified). Note, prices will not be rendered, and--- differently-priced quantities of the same commodity will appear merged.--- The output will be one or more lines depending on the format and number of commodities.-balanceReportItemAsText :: ReportOpts -> StringFormat -> BalanceReportItem -> [String]-balanceReportItemAsText opts fmt (_, accountName, depth, amt) =- renderBalanceReportItem opts fmt (- maybeAccountNameDrop opts accountName,- depth,- normaliseMixedAmountSquashPricesForDisplay amt- )---- | Render a balance report item using the given StringFormat, generating one or more lines of text.-renderBalanceReportItem :: ReportOpts -> StringFormat -> (AccountName, Int, MixedAmount) -> [String]-renderBalanceReportItem opts fmt (acctname, depth, total) =- lines $- case fmt of- OneLine comps -> concatOneLine $ render1 comps- TopAligned comps -> concatBottomPadded $ render comps- BottomAligned comps -> concatTopPadded $ render comps- where- render1 = map (renderComponent1 opts (acctname, depth, total))- render = map (renderComponent opts (acctname, depth, total))--defaultTotalFieldWidth = 20---- | Render one StringFormat component for a balance report item.-renderComponent :: ReportOpts -> (AccountName, Int, MixedAmount) -> StringFormatComponent -> String-renderComponent _ _ (FormatLiteral s) = s-renderComponent opts (acctname, depth, total) (FormatField ljust min max field) = case field of- DepthSpacerField -> formatString ljust Nothing max $ replicate d ' '- where d = case min of- Just m -> depth * m- Nothing -> depth- AccountField -> formatString ljust min max (T.unpack acctname)- TotalField -> fitStringMulti min max True False $ showamt total- where- showamt | color_ opts = cshowMixedAmountWithoutPrice- | otherwise = showMixedAmountWithoutPrice- _ -> ""---- | Render one StringFormat component for a balance report item.--- This variant is for use with OneLine string formats; it squashes--- any multi-line rendered values onto one line, comma-and-space separated,--- while still complying with the width spec.-renderComponent1 :: ReportOpts -> (AccountName, Int, MixedAmount) -> StringFormatComponent -> String-renderComponent1 _ _ (FormatLiteral s) = s-renderComponent1 opts (acctname, depth, total) (FormatField ljust min max field) = case field of- AccountField -> formatString ljust min max ((intercalate ", " . lines) (indented (T.unpack acctname)))- where- -- better to indent the account name here rather than use a DepthField component- -- so that it complies with width spec. Uses a fixed indent step size.- indented = ((replicate (depth*2) ' ')++)- TotalField -> fitStringMulti min max True False $ ((intercalate ", " . map strip . lines) (showamt total))- where- showamt | color_ opts = cshowMixedAmountWithoutPrice- | otherwise = showMixedAmountWithoutPrice- _ -> ""---- rendering multi-column balance reports---- | Render a multi-column balance report as CSV.--- The CSV will always include the initial headings row,--- and will include the final totals row unless --no-total is set.-multiBalanceReportAsCsv :: ReportOpts -> MultiBalanceReport -> CSV-multiBalanceReportAsCsv opts@ReportOpts{average_, row_total_} (MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =- maybetranspose $ - ("Account" : map showDateSpan colspans- ++ ["Total" | row_total_]- ++ ["Average" | average_]- ) :- [T.unpack (maybeAccountNameDrop opts a) :- map showMixedAmountOneLineWithoutPrice- (amts- ++ [rowtot | row_total_]- ++ [rowavg | average_])- | (a, _, _, amts, rowtot, rowavg) <- items]- ++- if no_total_ opts- then []- else ["Total:" :- map showMixedAmountOneLineWithoutPrice (- coltotals- ++ [tot | row_total_]- ++ [avg | average_]- )]- where- maybetranspose | transpose_ opts = transpose- | otherwise = id- --- | Render a multi-column balance report as HTML.-multiBalanceReportAsHtml :: ReportOpts -> MultiBalanceReport -> Html ()-multiBalanceReportAsHtml ropts mbr =- let- (headingsrow,bodyrows,mtotalsrow) = multiBalanceReportHtmlRows ropts mbr- in- table_ $ mconcat $- [headingsrow]- ++ bodyrows- ++ maybeToList mtotalsrow---- | Render the HTML table rows for a MultiBalanceReport.--- Returns the heading row, 0 or more body rows, and the totals row if enabled.-multiBalanceReportHtmlRows :: ReportOpts -> MultiBalanceReport -> (Html (), [Html ()], Maybe (Html ()))-multiBalanceReportHtmlRows ropts mbr =- let- headingsrow:rest | transpose_ ropts = error' "Sorry, --transpose is not supported with HTML output yet"- | otherwise = multiBalanceReportAsCsv ropts mbr- (bodyrows, mtotalsrow) | no_total_ ropts = (rest, Nothing)- | otherwise = (init rest, Just $ last rest)- in- (multiBalanceReportHtmlHeadRow ropts headingsrow- ,map (multiBalanceReportHtmlBodyRow ropts) bodyrows- ,multiBalanceReportHtmlFootRow ropts <$> mtotalsrow -- TODO pad totals row with zeros when there are - )---- | Render one MultiBalanceReport heading row as a HTML table row.-multiBalanceReportHtmlHeadRow :: ReportOpts -> [String] -> Html ()-multiBalanceReportHtmlHeadRow _ [] = mempty -- shouldn't happen-multiBalanceReportHtmlHeadRow ropts (acct:rest) =- let- defstyle = style_ ""- (amts,tot,avg)- | row_total_ ropts && average_ ropts = (init $ init rest, [last $ init rest], [last rest])- | row_total_ ropts = (init rest, [last rest], [])- | average_ ropts = (init rest, [], [last rest])- | otherwise = (rest, [], [])- in- tr_ $ mconcat $- td_ [class_ "account"] (toHtml acct)- : [td_ [class_ "", defstyle] (toHtml a) | a <- amts]- ++ [td_ [class_ "rowtotal", defstyle] (toHtml a) | a <- tot]- ++ [td_ [class_ "rowaverage", defstyle] (toHtml a) | a <- avg]---- | Render one MultiBalanceReport data row as a HTML table row.-multiBalanceReportHtmlBodyRow :: ReportOpts -> [String] -> Html ()-multiBalanceReportHtmlBodyRow _ [] = mempty -- shouldn't happen-multiBalanceReportHtmlBodyRow ropts (label:rest) =- let- defstyle = style_ "text-align:right"- (amts,tot,avg)- | row_total_ ropts && average_ ropts = (init $ init rest, [last $ init rest], [last rest])- | row_total_ ropts = (init rest, [last rest], [])- | average_ ropts = (init rest, [], [last rest])- | otherwise = (rest, [], [])- in- tr_ $ mconcat $- td_ [class_ "account", style_ "text-align:left"] (toHtml label)- : [td_ [class_ "amount", defstyle] (toHtml a) | a <- amts]- ++ [td_ [class_ "amount rowtotal", defstyle] (toHtml a) | a <- tot]- ++ [td_ [class_ "amount rowaverage", defstyle] (toHtml a) | a <- avg]---- | Render one MultiBalanceReport totals row as a HTML table row.-multiBalanceReportHtmlFootRow :: ReportOpts -> [String] -> Html ()-multiBalanceReportHtmlFootRow _ropts [] = mempty--- TODO pad totals row with zeros when subreport is empty--- multiBalanceReportHtmlFootRow ropts $ --- "" --- : repeat nullmixedamt zeros--- ++ (if row_total_ ropts then [nullmixedamt] else [])--- ++ (if average_ ropts then [nullmixedamt] else [])-multiBalanceReportHtmlFootRow ropts (acct:rest) =- let- defstyle = style_ "text-align:right"- (amts,tot,avg)- | row_total_ ropts && average_ ropts = (init $ init rest, [last $ init rest], [last rest])- | row_total_ ropts = (init rest, [last rest], [])- | average_ ropts = (init rest, [], [last rest])- | otherwise = (rest, [], [])- in- tr_ $ mconcat $- th_ [style_ "text-align:left"] (toHtml acct)- : [th_ [class_ "amount coltotal", defstyle] (toHtml a) | a <- amts]- ++ [th_ [class_ "amount coltotal", defstyle] (toHtml a) | a <- tot]- ++ [th_ [class_ "amount colaverage", defstyle] (toHtml a) | a <- avg]----thRow :: [String] -> Html ()---thRow = tr_ . mconcat . map (th_ . toHtml)---- | Render a multi-column balance report as plain text suitable for console output.-multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> String-multiBalanceReportAsText opts r =- printf "%s in %s:\n\n" desc (showDateSpan $ multiBalanceReportSpan r)- ++ balanceReportTableAsText opts tabl- where- tabl = balanceReportAsTable opts r- desc = case balancetype_ opts of- PeriodChange -> "Balance changes"- CumulativeChange -> "Ending balances (cumulative)"- HistoricalBalance -> "Ending balances (historical)"---- | Build a 'Table' from a multi-column balance report.-balanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table String String MixedAmount-balanceReportAsTable opts@ReportOpts{average_, row_total_} (MultiBalanceReport (colspans, items, (coltotals,tot,avg))) =- maybetranspose $- addtotalrow $ - Table- (T.Group NoLine $ map Header accts)- (T.Group NoLine $ map Header colheadings)- (map rowvals items)- where- mkDate = case balancetype_ opts of- PeriodChange -> showDateSpanMonthAbbrev- _ -> maybe "" (showDate . prevday) . spanEnd- colheadings = map mkDate colspans- ++ [" Total" | row_total_]- ++ ["Average" | average_]- accts = map renderacct items- renderacct (a,a',i,_,_,_)- | tree_ opts = replicate ((i-1)*2) ' ' ++ T.unpack a'- | otherwise = T.unpack $ maybeAccountNameDrop opts a- rowvals (_,_,_,as,rowtot,rowavg) = as- ++ [rowtot | row_total_]- ++ [rowavg | average_]- addtotalrow | no_total_ opts = id- | otherwise = (+----+ (row "" $- coltotals- ++ [tot | row_total_ && not (null coltotals)]- ++ [avg | average_ && not (null coltotals)]- ))- maybetranspose | transpose_ opts = \(Table rh ch vals) -> Table ch rh (transpose vals)- | otherwise = id- --- | Given a table representing a multi-column balance report (for example,--- made using 'balanceReportAsTable'), render it in a format suitable for--- console output.-balanceReportTableAsText :: ReportOpts -> Table String String MixedAmount -> String-balanceReportTableAsText ropts = tableAsText ropts showamt- where- showamt | color_ ropts = cshowMixedAmountOneLineWithoutPrice- | otherwise = showMixedAmountOneLineWithoutPrice---tests_Balance = tests "Balance" [-- tests "balanceReportAsText" [- test "unicode in balance layout" $ do- j <- io $ readJournal' "2009/01/01 * медвежья шкура\n расходы:покупки 100\n актив:наличные\n"- let opts = defreportopts- balanceReportAsText opts (balanceReport opts (queryFromOpts (parsedate "2008/11/26") opts) j) `is`- unlines- [" -100 актив:наличные"- ," 100 расходы:покупки"- ,"--------------------"- ," 0"- ]- ]-- ]+There are three accumulation strategies for multi-column balance report, indicated by+the heading:++* A \"period balance\" (or \"flow\") report (with @--change@, the default) shows the+ change of account balance in each period, which is equivalent to the sum of postings+ in each period. Here, checking's balance increased by 10 in Feb:++ > Change of balance (flow):+ >+ > Jan Feb Mar+ > assets:checking 20 10 -5++* A \"cumulative balance\" report (with @--cumulative@) shows the accumulated ending balance+ across periods, starting from zero at the report's start date.+ Here, 30 is the sum of checking postings during Jan and Feb:++ > Ending balance (cumulative):+ >+ > Jan Feb Mar+ > assets:checking 20 30 25++* A \"historical balance\" report (with @--historical/-H@) also shows ending balances,+ but it includes the starting balance from any postings before the report start date.+ Here, 130 is the balance from all checking postings at the end of Feb, including+ pre-Jan postings which created a starting balance of 100:++ > Ending balance (historical):+ >+ > Jan Feb Mar+ > assets:checking 120 130 125++/Eliding and omitting, 2/++Here's a (imperfect?) specification for the eliding/omitting behaviour:++* Each account is normally displayed on its own line.++* An account less deep than the report's max depth, with just one+interesting subaccount, and the same balance as the subaccount, is+non-interesting, and prefixed to the subaccount's line, unless+@--no-elide@ is in effect.++* An account with a zero inclusive balance and less than two interesting+subaccounts is not displayed at all, unless @--empty@ is in effect.++* Multi-column balance reports show full account names with no eliding+ (like @--flat@). Accounts (and periods) are omitted as described below.++/Which accounts to show in balance reports/++By default:++* single-column: accounts with non-zero balance in report period.+ (With @--flat@: accounts with non-zero balance and postings.)++* change: accounts with postings and non-zero period balance in any period++* cumulative: accounts with non-zero cumulative balance in any period++* historical: accounts with non-zero historical balance in any period++With @-E/--empty@:++* single-column: accounts with postings in report period++* change: accounts with postings in report period++* cumulative: accounts with postings in report period++* historical: accounts with non-zero starting balance ++ accounts with postings in report period++/Which periods (columns) to show in balance reports/++An empty period/column is one where no report account has any postings.+A zero period/column is one where no report account has a non-zero period balance.++Currently,++by default:++* single-column: N/A++* change: all periods within the overall report period,+ except for leading and trailing empty periods++* cumulative: all periods within the overall report period,+ except for leading and trailing empty periods++* historical: all periods within the overall report period,+ except for leading and trailing empty periods++With @-E/--empty@:++* single-column: N/A++* change: all periods within the overall report period++* cumulative: all periods within the overall report period++* historical: all periods within the overall report period++/What to show in empty cells/++An empty periodic balance report cell is one which has no corresponding postings.+An empty cumulative/historical balance report cell is one which has no corresponding+or prior postings, ie the account doesn't exist yet.+Currently, empty cells show 0.++-}++{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Balance (+ -- ** balance command+ balancemode+ ,balance+ -- ** balance output rendering+ ,balanceReportAsText+ ,balanceReportAsCsv+ ,balanceReportAsSpreadsheet+ ,balanceReportItemAsText+ ,budgetReportAsText+ ,budgetReportAsCsv+ ,budgetReportAsSpreadsheet+ ,multiBalanceRowAsCellBuilders+ ,multiBalanceRowAsCsvText+ ,multiBalanceRowAsText+ ,multiBalanceReportAsText+ ,multiBalanceReportAsCsv+ ,multiBalanceReportAsHtml+ ,multiBalanceReportAsTable+ ,multiBalanceReportTableAsText+ ,multiBalanceReportAsSpreadsheet+ ,multiBalanceReportAsSpreadsheetParts+ ,multiBalanceHasTotalsColumn+ ,addTotalBorders+ ,simpleDateSpanCell+ ,tidyColumnLabels+ ,nbsp+ ,RowClass(..)+ -- ** Tests+ ,tests_Balance+) where++import Control.Arrow (second, (***))+import Control.Monad (guard)+import Data.Decimal (roundTo)+import Data.Default (def)+import Data.Function (on)+import Data.List (find, transpose)+#if !MIN_VERSION_base(4,20,0)+import Data.List (foldl')+#endif+import Data.Map qualified as Map+import Data.Set qualified as S+import Data.Maybe (mapMaybe, fromMaybe)+import Data.Tuple (swap)+import Data.Text (Text)+import Data.Text qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.Builder qualified as TB+import Data.Time (addDays, fromGregorian)+import System.Console.CmdArgs.Explicit as C (flagNone, flagReq, flagOpt)+import Safe (headMay, maximumMay)+import Text.Tabular.AsciiWide+ (Header(..), Align(..), Properties(..), Cell(..), Table(..), TableOpts(..),+ cellWidth, concatTables, renderColumns, renderRowB, renderTableByRowsB, textCell)++import System.IO qualified as IO++import Hledger+import Hledger.Cli.CliOptions+import Hledger.Cli.Utils+import Hledger.Cli.Anchor (setAccountAnchor, dateSpanCell, headerDateSpanCell)+import Hledger.Write.Csv (CSV, printCSV, printTSV)+import Hledger.Write.Ods (printFods)+import Hledger.Write.Html (Html, styledTableHtml, htmlAsLazyText, toHtml)+import Hledger.Write.Spreadsheet (rawTableContent, headerCell,+ addHeaderBorders, addRowSpanHeader,+ cellFromMixedAmount, cellsFromMixedAmount)+import Hledger.Write.Spreadsheet qualified as Ods+++-- | Command line options for this command.+balancemode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Balance.txt")+ (+ -- https://hledger.org/dev/hledger.html#calculation-mode :+ [flagNone ["sum"] (setboolopt "sum")+ (calcprefix ++ "show sum of posting amounts (default)")+ ,flagNone ["valuechange"] (setboolopt "valuechange")+ (calcprefix ++ "show total change of value of period-end historical balances (caused by deposits, withdrawals, market price fluctuations)")+ ,flagNone ["gain"] (setboolopt "gain")+ (calcprefix ++ "show unrealised capital gain/loss (historical balance value minus cost basis)")+ -- XXX --budget[=DESCPAT], --forecast[=PERIODEXP], could be more consistent+ ,flagOpt "" ["budget"] (\s opts -> Right $ setopt "budget" s opts) "DESCPAT"+ (unlines+ [ calcprefix ++ "show sum of posting amounts together with budget goals defined by periodic"+ , "transactions. With a DESCPAT argument (must be separated by = not space),"+ , "use only periodic transactions with matching description"+ , "(case insensitive substring match)."+ ])+ ,flagNone ["count"] (setboolopt "count")+ (calcprefix ++ "show the count of postings")++ -- https://hledger.org/dev/hledger.html#accumulation-mode :+ ,flagNone ["change"] (setboolopt "change")+ (accumprefix ++ "accumulate amounts from column start to column end (in multicolumn reports, default)")+ ,flagNone ["cumulative"] (setboolopt "cumulative")+ (accumprefix ++ "accumulate amounts from report start (specified by e.g. -b/--begin) to column end")+ ,flagNone ["historical","H"] (setboolopt "historical")+ (accumprefix ++ "accumulate amounts from journal start to column end (includes postings before report start date)")+ ]++ -- other options specific to this command:+ ++ flattreeflags True +++ [flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "in list mode, omit N leading account name parts"+ ,flagNone ["declared"] (setboolopt "declared") "include non-parent declared accounts (best used with -E)"+ ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)"+ ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"+ ,flagNone ["summary-only"] (setboolopt "summary-only") "display only row summaries (e.g. row total, average) (in multicolumn reports)"+ ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"+ ,flagNone ["no-elide"] (setboolopt "no-elide") "in tree mode, don't squash boring parent accounts"+ ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"+ ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name (in flat mode). With multiple columns, sorts by the row total, or by row average if that is displayed."+ ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"+ ,flagNone ["related","r"] (setboolopt "related") "show the other accounts transacted with, instead"+ ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"+ ,flagNone ["transpose"] (setboolopt "transpose") "switch rows and columns (use vertical time axis)"+ ,flagReq ["layout"] (\s opts -> Right $ setopt "layout" s opts) "ARG"+ (unlines+ ["how to lay out multi-commodity amounts and the overall table:"+ ,"'wide[,W]': commodities on same line, up to W wide"+ ,"'tall' : commodities on separate lines"+ ,"'bare' : commodity symbols in a separate column"+ ,"'tidy' : each data field in its own column"+ ])+ ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX" "in html output, generate links to hledger-web, with this prefix. (Usually the base url shown by hledger-web; can also be relative.)"++ -- output:+ ,outputFormatFlag ["txt","html","csv","tsv","json","fods"]+ ,outputFileFlag++ ]+ )+ cligeneralflagsgroups1+ (hiddenflags +++ [ flagNone ["commodity-column"] (setboolopt "commodity-column")+ "show commodity symbols in a separate column, amounts as bare numbers, one row per commodity"+ ])+ ([], Just $ argsFlag "[QUERY]")++ where+ calcprefix = "calculation mode: "+ accumprefix = "accumulation mode: "++-- | The balance command, prints a balance report.+balance :: CliOpts -> Journal -> IO ()+balance opts@CliOpts{reportspec_=rspec} j = case balancecalc_ ropts of+ CalcBudget -> do -- single or multi period budget report+ let rspan = fst $ reportSpan j rspec+ budgetreport = styleAmounts styles $ budgetReport rspec (balancingopts_ $ inputopts_ opts) rspan j+ render = case fmt of+ "txt" -> budgetReportAsText ropts+ "json" -> (<>"\n") . toJsonText+ "csv" -> printCSV . budgetReportAsCsv ropts+ "tsv" -> printTSV . budgetReportAsCsv ropts+ "html" -> (<>"\n") . htmlAsLazyText .+ styledTableHtml . map (map (fmap toHtml)) . budgetReportAsSpreadsheet oneLineNoCostFmt ropts+ "fods" -> printFods IO.localeEncoding .+ Map.singleton "Budget Report" . (,) (1,0) . budgetReportAsSpreadsheet oneLineNoCostFmt ropts+ _ -> error' $ unsupportedOutputFormatError fmt+ writeOutputLazyText opts $ render budgetreport++ _ | multiperiod -> do -- multi period balance report+ let report = styleAmounts styles $ multiBalanceReport rspec j+ render = case fmt of+ "txt" -> multiBalanceReportAsText ropts+ "csv" -> printCSV . multiBalanceReportAsCsv ropts+ "tsv" -> printTSV . multiBalanceReportAsCsv ropts+ "html" -> (<>"\n") . htmlAsLazyText . multiBalanceReportAsHtml ropts+ "json" -> (<>"\n") . toJsonText+ "fods" -> printFods IO.localeEncoding .+ Map.singleton "Multi-period Balance Report" . multiBalanceReportAsSpreadsheet ropts+ _ -> const $ error' $ unsupportedOutputFormatError fmt -- PARTIAL:+ writeOutputLazyText opts $ render report++ _ -> do -- single period simple balance report+ let report = styleAmounts styles $ balanceReport rspec j -- simple Ledger-style balance report+ render = case fmt of+ "txt" -> TB.toLazyText . balanceReportAsText ropts+ "csv" -> printCSV . balanceReportAsCsv ropts+ "tsv" -> printTSV . balanceReportAsCsv ropts+ "html" -> (<>"\n") . htmlAsLazyText .+ styledTableHtml . map (map (fmap toHtml)) . balanceReportAsSpreadsheet ropts+ "json" -> (<>"\n") . toJsonText+ "fods" -> printFods IO.localeEncoding . Map.singleton "Balance Report" . (,) (1,0) . balanceReportAsSpreadsheet ropts+ _ -> error' $ unsupportedOutputFormatError fmt -- PARTIAL:+ writeOutputLazyText opts $ render report+ where+ styles = journalCommodityStylesWith HardRounding j+ ropts =+ let ropts0 = _rsReportOpts rspec in+ ropts0 {+ -- tidy csv is defined externally and must not include totals or averages+ no_total_ = no_total_ ropts0 || layout_ ropts0 == LayoutTidy+ }+ -- Tidy csv/tsv should be consistent between single period and multiperiod reports.+ multiperiod = interval_ ropts /= NoInterval || (layout_ ropts == LayoutTidy && delimited)+ delimited = fmt == "csv" || fmt == "tsv"+ fmt = outputFormatFromOpts opts++-- Rendering++data RowClass = Value | Total+ deriving (Eq, Ord, Enum, Bounded, Show)++amountClass :: RowClass -> Ods.Class+amountClass rc =+ Ods.Class $+ case rc of Value -> "amount"; Total -> "amount coltotal"++budgetClass :: RowClass -> Ods.Class+budgetClass rc =+ Ods.Class $+ case rc of Value -> "budget"; Total -> "budget coltotal"++rowTotalClass :: RowClass -> Ods.Class+rowTotalClass rc =+ Ods.Class $+ case rc of Value -> "amount rowtotal"; Total -> "amount coltotal"++rowAverageClass :: RowClass -> Ods.Class+rowAverageClass rc =+ Ods.Class $+ case rc of Value -> "amount rowaverage"; Total -> "amount colaverage"++budgetTotalClass :: RowClass -> Ods.Class+budgetTotalClass rc =+ Ods.Class $+ case rc of Value -> "budget rowtotal"; Total -> "budget coltotal"++budgetAverageClass :: RowClass -> Ods.Class+budgetAverageClass rc =+ Ods.Class $+ case rc of Value -> "budget rowaverage"; Total -> "budget colaverage"++-- What to show as heading for the totals row in balance reports ?+-- Currently nothing in terminal, Total: in HTML, FODS and xSV output.+totalRowHeadingText = ""+totalRowHeadingSpreadsheet = "Total:"+totalRowHeadingBudgetText = ""+totalRowHeadingBudgetCsv = "Total:"++-- Single-column balance reports++-- | Render a single-column balance report as CSV.+balanceReportAsCsv :: ReportOpts -> BalanceReport -> CSV+balanceReportAsCsv opts =+ rawTableContent . balanceReportAsSpreadsheet opts++-- | Render a single-column balance report as plain text.+balanceReportAsText :: ReportOpts -> BalanceReport -> TB.Builder+balanceReportAsText opts ((items, total)) = case layout_ opts of+ LayoutBare | iscustom -> error' "Custom format not supported with commodity columns" -- PARTIAL:+ LayoutBare -> bareLayoutBalanceReportAsText opts ((items, total))+ _ -> unlinesB ls <> unlinesB (if no_total_ opts then [] else [overline, totalLines])+ where+ (ls, sizes) = unzip $ map (balanceReportItemAsText opts) items+ -- abuse renderBalanceReportItem to render the total with similar format+ (totalLines, _) = renderBalanceReportItem opts ("",0,total)+ -- with a custom format, extend the line to the full report width;+ -- otherwise show the usual 20-char line for compatibility+ iscustom = case format_ opts of+ OneLine ((FormatField _ _ _ TotalField):_) -> False+ TopAligned ((FormatField _ _ _ TotalField):_) -> False+ BottomAligned ((FormatField _ _ _ TotalField):_) -> False+ _ -> True+ overlinewidth = if iscustom then sum (map maximum' $ transpose sizes) else 20+ overline = TB.fromText $ T.replicate overlinewidth "-"++-- | Render a single-column balance report as plain text with a separate commodity column (--layout=bare)+bareLayoutBalanceReportAsText :: ReportOpts -> BalanceReport -> TB.Builder+bareLayoutBalanceReportAsText opts (items, total) =+ unlinesB .+ map+ (renderColumns def{tableBorders=singleColumnTableOuterBorder} sizes .+ Group singleColumnTableInterColumnBorder . map Header) $+ ls ++ concat [[[overline], totalline] | not (no_total_ opts)]+ where+ render (_, acctname, dep, amt) =+ [ Cell TopRight damts+ , Cell TopLeft (fmap wbFromText cs)+ , Cell TopLeft (replicate (length damts - 1) mempty ++ [wbFromText dispname]) ]+ where dopts = oneLineNoCostFmt{displayCommodity=layout_ opts /= LayoutBare, displayCommodityOrder=Just cs, displayColour=color_ opts}+ cs = if mixedAmountLooksZero amt then [""] else S.toList $ maCommodities amt+ dispname = T.replicate ((dep - 1) * 2) " " <> acctname+ damts = showMixedAmountLinesB dopts amt+ ls = fmap render items+ totalline = render ("", "", 0, total)+ sizes = fromMaybe 0 . maximumMay . map cellWidth <$>+ transpose ([totalline | not (no_total_ opts)] ++ ls)+ overline = Cell TopLeft . pure . wbFromText . flip T.replicate "-" . fromMaybe 0 $ headMay sizes+ singleColumnTableOuterBorder = pretty_ opts+ singleColumnTableInterColumnBorder = if pretty_ opts then SingleLine else NoLine++{-+This implementation turned out to be a bit convoluted but implements the following algorithm for formatting:++- If there is a single amount, print it with the account name directly:+- Otherwise, only print the account name on the last line.++ a USD 1 ; Account 'a' has a single amount+ EUR -1+ b USD -1 ; Account 'b' has two amounts. The account name is printed on the last line.+-}+-- | Render one balance report line item as plain text suitable for console output (or+-- whatever string format is specified). Note, prices will not be rendered, and+-- differently-priced quantities of the same commodity will appear merged.+-- The output will be one or more lines depending on the format and number of commodities.+balanceReportItemAsText :: ReportOpts -> BalanceReportItem -> (TB.Builder, [Int])+balanceReportItemAsText opts (_, accountName, dep, amt) =+ renderBalanceReportItem opts (accountName, dep, amt)++-- | Render a balance report item, using the StringFormat specified by --format.+--+renderBalanceReportItem :: ReportOpts -> (AccountName, Int, MixedAmount) -> (TB.Builder, [Int])+renderBalanceReportItem opts (acctname, dep, total) =+ case format_ opts of+ OneLine comps -> renderRowFromComponents $ renderComponents True True comps+ TopAligned comps -> renderRowFromComponents $ renderComponents True False comps+ BottomAligned comps -> renderRowFromComponents $ renderComponents False False comps++ where+ -- Combine the rendered component cells horizontally, as a possibly multi-line text (builder),+ -- aligned in borderless columns (? XXX). Also returns the rendered width of each cell.+ renderRowFromComponents :: [Cell] -> (TB.Builder, [Int])+ renderRowFromComponents cs =+ ( renderRowB def{tableBorders=False, borderSpaces=False} . Group NoLine $ map Header cs+ , map cellWidth cs+ )++ -- Render each of the given StringFormat components for the balance report item,+ -- returning each as a Cell.+ renderComponents :: Bool -> Bool -> [StringFormatComponent] -> [Cell]+ renderComponents topaligned oneline = map (renderComponent topaligned oneline opts (acctname, dep, total))++-- Render one StringFormat component for a balance report item.+-- Returns a Cell, containing 0 or more lines of text (as builders).+renderComponent :: Bool -> Bool -> ReportOpts -> (AccountName, Int, MixedAmount) -> StringFormatComponent -> Cell+renderComponent _ _ _ _ (FormatLiteral s) = textCell TopLeft s+renderComponent topaligned oneline opts (acctname, dep, total) (FormatField ljust mmin mmax field) = case field of+ DepthSpacerField -> Cell align [WideBuilder (TB.fromText $ T.replicate d " ") d]+ where d = maybe id min mmax $ dep * fromMaybe 1 mmin+ AccountField -> textCell align $ formatText ljust mmin mmax acctname+ TotalField -> Cell align . pure $ showMixedAmountB dopts total+ _ -> Cell align [mempty]+ where+ align | topaligned && ljust = TopLeft+ | topaligned = TopRight+ | ljust = BottomLeft+ | otherwise = BottomRight+ dopts = noCostFmt{displayCommodity = layout_ opts /= LayoutBare+ ,displayOneLine = oneline+ ,displayMinWidth = mmin+ ,displayMaxWidth = mmax+ ,displayColour = color_ opts+ }+++simpleDateSpanCell :: DateSpan -> Ods.Cell Ods.NumLines Text+simpleDateSpanCell = Ods.defaultCell . showDateSpan++addTotalBorders :: [[Ods.Cell border text]] -> [[Ods.Cell Ods.NumLines text]]+addTotalBorders =+ zipWith+ (\border ->+ map (\c -> c {+ Ods.cellStyle = Ods.Body Ods.Total,+ Ods.cellBorder = Ods.noBorder {Ods.borderTop = border}}))+ (Ods.DoubleLine : repeat Ods.NoLine)+++-- | Render a single-column balance report as FODS.+balanceReportAsSpreadsheet ::+ ReportOpts -> BalanceReport -> [[Ods.Cell Ods.NumLines Text]]+balanceReportAsSpreadsheet opts (items, total) =+ (if transpose_ opts then Ods.transpose else id) $+ headers :+ concatMap (rows Value) items +++ if no_total_ opts then []+ else addTotalBorders $+ rows Total (totalRowHeadingSpreadsheet, totalRowHeadingSpreadsheet, 0, total)+ where+ cell = Ods.defaultCell+ headers =+ addHeaderBorders $ map headerCell $+ "account" : case layout_ opts of+ LayoutBare -> ["commodity", "balance"]+ _ -> ["balance"]+ rows ::+ RowClass -> BalanceReportItem ->+ [[Ods.Cell Ods.NumLines Text]]+ rows rc (name, dispName, dep, ma) =+ let accountCell =+ setAccountAnchor+ (guard (rc==Value) >> balance_base_url_ opts)+ (querystring_ opts) name $+ cell $ renderBalanceAcct opts nbsp (name, dispName, dep) in+ addRowSpanHeader accountCell $+ case layout_ opts of+ LayoutBare ->+ map (\a -> [cell $ acommodity a, renderAmount rc $ mixedAmount a])+ . amounts $ mixedAmountStripCosts ma+ _ -> [[renderAmount rc ma]]++ renderAmount rc mixedAmt =+ wbToText <$> cellFromMixedAmount bopts (amountClass rc, mixedAmt)+ where+ bopts = machineFmt{displayCommodity=showcomm, displayCommodityOrder = commorder}+ (showcomm, commorder)+ | layout_ opts == LayoutBare = (False, Just $ S.toList $ maCommodities mixedAmt)+ | otherwise = (True, Nothing)++++-- Multi-column balance reports++-- | Render a multi-column balance report as CSV.+-- The CSV will always include the initial headings row,+-- and will include the final totals row unless --no-total is set.+multiBalanceReportAsCsv :: ReportOpts -> MultiBalanceReport -> CSV+multiBalanceReportAsCsv opts@ReportOpts{..} report =+ (if transpose_ then transpose else id) $+ rawTableContent $ header : body ++ totals+ where+ (header, body, totals) =+ multiBalanceReportAsSpreadsheetParts machineFmt opts report++-- | Render the Spreadsheet table rows (CSV, ODS, HTML) for a MultiBalanceReport.+-- Returns the heading row, 0 or more body rows, and the totals row if enabled.+multiBalanceReportAsSpreadsheetParts ::+ AmountFormat -> ReportOpts -> MultiBalanceReport ->+ ([Ods.Cell Ods.NumLines Text],+ [[Ods.Cell Ods.NumLines Text]],+ [[Ods.Cell Ods.NumLines Text]])+multiBalanceReportAsSpreadsheetParts fmt opts@ReportOpts{..} (PeriodicReport colspans items tr) =+ (headers, concatMap fullRowAsTexts items, addTotalBorders totalrows)+ where+ accountCell label =+ (Ods.defaultCell label) {Ods.cellClass = Ods.Class "account"}+ hCell cls label = (headerCell label) {Ods.cellClass = Ods.Class cls}+ headers =+ addHeaderBorders $+ hCell "account" "account" :+ case layout_ of+ LayoutTidy -> map headerCell tidyColumnLabels+ LayoutBare -> headerCell "commodity" : dateHeaders+ _ -> dateHeaders+ dateHeaders =+ (if not summary_only_ then map (headerDateSpanCell balance_base_url_ querystring_) colspans else [] )+++ [hCell "rowtotal" "total" | multiBalanceHasTotalsColumn opts] +++ [hCell "rowaverage" "average" | average_]+ fullRowAsTexts row =+ addRowSpanHeader anchorCell $+ rowAsText Value (dateSpanCell balance_base_url_ querystring_ acctName) row+ where acctName = prrFullName row+ anchorCell =+ setAccountAnchor balance_base_url_ querystring_ acctName $+ accountCell $ renderPeriodicAcct opts nbsp row+ totalrows =+ if no_total_+ then []+ else addRowSpanHeader (accountCell totalRowHeadingSpreadsheet) $+ rowAsText Total simpleDateSpanCell tr+ rowAsText rc dsCell =+ map (map (fmap wbToText)) .+ multiBalanceRowAsCellBuilders fmt opts colspans rc dsCell++tidyColumnLabels :: [Text]+tidyColumnLabels =+ ["period", "start_date", "end_date", "commodity", "value"]+++-- | Render a multi-column balance report as HTML.+multiBalanceReportAsHtml :: ReportOpts -> MultiBalanceReport -> Html+multiBalanceReportAsHtml ropts mbr =+ styledTableHtml . map (map (fmap toHtml)) $+ snd $ multiBalanceReportAsSpreadsheet ropts mbr++-- | Render the ODS table rows for a MultiBalanceReport.+-- Returns the heading row, 0 or more body rows, and the totals row if enabled.+multiBalanceReportAsSpreadsheet ::+ ReportOpts -> MultiBalanceReport ->+ ((Int, Int), [[Ods.Cell Ods.NumLines Text]])+multiBalanceReportAsSpreadsheet ropts mbr =+ let (header,body,total) =+ multiBalanceReportAsSpreadsheetParts oneLineNoCostFmt ropts mbr+ in (if transpose_ ropts then swap *** Ods.transpose else id) $+ ((1, case layout_ ropts of LayoutWide _ -> 1; _ -> 0),+ header : body ++ total)+++-- | Render a multi-column balance report as plain text suitable for console output.+multiBalanceReportAsText :: ReportOpts -> MultiBalanceReport -> TL.Text+multiBalanceReportAsText ropts@ReportOpts{..} r = TB.toLazyText $+ TB.fromText title+ <> TB.fromText "\n\n"+ <> multiBalanceReportTableAsText ropts (multiBalanceReportAsTable ropts r)+ where+ title = mtitle <> " in " <> showDateSpan (periodicReportSpan r) <> valuationdesc <> ":"++ mtitle = case (balancecalc_, balanceaccum_) of+ (CalcValueChange, PerPeriod ) -> "Period-end value changes"+ (CalcValueChange, Cumulative ) -> "Cumulative period-end value changes"+ (CalcGain, PerPeriod ) -> "Incremental gain"+ (CalcGain, Cumulative ) -> "Cumulative gain"+ (CalcGain, Historical ) -> "Historical gain"+ (_, PerPeriod ) -> "Balance changes"+ (_, Cumulative ) -> "Ending balances (cumulative)"+ (_, Historical) -> "Ending balances (historical)"+ valuationdesc =+ (case conversionop_ of+ Just ToCost -> ", converted to cost"+ _ -> "")+ <> (case value_ of+ Just (AtThen _mc) -> ", valued at posting date"+ Just (AtEnd _mc) | changingValuation -> ""+ Just (AtEnd _mc) -> ", valued at period ends"+ Just (AtNow _mc) -> ", current value"+ Just (AtDate d _mc) -> ", valued at " <> showDate d+ Nothing -> "")++ changingValuation = case (balancecalc_, balanceaccum_) of+ (CalcValueChange, PerPeriod) -> True+ (CalcValueChange, Cumulative) -> True+ _ -> False++-- | Given a table representing a multi-column balance report,+-- render it in a format suitable for console output.+-- Amounts with more than two commodities will be elided unless --no-elide is used.+multiBalanceReportTableAsText :: ReportOpts -> Table T.Text T.Text WideBuilder -> TB.Builder+multiBalanceReportTableAsText ReportOpts{..} = renderTableByRowsB tableopts renderCh renderRow+ where+ tableopts = def{tableBorders=multiColumnTableOuterBorder, prettyTable=pretty_}+ multiColumnTableOuterBorder = pretty_++ renderCh :: [Text] -> [Cell]+ renderCh+ | layout_ /= LayoutBare || transpose_ = fmap (textCell TopRight)+ | otherwise = zipWith ($) (textCell TopLeft : repeat (textCell TopRight))++ renderRow :: (Text, [WideBuilder]) -> (Cell, [Cell])+ renderRow (rh, row)+ | layout_ /= LayoutBare || transpose_ =+ (textCell TopLeft rh, fmap (Cell TopRight . pure) row)+ | otherwise =+ (textCell TopLeft rh, zipWith ($) (Cell TopLeft : repeat (Cell TopRight)) (fmap pure row))++-- | Build a 'Table' from a multi-column balance report.+multiBalanceReportAsTable :: ReportOpts -> MultiBalanceReport -> Table T.Text T.Text WideBuilder+multiBalanceReportAsTable opts@ReportOpts{summary_only_, average_, balanceaccum_}+ (PeriodicReport spans items tr) =+ maybetranspose $+ addtotalrow $+ Table+ (Group multiColumnTableInterRowBorder $ map Header $ concat accts)+ (Group multiColumnTableInterColumnBorder $ map Header colheadings)+ (concat rows)+ where+ colheadings = ["Commodity" | layout_ opts == LayoutBare]+ ++ (if not summary_only_ then map (reportPeriodName balanceaccum_ spans) spans else [])+ ++ [" Total" | multiBalanceHasTotalsColumn opts]+ ++ ["Average" | average_]+ (accts, rows) = unzip $ fmap fullRowAsTexts items+ where+ fullRowAsTexts row = (replicate (length rs) (renderacct row), rs)+ where+ rs = multiBalanceRowAsText opts row+ renderacct row' = T.replicate (prrIndent row' * 2) " " <> prrDisplayName row'+ addtotalrow+ | no_total_ opts = id+ | otherwise =+ let totalrows = multiBalanceRowAsText opts tr+ rowhdrs = Group NoLine $ map Header $ totalRowHeadingText : replicate (length totalrows - 1) ""+ colhdrs = Header [] -- unused, concatTables will discard+ in (flip (concatTables SingleLine) $ Table rowhdrs colhdrs totalrows)+ maybetranspose | transpose_ opts = \(Table rh ch vals) -> Table ch rh (transpose vals)+ | otherwise = id+ multiColumnTableInterRowBorder = NoLine+ multiColumnTableInterColumnBorder = if pretty_ opts then SingleLine else NoLine++multiBalanceRowAsCellBuilders ::+ AmountFormat -> ReportOpts -> [DateSpan] ->+ RowClass -> (DateSpan -> Ods.Cell Ods.NumLines Text) ->+ PeriodicReportRow a MixedAmount ->+ [[Ods.Cell Ods.NumLines WideBuilder]]+multiBalanceRowAsCellBuilders bopts ropts@ReportOpts{..} colspans+ rc renderDateSpanCell (PeriodicReportRow _acct as rowtot rowavg) =+ case layout_ of+ LayoutWide width -> [fmap (cellFromMixedAmount bopts{displayMaxWidth=width}) clsamts]+ LayoutTall -> paddedTranspose Ods.emptyCell+ . map (cellsFromMixedAmount bopts{displayMaxWidth=Nothing})+ $ clsamts+ LayoutBare -> zipWith (:) (map wbCell cs) -- add symbols+ . transpose -- each row becomes a list of Text quantities+ . map (cellsFromMixedAmount bopts{displayCommodity=False, displayCommodityOrder=Just cs, displayMinWidth=Nothing})+ $ clsamts+ LayoutTidy -> concat+ . zipWith (map . addDateColumns) colspans+ . map ( zipWith (\c a -> [wbCell c, a]) cs+ . cellsFromMixedAmount bopts{displayCommodity=False, displayCommodityOrder=Just cs, displayMinWidth=Nothing})+ $ classified+ -- Do not include totals column or average for tidy output, as this+ -- complicates the data representation and can be easily calculated+ where+ wbCell = Ods.defaultCell . wbFromText+ wbDate content = (wbCell content) {Ods.cellType = Ods.TypeDate}+ cs = if all mixedAmountLooksZero allamts then [""] else S.toList $ foldMap maCommodities allamts+ classified = map ((,) (amountClass rc)) as+ allamts = map snd clsamts+ clsamts = (if not summary_only_ then classified else []) +++ [(rowTotalClass rc, rowtot) |+ multiBalanceHasTotalsColumn ropts && not (null as)] +++ [(rowAverageClass rc, rowavg) | average_ && not (null as)]+ addDateColumns spn@(DateSpan s e) remCols =+ (wbFromText <$> renderDateSpanCell spn) :+ wbDate (maybe "" showEFDate s) :+ wbDate (maybe "" (showEFDate . modifyEFDay (addDays (-1))) e) :+ remCols++ paddedTranspose :: a -> [[a]] -> [[a]]+ paddedTranspose _ [] = [[]]+ paddedTranspose n as1 = take (maximum . map length $ as1) . trans $ as1+ where+ trans ([] : xss) = (n : map h xss) : trans ([n] : map t xss)+ trans ((x : xs) : xss) = (x : map h xss) : trans (m xs : map t xss)+ trans [] = []+ h (x:_) = x+ h [] = n+ t (_:xs) = xs+ t [] = [n]+ m (x:xs) = x:xs+ m [] = [n]+++multiBalanceHasTotalsColumn :: ReportOpts -> Bool+multiBalanceHasTotalsColumn ropts =+ row_total_ ropts && balanceaccum_ ropts `notElem` [Cumulative, Historical]++multiBalanceRowAsText :: ReportOpts -> PeriodicReportRow a MixedAmount -> [[WideBuilder]]+multiBalanceRowAsText opts =+ rawTableContent .+ multiBalanceRowAsCellBuilders oneLineNoCostFmt{displayColour=color_ opts} opts []+ Value simpleDateSpanCell++multiBalanceRowAsCsvText :: ReportOpts -> [DateSpan] -> PeriodicReportRow a MixedAmount -> [[T.Text]]+multiBalanceRowAsCsvText opts colspans =+ map (map (wbToText . Ods.cellContent)) .+ multiBalanceRowAsCellBuilders machineFmt opts colspans+ Value simpleDateSpanCell+++-- Budget reports++-- A BudgetCell's data values rendered for display - the actual change amount,+-- the budget goal amount if any, and the corresponding goal percentage if possible.+type BudgetDisplayCell = (WideBuilder, Maybe (WideBuilder, Maybe WideBuilder))++-- | A row of rendered budget data cells.+type BudgetDisplayRow = [BudgetDisplayCell]++-- | An amount render helper for the budget report. Renders each commodity separately.+type BudgetShowAmountsFn = MixedAmount -> [WideBuilder]++-- | A goal percentage calculating helper for the budget report.+type BudgetCalcPercentagesFn = Change -> BudgetGoal -> [Maybe Percentage]++-- | Render a budget report as plain text suitable for console output.+budgetReportAsText :: ReportOpts -> BudgetReport -> TL.Text+budgetReportAsText ropts@ReportOpts{..} budgetr = TB.toLazyText $+ TB.fromText title <> TB.fromText "\n\n" <>+ multiBalanceReportTableAsText ropts (budgetReportAsTable ropts budgetr)+ where+ title = "Budget performance in " <> showDateSpan (periodicReportSpan budgetr)+ <> (case conversionop_ of+ Just ToCost -> ", converted to cost"+ _ -> "")+ <> (case value_ of+ Just (AtThen _mc) -> ", valued at posting date"+ Just (AtEnd _mc) -> ", valued at period ends"+ Just (AtNow _mc) -> ", current value"+ Just (AtDate d _mc) -> ", valued at " <> showDate d+ Nothing -> "")+ <> ":"++-- | Build a 'Table' from a multi-column balance report.+budgetReportAsTable :: ReportOpts -> BudgetReport -> Table Text Text WideBuilder+budgetReportAsTable ropts@ReportOpts{..} (PeriodicReport spans items totrow) =+ maybetransposetable $+ addtotalrow $+ Table+ (Group budgetTableInterRowBorder $ map Header accts)+ (Group budgetTableInterColumnBorder $ map Header colheadings)+ rows+ where+ budgetTableInterRowBorder = NoLine+ budgetTableInterColumnBorder = if pretty_ then SingleLine else NoLine++ maybetransposetable+ | transpose_ = \(Table rh ch vals) -> Table ch rh (transpose vals)+ | otherwise = id++ addtotalrow+ | no_total_ = id+ | otherwise =+ let+ rowhdrs = Group NoLine $ map Header $ totalRowHeadingBudgetText : replicate (length totalrows - 1) ""+ colhdrs = Header [] -- ignored by concatTables+ in+ (flip (concatTables SingleLine) $ Table rowhdrs colhdrs totalrows) -- XXX ?++ colheadings = ["Commodity" | layout_ == LayoutBare]+ ++ (if not summary_only_ then map (reportPeriodName balanceaccum_ spans) spans else [])+ ++ [" Total" | row_total_]+ ++ ["Average" | average_]++ (accts, rows, totalrows) =+ (accts'+ ,maybecommcol itemscs $ showcells texts+ ,maybecommcol totrowcs $ showtotrow totrowtexts)+ where+ -- If --layout=bare, prepend a commodities column.+ maybecommcol :: [WideBuilder] -> [[WideBuilder]] -> [[WideBuilder]]+ maybecommcol cs+ | layout_ == LayoutBare = zipWith (:) cs+ | otherwise = id++ showcells, showtotrow :: [[BudgetDisplayCell]] -> [[WideBuilder]]+ (showcells, showtotrow) =+ (maybetranspose . map (zipWith showBudgetDisplayCell widths) . maybetranspose+ ,maybetranspose . map (zipWith showBudgetDisplayCell totrowwidths) . maybetranspose)+ where+ -- | Combine a BudgetDisplayCell's rendered values into a "[PERCENT of GOAL]" rendering,+ -- respecting the given widths.+ showBudgetDisplayCell :: (Int, Int, Int) -> BudgetDisplayCell -> WideBuilder+ showBudgetDisplayCell (actualwidth, budgetwidth, percentwidth) (actual, mbudget) =+ flip WideBuilder (actualwidth + totalbudgetwidth) $+ toPadded actual <> maybe emptycell showBudgetGoalAndPercentage mbudget++ where+ toPadded (WideBuilder b w) = (TB.fromText . flip T.replicate " " $ actualwidth - w) <> b++ (totalpercentwidth, totalbudgetwidth) =+ let totalpercentwidth' = if percentwidth == 0 then 0 else percentwidth + 5+ in ( totalpercentwidth'+ , if budgetwidth == 0 then 0 else budgetwidth + totalpercentwidth' + 3+ )++ emptycell :: TB.Builder+ emptycell = TB.fromText $ T.replicate totalbudgetwidth " "++ showBudgetGoalAndPercentage :: (WideBuilder, Maybe WideBuilder) -> TB.Builder+ showBudgetGoalAndPercentage (goal, perc) =+ let perct = case perc of+ Nothing -> T.replicate totalpercentwidth " "+ Just pct -> T.replicate (percentwidth - wbWidth pct) " " <> wbToText pct <> "% of "+ in TB.fromText $ " [" <> perct <> T.replicate (budgetwidth - wbWidth goal) " " <> wbToText goal <> "]"++ -- | Build a list of widths for each column.+ -- When --transpose is used, the totals row must be included in this list.+ widths :: [(Int, Int, Int)]+ widths = zip3 actualwidths budgetwidths percentwidths+ where+ actualwidths = map (maximum' . map first3 ) $ cols+ budgetwidths = map (maximum' . map second3) $ cols+ percentwidths = map (maximum' . map third3 ) $ cols+ catcolumnwidths = foldl' (zipWith (++)) $ repeat []+ cols = maybetranspose $ catcolumnwidths $ map (cellswidth . rowToBudgetCells) items ++ [cellswidth $ rowToBudgetCells totrow]++ cellswidth :: [BudgetCell] -> [[(Int, Int, Int)]]+ cellswidth row =+ let cs = budgetCellsCommodities row+ (showmixed, percbudget) = mkBudgetDisplayFns cs+ disp = showcell showmixed percbudget+ budgetpercwidth = wbWidth *** maybe 0 wbWidth+ cellwidth (am, bm) = let (bw, pw) = maybe (0, 0) budgetpercwidth bm in (wbWidth am, bw, pw)+ in map (map cellwidth . disp) row++ totrowwidths :: [(Int, Int, Int)]+ totrowwidths+ | transpose_ = drop (length texts) widths+ | otherwise = widths++ maybetranspose+ | transpose_ = transpose+ | otherwise = id++ (accts', itemscs, texts) = unzip3 $ concat shownitems+ where+ shownitems :: [[(AccountName, WideBuilder, BudgetDisplayRow)]]+ shownitems =+ map (\i ->+ let+ addacctcolumn = map (\(cs, cvals) -> (renderPeriodicAcct ropts " " i, cs, cvals))+ isunbudgetedrow = displayFull (prrName i) == unbudgetedAccountName+ in addacctcolumn $ showrow isunbudgetedrow $ rowToBudgetCells i)+ items++ (totrowcs, totrowtexts) = unzip $ concat showntotrow+ where+ showntotrow :: [[(WideBuilder, BudgetDisplayRow)]]+ showntotrow = [showrow False $ rowToBudgetCells totrow]++ -- | Get the data cells from a row or totals row, maybe adding+ -- the row total and/or row average depending on options.+ rowToBudgetCells :: PeriodicReportRow a BudgetCell -> [BudgetCell]+ rowToBudgetCells (PeriodicReportRow _ as rowtot rowavg) =+ (if not summary_only_ then as else [])+ ++ [rowtot | row_total_ && not (null as)]+ ++ [rowavg | average_ && not (null as)]++ -- | Render a row's data cells as "BudgetDisplayCell"s, and a rendered list of commodity symbols.+ -- Also requires a flag indicating whether this is the special <unbudgeted> row.+ -- (The types make that hard to check here.)+ showrow :: Bool -> [BudgetCell] -> [(WideBuilder, BudgetDisplayRow)]+ showrow isunbudgetedrow cells =+ let+ cs = budgetCellsCommodities cells+ -- #2071 If there are no commodities - because there are no actual or goal amounts -+ -- the zipped list would be empty, causing this row not to be shown.+ -- But rows like this sometimes need to be shown to preserve the account tree structure.+ -- So, ensure 0 will be shown as actual amount(s).+ -- Unfortunately this disables boring parent eliding, as if --no-elide had been used.+ -- (Just turning on --no-elide higher up doesn't work right.)+ -- Note, no goal amount will be shown for these rows,+ -- whereas --no-elide is likely to show a goal amount aggregated from children.+ cs1 = if null cs && not isunbudgetedrow then [""] else cs+ (showmixed, percbudget) = mkBudgetDisplayFns cs1+ in+ zip (map wbFromText cs1) $+ transpose $+ map (showcell showmixed percbudget)+ cells++ budgetCellsCommodities :: [BudgetCell] -> [CommoditySymbol]+ budgetCellsCommodities = S.toList . foldl' S.union mempty . map budgetCellCommodities+ where+ budgetCellCommodities :: BudgetCell -> S.Set CommoditySymbol+ budgetCellCommodities (am, bm) = f am `S.union` f bm+ where f = maybe mempty maCommodities++ -- | Render a "BudgetCell"'s amounts as "BudgetDisplayCell"s (one per commodity).+ showcell :: BudgetShowAmountsFn -> BudgetCalcPercentagesFn -> BudgetCell -> BudgetDisplayRow+ showcell showCommodityAmounts calcCommodityPercentages (mactual, mbudget) =+ zip actualamts budgetinfos+ where+ actual = fromMaybe nullmixedamt mactual+ actualamts = showCommodityAmounts actual+ budgetinfos =+ case mbudget of+ Nothing -> repeat Nothing+ Just goal -> map Just $ showGoalAmountsAndPercentages goal+ where+ showGoalAmountsAndPercentages :: MixedAmount -> [(WideBuilder, Maybe WideBuilder)]+ showGoalAmountsAndPercentages goal = zip amts mpcts+ where+ amts = showCommodityAmounts goal+ mpcts = map (showrounded <$>) $ calcCommodityPercentages actual goal+ where showrounded = wbFromText . T.pack . show . roundTo 0++ -- | Make budget info display helpers that adapt to --layout=wide.+ mkBudgetDisplayFns :: [CommoditySymbol] -> (BudgetShowAmountsFn, BudgetCalcPercentagesFn)+ mkBudgetDisplayFns cs = case layout_ of+ LayoutWide width ->+ ( pure . showMixedAmountB oneLineNoCostFmt{displayMaxWidth=width, displayColour=color_}+ , \a -> pure . percentage a)+ _ -> ( showMixedAmountLinesB noCostFmt{displayCommodity=layout_/=LayoutBare, displayCommodityOrder=Just cs, displayMinWidth=Nothing, displayColour=color_}+ , \a b -> map (percentage' a b) cs)+ where+ -- | Calculate the percentage of actual change to budget goal to show, if any.+ -- If valuing at cost, both amounts are converted to cost before comparing.+ -- A percentage will not be shown if:+ --+ -- - actual or goal are not the same, single, commodity+ --+ -- - the goal is zero+ --+ percentage :: Change -> BudgetGoal -> Maybe Percentage+ percentage actual budget =+ case (costedAmounts actual, costedAmounts budget) of+ ([a], [b]) | (acommodity a == acommodity b || amountLooksZero a) && not (amountLooksZero b)+ -> Just $ 100 * aquantity a / aquantity b+ _ -> Nothing+ where+ costedAmounts = case conversionop_ of+ Just ToCost -> amounts . mixedAmountCost+ _ -> amounts . mixedAmountStripCosts -- strip any lingering cost info that would prevent unification++ -- | Like percentage, but accept multicommodity actual and budget amounts,+ -- and extract the specified commodity from both.+ percentage' :: Change -> BudgetGoal -> CommoditySymbol -> Maybe Percentage+ percentage' am bm c = case ((,) `on` find ((==) c . acommodity) . amounts) am bm of+ (Just a, Just b) -> percentage (mixedAmount a) (mixedAmount b)+ _ -> Nothing++-- XXX generalise this with multiBalanceReportAsCsv ?+-- | Render a budget report as CSV. Like multiBalanceReportAsCsv,+-- but includes alternating actual and budget amount columns.+budgetReportAsCsv :: ReportOpts -> BudgetReport -> [[Text]]+budgetReportAsCsv ropts report+ = rawTableContent $+ budgetReportAsSpreadsheet machineFmt ropts report++budgetReportAsSpreadsheet ::+ AmountFormat -> ReportOpts -> BudgetReport -> [[Ods.Cell Ods.NumLines Text]]+budgetReportAsSpreadsheet+ fmt+ ropts@ReportOpts{..}+ (PeriodicReport colspans items totrow)+ = (if transpose_ then Ods.transpose else id) $++ -- heading row+ (addHeaderBorders $ map headerCell $+ "Account" :+ ["Commodity" | layout_ == LayoutBare ]+ ++ (if not summary_only_ then concatMap (\spn -> [showDateSpan spn, "budget"]) colspans else [])+ ++ concat [["Total" ,"budget"] | row_total_]+ ++ concat [["Average","budget"] | average_]+ ) :++ -- account rows+ concatMap (\row -> rowAsTexts Value (accountCell row) row) items++ -- totals row+ ++ addTotalBorders+ (concat [ rowAsTexts Total (cell totalRowHeadingBudgetCsv) totrow | not no_total_ ])++ where+ cell = Ods.defaultCell+ accountCell row =+ let name = prrFullName row in+ setAccountAnchor (balance_base_url_) querystring_ name $+ cell $ renderPeriodicAcct ropts nbsp row+ {-+ ToDo: The chosen HTML cell class names are not put in stone.+ If you find you need more systematic names,+ feel free to develop a more sophisticated scheme.+ -}+ flattentuples rc tups =+ concat [[(amountClass rc, a),(budgetClass rc, b)] | (a,b) <- tups]+ showNorm (cls,mval) =+ maybe Ods.emptyCell (fmap wbToText . curry (cellFromMixedAmount fmt) cls) mval++ rowAsTexts :: RowClass+ -> Ods.Cell Ods.NumLines Text+ -> PeriodicReportRow a BudgetCell+ -> [[Ods.Cell Ods.NumLines Text]]+ rowAsTexts rc acctCell (PeriodicReportRow _ as (rowtot,budgettot) (rowavg, budgetavg)) =+ addRowSpanHeader acctCell $+ case layout_ of+ LayoutBare ->+ zipWith (:) (map cell cs) -- add symbols+ . transpose -- each row becomes a list of Text quantities+ . map (map (fmap wbToText) . cellsFromMixedAmount dopts . second (fromMaybe nullmixedamt))+ $ vals+ _ -> [map showNorm vals]+ where+ cs = S.toList . mconcat . map maCommodities $ mapMaybe snd vals+ dopts = fmt{displayCommodity=layout_ /= LayoutBare, displayCommodityOrder=Just cs, displayMinWidth=Nothing}+ vals = flattentuples rc (if not summary_only_ then as else [])+ ++ concat [[(rowTotalClass rc, rowtot),+ (budgetTotalClass rc, budgettot)]+ | row_total_]+ ++ concat [[(rowAverageClass rc, rowavg),+ (budgetAverageClass rc, budgetavg)]+ | average_]+++nbsp :: Text+nbsp = "\160"++renderBalanceAcct ::+ ReportOpts -> Text -> (AccountName, AccountName, Int) -> Text+renderBalanceAcct opts space (fullName, displayName, dep) =+ case accountlistmode_ opts of+ ALTree -> T.replicate (dep*2) space <> displayName+ ALFlat -> accountNameDrop (drop_ opts) fullName++-- FIXME. Have to check explicitly for which to render here, since+-- budgetReport sets accountlistmode to ALTree. Find a principled way to do+-- this.+renderPeriodicAcct ::+ ReportOpts -> Text -> PeriodicReportRow DisplayName a -> Text+renderPeriodicAcct opts space row =+ renderBalanceAcct opts space+ (prrFullName row, prrDisplayName row, prrIndent row)+++-- tests++tests_Balance = testGroup "Balance" [++ testGroup "balanceReportAsText" [+ testCase "unicode in balance layout" $ do+ j <- readJournal'' "2009/01/01 * медвежья шкура\n расходы:покупки 100\n актив:наличные\n"+ let rspec = defreportspec{_rsReportOpts=defreportopts{no_total_=True}}+ TB.toLazyText (balanceReportAsText (_rsReportOpts rspec) (balanceReport rspec{_rsDay=fromGregorian 2008 11 26} j))+ @?=+ TL.unlines+ [" -100 актив:наличные"+ ," 100 расходы:покупки"+ ]+ ]++ ]
Hledger/Cli/Commands/Balance.txt view
@@ -1,472 +1,949 @@-balance, bal, b-Show accounts and their balances.--_FLAGS_--The balance command is hledger's most versatile command. Note, despite-the name, it is not always used for showing real-world account balances;-the more accounting-aware balancesheet and incomestatement may be more-convenient for that.--By default, it displays all accounts, and each account's change in-balance during the entire period of the journal. Balance changes are-calculated by adding up the postings in each account. You can limit the-postings matched, by a query, to see fewer accounts, changes over a-different time period, changes from only cleared transactions, etc.--If you include an account's complete history of postings in the report,-the balance change is equivalent to the account's current ending-balance. For a real-world account, typically you won't have all-transactions in the journal; instead you'll have all transactions after-a certain date, and an "opening balances" transaction setting the-correct starting balance on that date. Then the balance command will-show real-world account balances. In some cases the -H/--historical flag-is used to ensure this (more below).--The balance command can produce several styles of report:--Classic balance report--This is the original balance report, as found in Ledger. It usually-looks like this:--$ hledger balance- $-1 assets- $1 bank:saving- $-2 cash- $2 expenses- $1 food- $1 supplies- $-2 income- $-1 gifts- $-1 salary- $1 liabilities:debts---------------------- 0--By default, accounts are displayed hierarchically, with subaccounts-indented below their parent. At each level of the tree, accounts are-sorted by account code if any, then by account name. Or with--S/--sort-amount, by their balance amount.--"Boring" accounts, which contain a single interesting subaccount and no-balance of their own, are elided into the following line for more-compact output. (Eg above, the "liabilities" account.) Use --no-elide to-prevent this.--Account balances are "inclusive" - they include the balances of any-subaccounts.--Accounts which have zero balance (and no non-zero subaccounts) are-omitted. Use -E/--empty to show them.--A final total is displayed by default; use -N/--no-total to suppress it,-eg:--$ hledger balance -p 2008/6 expenses --no-total- $2 expenses- $1 food- $1 supplies--Customising the classic balance report--You can customise the layout of classic balance reports with---format FMT:--$ hledger balance --format "%20(account) %12(total)"- assets $-1- bank:saving $1- cash $-2- expenses $2- food $1- supplies $1- income $-2- gifts $-1- salary $-1- liabilities:debts $1----------------------------------- 0--The FMT format string (plus a newline) specifies the formatting applied-to each account/balance pair. It may contain any suitable text, with-data fields interpolated like so:--%[MIN][.MAX](FIELDNAME)--- MIN pads with spaces to at least this width (optional)-- MAX truncates at this width (optional)-- FIELDNAME must be enclosed in parentheses, and can be one of:-- - depth_spacer - a number of spaces equal to the account's depth,- or if MIN is specified, MIN * depth spaces.- - account - the account's name- - total - the account's balance/posted total, right justified--Also, FMT can begin with an optional prefix to control how-multi-commodity amounts are rendered:--- %_ - render on multiple lines, bottom-aligned (the default)-- %^ - render on multiple lines, top-aligned-- %, - render on one line, comma-separated--There are some quirks. Eg in one-line mode, %(depth_spacer) has no-effect, instead %(account) has indentation built in. Experimentation may-be needed to get pleasing results.--Some example formats:--- %(total) - the account's total-- %-20.20(account) - the account's name, left justified, padded to 20- characters and clipped at 20 characters-- %,%-50(account) %25(total) - account name padded to 50 characters,- total padded to 20 characters, with multiple commodities rendered on- one line-- %20(total) %2(depth_spacer)%-(account) - the default format for the- single-column balance report--Colour support--The balance command shows negative amounts in red, if:--- the TERM environment variable is not set to dumb-- the output is not being redirected or piped anywhere--Flat mode--To see a flat list instead of the default hierarchical display, use---flat. In this mode, accounts (unless depth-clipped) show their full-names and "exclusive" balance, excluding any subaccount balances. In-this mode, you can also use --drop N to omit the first few account name-components.--$ hledger balance -p 2008/6 expenses -N --flat --drop 1- $1 food- $1 supplies--Depth limited balance reports--With --depth N or depth:N or just -N, balance reports show accounts only-to the specified numeric depth. This is very useful to summarise a-complex set of accounts and get an overview.--$ hledger balance -N -1- $-1 assets- $2 expenses- $-2 income- $1 liabilities--Flat-mode balance reports, which normally show exclusive balances, show-inclusive balances at the depth limit.--Multicolumn balance report--Multicolumn or tabular balance reports are a very useful hledger-feature, and usually the preferred style. They share many of the above-features, but they show the report as a table, with columns representing-time periods. This mode is activated by providing a reporting interval.--There are three types of multicolumn balance report, showing different-information:--1. By default: each column shows the sum of postings in that period, ie- the account's change of balance in that period. This is useful eg- for a monthly income statement:-- $ hledger balance --quarterly income expenses -E- Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4 - ===================++=================================- expenses:food || 0 $1 0 0 - expenses:supplies || 0 $1 0 0 - income:gifts || 0 $-1 0 0 - income:salary || $-1 0 0 0 - -------------------++---------------------------------- || $-1 $1 0 0 --2. With --cumulative: each column shows the ending balance for that- period, accumulating the changes across periods, starting from 0 at- the report start date:-- $ hledger balance --quarterly income expenses -E --cumulative- Ending balances (cumulative) in 2008:-- || 2008/03/31 2008/06/30 2008/09/30 2008/12/31 - ===================++=================================================- expenses:food || 0 $1 $1 $1 - expenses:supplies || 0 $1 $1 $1 - income:gifts || 0 $-1 $-1 $-1 - income:salary || $-1 $-1 $-1 $-1 - -------------------++-------------------------------------------------- || $-1 0 0 0 --3. With --historical/-H: each column shows the actual historical ending- balance for that period, accumulating the changes across periods,- starting from the actual balance at the report start date. This is- useful eg for a multi-period balance sheet, and when you are showing- only the data after a certain start date:-- $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1- Ending balances (historical) in 2008/04/01-2008/12/31:-- || 2008/06/30 2008/09/30 2008/12/31 - ======================++=====================================- assets:bank:checking || $1 $1 0 - assets:bank:saving || $1 $1 $1 - assets:cash || $-2 $-2 $-2 - liabilities:debts || 0 0 $1 - ----------------------++-------------------------------------- || 0 0 0 --Multicolumn balance reports display accounts in flat mode by default; to-see the hierarchy, use --tree.--With a reporting interval (like --quarterly above), the report start/end-dates will be adjusted if necessary so that they encompass the displayed-report periods. This is so that the first and last periods will be-"full" and comparable to the others.--The -E/--empty flag does two things in multicolumn balance reports:-first, the report will show all columns within the specified report-period (without -E, leading and trailing columns with all zeroes are not-shown). Second, all accounts which existed at the report start date will-be considered, not just the ones with activity during the report period-(use -E to include low-activity accounts which would otherwise would be-omitted).--The -T/--row-total flag adds an additional column showing the total for-each row.--The -A/--average flag adds a column showing the average value in each-row.--Here's an example of all three:--$ hledger balance -Q income expenses --tree -ETA-Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4 Total Average -============++===================================================- expenses || 0 $2 0 0 $2 $1 - food || 0 $1 0 0 $1 0 - supplies || 0 $1 0 0 $1 0 - income || $-1 $-1 0 0 $-2 $-1 - gifts || 0 $-1 0 0 $-1 0 - salary || $-1 0 0 0 $-1 0 -------------++---------------------------------------------------- || $-1 $1 0 0 0 0 --# Average is rounded to the dollar here since all journal amounts are--Limitations:--In multicolumn reports the -V/--value flag uses the market price on the-report end date, for all columns (not the price on each column's end-date).--Eliding of boring parent accounts in tree mode, as in the classic-balance report, is not yet supported in multicolumn reports.--Budget report--With --budget, extra columns are displayed showing budget goals for each-account and period, if any. Budget goals are defined by periodic-transactions. This is very useful for comparing planned and actual-income, expenses, time usage, etc. --budget is most often combined with-a report interval.--For example, you can take average monthly expenses in the common expense-categories to construct a minimal monthly budget:--;; Budget-~ monthly- income $2000- expenses:food $400- expenses:bus $50- expenses:movies $30- assets:bank:checking--;; Two months worth of expenses-2017-11-01- income $1950- expenses:food $396- expenses:bus $49- expenses:movies $30- expenses:supplies $20- assets:bank:checking--2017-12-01- income $2100- expenses:food $412- expenses:bus $53- expenses:gifts $100- assets:bank:checking--You can now see a monthly budget report:--$ hledger balance -M --budget-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] --Note this is different from a normal balance report in several ways:--- Only accounts with budget goals during the report period are shown,- by default.--- In each column, in square brackets after the actual amount, budgeted- amounts are shown, along with the percentage of budget used.--- All parent accounts are always shown, even in flat mode. Eg assets,- assets:bank, and expenses above.--- Amounts always include all subaccounts, budgeted or unbudgeted, even- in flat mode.--This means that the numbers displayed will not always add up! Eg above,-the expenses actual amount includes the gifts and supplies transactions,-but the expenses:gifts and expenses:supplies accounts are not 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:--$ hledger balance -M --budget --empty-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:gifts || 0 $100 - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - expenses:supplies || $20 0 - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] --You can roll over unspent budgets to next period with --cumulative:--$ hledger balance -M --budget --cumulative-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - expenses || $495 [ 103% of $480] $1060 [ 110% of $960] - expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100] - expenses:food || $396 [ 99% of $400] $808 [ 101% of $800] - expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60] - income || $1950 [ 98% of $2000] $4050 [ 101% of $4000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] --For more examples, see Budgeting and Forecasting.--Nested budgets--You can add budgets to any account in your account hierarchy. If you-have budgets on both parent account and some of its children, then-budget(s) of the child account(s) would be added to the budget of their-parent, much like account balances behave.--In the most simple case this means that once you add a budget to any-account, all its parents would have budget as well.--To illustrate this, consider the following budget:--~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities--With this, monthly budget for electronics is defined to be $100 and-budget for personal expenses is an additional $1000, which implicity-means that budget for both expenses:personal and expenses is $1100.--Transactions in expenses:personal:electronics will be counted both-towards its $100 budget and $1100 of expenses:personal , and-transactions in any other subaccount of expenses:personal would be-counted towards only towards the budget of expenses:personal.--For example, let's consider these transactions:--~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities--2019/01/01 Google home hub- expenses:personal:electronics $90.00- liabilities $-90.00--2019/01/02 Phone screen protector- expenses:personal:electronics:upgrades $10.00- liabilities--2019/01/02 Weekly train ticket- expenses:personal:train tickets $153.00- liabilities--2019/01/03 Flowers- expenses:personal $30.00- liabilities--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:--$ hledger balance --budget -M-Budget performance in 2019/01:-- || Jan -===============================++===============================- expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - liabilities || $-283.00 [ 26% of $-1100.00] --------------------------------++-------------------------------- || 0 [ 0] --And with --empty, we can get a better picture of budget allocation and-consumption:--$ hledger balance --budget -M --empty-Budget performance in 2019/01:-- || Jan -========================================++===============================- expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - expenses:personal:electronics:upgrades || $10.00 - expenses:personal:train tickets || $153.00 - liabilities || $-283.00 [ 26% of $-1100.00] -----------------------------------------++-------------------------------- || 0 [ 0] --Output format--The balance command supports output destination and output format-selection.+balance++(bal)++A flexible, general purpose "summing" report that shows accounts with+some kind of numeric data. This can be balance changes per period, end+balances, budget performance, unrealised capital gains, etc.++Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --budget[=DESCPAT] calculation mode: show sum of posting amounts+ together with budget goals defined by periodic+ transactions. With a DESCPAT argument (must be+ separated by = not space),+ use only periodic transactions with matching+ description+ (case insensitive substring match).+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports,+ default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name (in+ flat mode). With multiple columns, sorts by the row+ total, or by row average if that is displayed.+ -% --percent express values in percentage of each column's+ total+ -r --related show the other accounts transacted with, instead+ --invert display all amounts with reversed sign+ --transpose switch rows and columns (use vertical time axis)+ --layout=ARG how to lay out multi-commodity amounts and the+ overall table:+ 'wide[,W]': commodities on same line, up to W wide+ 'tall' : commodities on separate lines+ 'bare' : commodity symbols in a separate column+ 'tidy' : each data field in its own column+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json, fods.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++balance is one of hledger's oldest and most versatile commands, for+listing account balances, balance changes, values, value changes and+more, during one time period or many. Generally it shows a table, with+rows representing accounts, and columns representing periods.++Note there are some variants of the balance command with convenient+defaults, which are simpler to use: balancesheet, balancesheetequity,+cashflow and incomestatement. When you need more control, then use+balance.++balance features++Here's a quick overview of the balance command's features, followed by+more detailed descriptions and examples. Many of these work with the+other balance-like commands as well (bs, cf, is..).++balance can show..++- accounts as a list (-l) or a tree (-t)+- optionally depth-limited (-[1-9])+- sorted by declaration order and name, or by amount++..and their..++- balance changes (the default)+- or actual and planned balance changes (--budget)+- or value of balance changes (-V)+- or change of balance values (--valuechange)+- or unrealised capital gain/loss (--gain)+- or balance changes from sibling postings (--related/-r)+- or postings count (--count)++..in..++- one time period (the whole journal period by default)+- or multiple periods (-D, -W, -M, -Q, -Y, -p INTERVAL)++..either..++- per period (the default)+- or accumulated since report start date (--cumulative)+- or accumulated since account creation (--historical/-H)++..possibly converted to..++- cost (--value=cost[,COMM]/--cost/-B)+- or market value, as of transaction dates (--value=then[,COMM])+- or at period ends (--value=end[,COMM])+- or now (--value=now)+- or at some other date (--value=YYYY-MM-DD)++..with..++- totals (-T), averages (-A), percentages (-%), inverted sign (--invert)+- rows and columns swapped (--transpose)+- another field used as account name (--pivot)+- custom-formatted line items (single-period reports only) (--format)+- commodities displayed on the same line or multiple lines (--layout)++This command supports the output destination and output format options,+with output formats txt, csv, tsv (Added in 1.32), json, and+(multi-period reports only:) html, fods (Added in 1.40). In txt output+in a colour-supporting terminal, negative amounts are shown in red.++Simple balance report++With no arguments, balance shows a list of all accounts and their change+of balance - ie, the sum of posting amounts, both inflows and outflows -+during the entire period of the journal. ("Simple" here means just one+column of numbers, covering a single period. You can also have+multi-period reports, described later.)++For real-world accounts, these numbers will normally be their end+balance at the end of the journal period; more on this below.++Accounts are sorted by declaration order if any, and then alphabetically+by account name. For instance (using examples/sample.journal):++$ hledger -f examples/sample.journal bal+ $1 assets:bank:saving+ $-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $-1 income:gifts+ $-1 income:salary+ $1 liabilities:debts+--------------------+ 0 ++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):++$ hledger -f examples/sample.journal bal -E+ 0 assets:bank:checking+ $1 assets:bank:saving+ $-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $-1 income:gifts+ $-1 income:salary+ $1 liabilities:debts+--------------------+ 0 ++The total of the amounts displayed is shown as the last line, unless+-N/--no-total is used.++Balance report line format++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:++$ hledger -f examples/sample.journal balance --format "%20(account) %12(total)"+ assets $-1+ bank:saving $1+ cash $-2+ expenses $2+ food $1+ supplies $1+ income $-2+ gifts $-1+ salary $-1+ liabilities:debts $1+---------------------------------+ 0++The FMT format string specifies the formatting applied to each+account/balance pair. It may contain any suitable text, with data fields+interpolated like so:++%[MIN][.MAX](FIELDNAME)++- MIN pads with spaces to at least this width (optional)++- MAX truncates at this width (optional)++- FIELDNAME must be enclosed in parentheses, and can be one of:++ - depth_spacer - a number of spaces equal to the account's depth, or+ if MIN is specified, MIN * depth spaces.+ - account - the account's name+ - total - the account's balance/posted total, right justified++Also, FMT can begin with an optional prefix to control how+multi-commodity amounts are rendered:++- %_ - render on multiple lines, bottom-aligned (the default)+- %^ - render on multiple lines, top-aligned+- %, - render on one line, comma-separated++There are some quirks. Eg in one-line mode, %(depth_spacer) has no+effect, instead %(account) has indentation built in. Experimentation may+be needed to get pleasing results.++Some example formats:++- %(total) - the account's total+- %-20.20(account) - the account's name, left justified, padded to 20+ characters and clipped at 20 characters+- %,%-50(account) %25(total) - account name padded to 50 characters,+ total padded to 20 characters, with multiple commodities rendered on+ one line+- %20(total) %2(depth_spacer)%-(account) - the default format for the+ single-column balance report++Filtered balance report++You can show fewer accounts, a different time period, totals from+cleared transactions only, etc. by using query arguments or options to+limit the postings being matched. Eg:++$ hledger -f examples/sample.journal bal --cleared assets date:200806+ $-2 assets:cash+--------------------+ $-2 ++List or tree mode++By default, or with -l/--flat, accounts are shown as a flat list 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:++$ hledger -f examples/sample.journal balance+ $-1 assets+ $1 bank:saving+ $-2 cash+ $2 expenses+ $1 food+ $1 supplies+ $-2 income+ $-1 gifts+ $-1 salary+ $1 liabilities:debts+--------------------+ 0++Notes:++- "Boring" accounts are combined with their subaccount for more compact+ output, unless --no-elide is used. Boring accounts have no balance of+ their own and just one subaccount (eg assets:bank and liabilities+ above).++- All balances shown are "inclusive", ie including the balances from all+ subaccounts. Note this means some repetition in the output, which+ requires explanation when sharing reports with+ non-plaintextaccounting-users. A tree mode report's final total is the+ sum of the top-level balances shown, not of all the balances shown.++- Each group of sibling accounts (ie, under a common parent) is sorted+ separately.++Depth limiting++With a depth:NUM query, or --depth NUM option, or just -NUM (eg: -3)+balance reports will show accounts only to the specified depth, hiding+the deeper subaccounts. This can be useful for getting an overview+without too much detail.++Account balances at the depth limit always include the balances from any+deeper subaccounts (even in list mode). Eg, limiting to depth 1:++$ hledger -f examples/sample.journal balance -1+ $-1 assets+ $2 expenses+ $-2 income+ $1 liabilities+--------------------+ 0 ++Dropping top-level accounts++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:++$ hledger -f examples/sample.journal bal expenses --drop 1+ $1 food+ $1 supplies+--------------------+ $2 ++Showing declared accounts++With --declared, accounts which have been declared with an account+directive will be included in the balance report, even if they have no+transactions. (Since they will have a zero balance, you will also need+-E/--empty to see them.)++More precisely, leaf declared accounts (with no subaccounts) will be+included, since those are usually the more useful in reports.++The idea of this is to be able to see a useful "complete" balance+report, even when you don't have transactions in all of your declared+accounts yet.++Sorting by amount++With -S/--sort-amount, accounts with the largest (most positive)+balances are shown first. Eg: hledger bal expenses -MAS shows your+biggest averaged monthly expenses first. When more than one commodity is+present, they will be sorted by the alphabetically earliest commodity+first, and then by subsequent commodities (if an amount is missing a+commodity, it is treated as 0).++Revenues and liability balances are typically negative, however, so -S+shows these in reverse order. To work around this, you can add --invert+to flip the signs. Or you could use one of the higher-level balance+reports (bs, is..), which flip the sign automatically (eg:+hledger is -MAS).++Percentages++With -%/--percent, balance reports show each account's value expressed+as a percentage of the (column) total.++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:++$ hledger bal -% amt:`>0`+$ hledger bal -% amt:`<0`++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:++$ hledger bal -% cur:\\$+$ hledger bal -% cur:€++Multi-period balance report++With a report interval (set by the -D/--daily, -W/--weekly,+-M/--monthly, -Q/--quarterly, -Y/--yearly, or -p/--period flag), balance+shows a tabular report, with columns representing successive time+periods (and a title):++$ hledger -f examples/sample.journal bal --quarterly income expenses -E+Balance changes in 2008:++ || 2008q1 2008q2 2008q3 2008q4 +===================++=================================+ expenses:food || 0 $1 0 0 + expenses:supplies || 0 $1 0 0 + income:gifts || 0 $-1 0 0 + income:salary || $-1 0 0 0 +-------------------++---------------------------------+ || $-1 $1 0 0 ++Notes:++- The report's start/end dates will be expanded, if necessary, to fully+ encompass the displayed subperiods (so that the first and last+ subperiods have the same duration as the others).+- Leading and trailing periods (columns) containing all zeroes are not+ shown, unless -E/--empty is used.+- Accounts (rows) containing all zeroes are not shown, unless -E/--empty+ is used.+- Amounts with many commodities are shown in abbreviated form, unless+ --no-elide is used.+- Average and/or total columns can be added with the -A/--average and+ -T/--row-total flags.+- The --transpose flag can be used to exchange rows and columns.+- The --pivot FIELD option causes a different transaction field to be+ used as "account name". See PIVOTING.+- The --summary-only flag (--summary also works) hides all but the Total+ and Average columns (those should be enabled with --row-total and+ -A/--average).++Multi-period reports with many periods can be too wide for easy viewing+in the terminal. Here are some ways to handle that:++- Hide the totals row with -N/--no-total+- Filter to a single currency with cur:+- Convert to a single currency with -V [--infer-market-price]+- Use a more compact layout like --layout=bare+- Maximize the terminal window+- Reduce the terminal's font size+- View with a pager like less, eg: hledger bal -D --color=yes | less -RS+- Output as CSV and use a CSV viewer like visidata+ (hledger bal -D -O csv | vd -f csv), Emacs' csv-mode+ (M-x csv-mode, C-c C-a), or a spreadsheet+ (hledger bal -D -o a.csv && open a.csv)+- Output as HTML and view with a browser:+ hledger bal -D -o a.html && open a.html++Balance change, end balance++It's important to be clear on the meaning of the numbers shown in+balance reports. Here is some terminology we use:++A balance change is the net amount added to, or removed from, an account+during some period.++An end balance is the amount accumulated in an account as of some date+(and some time, but hledger doesn't store that; assume end of day in+your timezone). It is the sum of previous balance changes.++We call it a historical end balance if it includes all balance changes+since the account was created. For a real world account, this means it+will match the "historical record", eg the balances reported in your+bank statements or bank web UI. (If they are correct!)++In general, balance changes are what you want to see when reviewing+revenues and expenses, and historical end balances are what you want to+see when reviewing or reconciling asset, liability and equity accounts.++balance shows balance changes by default. To see accurate historical end+balances:++1. Initialise account starting balances with an "opening balances"+ transaction (a transfer from equity to the account), unless the+ journal covers the account's full lifetime.++2. Include all of of the account's prior postings in the report, by not+ specifying a report start date, or by using the -H/--historical+ flag. (-H causes report start date to be ignored when summing+ postings.)++Balance report modes++The balance command is quite flexible; here is the full detail on how to+control what it reports. If the following seems complicated, don't+worry - this is for advanced reporting, and it does take time and+experimentation to get familiar with all the report modes.++There are three important option groups:++hledger balance [CALCULATIONMODE] [ACCUMULATIONMODE] [VALUATIONMODE] ...++Calculation mode++The basic calculation to perform for each table cell. It is one of:++- --sum : sum the posting amounts (default)+- --budget : sum the amounts, but also show the budget goal amount (for+ each account/period)+- --valuechange : show the change in period-end historical balance+ values (caused by deposits, withdrawals, and/or market price+ fluctuations)+- --gain : show the unrealised capital gain/loss, (the current valued+ balance minus each amount's original cost)+- --count : show the count of postings++Accumulation mode++How amounts should accumulate across a report's subperiods/columns.+Another way to say it: which time period's postings should contribute to+each cell's calculation. It is one of:++- --change : calculate with postings from column start to column end, ie+ "just this column". Typically used to see revenues/expenses. (default+ for balance, cashflow, incomestatement)++- --cumulative : calculate with postings from report start to column+ end, ie "previous columns plus this column". Typically used to show+ changes accumulated since the report's start date. Not often used.++- --historical/-H : calculate with postings from journal start to column+ end, ie "all postings from before report start date until this+ column's end". Typically used to see historical end balances of+ assets/liabilities/equity. (default for balancesheet,+ balancesheetequity)++Valuation mode++Which kind of value or cost conversion should be applied, if any, before+displaying the report. See Cost reporting and Value reporting for more+about conversions.++A valuation (or cost) mode can be selected with the --value option:++- no conversion : don't convert to cost or value (default)+- --value=cost[,COMM] : convert amounts to cost (then optionally to some+ other commodity)+- --value=then[,COMM] : convert amounts to market value on transaction+ dates+- --value=end[,COMM] : convert amounts to market value on period end+ date(s)+ (default with --valuechange, --gain)+- --value=now[,COMM] : convert amounts to market value on today's date+- --value=YYYY-MM-DD[,COMM] : convert amounts to market value on another+ date++or with the legacy -B/-V/-X options, which are equivalent and easier to+type:++- -B/--cost : like --value=cost+- -V/--market : like --value=end+- -X COMM/--exchange COMM : like --value=end,COMM++Note that --value can also convert to cost, as a convenience; but+actually --cost and --value are independent options, and could be used+together.++Combining balance report modes++Most combinations of these modes should produce reasonable reports, but+if you find any that seem wrong or misleading, let us know. The+following restrictions are applied:++- --valuechange implies --value=end+- --valuechange makes --change the default when used with the+ balancesheet/balancesheetequity commands+- --cumulative or --historical disables --row-total/-T++For reference, here is what the combinations of accumulation and+valuation show:++ ------------------------------------------------------------------------------------------------+ Valuation:> no valuation --value= then --value= end --value= YYYY-MM-DD /now+ Accumulation:v + ------------------ ---------------- ----------------- --------------- --------------------------+ --change change in period sum of period-end DATE-value of change in+ posting-date value of change period+ market values in in period + period ++ --cumulative change from sum of period-end DATE-value of change from+ report start to posting-date value of change report start to period end+ period end market values from report + from report start start to period + to period end end ++ --historical /-H change from sum of period-end DATE-value of change from+ journal start to posting-date value of change journal start to period+ period end market values from journal end+ (historical end from journal start to period + balance) start to period end + end + ------------------------------------------------------------------------------------------------++Budget report++The --budget report is like a regular balance report, but with two main+differences:++- Budget goals and performance percentages are also shown, in brackets+- Accounts which don't have budget goals are hidden by default.++This is useful for comparing planned and actual income, expenses, time+usage, etc.++Periodic transaction rules are used to define budget goals. For example,+here's a periodic rule defining monthly goals for bus travel and food+expenses:++;; Budget+~ monthly+ (expenses:bus) $30+ (expenses:food) $400++After recording some actual expenses,++;; Two months worth of expenses+2017-11-01+ income $-1950+ expenses:bus $35+ expenses:food:groceries $310+ expenses:food:dining $42+ expenses:movies $38+ assets:bank:checking++2017-12-01+ income $-2100+ expenses:bus $53+ expenses:food:groceries $380+ expenses:food:dining $32+ expenses:gifts $100+ assets:bank:checking++we can see a budget report like this:++$ hledger bal -M --budget+Budget performance in 2017-11-01..2017-12-31:++ || Nov Dec +===============++============================================+ <unbudgeted> || $-425 $-565 + expenses || $425 [ 99% of $430] $565 [131% of $430] + expenses:bus || $35 [117% of $30] $53 [177% of $30] + expenses:food || $352 [ 88% of $400] $412 [103% of $400] +---------------++--------------------------------------------+ || 0 [ 0% of $430] 0 [ 0% of $430] ++This is "goal-based budgeting"; you define goals for accounts and+periods, often recurring, and hledger shows performance relative to the+goals. This contrasts with "envelope budgeting", which is more detailed+and strict - useful when cash is tight, but also quite a bit more work.+https://plaintextaccounting.org/Budgeting has more on this topic.++Using the budget report++Historically this report has been confusing and fragile. hledger's+version should be relatively robust and intuitive, but you may still+find surprises. Here are more notes to help with learning and+troubleshooting.++- In the above example, expenses:bus and expenses:food are shown because+ they have budget goals during the report period.++- Their parent expenses is also shown, with budget goals aggregated from+ the children.++- The subaccounts expenses:food:groceries and expenses:food:dining are+ not shown since they have no budget goal of their own, but they+ contribute to expenses:food's actual amount.++- Unbudgeted accounts expenses:movies and expenses:gifts are also not+ shown, but they contribute to expenses's actual amount.++- The other unbudgeted accounts income and assets:bank:checking are+ grouped as <unbudgeted>.++- --depth or depth: can be used to limit report depth in the usual way+ (but will not reveal unbudgeted subaccounts).++- Amounts are always inclusive of subaccounts (even in -l/--list mode).++- Numbers displayed in a --budget report will not always agree with the+ totals, because of hidden unbudgeted accounts; this is normal.+ -E/--empty can be used to reveal the hidden accounts.++- In the periodic rules used for setting budget goals, unbalanced+ postings are convenient.++- You can filter budget reports with the usual queries, eg to focus on+ particular accounts. It's common to restrict them to just expenses.+ (The <unbudgeted> account is occasionally hard to exclude; this is+ because of date surprises, discussed below.)++- When you have multiple currencies, you may want to convert them to one+ (-X COMM --infer-market-prices) and/or show just one at a time+ (cur:COMM). If you do need to show multiple currencies at once,+ --layout bare can be helpful.++- You can "roll over" amounts (actual and budgeted) to the next period+ with --cumulative.++See also: https://hledger.org/budgeting.html.++Budget date surprises++With small data, or when starting out, some of the generated budget goal+transaction dates might fall outside the report periods. Eg with the+following journal and report, the first period appears to have no+expenses:food budget. (Also the <unbudgeted> account should be excluded+by the expenses query, but isn't.):++~ monthly in 2020+ (expenses:food) $500++2020-01-15+ expenses:food $400+ assets:checking++$ hledger bal --budget expenses+Budget performance in 2020-01-15:++ || 2020-01-15 +===============++====================+ <unbudgeted> || $400 + expenses:food || 0 [ 0% of $500] +---------------++--------------------+ || $400 [80% of $500] ++In this case, the budget goal transactions are generated on first days+of of month (this can be seen with+hledger print --forecast tag:generated expenses). Whereas the report+period defaults to just the 15th day of january (this can be seen from+the report table's column headings).++To fix this kind of thing, be more explicit about the report period+(and/or the periodic rules' dates). In this case, adding -b 2020 does+the trick.++Selecting budget goals++By default, the budget report uses all available periodic transaction+rules to generate goals. This includes rules with a different report+interval from your report. Eg if you have daily, weekly and monthly+periodic rules, all of these will contribute to the goals in a monthly+budget report.++You can select a subset of periodic rules by providing an argument to+the --budget flag. --budget=DESCPAT will match all periodic rules whose+description contains DESCPAT, a case-insensitive substring (not a+regular expression or query). This means you can give your periodic+rules descriptions (remember that two spaces are needed between period+expression and description), and then select from multiple budgets+defined in your journal.++Budgeting vs forecasting++--forecast and --budget both use the periodic transaction rules in the+journal to generate temporary transactions for reporting purposes.+However they are separate features - though you can use both at the same+time if you want. Here are some differences between them:++ -----------------------------------------------------------------------+ --forecast --budget+ -------------------------------------- --------------------------------+ is a general option; it enables is a balance command option; it+ forecasting with all reports selects the balance report's+ budget mode++ generates visible transactions which generates invisible transactions+ appear in reports which produce goal amounts++ generates forecast transactions from generates budget goal+ after the last regular transaction, to transactions throughout the+ the end of the report period; or with report period, optionally+ an argument --forecast=PERIODEXPR restricted by periods specified+ generates them throughout the in the periodic transaction+ specified period, both optionally rules+ restricted by periods specified in the + periodic transaction rules ++ uses all periodic rules uses all periodic rules; or with+ an argument --budget=DESCPAT+ uses just the rules matched by+ DESCPAT+ -----------------------------------------------------------------------++Balance report layout++The --layout option affects how balance and the other balance-like+commands show multi-commodity amounts and commodity symbols. It can+improve readability, for humans and/or machines (other software). It has+four possible values:++- --layout=wide[,WIDTH]: commodities are shown on a single line,+ optionally elided to WIDTH+- --layout=tall: each commodity is shown on a separate line+- --layout=bare: commodity symbols are in their own column, amounts are+ bare numbers+- --layout=tidy: data is normalised to easily-consumed "tidy" form, with+ one row per data value. (This one is currently supported only by the+ balance command.)++Here are the --layout modes supported by each output format Only CSV+output supports all of them:++ - txt csv html json sql+ ------ ----- ----- ------ ------ -----+ wide Y Y Y + tall Y Y Y + bare Y Y Y + tidy Y ++Examples:++Wide layout++With many commodities, reports can be very wide:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide+Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total +==================++====================================================================================================================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT +------------------++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT ++A width limit reduces the width, but some commodities will be hidden:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide,32+Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total +==================++===========================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. +------------------++---------------------------------------------------------------------------------------------------------------------------+ || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. ++Tall layout++Each commodity gets a new line (may be different in each column), and+account names are repeated:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=tall+Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total +==================++==================================================+ Assets:US:ETrade || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD + Assets:US:ETrade || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + Assets:US:ETrade || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD + Assets:US:ETrade || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + Assets:US:ETrade || 18.00 VHT 294.00 VHT +------------------++--------------------------------------------------+ || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD + || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD + || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + || 18.00 VHT 294.00 VHT ++Bare layout++Commodity symbols are kept in one column, each commodity has its own+row, amounts are bare numbers, account names are repeated:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=bare+Balance changes in 2012-01-01..2014-12-31:++ || Commodity 2012 2013 2014 Total +==================++=============================================+ Assets:US:ETrade || GLD 0 70.00 0 70.00 + Assets:US:ETrade || ITOT 10.00 18.00 -11.00 17.00 + Assets:US:ETrade || USD 337.18 -98.12 4881.44 5120.50 + Assets:US:ETrade || VEA 12.00 10.00 14.00 36.00 + Assets:US:ETrade || VHT 106.00 18.00 170.00 294.00 +------------------++---------------------------------------------+ || GLD 0 70.00 0 70.00 + || ITOT 10.00 18.00 -11.00 17.00 + || USD 337.18 -98.12 4881.44 5120.50 + || VEA 12.00 10.00 14.00 36.00 + || VHT 106.00 18.00 170.00 294.00 ++Bare layout also affects CSV output, which is useful for producing data+that is easier to consume, eg for making charts:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare+"account","commodity","balance"+"Assets:US:ETrade","GLD","70.00"+"Assets:US:ETrade","ITOT","17.00"+"Assets:US:ETrade","USD","5120.50"+"Assets:US:ETrade","VEA","36.00"+"Assets:US:ETrade","VHT","294.00"+"Total:","GLD","70.00"+"Total:","ITOT","17.00"+"Total:","USD","5120.50"+"Total:","VEA","36.00"+"Total:","VHT","294.00"++Bare layout will sometimes display an extra row for the no-symbol+commodity, because of zero amounts (hledger treats zeroes as+commodity-less, usually). This can break hledger-bar confusingly+(workaround: add a cur: query to exclude the no-symbol row).++Tidy layout++This produces normalised "tidy data" (see+https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html)+where every variable has its own column and each row represents a single+data point. This is the easiest kind of data for other software to+consume:++$ 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"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","ITOT","10.00"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","USD","337.18"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","VEA","12.00"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","VHT","106.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","GLD","70.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","ITOT","18.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","USD","-98.12"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","VEA","10.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","VHT","18.00"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","GLD","0"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","ITOT","-11.00"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","USD","4881.44"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","VEA","14.00"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","VHT","170.00"++Balance report output++As noted in Output format, if you choose HTML output (by using -O html+or -o somefile.html), you can create a hledger.css file in the same+directory to customise the report's appearance.++The HTML and FODS output formats can generate hyperlinks to a+hledger-web register view for each account and period. E.g. if your+hledger-web server is reachable at http://localhost:5000 then you might+run the balance command with the extra option+--base-url=http://localhost:5000. You can also produce relative links,+like --base-url="some/path" or --base-url="".)++Some useful balance reports++Some frequently used balance options/reports are:++- bal -M revenues expenses+ Show revenues/expenses in each month. Also available as the+ incomestatement command.++- bal -M -H assets liabilities+ Show historical asset/liability balances at each month end. Also+ available as the balancesheet command.++- bal -M -H assets liabilities equity+ Show historical asset/liability/equity balances at each month end.+ Also available as the balancesheetequity command.++- bal -M assets not:receivable+ Show changes to liquid assets in each month. Also available as the+ cashflow command.++Also:++- bal -M expenses -2 -SA+ Show monthly expenses summarised to depth 2 and sorted by average+ amount.++- bal -M --budget expenses+ Show monthly expenses and budget goals.++- bal -M --valuechange investments+ Show monthly change in market value of investment assets.++- bal investments --valuechange -D date:lastweek amt:'>1000' -STA [--invert]+ Show top gainers [or losers] last week
Hledger/Cli/Commands/Balancesheet.hs view
@@ -1,5 +1,6 @@-{-# LANGUAGE RecordWildCards #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-} {-| The @balancesheet@ command prints a simple balance sheet.@@ -23,18 +24,20 @@ cbcqueries = [ CBCSubreportSpec{ cbcsubreporttitle="Assets"- ,cbcsubreportquery=journalAssetAccountQuery- ,cbcsubreportnormalsign=NormallyPositive+ ,cbcsubreportquery=Type [Asset]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyPositive})+ ,cbcsubreporttransform=id ,cbcsubreportincreasestotal=True } ,CBCSubreportSpec{ cbcsubreporttitle="Liabilities"- ,cbcsubreportquery=journalLiabilityAccountQuery- ,cbcsubreportnormalsign=NormallyNegative+ ,cbcsubreportquery=Type [Liability]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})+ ,cbcsubreporttransform=fmap maNegate ,cbcsubreportincreasestotal=False } ],- cbctype = HistoricalBalance+ cbcaccum = Historical } balancesheetmode :: Mode RawOpts@@ -42,4 +45,3 @@ balancesheet :: CliOpts -> Journal -> IO () balancesheet = compoundBalanceCommand balancesheetSpec-
Hledger/Cli/Commands/Balancesheet.txt view
@@ -1,41 +1,94 @@-balancesheet, bs-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date). It assumes that these accounts are under a top-level asset or-liability account (case insensitive, plural forms also allowed).+balancesheet -Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).+(bs) -_FLAGS_+Show the end balances in asset and liability accounts. Amounts are shown+with normal positive sign, as in conventional financial statements. -Example:+Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format. -$ hledger balancesheet-Balance Sheet+This command displays a balance sheet, showing historical ending+balances of asset and liability accounts. (To see equity as well, use+the balancesheetequity command.) -Assets:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1+Accounts declared with the Asset, Cash or Liability type are shown (see+account types). Or if no such accounts are declared, it shows top-level+accounts named asset or liability (case insensitive, plurals allowed)+and their subaccounts. -Liabilities:- $1 liabilities:debts---------------------- $1+Example: -Total:---------------------- 0+$ hledger balancesheet+Balance Sheet 2008-12-31 -With a reporting interval, multiple columns will be shown, one for each-report period. As with multicolumn balance reports, you can alter the-report mode with --change/--cumulative/--historical. Normally-balancesheet shows historical ending balances, which is what you need-for a balance sheet; note this means it ignores report begin dates.+ || 2008-12-31 +====================++============+ Assets || +--------------------++------------+ assets:bank:saving || $1 + assets:cash || $-2 +--------------------++------------+ || $-1 +====================++============+ Liabilities || +--------------------++------------+ liabilities:debts || $-1 +--------------------++------------+ || $-1 +====================++============+ Net: || 0 -This command also supports output destination and output format-selection.+This command is a higher-level variant of the balance command, and+supports many of that command's features, such as multi-period reports.+It is similar to hledger balance -H assets liabilities, but with smarter+account detection, and liabilities displayed with their sign flipped.++This command also supports the output destination and output format+options The output formats supported are txt, csv, tsv (Added in 1.32),+html, and json.
Hledger/Cli/Commands/Balancesheetequity.hs view
@@ -1,5 +1,7 @@-{-# LANGUAGE QuasiQuotes, RecordWildCards #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE QuasiQuotes #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-} {-| The @balancesheetequity@ command prints a simple balance sheet.@@ -23,24 +25,27 @@ cbcqueries = [ CBCSubreportSpec{ cbcsubreporttitle="Assets"- ,cbcsubreportquery=journalAssetAccountQuery- ,cbcsubreportnormalsign=NormallyPositive+ ,cbcsubreportquery=Type [Asset]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyPositive})+ ,cbcsubreporttransform=id ,cbcsubreportincreasestotal=True } ,CBCSubreportSpec{ cbcsubreporttitle="Liabilities"- ,cbcsubreportquery=journalLiabilityAccountQuery- ,cbcsubreportnormalsign=NormallyNegative+ ,cbcsubreportquery=Type [Liability]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})+ ,cbcsubreporttransform=fmap maNegate ,cbcsubreportincreasestotal=False } ,CBCSubreportSpec{ cbcsubreporttitle="Equity"- ,cbcsubreportquery=journalEquityAccountQuery- ,cbcsubreportnormalsign=NormallyNegative+ ,cbcsubreportquery=Type [Equity]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})+ ,cbcsubreporttransform=fmap maNegate ,cbcsubreportincreasestotal=False } ],- cbctype = HistoricalBalance+ cbcaccum = Historical } balancesheetequitymode :: Mode RawOpts
Hledger/Cli/Commands/Balancesheetequity.txt view
@@ -1,31 +1,101 @@-balancesheetequity, bse-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level equity account).+balancesheetequity -_FLAGS_+(bse) +This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts. Amounts are shown with+normal positive sign, as in conventional financial statements.++Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++This report shows accounts declared with the Asset, Cash, Liability or+Equity type (see account types). 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: $ hledger balancesheetequity-Balance Sheet With Equity+Balance Sheet With Equity 2008-12-31 -Assets:- $-2 assets- $1 bank:saving- $-3 cash---------------------- $-2+ || 2008-12-31 +====================++============+ Assets || +--------------------++------------+ assets:bank:saving || $1 + assets:cash || $-2 +--------------------++------------+ || $-1 +====================++============+ Liabilities || +--------------------++------------+ liabilities:debts || $-1 +--------------------++------------+ || $-1 +====================++============+ Equity || +--------------------++------------+--------------------++------------+ || 0 +====================++============+ Net: || 0 -Liabilities:- $1 liabilities:debts---------------------- $1+This command is a higher-level variant of the balance command, and+supports many of that command's features, such as multi-period reports.+It is similar to hledger balance -H assets liabilities equity, but with+smarter account detection, and liabilities/equity displayed with their+sign flipped. -Equity:- $1 equity:owner---------------------- $1+This report is the easiest way to see if the accounting equation (A+L+E+= 0) is satisfied (after you have done a close --retain to merge+revenues and expenses with equity, and perhaps added --infer-equity to+balance your commodity conversions). -Total:---------------------- 0+This command also supports the output destination and output format+options The output formats supported are txt, csv, tsv, html, and json.
Hledger/Cli/Commands/Cashflow.hs view
@@ -1,5 +1,7 @@-{-# LANGUAGE QuasiQuotes, RecordWildCards #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE QuasiQuotes #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-} {-| The @cashflow@ command prints a simplified cashflow statement. It just@@ -26,12 +28,13 @@ cbcqueries = [ CBCSubreportSpec{ cbcsubreporttitle="Cash flows"- ,cbcsubreportquery=journalCashAccountQuery- ,cbcsubreportnormalsign=NormallyPositive+ ,cbcsubreportquery=Type [Cash]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_= Just NormallyPositive})+ ,cbcsubreporttransform=id ,cbcsubreportincreasestotal=True } ],- cbctype = PeriodChange+ cbcaccum = PerPeriod } cashflowmode :: Mode RawOpts
Hledger/Cli/Commands/Cashflow.txt view
@@ -1,33 +1,95 @@-cashflow, cf-This command displays a simple cashflow statement, showing changes in-"cash" accounts. It assumes that these accounts are under a top-level-asset account (case insensitive, plural forms also allowed) and do not-contain receivable or A/R in their name. Note this report shows all-account balances with normal positive sign (like conventional financial-statements, unlike balance/print/register) (experimental).+cashflow -_FLAGS_+(cf) -Example:+This command displays a (simple) cashflow statement, showing the inflows+and outflows affecting "cash" (ie, liquid, easily convertible) assets.+Amounts are shown with normal positive sign, as in conventional+financial statements. -$ hledger cashflow-Cashflow Statement+Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format. -Cash flows:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1+This report shows accounts declared with the Cash type (see account+types). Or if no such accounts are declared, it shows accounts -Total:---------------------- $-1+- under a top-level account named asset (case insensitive, plural+ allowed)+- whose name contains some variation of cash, bank, checking or saving. -With a reporting interval, multiple columns will be shown, one for each-report period. Normally cashflow shows changes in assets per period,-though as with multicolumn balance reports you can alter the report mode-with --change/--cumulative/--historical.+More precisely: all accounts matching this case insensitive regular+expression: -This command also supports output destination and output format-selection.+^assets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|currentcash)(:|$)++and their subaccounts.++An example cashflow report:++$ hledger cashflow+Cashflow Statement 2008++ || 2008 +====================++======+ Cash flows || +--------------------++------+ assets:bank:saving || $1 + assets:cash || $-2 +--------------------++------+ || $-1 ++This command is a higher-level variant of the balance command, and+supports many of that command's features, such as multi-period reports.+It is similar to+hledger balance assets not:fixed not:investment not:receivable, but with+smarter account detection.++This command also supports the output destination and output format+options The output formats supported are txt, csv, tsv (Added in 1.32),+html, and json.
+ Hledger/Cli/Commands/Check.hs view
@@ -0,0 +1,113 @@+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE TupleSections #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Check (+ checkmode+ ,check+) where++import Data.Char (toLower)+import Data.Either (partitionEithers)+import Data.List (isPrefixOf, find, sort)+import Control.Monad (forM_)+import System.Console.CmdArgs.Explicit++import Hledger+import Hledger.Cli.CliOptions++checkmode :: Mode RawOpts+checkmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Check.txt")+ []+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[CHECKS]")++check :: CliOpts -> Journal -> IO ()+check copts@CliOpts{rawopts_} j = do+ let + args = listofstringopt "args" rawopts_+ -- reset the report spec that was generated by argsToCliOpts,+ -- since we are not using arguments as a query in the usual way+ copts' = cliOptsUpdateReportSpecWith (\ropts -> ropts{querystring_=[]}) copts++ case partitionEithers (map parseCheckArgument args) of+ (unknowns@(_:_), _) -> error' $ "These checks are unknown: "++unwords unknowns+ ([], checks) -> forM_ (sort checks) $ runCheck copts' j+ +-- | Regenerate this CliOpts' report specification, after updating its+-- underlying report options with the given update function.+-- This can raise an error if there is a problem eg due to missing or+-- unparseable options data. See also updateReportSpecFromOpts.+cliOptsUpdateReportSpecWith :: (ReportOpts -> ReportOpts) -> CliOpts -> CliOpts+cliOptsUpdateReportSpecWith roptsupdate copts@CliOpts{reportspec_} =+ case updateReportSpecWith roptsupdate reportspec_ of+ Left e -> error' e -- PARTIAL:+ Right rs -> copts{reportspec_=rs}++-- | A type of error check that we can perform on the data.+-- If performing multiple checks, they will be performed in the order defined here, generally.+-- (We report only the first failure, so the more useful checks should come first.)+data Check =+ -- keep the order here synced with Check.md and Hledger.Data.JournalChecks.journalStrictChecks.+ -- done always+ Parseable+ | Autobalanced+ | Assertions -- unless -I is used+ -- done when --strict is used, or when specified with the check command+ | Balanced+ | Commodities+ | Accounts+ -- done when specified with the check command+ | Ordereddates+ | Payees+ | Tags+ | Recentassertions+ | Uniqueleafnames+ deriving (Read,Show,Eq,Enum,Bounded,Ord)++-- | Parse the name (or a name prefix) of an error check, or return the name unparsed.+-- Check names are conventionally all lower case, but this parses case insensitively.+parseCheck :: String -> Either String Check+parseCheck s = + maybe (Left s) (Right . read) $ -- PARTIAL: read should not fail here+ find (s' `isPrefixOf`) $ checknames+ where+ s' = capitalise $ map toLower s+ checknames = map show [minBound..maxBound::Check]++-- | Parse a check argument: a string which is the lower-case name of an error check,+-- or a prefix thereof, followed by zero or more space-separated arguments for that check.+parseCheckArgument :: String -> Either String (Check,[String])+parseCheckArgument s =+ dbg3 "check argument" $+ ((,checkargs)) <$> parseCheck checkname+ where+ (checkname:checkargs) = words' s++-- XXX do all of these print on stderr ?+-- | Run the named error check, possibly with some arguments, +-- on this journal with these options.+runCheck :: CliOpts -> Journal -> (Check,[String]) -> IO ()+runCheck _opts j (chck,_) = do+ let+ results = case chck of+ -- these checks are assumed to have passed earlier during journal parsing (if enabled):+ Parseable -> Right ()+ Autobalanced -> Right ()+ Balanced -> Right ()+ Assertions -> Right ()+ Accounts -> journalCheckAccounts j+ Commodities -> journalCheckCommodities j+ Ordereddates -> journalCheckOrdereddates j+ Payees -> journalCheckPayees j+ Recentassertions -> journalCheckRecentAssertions j+ Tags -> journalCheckTags j+ Uniqueleafnames -> journalCheckUniqueleafnames j++ case results of+ Right () -> return ()+ Left err -> error' err
+ Hledger/Cli/Commands/Check.txt view
@@ -0,0 +1,105 @@+check++Check for various kinds of errors in your data.++Flags:+no command-specific flags++hledger provides a number of built-in correctness checks to help+validate your data and prevent errors. Some are run automatically, some+when you enable --strict mode; or you can run any of them on demand by+providing them as arguments to the check command. check produces no+output and a zero exit code if all is well. Eg:++hledger check # run basic checks+hledger check -s # run basic and strict checks+hledger check ordereddates payees # run basic checks and two others++If you are an Emacs user, you can also configure flycheck-hledger to run+these checks, providing instant feedback as you edit the journal.++Here are the checks currently available. They are generally checked in+the order they are shown here, and only the first failure will be+reported.++Basic checks++These important checks are performed by default, by almost all hledger+commands:++- parseable - data files are in a supported format, with no syntax+ errors and no invalid include directives. This ensures that all files+ exist and are readable.++- autobalanced - all transactions are balanced, after automatically+ inferring missing amounts and conversion rates and then converting+ amounts to cost. This ensures that each transaction's journal entry is+ well formed.++- assertions - all balance assertions in the journal are passing.+ Balance assertions are a strong defense against errors, catching many+ problems. This check is on by default, but if it gets in your way, you+ can disable it temporarily with -I/--ignore-assertions, or as a+ default by adding that flag to your config file. (Then use -s/--strict+ or hledger check assertions when you want to enable it).++Strict checks++When the -s/--strict flag is used (AKA strict mode), all commands will+perform the following additional checks (and assertions, above). These+provide extra error-catching power to help you keep your data clean and+correct:++- balanced - like autobalanced, but implicit conversions between+ commodities are not allowed; all conversion transactions must use cost+ notation or equity postings. This prevents wrong conversions caused by+ typos.++- commodities - all commodity symbols used must be declared. This guards+ against mistyping or omitting commodity symbols.++- accounts - all account names used must be declared. This prevents the+ use of mis-spelled or outdated account names.++Other checks++These are not wanted by everyone, but can be run using the check+command:++- tags - all tags used must be declared. This prevents mis-spelled tag+ names. Note hledger fairly often finds unintended tags in comments.++- payees - all payees used in transactions must be declared. This will+ force you to declare any new payee name before using it. Most people+ will probably find this a bit too strict.++- ordereddates - within each file, transactions must be ordered by date.+ This is a simple and effective error catcher. It's not included in+ strict mode, but you can add it by running+ hledger check -s ordereddates. If enabled, this check is performed+ before balance assertions.++- recentassertions - all accounts with balance assertions must have one+ that's within the 7 days before their latest posting. This will+ encourage adding balance assertions for your active asset/liability+ accounts, which in turn should encourage you to reconcile regularly+ with those real world balances - another strong defense against+ errors. (hledger close --assert >>$LEDGER_FILE is a convenient way to+ add new balance assertions. Later these become quite redundant, and+ you might choose to remove them to reduce clutter.)++- uniqueleafnames - no two accounts may have the same last account name+ part (eg the checking in assets:bank:checking). This ensures each+ account can be matched by a unique short name, easier to remember and+ to type.++Custom checks++You can build your own custom checks with add-on command scripts. See+also Cookbook > Scripting. Here are some examples from hledger/bin/:++- hledger-check-tagfiles - all tag values containing / exist as file+ paths++- hledger-check-fancyassertions - more complex balance assertions are+ passing
− Hledger/Cli/Commands/Checkdates.hs
@@ -1,70 +0,0 @@-{-# LANGUAGE NoOverloadedStrings #-} -- prevent trouble if turned on in ghci-{-# LANGUAGE TemplateHaskell #-}--module Hledger.Cli.Commands.Checkdates (- checkdatesmode- ,checkdates-) where--import Hledger-import Hledger.Cli.CliOptions-import System.Console.CmdArgs.Explicit-import Text.Printf--checkdatesmode :: Mode RawOpts-checkdatesmode = hledgerCommandMode- $(embedFileRelative "Hledger/Cli/Commands/Checkdates.txt")- [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"]- [generalflagsgroup1]- []- ([], Just $ argsFlag "[QUERY]")--checkdates :: CliOpts -> Journal -> IO ()-checkdates CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do- d <- getCurrentDay- let ropts_ = ropts{accountlistmode_=ALFlat}- let q = queryFromOpts d ropts_- let ts = filter (q `matchesTransaction`) $- jtxns $ journalSelectingAmountFromOpts ropts j- let strict = boolopt "strict" rawopts- let date = transactionDateFn ropts- let compare a b =- if strict- then date a < date b- else date a <= date b- case checkTransactions compare ts of- FoldAcc{fa_previous=Nothing} -> putStrLn "ok (empty journal)"- FoldAcc{fa_error=Nothing} -> putStrLn "ok"- FoldAcc{fa_error=Just error, fa_previous=Just previous} ->- putStrLn $ printf ("ERROR: transaction out of%s date order"- ++ "\nPrevious date: %s"- ++ "\nDate: %s"- ++ "\nLocation: %s"- ++ "\nTransaction:\n\n%s")- (if strict then " STRICT" else "")- (show $ date previous)- (show $ date error)- (show $ tsourcepos error)- (showTransactionUnelided error)--data FoldAcc a b = FoldAcc- { fa_error :: Maybe a- , fa_previous :: Maybe b- }--foldWhile :: (a -> FoldAcc a b -> FoldAcc a b) -> FoldAcc a b -> [a] -> FoldAcc a b-foldWhile _ acc [] = acc-foldWhile fold acc (a:as) =- case fold a acc of- acc@FoldAcc{fa_error=Just _} -> acc- acc -> foldWhile fold acc as--checkTransactions :: (Transaction -> Transaction -> Bool)- -> [Transaction] -> FoldAcc Transaction Transaction-checkTransactions compare = foldWhile f FoldAcc{fa_error=Nothing, fa_previous=Nothing}- where- f current acc@FoldAcc{fa_previous=Nothing} = acc{fa_previous=Just current}- f current acc@FoldAcc{fa_previous=Just previous} =- if compare previous current- then acc{fa_previous=Just current}- else acc{fa_error=Just current}
− Hledger/Cli/Commands/Checkdates.txt
@@ -1,7 +0,0 @@-check-dates-Check that transactions are sorted by increasing date. With --date2,-checks secondary dates instead. With --strict, dates must also be-unique. With a query, only matched transactions' dates are checked.-Reads the default journal file, or another specified with -f.--_FLAGS_
− Hledger/Cli/Commands/Checkdupes.hs
@@ -1,43 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}--module Hledger.Cli.Commands.Checkdupes (- checkdupesmode- ,checkdupes-) -where--import Data.Function-import Data.List-import qualified Data.Text as T-import Hledger-import Hledger.Cli.CliOptions-import System.Console.CmdArgs.Explicit-import Text.Printf--checkdupesmode :: Mode RawOpts-checkdupesmode = hledgerCommandMode- $(embedFileRelative "Hledger/Cli/Commands/Checkdupes.txt")- []- [generalflagsgroup1]- []- ([], Nothing)--checkdupes _opts j = mapM_ render $ checkdupes' $ accountsNames j--accountsNames :: Journal -> [(String, AccountName)]-accountsNames j = map leafAndAccountName as- where leafAndAccountName a = (T.unpack $ accountLeafName a, a)- ps = journalPostings j- as = nub $ sort $ map paccount ps--checkdupes' :: (Ord k, Eq k) => [(k, v)] -> [(k, [v])]-checkdupes' l = zip dupLeafs dupAccountNames- where dupLeafs = map (fst . head) d- dupAccountNames = map (map snd) d- d = dupes' l- dupes' = filter ((> 1) . length)- . groupBy ((==) `on` fst)- . sortBy (compare `on` fst)--render :: (String, [AccountName]) -> IO ()-render (leafName, accountNameL) = printf "%s as %s\n" leafName (intercalate ", " (map T.unpack accountNameL))
− Hledger/Cli/Commands/Checkdupes.txt
@@ -1,8 +0,0 @@-check-dupes-Reports account names having the same leaf but different prefixes. In-other words, two or more leaves that are categorized differently. Reads-the default journal file, or another specified as an argument.--_FLAGS_--An example: http://stefanorodighiero.net/software/hledger-dupes.html
Hledger/Cli/Commands/Close.hs view
@@ -1,66 +1,263 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE MultiWayIf #-} module Hledger.Cli.Commands.Close ( closemode ,close-) +) where -import Control.Monad (when)-import Data.Maybe-import Data.Time.Calendar+import Data.Function (on)+import Data.List (groupBy)+import Data.Maybe (fromMaybe)+import Data.Text qualified as T+import Data.Text.IO qualified as T+import Data.Time.Calendar (addDays) import System.Console.CmdArgs.Explicit as C import Hledger import Hledger.Cli.CliOptions+import Safe (lastDef, readMay, readDef)+import System.FilePath (takeBaseName)+import Data.Char (isDigit)+import Hledger.Read.RulesReader (parseBalanceAssertionType)+import Hledger.Cli.Commands.Print (roundFlag, amountStylesSetRoundingFromRawOpts) +defclosedesc = "closing balances"+defopendesc = "opening balances"+defretaindesc = "retain earnings"++defcloseacct = "equity:opening/closing balances"+defretainacct = "equity:retained earnings"+ closemode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Close.txt")- [flagNone ["opening"] (setboolopt "opening") "show just opening transaction"- ,flagNone ["closing"] (setboolopt "closing") "show just closing transaction"+ [flagOpt "" ["clopen"] (\s opts -> Right $ setopt "clopen" s opts) "TAGVAL" "show closing and opening balances transactions, for AL accounts by default"+ ,flagOpt "" ["close"] (\s opts -> Right $ setopt "close" s opts) "TAGVAL" "show just a closing balances transaction"+ ,flagOpt "" ["open"] (\s opts -> Right $ setopt "open" s opts) "TAGVAL" "show just an opening balances transaction"+ ,flagOpt "" ["assert"] (\s opts -> Right $ setopt "assert" s opts) "TAGVAL" "show a balance assertions transaction"+ ,flagOpt "" ["assign"] (\s opts -> Right $ setopt "assign" s opts) "TAGVAL" "show a balance assignments transaction"+ ,flagOpt "" ["retain"] (\s opts -> Right $ setopt "retain" s opts) "TAGVAL" "show a retain earnings transaction, for RX accounts by default"+ ,flagNone ["explicit","x"] (setboolopt "explicit") "show all amounts explicitly"+ ,flagNone ["show-costs"] (setboolopt "show-costs") "show amounts with different costs separately"+ ,flagNone ["interleaved"] (setboolopt "interleaved") "show source and destination postings together"+ ,flagReq ["assertion-type"] (\s opts -> Right $ setopt "assertion-type" s opts) "TYPE" "=, ==, =* or ==*"+ ,flagReq ["close-desc"] (\s opts -> Right $ setopt "close-desc" s opts) "DESC" "set closing transaction's description"+ ,flagReq ["close-acct"] (\s opts -> Right $ setopt "close-acct" s opts) "ACCT" "set closing transaction's destination account"+ ,flagReq ["open-desc"] (\s opts -> Right $ setopt "open-desc" s opts) "DESC" "set opening transaction's description"+ ,flagReq ["open-acct"] (\s opts -> Right $ setopt "open-acct" s opts) "ACCT" "set opening transaction's source account"+ ,roundFlag ]- [generalflagsgroup1]- []- ([], Just $ argsFlag "[QUERY]")+ cligeneralflagsgroups1+ (hiddenflags+ ++ -- keep supporting old flag names for compatibility+ [flagNone ["closing"] (setboolopt "close") "old spelling of --close"+ ,flagNone ["opening"] (setboolopt "open") "old spelling of --open"+ ,flagNone ["migrate"] (setboolopt "clopen") "old spelling of --clopen"+ ,flagReq ["close-to"] (\s opts -> Right $ setopt "close-acct" s opts) "ACCT" "old spelling of --close-acct"+ ,flagReq ["open-from"] (\s opts -> Right $ setopt "open-acct" s opts) "ACCT" "old spelling of --open-acct"+ ]+ )+ ([], Just $ argsFlag "[--close|--open|--clopen|--assign|--assert|--retain] [ACCTQUERY]") -close CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do- today <- getCurrentDay- let - (opening, closing) = - case (boolopt "opening" rawopts, boolopt "closing" rawopts) of- (False, False) -> (True, True) -- by default show both opening and closing- (o, c) -> (o, c)- ropts_ = ropts{balancetype_=HistoricalBalance, accountlistmode_=ALFlat}- q = queryFromOpts today ropts_- openingdate = fromMaybe today $ queryEndDate False q- closingdate = addDays (-1) openingdate- (acctbals,_) = balanceReportFromMultiBalanceReport ropts_ q j- balancingamt = negate $ sum $ map (\(_,_,_,b) -> normaliseMixedAmountSquashPricesForDisplay b) acctbals+-- | The close command's mode (subcommand).+-- The code depends on these spellings.+data CloseMode = Clopen | Close | Open | Assign | Assert | Retain deriving (Eq,Show,Read) - -- since balance assertion amounts are required to be exact, the- -- amounts in opening/closing transactions should be too (#941)- -- setprec = setFullPrecision- setprec = setMinimalPrecision- -- balance assertion amounts will be unpriced, cf #824- closingps = [posting{paccount=a- ,pamount=mixed [setprec $ negate b]- ,pbalanceassertion=Just assertion{baamount=setprec b{aquantity=0, aprice=NoPrice}}- }- | (a,_,_,mb) <- acctbals- , b <- amounts $ normaliseMixedAmountSquashPricesForDisplay mb- ]- ++ [posting{paccount="equity:closing balances", pamount=negate balancingamt}]+-- | Pick the rightmost flag spelled like a CloseMode (--clopen, --close, --open, etc), or default to Close.+closeModeFromRawOpts :: RawOpts -> CloseMode+closeModeFromRawOpts rawopts = lastDef Close $ collectopts (\(name,_) -> readMay (capitalise name)) rawopts - openingps = [posting{paccount=a- ,pamount=mixed [setprec b]- ,pbalanceassertion=Just assertion{baamount=setprec b{aprice=NoPrice}}- }- | (a,_,_,mb) <- acctbals- , b <- amounts $ normaliseMixedAmountSquashPricesForDisplay mb- ]- ++ [posting{paccount="equity:opening balances", pamount=balancingamt}]+-- Debugger, beware: close is incredibly devious; simple rules combine to make a horrid maze.+-- Tests are in hledger/test/close.test.+close CliOpts{rawopts_=rawopts, reportspec_=rspec0} j = do+ let+ mode_ = closeModeFromRawOpts rawopts+ defacctsq_ = if mode_ == Retain then Type [Revenue, Expense] else Type [Asset, Liability]+ defcloseacct_ = if mode_ == Retain then defretainacct else defcloseacct+ closeacct = T.pack $ fromMaybe defcloseacct_ $ maybestringopt "close-acct" rawopts+ openacct = maybe closeacct T.pack $ maybestringopt "open-acct" rawopts - when closing $ putStr $ showTransaction (nulltransaction{tdate=closingdate, tdescription="closing balances", tpostings=closingps})- when opening $ putStr $ showTransaction (nulltransaction{tdate=openingdate, tdescription="opening balances", tpostings=openingps})+ -- For easy matching and exclusion, a recognisable tag is added to all generated transactions+ tagval = fromMaybe "" $ maybestringopt modeflag rawopts where modeflag = lowercase $ show mode_+ comment = T.pack $ if+ | mode_ == Assert -> "assert:" <> tagval+ | mode_ == Assign -> "assign:" <> tagval+ | mode_ == Retain -> "retain:" <> tagval+ | otherwise -> "clopen:" <> if null tagval then inferredval else tagval+ where+ inferredval = newfilebasename+ where+ oldfilebasename = takeBaseName $ journalFilePath j+ (nonnum, rest) = break isDigit $ reverse oldfilebasename+ (oldnum, rest2) = span isDigit rest+ newfilebasename = case oldnum of+ [] -> ""+ _ -> reverse rest2 <> newnum <> reverse nonnum+ where+ newnum = show $ 1 + readDef err (reverse oldnum) -- PARTIAL: should not fail+ where err = error' $ "could not read " <> show oldnum <> " as a number in Hledger.Cli.Commands.Close.close" + ropts = (_rsReportOpts rspec0){balanceaccum_=Historical, accountlistmode_=ALFlat}+ rspec1 = setDefaultConversionOp NoConversionOp rspec0{_rsReportOpts=ropts}++ -- Dates of the closing and opening transactions.+ -- "The default closing date is yesterday, or the journal's end date, whichever is later.+ -- You can change this by specifying a [report end date](#report-start--end-date) with `-e`.+ -- The last day of the report period will be the closing date, eg `-e 2024` means "close on 2023-12-31".+ -- The opening date is always the day after the closing date."+ argsq = _rsQuery rspec1+ yesterday = addDays (-1) $ _rsDay rspec1+ yesterdayorjournalend = case journalLastDay False j of+ Just journalend -> max yesterday journalend+ Nothing -> yesterday+ mreportlastday = addDays (-1) <$> queryEndDate False argsq+ closedate = fromMaybe yesterdayorjournalend mreportlastday+ opendate = addDays 1 closedate++ -- should we show the amount(s) on the equity posting(s) ?+ explicit = boolopt "explicit" rawopts++ -- the accounts to close+ argsacctq = filterQuery (\q -> queryIsAcct q || queryIsType q) argsq+ q2 = if queryIsNull argsacctq then And [argsq, defacctsq_] else argsq+ -- always exclude the balancing equity account+ q3 = And [q2, Not $ Acct $ accountNameToAccountOnlyRegex closeacct]+ -- the balances to close+ rspec3 = rspec1{_rsQuery=q3}+ (acctbals',_) = balanceReport rspec3 j+ acctbals = map (\(a,_,_,b) -> (a, if show_costs_ ropts then b else mixedAmountStripCosts b)) acctbals'+ totalamt = maSum $ map snd acctbals++ -- since balance assertion amounts are required to be exact, the+ -- amounts in opening/closing transactions should be too (#941, #1137)+ precise = amountSetFullPrecision++ -- interleave equity postings next to the corresponding closing posting, or put them all at the end ?+ interleaved = boolopt "interleaved" rawopts++ -- a balance assertion template of the right type+ assertion =+ case maybestringopt "assertion-type" rawopts >>= parseBalanceAssertionType of+ Nothing -> nullassertion+ Just (total, inclusive) -> nullassertion{batotal=total, bainclusive=inclusive}++ -- the closing (balance-asserting or balance-zeroing) transaction+ mclosetxn+ | mode_ `notElem` [Clopen, Close, Assert, Retain] = Nothing+ | otherwise = Just nulltransaction{+ tdate=closedate, tdescription=closedesc, tcomment=comment, tpostings=closeps+ }+ where+ closedesc = T.pack $ fromMaybe defclosedesc_ $ maybestringopt "close-desc" rawopts+ where+ defclosedesc_+ | mode_ == Retain = defretaindesc+ | mode_ == Assert = "assert balances"+ | otherwise = defclosedesc+ closeps+ -- XXX some duplication+ | mode_ == Assert =+ [ posting{+ paccount = a+ ,pamount = mixedAmount $ precise b{aquantity=0, acost=Nothing}+ -- after each commodity's last posting, assert 0 balance (#1035)+ -- balance assertion amounts are unpriced (#824)+ ,pbalanceassertion =+ if islast+ then Just assertion{baamount=precise b}+ else Nothing+ }+ | -- get the balances for each commodity and transaction price+ (a,mb) <- acctbals+ , let bs0 = amounts mb+ -- mark the last balance in each commodity with True+ , let bs2 = concat [reverse $ zip (reverse bs1) (True : repeat False)+ | bs1 <- groupBy ((==) `on` acommodity) bs0]+ , (b, islast) <- bs2+ ]++ | otherwise =+ concat [+ posting{paccount = a+ ,pamount = mixedAmount . precise $ negate b+ -- after each commodity's last posting, assert 0 balance (#1035)+ -- balance assertion amounts are unpriced (#824)+ ,pbalanceassertion =+ if islast+ then Just assertion{baamount=precise b{aquantity=0, acost=Nothing}}+ else Nothing+ }++ -- maybe an interleaved posting transferring this balance to equity+ : [posting{paccount=closeacct, pamount=mixedAmount $ precise b} | interleaved]++ | -- get the balances for each commodity and transaction price+ (a,mb) <- acctbals+ , let bs0 = amounts mb+ -- mark the last balance in each commodity with True+ , let bs2 = concat [reverse $ zip (reverse bs1) (True : repeat False)+ | bs1 <- groupBy ((==) `on` acommodity) bs0]+ , (b, islast) <- bs2+ ]++ -- or a final multicommodity posting transferring all balances to equity+ -- (print will show this as multiple single-commodity postings)+ ++ [posting{paccount=closeacct, pamount=if explicit then mixedAmountSetFullPrecision totalamt else missingmixedamt} | not interleaved]++ -- the opening (balance-assigning or balance-unzeroing) transaction+ mopentxn+ | mode_ `notElem` [Clopen, Open, Assign] = Nothing+ | otherwise = Just nulltransaction{+ tdate=opendate, tdescription=opendesc, tcomment=comment, tpostings=openps+ }+ where+ opendesc = T.pack $ fromMaybe defopendesc $ maybestringopt "open-desc" rawopts+ openps+ | mode_ == Assign =+ [ posting{paccount = a+ ,pamount = missingmixedamt+ ,pbalanceassertion = Just assertion{baamount=b}+ -- case mcommoditysum of+ -- Just s -> Just nullassertion{baamount=precise s}+ -- Nothing -> Nothing+ }++ | (a,mb) <- acctbals+ , let bs0 = amounts mb+ -- mark the last balance in each commodity with the unpriced sum in that commodity (for a balance assertion)+ , let bs2 = concat [reverse $ zip (reverse bs1) (Just commoditysum : repeat Nothing)+ | bs1 <- groupBy ((==) `on` acommodity) bs0+ , let commoditysum = (sum bs1)]+ , (b, _mcommoditysum) <- bs2+ ]+ ++ [posting{paccount=openacct, pamount=if explicit then mixedAmountSetFullPrecision (maNegate totalamt) else missingmixedamt} | not interleaved]++ | otherwise =+ concat [+ posting{paccount = a+ ,pamount = mixedAmount $ precise b+ ,pbalanceassertion =+ case mcommoditysum of+ Just s -> Just assertion{baamount=precise s{acost=Nothing}}+ Nothing -> Nothing+ }+ : [posting{paccount=openacct, pamount=mixedAmount . precise $ negate b} | interleaved]++ | (a,mb) <- acctbals+ , let bs0 = amounts mb+ -- mark the last balance in each commodity with the unpriced sum in that commodity (for a balance assertion)+ , let bs2 = concat [reverse $ zip (reverse bs1) (Just commoditysum : repeat Nothing)+ | bs1 <- groupBy ((==) `on` acommodity) bs0+ , let commoditysum = (sum bs1)]+ , (b, mcommoditysum) <- bs2+ ]+ ++ [posting{paccount=openacct, pamount=if explicit then mixedAmountSetFullPrecision (maNegate totalamt) else missingmixedamt} | not interleaved]++ -- print them+ -- allow user-specified rounding with --round, like print+ let styles = amountStylesSetRoundingFromRawOpts rawopts $ journalCommodityStyles j+ maybe (pure ()) (T.putStr . showTransaction . styleAmounts styles) mclosetxn+ maybe (pure ()) (T.putStr . showTransaction . styleAmounts styles) mopentxn+
Hledger/Cli/Commands/Close.txt view
@@ -1,78 +1,247 @@-close, equity-Prints a "closing balances" transaction and an "opening balances"-transaction that bring account balances to and from zero, respectively.-Useful for bringing asset/liability balances forward into a new journal-file, or for closing out revenues/expenses to retained earnings at the-end of a period.+close -_FLAGS_+(equity) -The closing transaction transfers balances to "equity:closing balances".-The opening transaction transfers balances from "equity:opening-balances". You can chose to print just one of the transactions by using-the --opening or --closing flag.+close prints several kinds of "closing" and/or "opening" transactions,+useful in various situations: migrating balances to a new journal file,+retaining earnings into equity, consolidating balances, viewing lot+costs.. Like print, it prints valid journal entries. You can copy these+into your journal file(s) when you are happy with how they look. -If you split your journal files by time (eg yearly), you will typically-run this command at the end of the year, and save the closing-transaction as last entry of the old file, and the opening transaction-as the first entry of the new file. This makes the files self contained,-so that correct balances are reported no matter which of them are-loaded. Ie, if you load just one file, the balances are initialised-correctly; or if you load several files, the redundant closing/opening-transactions cancel each other out. (They will show up in print or-register reports; you can exclude them with a query like-not:desc:'(opening|closing) balances'.)+Flags:+ --clopen[=TAGVAL] show closing and opening balances transactions,+ for AL accounts by default+ --close[=TAGVAL] show just a closing balances transaction+ --open[=TAGVAL] show just an opening balances transaction+ --assert[=TAGVAL] show a balance assertions transaction+ --assign[=TAGVAL] show a balance assignments transaction+ --retain[=TAGVAL] show a retain earnings transaction, for RX+ accounts by default+ -x --explicit show all amounts explicitly+ --show-costs show amounts with different costs separately+ --interleaved show source and destination postings together+ --assertion-type=TYPE =, ==, =* or ==*+ --close-desc=DESC set closing transaction's description+ --close-acct=ACCT set closing transaction's destination account+ --open-desc=DESC set opening transaction's description+ --open-acct=ACCT set opening transaction's source account+ --round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none - show original decimal digits,+ as in journal (default)+ soft - just add or remove decimal zeros+ to match precision+ hard - round posting amounts to precision+ (can unbalance transactions)+ all - also round cost amounts to precision+ (can unbalance transactions) -If you're running a business, you might also use this command to "close-the books" at the end of an accounting period, transferring income-statement account balances to retained earnings. (You may want to change-the equity account name to something like "equity:retained earnings".)+close has six modes, selected by choosing one of the mode flags:+--clopen, --close (default), --open, --assert, --assign, or --retain.+They are all doing the same kind of operation, but with different+defaults for different situations. -By default, the closing transaction is dated yesterday, the balances are-calculated as of end of yesterday, and the opening transaction is dated-today. To close on some other date, use: hledger close -e OPENINGDATE.-Eg, to close/open on the 2018/2019 boundary, use -e 2019. You can also-use -p or date:PERIOD (any starting date is ignored).+The journal entries generated by close will have a clopen: tag, which is+helpful when you want to exclude them from reports. If the main journal+file name contains a number, the tag's value will be that base file name+with the number incremented. Eg if the journal file is 2025.journal, the+tag will be clopen:2026. Or you can set the tag value by providing an+argument to the mode flag. Eg --close=foo or --clopen=2025-main. -Both transactions will include balance assertions for the-closed/reopened accounts. You probably shouldn't use status or realness-filters (like -C or -R or status:) with this command, or the generated-balance assertions will depend on these flags. Likewise, if you run this-command with --auto, the balance assertions will probably always require---auto.+close --clopen -Examples:+This is useful if migrating balances to a new journal file at the start+of a new year. It prints a "closing balances" transaction that zeroes+out account balances (Asset and Liability accounts, by default), and an+opposite "opening balances" transaction that restores them again.+Typically, you would run -Carrying asset/liability balances into a new file for 2019, all from-command line:+hledger close --clopen -e NEWYEAR >> $LEDGER_FILE -_Warning: we use >> here to append; be careful not to type a single >-which would wipe your journal!_+and then move the opening transaction from the old file to the new file+(and probably also update your LEDGER_FILE environment variable). -$ hledger close -f 2018.journal -e 2019 assets liabilities --opening >>2019.journal-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal+Why might you do this ? If your reports are fast, you may not need it.+But at some point you will probably want to partition your data by time,+for performance or data integrity or regulatory reasons. A new file or+set of files per year is common. Then, having each file/fileset+"bookended" with opening and closing balance transactions will allow you+to freely pick and choose which files to read - just the current year,+any past year, any sequence of years, or all of them - while showing+correct account balances in each case. The earliest opening balances+transaction sets correct starting balances, and any later+closing/opening pairs will harmlessly cancel each other out. -Now:+The balances will be transferred to and from+equity:opening/closing balances by default. You can override this by+using --close-acct and/or --open-acct. -$ 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+You can select a different set of accounts to close/open by providing an+account query. Eg to add Equity accounts, provide arguments like+assets liabilities equity or type:ALE. When migrating to a new file,+you'll usually want to bring along the AL or ALE accounts, but not the+RX accounts (Revenue, Expense). -Transactions spanning the closing date can complicate matters, breaking-balance assertions:+Assertions will be added indicating and checking the new balances of the+closed/opened accounts. -2018/12/30 a purchase made in 2018, clearing the following year+close --close++This prints just the closing balances transaction of --clopen. It is the+default if you don't specify a mode.++More customisation options are described below. Among other things, you+can use close --close to generate a transaction moving the balances from+any set of accounts, to a different account. (If you need to move just a+portion of the balance, see hledger-move.)++close --open++This prints just the opening balances transaction of --clopen. (It is+similar to Ledger's equity command.)++close --assert++This prints a transaction that asserts the account balances as they are+on the end date (and adds an assert: tag). It could be useful as+documention and to guard against changes.++close --assign++This prints a transaction that assigns the account balances as they are+on the end date (and adds an "assign:" tag). Unlike balance assertions,+assignments will post changes to balances as needed to reach the+specified amounts.++This is another way to set starting balances when migrating to a new+file, and it will set them correctly even in the presence of earlier+files which do not have a closing balances transaction. However, it can+hide errors, and disturb the accounting equation, so --clopen is usually+recommended.++close --retain++This is like --close, but it closes Revenue and Expense account balances+by default. They will be transferred to equity:retained earnings, or+another account specified with --close-acct.++Revenues and expenses correspond to changes in equity. They are+categorised separately for reporting purposes, but traditionally at the+end of each accounting period, businesses consolidate them into equity,+This is called "retaining earnings", or "closing the books".++In personal accounting, there's not much reason to do this, and most+people don't. (One reason to do it is to help the balancesheetequity+report show a zero total, demonstrating that the accounting equation+(A-L=E) is satisfied.)++close customisation++In all modes, the following things can be overridden:++- the accounts to be closed/opened, with account query arguments+- the closing/opening dates, with -e OPENDATE+- the balancing account, with --close-acct=ACCT and/or --open-acct=ACCT+- the transaction descriptions, with --close-desc=DESC and+ --open-desc=DESC+- the transactions' clopen tag value, with a TAGVAL argument for the+ mode flag (see above).++By default, the closing date is yesterday, or the journal's end date,+whichever is later; and the opening date is always one day after the+closing date. You can change these by specifying a report end date; the+closing date will be the last day of the report period. Eg -e 2024 means+"close on 2023-12-31, open on 2024-01-01".++With --x/--explicit, the balancing amount will be shown explicitly, and+if it involves multiple commodities, a separate posting will be+generated for each of them (similar to print -x).++With --interleaved, each individual transfer is shown with source and+destination postings next to each other (perhaps useful for+troubleshooting).++With --show-costs, balances' costs are also shown, with different costs+kept separate. This may generate very large journal entries, if you have+many currency conversions or investment transactions. close --show-costs+is currently the best way to view investment lots with hledger. (To move+or dispose of lots, see the more capable hledger-move script.)++close and balance assertions++close adds balance assertions verifying that the accounts have been+reset to zero in a closing transaction or restored to their previous+balances in an opening transaction. These provide useful error checking,+but you can ignore them temporarily with -I, or remove them if you+prefer.++Single-commodity, subaccount-exclusive balance assertions (=) are+generated by default. This can be changed with --assertion-type='==*'+(eg).++When running close you should probably avoid using -C, -R, status:+(filtering by status or realness) or --auto (generating postings), since+the generated balance assertions would then require these.++Transactions with multiple dates (eg posting dates) spanning the file+boundary also can disrupt the balance assertions:++2023-12-30 a purchase made in december, cleared in january expenses:food 5- assets:bank:checking -5 ; [2019/1/2]+ assets:bank:checking -5 ; date: 2023-01-02 -Here's one way to resolve that:+To solve this you can transfer the money to and from a temporary+account, splitting the multi-day transaction into two single-day+transactions: -; in 2018.journal:-2018/12/30 a purchase made in 2018, clearing the following year+; in 2022.journal:+2022-12-30 a purchase made in december, cleared in january expenses:food 5- liabilities:pending+ equity:pending -5 -; in 2019.journal:-2019/1/2 clearance of last year's pending transactions- liabilities:pending 5 = 0- assets:checking+; in 2023.journal:+2023-01-02 last year's transaction cleared+ equity:pending 5 = 0+ assets:bank:checking -5++close examples++Retain earnings++Record 2022's revenues/expenses as retained earnings on 2022-12-31,+appending the generated transaction to the journal:++$ hledger close --retain -f 2022.journal -p 2022 >> 2022.journal++After this, to see 2022's revenues and expenses you must exclude the+retain earnings transaction:++$ hledger -f 2022.journal is not:desc:'retain earnings'++Migrate balances to a new file++Close assets/liabilities on 2022-12-31 and re-open them on 2023-01-01:++$ hledger close --clopen -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++After this, to see 2022's end-of-year balances you must exclude the+closing balances transaction:++$ hledger -f 2022.journal bs not:desc:'closing balances'++For more flexibility, it helps to tag closing and opening transactions+with eg clopen:NEWYEAR, then you can ensure correct balances by+excluding all opening/closing transactions except the first, like so:++$ hledger bs -Y -f 2021.j -f 2022.j -f 2023.j expr:'tag:clopen=2021 or not tag:clopen'+$ hledger bs -Y -f 2021.j -f 2022.j expr:'tag:clopen=2021 or not tag:clopen'+$ hledger bs -Y -f 2022.j -f 2023.j expr:'tag:clopen=2022 or not tag:clopen'+$ hledger bs -Y -f 2021.j expr:'tag:clopen=2021 or not tag:clopen'+$ hledger bs -Y -f 2022.j expr:'tag:clopen=2022 or not tag:clopen'+$ hledger bs -Y -f 2023.j # unclosed file, no query needed++More detailed close examples++See examples/multi-year.
+ Hledger/Cli/Commands/Codes.hs view
@@ -0,0 +1,39 @@+{-|++The @codes@ command lists the codes seen in transactions, in the order parsed.++-}++{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Codes (+ codesmode+ ,codes+) where++import Data.Text qualified as T+import Data.Text.IO qualified as T++import Hledger+import Hledger.Cli.CliOptions+++-- | Command line options for this command.+codesmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Codes.txt")+ []+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[QUERY]")++-- | The codes command.+codes :: CliOpts -> Journal -> IO ()+codes CliOpts{reportspec_=rspec} j = do+ let ts = entriesReport rspec j+ codes' = (if empty_ (_rsReportOpts rspec) then id else filter (not . T.null)) $+ map tcode ts+ mapM_ T.putStrLn codes'
+ Hledger/Cli/Commands/Codes.txt view
@@ -0,0 +1,46 @@+codes++List the codes seen in transactions, in the order parsed.++Flags:+no command-specific flags++This command prints the value of each transaction's code field, in the+order transactions were parsed. The transaction code is an optional+value written in parentheses between the date and description, often+used to store a cheque number, order number or similar.++Transactions aren't required to have a code, and missing or empty codes+will not be shown by default. With the -E/--empty flag, they will be+printed as blank lines.++You can add a query to select a subset of transactions.++Examples:++2022/1/1 (123) Supermarket + Food $5.00+ Checking ++2022/1/2 (124) Post Office+ Postage $8.32+ Checking++2022/1/3 Supermarket+ Food $11.23+ Checking ++2022/1/4 (126) Post Office+ Postage $3.21+ Checking++$ hledger codes+123+124+126++$ hledger codes -E+123+124++126
+ Hledger/Cli/Commands/Commands.txt view
@@ -0,0 +1,6 @@+commands++Show the hledger commands list.++Flags:+ --builtin show only builtin commands, not addons
Hledger/Cli/Commands/Commodities.hs view
@@ -12,25 +12,50 @@ ,commodities ) where -import Control.Monad-import Data.List-import qualified Data.Map as M-import qualified Data.Text.IO as T+import Data.Map qualified as M+import Data.Set qualified as S+import Data.Text.IO qualified as T+import System.Console.CmdArgs.Explicit import Hledger import Hledger.Cli.CliOptions+import Data.List.Extra (nubSort)+import Data.List ((\\)) -- | Command line options for this command. commoditiesmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Commodities.txt")- []+ [flagNone ["used"] (setboolopt "used") "list commodities used"+ ,flagNone ["declared"] (setboolopt "declared") "list commodities declared"+ ,flagNone ["undeclared"] (setboolopt "undeclared") "list commodities used but not declared"+ ,flagNone ["unused"] (setboolopt "unused") "list commodities declared but not used"+ ,flagNone ["find"] (setboolopt "find") "list the first commodity matched by the first argument (a case-insensitive infix regexp)"+ ] [generalflagsgroup2]- []- ([], Nothing)+ confflags+ ([], Just $ argsFlag "[QUERY..]") commodities :: CliOpts -> Journal -> IO ()-commodities _copts j = do- let cs = filter (/= "AUTO") $- nub $ sort $ M.keys (jcommodities j) ++ M.keys (jinferredcommodities j)- forM_ cs T.putStrLn+commodities opts@CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query}} j = do+ let+ filt = filter (matchesCommodity query)+ used = dbg5 "used" $ S.toList $ journalCommoditiesFromPriceDirectives j <> journalCommoditiesFromTransactions j+ declared' = dbg5 "declared" $ M.keys $ jdeclaredcommodities j+ unused = dbg5 "unused" $ declared' \\ used+ undeclared = dbg5 "undeclared" $ used \\ declared'+ all' = dbg5 "all" $ nubSort $ concat [+ journalCommoditiesDeclared j+ ,map pdcommodity $ jpricedirectives j -- gets the first symbol from P directives+ ,map acommodity (S.toList $ journalAmounts j) -- includes the second symbol from P directives+ ]+ found = dbg5 "found" $ findMatchedByArgument rawopts "commodity" all'++ mapM_ T.putStrLn $+ case declarablesSelectorFromOpts opts of+ Nothing -> filt all'+ Just Used -> filt used+ Just Declared -> filt declared'+ Just Undeclared -> filt undeclared+ Just Unused -> filt unused+ Just Find -> [found]
Hledger/Cli/Commands/Commodities.txt view
@@ -1,4 +1,19 @@ commodities-List all commodity/currency symbols used or declared in the journal. -_FLAGS_+List the commodity symbols used or declared in the journal.++Flags:+ --used list commodities used+ --declared list commodities declared+ --undeclared list commodities used but not declared+ --unused list commodities declared but not used+ --find list the first commodity matched by the first+ argument (a case-insensitive infix regexp)++This command lists commodity symbols/names - all of them by default, or+just the ones which have been used in transactions or P directives, or+declared with commodity directives, or used but not declared, or+declared but not used, or just the first one matched by a pattern (with+--find, returning a non-zero exit code if it fails).++You can add cur: query arguments to further limit the commodities.
+ Hledger/Cli/Commands/Demo.hs view
@@ -0,0 +1,180 @@+{-|+The @demo@ command lists and plays small hledger demos in the terminal, using asciinema.+-}+{-+PROJECTS+improve cast output+ install+ command line editing glitches+ shrink / compress ?+ help+ screen corrupted by pager+ demo+ update (or drop till stable)+ add+ print+ balance+document cast production tips+ always clear screen after running pager/curses apps ?+ record with tall window to avoid showing pager in playback ?+improve functionality+ show "done" in final red line ?+ mirror common asciinema flags like -s, -i and/or set speed/max idle with optional arguments+ support other asciinema operations (cat)+ show hledger.org player urls+ windows/PowerSession support+ attract/continuous play mode+more casts+ clarify goals/target user(s)/scenarios+ identify and prioritise some casts needed+-}++{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Demo (+ demomode+ ,demo+) where++import Text.Printf+import Control.Concurrent (threadDelay)+import System.Process (callProcess)+import System.IO.Error (catchIOError)+import Safe (readMay, atMay, headMay)+import Data.List (isPrefixOf, find, findIndex, isInfixOf, dropWhileEnd)+import Control.Applicative ((<|>))+import Data.ByteString as B (ByteString)+import Data.Maybe+import Data.ByteString.Char8 qualified as B+import Safe (tailMay)+import System.IO.Temp (withSystemTempFile)+import System.IO (hClose)+import System.Console.CmdArgs.Explicit (flagReq)++import Hledger+import Hledger.Cli.CliOptions+import System.Directory (findExecutable)+import Control.Monad (when)++demos :: [Demo]+demos = map readDemo [+ -- XXX these are confusing, redo+ -- (embedFileRelative "embeddedfiles/help.cast"), -- https://asciinema.org/a/568112 Getting help+ -- (embedFileRelative "embeddedfiles/demo.cast"), -- https://asciinema.org/a/567944 Watching the built-in demos+ $(embedFileRelative "embeddedfiles/add.cast"), -- https://asciinema.org/a/567935 The easiest way to start a journal (add)+ $(embedFileRelative "embeddedfiles/print.cast"), -- https://asciinema.org/a/567936 Show full transactions (print)+ $(embedFileRelative "embeddedfiles/balance.cast"), -- https://asciinema.org/a/567937 Show account balances and changes (balance)+ $(embedFileRelative "embeddedfiles/install.cast") -- https://asciinema.org/a/567934 Installing hledger from source with hledger-install+ ]++-- | An embedded asciinema cast, with some of the metadata separated out.+-- The original file name is not preserved.+data Demo = Demo {+ dtitle :: String, -- asciinema title field+ _dcontent :: ByteString -- asciinema v2 content+}++-- | Command line options for this command.+demomode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Demo.txt")+ [+ flagReq ["speed","s"] (\s opts -> Right $ setopt "speed" s opts) "SPEED"+ ("playback speed (1 is original speed, .5 is half, 2 is double, etc (default: 2))")+ ]+ [generalflagsgroup3]+ []+ ([], Just $ argsFlag optsstr)++optsstr = "[NUM|PREFIX|SUBSTR]"+-- optsstr = "[NUM|PREFIX|SUBSTR] [-- ASCIINEMAOPTS]"+usagestr = "Usage: hledger demo " <> optsstr++-- | The demo command.+demo :: CliOpts -> Journal -> IO ()+demo CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=_query}} _j = do+ -- demos <- getCurrentDirectory >>= readDemos+ case listofstringopt "args" rawopts of+ [] -> putStrLn usagestr >> putStr listDemos+ (a:as) ->+ case findDemo demos a of+ Nothing -> error' $ unlines+ ["No demo \"" <> a <> "\" was found."+ ,usagestr+ ,listDemos+ ]+ Just (Demo t c) -> do+ -- check if asciinema is installed, first+ masciinema <- findExecutable "asciinema"+ when (isNothing masciinema) $ error' "Could not find 'asciinema'; please install that first."+ let+ -- try to preserve the original pauses a bit while also moving things along+ defidlelimit = 10+ defspeed = 2+ speed =+ case maybestringopt "speed" rawopts of+ Nothing -> defspeed+ Just s -> fromMaybe err $ readMay s+ where err = error' $ "could not parse --speed " <> s <> ", numeric argument expected"+ idx = maybe 0 (1+) $ findIndex (\(Demo t2 _) -> t2 == t) demos -- should succeed+ mw <- getTerminalWidth+ let line = red' $ replicate w '.' where w = fromMaybe (length t) mw+ printf "playing: %d) %s\nspace to pause, . to step, ctrl-c to quit\n" idx (bold' t)+ putStrLn line+ putStrLn ""+ threadDelay 1000000+ -- XXX this used to see asciinema options after --, currently it doesn't+ runAsciinemaPlay speed defidlelimit c as+ putStrLn ""+ putStrLn line++readDemo :: ByteString -> Demo+readDemo content = Demo title content+ where+ title = maybe "" (readTitle . B.unpack) $ headMay $ B.lines content+ where+ readTitle s+ | "\"title\":" `isPrefixOf` s = takeWhile (/='"') $ drop 1 $ lstrip $ drop 8 s+ | otherwise = maybe "" readTitle $ tailMay s++findDemo :: [Demo] -> String -> Maybe Demo+findDemo ds s =+ (readMay s >>= atMay ds . subtract 1) -- try to find by number+ <|> find ((sl `isPrefixOf`).lowercase.dtitle) ds -- or by title prefix (ignoring case)+ <|> find ((sl `isInfixOf`) .lowercase.dtitle) ds -- or by title substring (ignoring case)+ where+ sl = lowercase s++listDemos :: String+listDemos = unlines $+ "Demos:" :+ -- "" :+ [show i <> ") " <> bold' t | (i, Demo t _) <- zip [(1::Int)..] demos]++-- | Run asciinema play with the given speed and idle limit, passing the given content to its stdin.+runAsciinemaPlay :: Float -> Float -> ByteString -> [String] -> IO ()+runAsciinemaPlay speed idlelimit content args = do+ -- XXX try piping to stdin also+ withSystemTempFile "hledger-cast" $ \f h -> do+ -- don't add an extra newline here, it breaks asciinema 2.3.0 (#2094).+ -- XXX we could try harder and strip excess newlines/carriage returns+linefeeds here+ B.hPutStr h content >> hClose h+ callProcess "asciinema" (dbg8With (("asciinema: "++).unwords) $ concat [+ ["play"]+ ,["-s"<> showwithouttrailingzero speed]+ ,if idlelimit == 0 then [] else ["-i"<>showwithouttrailingzero idlelimit]+ ,[f]+ ,args+ ])+ `catchIOError` \err -> do+ printError $ unlines+ [""+ ,show err+ ,"Running asciinema failed. Trying 'asciinema --version':"+ ]+ callProcess "asciinema" ["--version"]+ `catchIOError` \_ -> error' "This also failed."+ where+ showwithouttrailingzero = dropWhileEnd (=='.') . dropWhileEnd (=='0') . show+
+ Hledger/Cli/Commands/Demo.txt view
@@ -0,0 +1,27 @@+demo++Play demos of hledger usage in the terminal, if asciinema is installed.++Flags:+ -s --speed=SPEED playback speed (1 is original speed, .5 is half, 2+ is double, etc (default: 2))++Run this command with no argument to list the demos. To play a demo,+write its number or a prefix or substring of its title. Tips:++Make your terminal window large enough to see the demo clearly.++Use the -s/--speed SPEED option to set your preferred playback speed, eg+-s4 to play at 4x original speed or -s.5 to play at half speed. The+default speed is 2x.++During playback, several keys are available: SPACE to pause/unpause, .+to step forward (while paused), CTRL-c quit.++Examples:++$ hledger demo # list available demos+$ hledger demo 1 # play the first demo at default speed (2x)+$ hledger demo install -s4 # play the "install" demo at 4x speed++This command is experimental: there aren't many useful demos yet.
+ Hledger/Cli/Commands/Descriptions.hs view
@@ -0,0 +1,38 @@+{-|++The @descriptions@ command lists all unique descriptions seen in transactions, sorted alphabetically.++-}++{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Descriptions (+ descriptionsmode+ ,descriptions+) where++import Data.List.Extra (nubSort)+import Data.Text.IO qualified as T++import Hledger+import Hledger.Cli.CliOptions+++-- | Command line options for this command.+descriptionsmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Descriptions.txt")+ []+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[QUERY]")++-- | The descriptions command.+descriptions :: CliOpts -> Journal -> IO ()+descriptions CliOpts{reportspec_=rspec} j = do+ let ts = entriesReport rspec j+ descs = nubSort $ map tdescription ts++ mapM_ T.putStrLn descs
+ Hledger/Cli/Commands/Descriptions.txt view
@@ -0,0 +1,17 @@+descriptions++List the unique descriptions used in transactions.++Flags:+no command-specific flags++This command lists the unique descriptions that appear in transactions,+in alphabetic order. You can add a query to select a subset of+transactions.++Example:++$ hledger descriptions+Store Name+Gas Station | Petrol+Person A
+ Hledger/Cli/Commands/Diff.hs view
@@ -0,0 +1,116 @@+{-|++The @diff@ command compares two diff.++-}++{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Diff (+ diffmode+ ,diff+) where++import Data.List.Extra ((\\), groupSortOn, nubBy, sortBy)+import Data.Function (on)+import Data.Ord (comparing)+import Data.Maybe (fromJust)+import Data.Time (diffDays)+import Data.Either (partitionEithers)+import Data.Text.IO qualified as T+import Lens.Micro (set)+import Safe (headDef)++import Hledger+import Hledger.Cli.CliOptions++-- | Command line options for this command.+diffmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Diff.txt")+ []+ [generalflagsgroup2]+ confflags+ ([], Just $ argsFlag "-f FILE1 -f FILE2 FULLACCOUNTTNAME")++data PostingWithPath = PostingWithPath {+ ppposting :: Posting,+ pptxnidx :: Int,+ pppidx :: Int }+ deriving (Show)++instance Eq PostingWithPath where+ a == b = pptxnidx a == pptxnidx b+ && pppidx a == pppidx b++pptxn :: PostingWithPath -> Transaction+pptxn = fromJust . ptransaction . ppposting++ppamountqty :: PostingWithPath -> Quantity+ppamountqty = aquantity . headDef nullamt . amounts . pamount . ppposting++allPostingsWithPath :: Journal -> [PostingWithPath]+allPostingsWithPath j = do+ (txnidx, txn) <- zip [0..] $ jtxns j+ (pidx, p) <- zip [0..] $ tpostings txn+ return PostingWithPath { ppposting = p, pptxnidx = txnidx, pppidx = pidx }++combine :: ([a], [b]) -> [Either a b]+combine (ls, rs) = map Left ls ++ map Right rs++combinedBinBy :: Ord b => (a -> b) -> ([a], [a]) -> [([a], [a])]+combinedBinBy f = map partitionEithers . groupSortOn (either f f) . combine++greedyMaxMatching :: (Eq a, Eq b) => [(a,b)] -> [(a,b)]+greedyMaxMatching = greedyMaxMatching' []++greedyMaxMatching' :: (Eq a, Eq b) => [Either a b] -> [(a,b)] -> [(a,b)]+greedyMaxMatching' alreadyUsed ((l,r):rest)+ | Left l `elem` alreadyUsed || Right r `elem` alreadyUsed+ = greedyMaxMatching' alreadyUsed rest+ | otherwise = (l,r) : greedyMaxMatching' (Left l : Right r : alreadyUsed) rest+greedyMaxMatching' _ [] = []++dateCloseness :: (PostingWithPath, PostingWithPath) -> Integer+dateCloseness = negate . uncurry (diffDays `on` tdate.pptxn)++type Matching = [(PostingWithPath, PostingWithPath)]++matching :: [PostingWithPath] -> [PostingWithPath] -> Matching+matching ppl ppr = do+ (left, right) <- combinedBinBy ppamountqty (ppl, ppr) -- TODO: probably not a correct choice of bins+ greedyMaxMatching $ sortBy (comparing dateCloseness) [ (l,r) | l <- left, r <- right ]++matchingPostings :: AccountName -> Journal -> [PostingWithPath]+matchingPostings acct j = filter ((== acct) . paccount . ppposting) $ allPostingsWithPath j++pickSide :: Side -> (a,a) -> a+pickSide L (l,_) = l+pickSide R (_,r) = r++unmatchedtxns :: Side -> [PostingWithPath] -> Matching -> [Transaction]+unmatchedtxns s pp m =+ map pptxn $ nubBy ((==) `on` pptxnidx) $ pp \\ map (pickSide s) m++-- | The diff command.+diff :: CliOpts -> Journal -> IO ()+diff CliOpts{file_=[f1, f2], reportspec_=ReportSpec{_rsQuery=Acct acctRe}} _ = do+ j1 <- orDieTrying $ readJournalFile (set ignore_assertions True definputopts) f1+ j2 <- orDieTrying $ readJournalFile (set ignore_assertions True definputopts) f2++ let acct = reString acctRe+ let pp1 = matchingPostings acct j1+ let pp2 = matchingPostings acct j2++ let m = matching pp1 pp2++ let unmatchedtxn1 = unmatchedtxns L pp1 m+ let unmatchedtxn2 = unmatchedtxns R pp2 m++ putStrLn "These transactions are in the first file only:\n"+ mapM_ (T.putStr . showTransaction) unmatchedtxn1++ putStrLn "These transactions are in the second file only:\n"+ mapM_ (T.putStr . showTransaction) unmatchedtxn2++diff _ _ = error' "Please specify two input files. Usage: hledger diff -f FILE1 -f FILE2 FULLACCOUNTNAME"
+ Hledger/Cli/Commands/Diff.txt view
@@ -0,0 +1,34 @@+diff++Compares a particular account's transactions in two input files. It+shows any transactions to this account which are in one file but not in+the other.++Flags:+no command-specific flags++More precisely: for each posting affecting this account in either file,+this command looks for a corresponding posting in the other file which+posts the same amount to the same account (ignoring date, description,+etc).++Since it compares postings, not transactions, this also works when+multiple bank transactions have been combined into a single journal+entry.++This command is useful eg if you have downloaded an account's+transactions from your bank (eg as CSV data): when hledger and your bank+disagree about the account balance, you can compare the bank data with+your journal to find out the cause.++Examples:++$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro +These transactions are in the first file only:++2014/01/01 Opening Balances+ assets:bank:giro EUR ...+ ...+ equity:opening balances EUR -...++These transactions are in the second file only:
Hledger/Cli/Commands/Files.hs view
@@ -4,7 +4,6 @@ -} -{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-} module Hledger.Cli.Commands.Files (@@ -12,12 +11,10 @@ ,files ) where -import Data.List-import Safe+import Data.Text qualified as T+import Safe (headMay) import Hledger-import Prelude hiding (putStrLn)-import Hledger.Utils.UTF8IOCompat (putStrLn) import Hledger.Cli.CliOptions @@ -25,16 +22,16 @@ filesmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Files.txt") []- [generalflagsgroup2]- []+ cligeneralflagsgroups2+ hiddenflags ([], Just $ argsFlag "[REGEX]") -- | The files command. files :: CliOpts -> Journal -> IO () files CliOpts{rawopts_=rawopts} j = do let args = listofstringopt "args" rawopts- regex = headMay args- files = maybe id (filter . regexMatches) regex - $ map fst + regex <- mapM (either fail pure . toRegex . T.pack) $ headMay args+ let fs = maybe id (filter . regexMatch) regex+ $ map fst $ jfiles j- mapM_ putStrLn files+ mapM_ putStrLn fs
Hledger/Cli/Commands/Files.txt view
@@ -1,5 +1,7 @@ files+ List all files included in the journal. With a REGEX argument, only file names matching the regular expression (case sensitive) are shown. -_FLAGS_+Flags:+no command-specific flags
Hledger/Cli/Commands/Help.hs view
@@ -17,39 +17,34 @@ ) where -import Prelude ()-import "base-compat-batteries" Prelude.Compat-import Data.Char-import Data.List import Data.Maybe-import Safe+import Safe (headMay) import System.Console.CmdArgs.Explicit import System.Environment import System.IO -import Hledger.Utils (embedFileRelative)-import Hledger.Data.RawOptions-import Hledger.Data.Types import Hledger.Cli.CliOptions import Hledger.Cli.DocFiles+import Hledger.Data.RawOptions+import Hledger.Data.Types+import Hledger.Utils (embedFileRelative) --import Hledger.Utils.Debug helpmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Help.txt")- [flagNone ["info"] (setboolopt "info") "show the manual with info"- ,flagNone ["man"] (setboolopt "man") "show the manual with man"- ,flagNone ["pager"] (setboolopt "pager") "show the manual with $PAGER or less"- ,flagNone ["cat"] (setboolopt "cat") "show the manual on stdout"- ,flagNone ["help","h"] (setboolopt "help") "show this help"+ -- The help-* names avoid a clash with the --info and --man flags handled in Cli.hs.+ [flagNone ["i"] (setboolopt "help-i") "show the manual with info"+ ,flagNone ["m"] (setboolopt "help-m") "show the manual with man"+ ,flagNone ["p"] (setboolopt "help-p") "show the manual with $PAGER or less\n(less is always used if TOPIC is specified)" ]- []+ [(helpflagstitle, helpflags)] []- ([], Just $ argsFlag "[MANUAL]")+ ([], Just $ argsFlag "[TOPIC]") --- | List or display one of the hledger manuals in various formats. --- You can select a docs viewer with one of the `--info`, `--man`, `--pager`, `--cat` flags.+-- | Display the hledger manual in various formats.+-- You can select a docs viewer with one of the `--info`, `--man`, `--pager` flags. -- Otherwise it will use the first available of: info, man, $PAGER, less, stdout--- (and always stdout if output is non-interactive). +-- (and always stdout if output is non-interactive). help' :: CliOpts -> Journal -> IO () help' opts _ = do exes <- likelyExecutablesInPath@@ -57,26 +52,18 @@ interactive <- hIsTerminalDevice stdout let args = take 1 $ listofstringopt "args" $ rawopts_ opts- topic = case args of- [pat] -> headMay [t | t <- docTopics, map toLower pat `isInfixOf` t]- _ -> Nothing- [info, man, pager, cat] = - [runInfoForTopic, runManForTopic, runPagerForTopic pagerprog, printHelpForTopic]+ mtopic = headMay args+ [info, man, pager, cat] =+ [runInfoForTopic, runManForTopic, runPagerForTopic, printHelpForTopic] viewer- | boolopt "info" $ rawopts_ opts = info- | boolopt "man" $ rawopts_ opts = man- | boolopt "pager" $ rawopts_ opts = pager- | boolopt "cat" $ rawopts_ opts = cat- | not interactive = cat - | "info" `elem` exes = info- | "man" `elem` exes = man- | pagerprog `elem` exes = pager- | otherwise = cat - case topic of- Nothing -> putStrLn $ unlines [- "Please choose a manual by typing \"hledger help MANUAL\" (any substring is ok)."- ,"A viewer (info, man, a pager, or stdout) will be auto-selected,"- ,"or type \"hledger help -h\" to see options. Manuals available:"- ]- ++ "\n " ++ unwords docTopics- Just t -> viewer t+ | boolopt "help-i" $ rawopts_ opts = info+ | boolopt "help-m" $ rawopts_ opts = man+ | boolopt "help-p" $ rawopts_ opts = pager+ | not interactive = cat+ | "info" `elem` exes = info+ | "man" `elem` exes = man+ | pagerprog `elem` exes = pager+ | "less" `elem` exes = pager+ | otherwise = cat++ viewer "hledger" mtopic
Hledger/Cli/Commands/Help.txt view
@@ -1,35 +1,35 @@ help-Show any of the hledger manuals. -_FLAGS_--The help command displays any of the main hledger manuals, in one of-several ways. Run it with no argument to list the manuals, or provide a-full or partial manual name to select one.--hledger manuals are available in several formats. hledger help will use-the first of these display methods that it finds: info, man, $PAGER,-less, stdout (or when non-interactive, just stdout). You can force a-particular viewer with the --info, --man, --pager, --cat flags.+Show the hledger user manual with info, man, or a pager. With a (case+insensitive) TOPIC argument, try to open it at that section heading. -Examples:+Flags:+ -i show the manual with info+ -m show the manual with man+ -p show the manual with $PAGER or less+ (less is always used if TOPIC is specified) -$ hledger help-Please choose a manual by typing "hledger help MANUAL" (a substring is ok).-Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot+This command shows the hledger manual built in to your hledger+executable. It can be useful when offline, or when you prefer the+terminal to a web browser, or when the appropriate hledger manual or+viewers are not installed properly on your system. -$ hledger help h --man+By default it chooses the best viewer found in $PATH, trying in this+order: info, man, $PAGER, less, more, stdout. (If a TOPIC is specified,+$PAGER and more are not tried.) You can force the use of info, man, or a+pager with the -i, -m, or -p flags. If no viewer can be found, or if+running non-interactively, it just prints the manual to stdout. -hledger(1) hledger User Manuals hledger(1)+When using info, TOPIC can match either the full heading or a prefix. If+your info --version is < 6, you'll need to upgrade it, eg with+'brew install texinfo' on mac. -NAME- hledger - a command-line accounting tool+When using man or less, TOPIC must match the full heading. For a prefix+match, you can write 'TOPIC.*'. -SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [ARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]- hledger+Examples -DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any-...+$ hledger help -h # show the help command's usage+$ hledger help # show the manual with info, man or $PAGER+$ hledger help 'time periods' # show the manual's "Time periods" topic+$ hledger help 'time periods' -m # use man, even if info is installed
Hledger/Cli/Commands/Import.hs view
@@ -1,47 +1,101 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE NamedFieldPuns #-} module Hledger.Cli.Commands.Import ( importmode ,importcmd-) +) where import Control.Monad import Data.List+import Data.Text.IO qualified as T+import System.Console.CmdArgs.Explicit+import Text.Printf+ import Hledger import Hledger.Cli.CliOptions import Hledger.Cli.Commands.Add (journalAddTransaction)--- import Hledger.Cli.Commands.Print (print')-import System.Console.CmdArgs.Explicit-import Text.Printf+import System.IO (stderr)+import System.FilePath (takeFileName) importmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Import.txt")- [flagNone ["dry-run"] (setboolopt "dry-run") "just show the transactions to be imported"] - [generalflagsgroup1]- []- ([], Just $ argsFlag "FILE [...]")+ [flagNone ["catchup"] (setboolopt "catchup") "just mark all transactions as already imported"+ ,flagNone ["dry-run"] (setboolopt "dry-run") "just show the transactions to be imported"+ ]+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[-f JOURNALFILE] DATAFILES...") importcmd opts@CliOpts{rawopts_=rawopts,inputopts_=iopts} j = do+ -- XXX could be helpful to show the last-seen date, and number of old transactions, too let inputfiles = listofstringopt "args" rawopts+ inputstr = intercalate ", " $ map (quoteIfNeeded.takeFileName) inputfiles+ catchup = boolopt "catchup" rawopts dryrun = boolopt "dry-run" rawopts- iopts' = iopts{new_=True, new_save_=not dryrun}+ combinedStyles = + let+ maybeInputStyles = commodity_styles_ . balancingopts_ $ iopts+ inferredStyles = journalCommodityStyles j+ in+ case maybeInputStyles of+ Nothing -> Just inferredStyles+ Just inputStyles -> Just $ inputStyles <> inferredStyles++ iopts' = iopts{+ new_=True, -- read only new transactions since last time+ new_save_=False, -- defer saving .latest files until the end+ strict_=False, -- defer strict checks until the end+ balancingopts_=defbalancingopts{commodity_styles_= combinedStyles} -- use amount styles from both when balancing txns+ }+ case inputfiles of- [] -> error' "please provide one or more input files as arguments"+ [] -> error' "please provide one or more data files as arguments" -- PARTIAL: fs -> do- enewj <- readJournalFiles iopts' fs- case enewj of- Left e -> error' e - Right newj ->+ enewjandlatestdatesforfiles <- runExceptT $ readJournalFilesAndLatestDates iopts' fs+ case enewjandlatestdatesforfiles of+ Left err -> error' err+ Right (newj, latestdatesforfiles) -> case sortOn tdate $ jtxns newj of- [] -> return ()- newts | dryrun -> do- printf "; would import %d new transactions:\n\n" (length newts)- -- TODO how to force output here ?- -- length (jtxns newj) `seq` print' opts{rawopts_=("explicit",""):rawopts} newj- mapM_ (putStr . showTransactionUnelided) newts+ [] -> hPrintf stderr "no new transactions found in %s\n" inputstr++ newts | catchup ->+ if dryrun+ then hPrintf stderr "would skip %d new transactions (dry run)\n\n" (length newts)+ else do+ hPrintf stderr "marked %s as caught up, skipping %d transactions\n\n" inputstr (length newts)+ saveLatestDatesForFiles latestdatesforfiles+ newts -> do- foldM_ (`journalAddTransaction` opts) j newts -- gets forced somehow.. (how ?)- printf "imported %d new transactions\n" (length newts)+ if dryrun+ then do+ -- show txns to be imported+ hPrintf stderr "would import %d new transactions from %s:\n\n" (length newts) inputstr+ mapM_ (T.putStr . showTransaction) newts++ -- then check the whole journal with them added, if in strict mode+ when (strict_ iopts) $ strictChecks++ else do+ -- first check the whole journal with them added, if in strict mode+ when (strict_ iopts) $ strictChecks++ -- then append the transactions to the main journal file.+ -- XXX This writes unix line endings (\n), some at least,+ -- even if the file uses dos line endings (\r\n), which could leave+ -- mixed line endings in the file. See also writeFileWithBackupIfChanged.+ foldM_ (`journalAddTransaction` opts) j newts -- gets forced somehow.. (how ?)++ hPrintf stderr "imported %d new transactions from %s to %s\n" (length newts) inputstr (journalFilePath j)++ -- and if we got this far, update each file's .latest file+ saveLatestDatesForFiles latestdatesforfiles++ where+ -- add the new transactions to the journal in memory and check the whole thing+ strictChecks = either fail pure $ journalStrictChecks j'+ where j' = foldl' (flip addTransaction) j newts
Hledger/Cli/Commands/Import.txt view
@@ -1,19 +1,216 @@ import-Read new transactions added to each FILE since last run, and add them to-the main journal file. Or with --dry-run, just print the transactions-that would be added. -_FLAGS_+Import new transactions from one or more data files to the main journal. -The input files are specified as arguments - no need to write -f before-each one. So eg to add new transactions from all CSV files to the main-journal, it's just: hledger import *.csv+Flags:+ --catchup just mark all transactions as already imported+ --dry-run just show the transactions to be imported -New transactions are detected in the same way as print --new: by-assuming transactions are always added to the input files in increasing-date order, and by saving .latest.FILE state files.+This command detects new transactions in one or more data files+specified as arguments, and appends them to the main journal. -The --dry-run output is in journal format, so you can filter it, eg to-see only uncategorised transactions:+You can import from any input file format hledger supports, but+CSV/SSV/TSV files, downloaded from financial institutions, are the most+common import source. -$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions+The import destination is the default journal file, or another specified+in the usual way with $LEDGER_FILE or -f/--file. It should be in journal+format.++Examples:++$ hledger import bank1-checking.csv bank1-savings.csv++$ hledger import *.csv++Import dry run++It's useful to preview the import by running first with --dry-run, to+sanity check the range of dates being imported, and to check the effect+of your conversion rules if converting from CSV. Eg:++$ hledger import bank.csv --dry-run++The dry run output is valid journal format, so hledger can re-parse it.+If the output is large, you could show just the uncategorised+transactions like so:++$ hledger import --dry-run bank.csv | hledger -f- -I print unknown++You could also run this repeatedly to see the effect of edits to your+conversion rules:++$ watchexec -- "hledger import --dry-run bank.csv | hledger -f- -I print unknown"++Once the conversion and dates look good enough to import to your+journal, perhaps with some manual fixups to follow, you would do the+actual import:++$ hledger import bank.csv++Overlap detection++Reading CSV files is built in to hledger, and not specific to import; so+you could also import by doing hledger -f bank.csv print >>$LEDGER_FILE.++But import is easier and provides some advantages. The main one is that+it avoids re-importing transactions it has seen on previous runs. This+means you don't have to worry about overlapping data in successive+downloads of your bank CSV; just download and import as often as you+like, and only the new transactions will be imported each time.++We don't call this "deduplication", as it's generally not possible to+reliably detect duplicates in bank CSV. Instead, import remembers the+latest date processed previously in each CSV file (saving it in a hidden+file), and skips any records prior to that date. This works well for+most real-world CSV, where:++1. the data file name is stable (does not change) across imports+2. the item dates are stable across imports+3. the order of same-date items is stable across imports+4. the newest items have the newest dates++(Occasional violations of 2-4 are often harmless; you can reduce the+chance of disruption by downloading and importing more often.)++Overlap detection is automatic, and shouldn't require much attention+from you, except perhaps at first import (see below). But here's how it+works:++- For each FILE being imported from:++ 1. hledger reads a file named .latest.FILE file in the same+ directory, if any. This file contains the latest record date+ previously imported from FILE, in YYYY-MM-DD format. If multiple+ records with that date were imported, the date is repeated on N+ lines.++ 2. hledger reads records from FILE. If a latest date was found in+ step 1, any records before that date, and the first N records on+ that date, are skipped.++- After a successful import from all FILEs, without error and without+ --dry-run, hledger updates each FILE's .latest.FILE for next time.++If this goes wrong, it's relatively easy to repair:++- You'll notice it before import when you preview with import --dry-run.+- Or after import when you try to reconcile your hledger account+ balances with your bank.+- hledger print -f FILE.csv will show all recently downloaded+ transactions. Compare these with your journal. Copy/paste if needed.+- Update your conversion rules and print again, if needed.+- You can manually update or remove the .latest file, or use+ import --catchup FILE.+- Download and import more often, eg twice a week, at least while you+ are learning. It's easier to review and troubleshoot when there are+ fewer transactions.++First import++The first time you import from a file, when no corresponding .latest+file has been created yet, all of the records will be imported.++But perhaps you have been entering the data manually, so you know that+all of these transactions are already recorded in the journal. In this+case you can run hledger import --catchup once. This will create a+.latest file containing the latest CSV record date, so that none of+those records will be re-imported.++Or, if you know that some but not all of the transactions are in the+journal, you can create the .latest file yourself. Eg, let's say you+previously recorded foobank transactions up to 2024-10-31 in the+journal. Then in the directory where you'll be saving foobank.csv, you+would create a .latest.foobank.csv file containing++2024-10-31++Or if you had three foobank transactions recorded with that date, you+would repeat the date that many times:++2024-10-31+2024-10-31+2024-10-31++Then hledger import foobank.csv [--dry-run] will import only the newer+records.++Importing balance assignments++Journal entries added by import will have all posting amounts made+explicit (like print -x).++This means that any balance assignments in the imported entries would+need to be evaluated. But this generally isn't possible, as the main+file's account balances are not visible during import. So try to avoid+generating balance assignments with your CSV rules, or importing from a+journal that contains balance assignments. (Balance assignments are best+avoided anyway.)++But if you must use them, eg because your CSV includes only balances:+you can import with print, which leaves implicit amounts implicit.+(print can also do overlap detection like import, with the --new flag):++$ hledger print --new -f bank.csv >> $LEDGER_FILE++(If you think import should preserve implicit balances, please test that+and send a pull request.)++Import and commodity styles++Amounts in entries added by import will be formatted according to the+journal's canonical commodity styles, as declared by commodity+directives or inferred from the journal's amounts.++Related: CSV > Amount decimal places.++Import archiving++When importing from a CSV rules file (hledger import bank.rules), you+can use the archive rule to enable automatic archiving of the data file.+After a successful import, the data file (specified by source) will be+moved to an archive folder (data/, next to the rules file,+auto-created), and renamed similar to the rules file, with a date. This+can be useful for troubleshooting, detecting variations in your banks'+CSV data, regenerating entries with improved rules, etc.++The archive rule also causes import to handle source glob patterns+differently: when there are multiple matched files, it will pick the+oldest, not the newest.++Import special cases++Deduplication++Here are two kinds of "deduplication" which import does not handle (and+should not, because these can happen legitimately in financial data):++- Two or more of the new CSV records are identical, and generate+ identical new journal entries.+- A new CSV record generates a journal entry identical to one(s) already+ in the journal.++Varying file name++If you have a download whose file name varies, you could rename it to a+fixed name after each download. Or you could use a CSV source rule with+a suitable glob pattern, and import from the .rules file.++Multiple versions++Say you download bank.csv, import it, but forget to delete it from your+downloads folder. The next time you download it, your web browser will+save it as (eg) bank (2).csv. The source rule's glob patterns are for+just this situation: instead of specifying source bank.csv, specify+source bank*.csv. Then hledger -f bank.rules CMD or+hledger import bank.rules will automatically pick the newest matched+file (bank (2).csv).++Alternately, what if you download, but forget to import or delete, then+download again ? Now each of bank.csv and bank (2).csv might contain+data that's not in the other, and not in your journal. In this case,+it's best to import each of them in turn, oldest first (otherwise,+overlap detection could cause new records to be skipped). Enabling+import archiving ensures this. Then+hledger import bank.rules; hledger import bank.rules will import and+archive first bank.csv, then bank (2).csv.
Hledger/Cli/Commands/Incomestatement.hs view
@@ -1,4 +1,6 @@-{-# LANGUAGE QuasiQuotes, TemplateHaskell, OverloadedStrings #-}+{-# LANGUAGE QuasiQuotes #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE OverloadedStrings #-} {-| The @incomestatement@ command prints a simple income statement (profit & loss report).@@ -22,18 +24,20 @@ cbcqueries = [ CBCSubreportSpec{ cbcsubreporttitle="Revenues"- ,cbcsubreportquery=journalRevenueAccountQuery- ,cbcsubreportnormalsign=NormallyNegative+ ,cbcsubreportquery=Type [Revenue]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyNegative})+ ,cbcsubreporttransform=fmap maNegate ,cbcsubreportincreasestotal=True } ,CBCSubreportSpec{ cbcsubreporttitle="Expenses"- ,cbcsubreportquery=journalExpenseAccountQuery- ,cbcsubreportnormalsign=NormallyPositive+ ,cbcsubreportquery=Type [Expense]+ ,cbcsubreportoptions=(\ropts -> ropts{normalbalance_=Just NormallyPositive})+ ,cbcsubreporttransform=id ,cbcsubreportincreasestotal=False } ],- cbctype = PeriodChange+ cbcaccum = PerPeriod } incomestatementmode :: Mode RawOpts@@ -41,3 +45,20 @@ incomestatement :: CliOpts -> Journal -> IO () incomestatement = compoundBalanceCommand incomestatementSpec+{- +Summary of code flow, 2021-11:++incomestatement+ compoundBalanceCommand+ compoundBalanceReport+ compoundBalanceReportWith+ colps = getPostingsByColumn+ startps = startingPostings+ generateSubreport+ startbals = startingBalances (startps restricted to this subreport)+ generateMultiBalanceReport startbals (colps restricted to this subreport)+ matrix = calculateReportMatrix startbals colps+ displaynames = displayedAccounts+ buildReportRows displaynames matrix+ -}+
Hledger/Cli/Commands/Incomestatement.txt view
@@ -1,42 +1,97 @@-incomestatement, is-This command displays a simple income statement, showing revenues and-expenses during a period. It assumes that these accounts are under a-top-level revenue or income or expense account (case insensitive, plural-forms also allowed). Note this report shows all account balances with-normal positive sign (like conventional financial statements, unlike-balance/print/register) (experimental).+incomestatement -_FLAGS_+(is) -This command displays a simple income statement. It currently assumes-that you have top-level accounts named income (or revenue) and expense-(plural forms also allowed.)+Show revenue inflows and expense outflows during the report period.+Amounts are shown with normal positive sign, as in conventional+financial statements. -$ hledger incomestatement-Income Statement+Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format. -Revenues:- $-2 income- $-1 gifts- $-1 salary---------------------- $-2+This command displays an income statement, showing revenues and expenses+during one or more periods. -Expenses:- $2 expenses- $1 food- $1 supplies---------------------- $2+It shows accounts declared with the Revenue or Expense type (see account+types). Or if no such accounts are declared, it shows top-level accounts+named revenue or income or expense (case insensitive, plurals allowed)+and their subaccounts. -Total:---------------------- 0+Example: -With a reporting interval, multiple columns will be shown, one for each-report period. Normally incomestatement shows revenues/expenses per-period, though as with multicolumn balance reports you can alter the-report mode with --change/--cumulative/--historical.+$ hledger incomestatement+Income Statement 2008 -This command also supports output destination and output format-selection.+ || 2008 +===================++======+ Revenues || +-------------------++------+ income:gifts || $1 + income:salary || $1 +-------------------++------+ || $2 +===================++======+ Expenses || +-------------------++------+ expenses:food || $1 + expenses:supplies || $1 +-------------------++------+ || $2 +===================++======+ Net: || 0 ++This command is a higher-level variant of the balance command, and+supports many of that command's features, such as multi-period reports.+It is similar to hledger balance '(revenues|income)' expenses, but with+smarter account detection, and revenues/income displayed with their sign+flipped.++This command also supports the output destination and output format+options The output formats supported are txt, csv, tsv (Added in 1.32),+html, and json.
+ Hledger/Cli/Commands/Notes.hs view
@@ -0,0 +1,38 @@+{-|++The @notes@ command lists all unique notes (description part after a |) seen in transactions, sorted alphabetically.++-}++{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-}++module Hledger.Cli.Commands.Notes (+ notesmode+ ,notes+) where++import Data.List.Extra (nubSort)+import Data.Text.IO qualified as T++import Hledger+import Hledger.Cli.CliOptions+++-- | Command line options for this command.+notesmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Notes.txt")+ []+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[QUERY]")++-- | The notes command.+notes :: CliOpts -> Journal -> IO ()+notes CliOpts{reportspec_=rspec} j = do+ let ts = entriesReport rspec j+ notes' = nubSort $ map transactionNote ts+ mapM_ T.putStrLn notes'
+ Hledger/Cli/Commands/Notes.txt view
@@ -0,0 +1,17 @@+notes++List the unique notes that appear in transactions.++Flags:+no command-specific flags++This command lists the unique notes that appear in transactions, in+alphabetic order. You can add a query to select a subset of+transactions. The note is the part of the transaction description after+a | character (or if there is no |, the whole description).++Example:++$ hledger notes+Petrol+Snacks
+ Hledger/Cli/Commands/Payees.hs view
@@ -0,0 +1,58 @@+{-|++The @payees@ command lists all unique payees (description part before a |) seen in transactions, sorted alphabetically.++-}++{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Payees (+ payeesmode+ ,payees+) where++import Data.Text.IO qualified as T+import System.Console.CmdArgs.Explicit++import Hledger+import Hledger.Cli.CliOptions+import Data.List ((\\))+import Data.List.Extra (nubSort)+++-- | Command line options for this command.+payeesmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Payees.txt")+ [flagNone ["used"] (setboolopt "used") "list payees used"+ ,flagNone ["declared"] (setboolopt "declared") "list payees declared"+ ,flagNone ["undeclared"] (setboolopt "undeclared") "list payees used but not declared"+ ,flagNone ["unused"] (setboolopt "unused") "list payees declared but not used"+ ,flagNone ["find"] (setboolopt "find") "list the first payee matched by the first argument (a case-insensitive infix regexp)"+ ]+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[QUERY..]")++-- | The payees command.+payees :: CliOpts -> Journal -> IO ()+payees opts@CliOpts{rawopts_=rawopts, reportspec_=ReportSpec{_rsQuery=query}} j = do+ let+ -- XXX matchesPayeeWIP is currently an alias for matchesDescription, not sure if it matters+ matchedused = dbg5 "matchedused" $ nubSort $ map transactionPayee $ filter (matchesTransaction query) $ jtxns j+ matcheddeclared = dbg5 "matcheddeclared" $ nubSort $ filter (matchesPayeeWIP query) $ journalPayeesDeclared j+ matchedunused = dbg5 "matchedunused" $ nubSort $ matcheddeclared \\ matchedused+ matchedundeclared = dbg5 "matchedundeclared" $ nubSort $ matchedused \\ matcheddeclared+ matchedall = dbg5 "matchedall" $ nubSort $ matcheddeclared ++ matchedused+ found = dbg5 "found" $ findMatchedByArgument rawopts "payee" all'+ where all' = nubSort $ map transactionPayee (jtxns j) <> journalPayeesDeclared j+ mapM_ T.putStrLn $ case declarablesSelectorFromOpts opts of+ Nothing -> matchedall+ Just Used -> matchedused+ Just Declared -> matcheddeclared+ Just Undeclared -> matchedundeclared+ Just Unused -> matchedunused+ Just Find -> [found]+
+ Hledger/Cli/Commands/Payees.txt view
@@ -0,0 +1,30 @@+payees++List the payee/payer names used or declared in the journal.++Flags:+ --used list payees used+ --declared list payees declared+ --undeclared list payees used but not declared+ --unused list payees declared but not used+ --find list the first payee matched by the first+ argument (a case-insensitive infix regexp)++This command lists unique payee/payer names - all of them by default, or+just the ones which have been used in transaction descriptions, or+declared with payee directives, or used but not declared, or declared+but not used, or just the first one matched by a pattern (with --find,+returning a non-zero exit code if it fails).++The payee/payer name is the part of the transaction description before a+| character (or if there is no |, the whole description).++You can add query arguments to select a subset of transactions or+payees.++Example:++$ hledger payees+Store Name+Gas Station+Person A
Hledger/Cli/Commands/Prices.hs view
@@ -1,84 +1,113 @@-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE NamedFieldPuns #-} module Hledger.Cli.Commands.Prices ( pricesmode ,prices-) +) where -import Data.Maybe import Data.List-import qualified Data.Text as T-import Data.Time+import Data.Text qualified as T+import Data.Text.IO qualified as T import Hledger import Hledger.Cli.CliOptions import System.Console.CmdArgs.Explicit+import Data.Maybe (mapMaybe)+import Data.Function ((&)) pricesmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Prices.txt")- [flagNone ["costs"] (setboolopt "costs") "print transaction prices from postings"- ,flagNone ["inverted-costs"] (setboolopt "inverted-costs") "print transaction inverted prices from postings also"]- [generalflagsgroup1]- []+ [flagNone ["show-reverse"] (setboolopt "show-reverse")+ "also show the prices inferred by reversing known prices"+ ]+ cligeneralflagsgroups1+ (hiddenflags +++ [flagNone ["costs"] (setboolopt "infer-market-prices") "deprecated, use --infer-market-prices instead"+ ,flagNone ["inverted-costs"] (setboolopt "show-reverse") "deprecated, use --show-reverse instead"+ ,flagNone ["infer-reverse-prices"] (setboolopt "show-reverse") "deprecated, use --show-reverse instead"+ ]) ([], Just $ argsFlag "[QUERY]") --- XXX the original hledger-prices script always ignored assertions +instance HasAmounts PriceDirective where+ styleAmounts styles pd = pd{pdamount=styleAmounts styles $ pdamount pd}++-- List market prices. prices opts j = do- d <- getCurrentDay let- q = queryFromOpts d (reportopts_ opts)- ps = filter (matchesPosting q) $ allPostings j- mprices = jmarketprices j- cprices = concatMap postingCosts ps- icprices = concatMap postingCosts . mapAmount invertPrice $ ps- allprices = mprices ++ ifBoolOpt "costs" cprices ++ ifBoolOpt "inverted-costs" icprices- mapM_ (putStrLn . showPrice) $- sortOn mpdate $- filter (matchesMarketPrice q) $- allprices- where- ifBoolOpt opt | boolopt opt $ rawopts_ opts = id- | otherwise = const []+ styles = journalCommodityStyles j+ q = _rsQuery $ reportspec_ opts -showPrice :: MarketPrice -> String-showPrice mp = unwords ["P", show $ mpdate mp, T.unpack . quoteCommoditySymbolIfNeeded $ mpcommodity mp, showAmountWithZeroCommodity $ mpamount mp]+ -- XXX duplicates logic in Hledger.Data.Valuation.makePriceGraph, keep synced -divideAmount' :: Quantity -> Amount -> Amount-divideAmount' n a = a' where- a' = (n `divideAmount` a) { astyle = style' }- style' = (astyle a) { asprecision = precision' }- extPrecision = (1+) . floor . logBase 10 $ (realToFrac n :: Double)- precision' = extPrecision + asprecision (astyle a)+ declaredprices =+ -- dbg0 "declaredprices" $+ jpricedirectives j -invertPrice :: Amount -> Amount-invertPrice a =- case aprice a of- NoPrice -> a- UnitPrice pa -> invertPrice- -- normalize to TotalPrice- a { aprice = TotalPrice pa' } where- pa' = ((1 / aquantity a) `divideAmount` pa) { aprice = NoPrice }- TotalPrice pa ->- a { aquantity = aquantity pa * signum (aquantity a), acommodity = acommodity pa, aprice = TotalPrice pa' } where- pa' = pa { aquantity = abs $ aquantity a, acommodity = acommodity a, aprice = NoPrice, astyle = astyle a }+ pricesfromcosts =+ -- dbg0 "pricesfromcosts" $+ concatMap postingPriceDirectivesFromCost $+ journalPostings j -amountCost :: Day -> Amount -> Maybe MarketPrice-amountCost d a =- case aprice a of- NoPrice -> Nothing- UnitPrice pa -> Just- MarketPrice { mpdate = d, mpcommodity = acommodity a, mpamount = pa }- TotalPrice pa -> Just- MarketPrice { mpdate = d, mpcommodity = acommodity a, mpamount = abs (aquantity a) `divideAmount'` pa }+ forwardprices =+ -- dbg0 "forwardprices" $+ if boolopt "infer-market-prices" (rawopts_ opts)+ then declaredprices `mergePriceDirectives` pricesfromcosts+ else declaredprices -postingCosts :: Posting -> [MarketPrice]-postingCosts p = mapMaybe (amountCost date) . amounts $ pamount p where- date = fromMaybe (tdate . fromJust $ ptransaction p) $ pdate p+ reverseprices =+ -- dbg0 "reverseprices" $+ mapMaybe reversePriceDirective forwardprices -allPostings :: Journal -> [Posting]-allPostings = concatMap tpostings . jtxns+ allprices =+ -- dbg0 "allprices" $+ if boolopt "show-reverse" (rawopts_ opts)+ then forwardprices `mergePriceDirectives` reverseprices+ else forwardprices -mapAmount :: (Amount -> Amount) -> [Posting] -> [Posting]-mapAmount f = map pf where- pf p = p { pamount = mf (pamount p) }- mf = mixed . map f . amounts+ filteredprices =+ -- dbg0 "filtered unsorted" $+ filter (matchesPriceDirective q) allprices++ mapM_ (T.putStrLn . showPriceDirective . styleAmounts styles) $+ sortOn pddate filteredprices++-- XXX performance+-- | Append any new price directives (with different from commodity,+-- to commodity, or date) from the second list to the first.+-- (Does not remove redundant prices from the first; just avoids adding more.)+mergePriceDirectives :: [PriceDirective] -> [PriceDirective] -> [PriceDirective]+mergePriceDirectives pds1 pds2 =+ pds1 ++ [ pd | pd <- pds2 , pdid pd `notElem` pds1ids ]+ where+ pds1ids = map pdid pds1+ pdid PriceDirective{pddate,pdcommodity,pdamount} = (pddate, pdcommodity, acommodity pdamount)++showPriceDirective :: PriceDirective -> T.Text+showPriceDirective mp = T.unwords [+ "P",+ T.pack . show $ pddate mp,+ quoteCommoditySymbolIfNeeded $ pdcommodity mp,+ wbToText . showAmountB defaultFmt{displayZeroCommodity=True} $ pdamount mp+ ]++-- | Convert a market price directive to a corresponding one in the+-- opposite direction, if possible. (A price directive with a zero+-- price can't be reversed.)+--+-- The price's display precision will be set to show all significant+-- decimal digits (or if they appear infinite, a smaller default precision (8).+-- This is visible eg in the prices command's output.+--+reversePriceDirective :: PriceDirective -> Maybe PriceDirective+reversePriceDirective pd@PriceDirective{pdcommodity=c, pdamount=a}+ | amountIsZero a = Nothing+ | otherwise = Just pd{pdcommodity=acommodity a, pdamount=a'}+ where+ lbl = lbl_ "reversePriceDirective"+ a' =+ amountSetFullPrecisionUpTo (Just defaultMaxPrecision) $+ invertAmount a{acommodity=c}+ & dbg9With (lbl "calculated reverse price".showAmount)+ -- & dbg9With (lbl "precision of reverse price".show.amountDisplayPrecision)
Hledger/Cli/Commands/Prices.txt view
@@ -1,7 +1,20 @@ prices-Print market price directives from the journal. With --costs, also print-synthetic market prices based on transaction prices. With---inverted-costs, also print inverse prices based on transaction prices.-Prices (and postings providing prices) can be filtered by a query. -_FLAGS_+Print the market prices declared with P directives. With+--infer-market-prices, also show any additional prices inferred from+costs. With --show-reverse, also show additional prices inferred by+reversing known prices.++Flags:+ --show-reverse also show the prices inferred by reversing known+ prices++Price amounts are always displayed with their full precision, except for+reverse prices which are limited to 8 decimal digits.++Prices can be filtered by a date:, cur: or amt: query.++Generally if you run this command with --infer-market-prices+--show-reverse, it will show the same prices used internally to+calculate value reports. But if in doubt, you can inspect those directly+by running the value report with --debug=2.
Hledger/Cli/Commands/Print.hs view
@@ -5,170 +5,368 @@ -} {-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TemplateHaskell #-} module Hledger.Cli.Commands.Print ( printmode ,print' -- ,entriesReportAsText- ,originalTransaction+ ,roundFlag+ ,roundFromRawOpts+ ,amountStylesSetRoundingFromRawOpts+ ,transactionWithMostlyOriginalPostings ) where ++import Data.Function ((&))+import Data.List (intersperse, intercalate)+import Data.List.Extra (nubSort) import Data.Text (Text)-import qualified Data.Text as T+import Data.Map (Map)+import Data.Map qualified as Map+import Data.Text qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.Builder qualified as TB+import Lens.Micro ((^.), _Just, has)+import Safe (lastMay, minimumDef) import System.Console.CmdArgs.Explicit-import Hledger.Read.CsvReader (CSV, printCSV) import Hledger+import Hledger.Write.Beancount (accountNameToBeancount, showTransactionBeancount, showBeancountMetadata)+import Hledger.Write.Csv (CSV, printCSV, printTSV)+import Hledger.Write.Ods (printFods)+import Hledger.Write.Html.Lucid (styledTableHtml)+import Hledger.Write.Spreadsheet qualified as Spr import Hledger.Cli.CliOptions import Hledger.Cli.Utils-import Hledger.Cli.Commands.Add ( transactionsSimilarTo )-+import Hledger.Cli.Anchor (setAccountAnchor)+import Lucid qualified+import System.IO qualified as IO+import Data.Maybe (isJust, catMaybes, fromMaybe)+import Hledger.Write.Beancount (commodityToBeancount, tagsToBeancountMetadata) printmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Print.txt")- ([let arg = "STR" in+ ([+ flagNone ["explicit","x"] (setboolopt "explicit") "show all amounts explicitly"+ ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"+ ,flagNone ["locations"] (setboolopt "locations") "add tags showing file paths and line numbers"+ ,let arg = "DESC" in flagReq ["match","m"] (\s opts -> Right $ setopt "match" s opts) arg- ("show the transaction whose description is most similar to "++arg++", and is most recent")- ,flagNone ["explicit","x"] (setboolopt "explicit")- "show all amounts explicitly"- ,flagNone ["new"] (setboolopt "new")- "show only newer-dated transactions added in each file since last run"- ] ++ outputflags)- [generalflagsgroup1]- []+ ("fuzzy search for one recent transaction with description closest to "++arg)+ ,flagNone ["new"] (setboolopt "new") "show only newer-dated transactions added in each file since last run"+ ,roundFlag+ ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX"+ "in html output, generate links to hledger-web, with this prefix. (Usually the base url shown by hledger-web; can also be relative.)"+ ,outputFormatFlag ["txt","beancount","csv","tsv","html","fods","json","sql"]+ ,outputFileFlag+ ])+ cligeneralflagsgroups1+ (hiddenflags +++ -- this works already as a unique abbreviation, but declare here in case it ever becomes nonunique+ [flagNone ["location"] (setboolopt "locations") "deprecated, use --locations instead"+ ]) ([], Just $ argsFlag "[QUERY]") +roundFlag = flagReq ["round"] (\s opts -> Right $ setopt "round" s opts) "TYPE" $+ intercalate "\n"+ ["how much rounding or padding should be done when displaying amounts ?"+ ,"none - show original decimal digits,"+ ," as in journal (default)"+ ,"soft - just add or remove decimal zeros"+ ," to match precision"+ ,"hard - round posting amounts to precision"+ ," (can unbalance transactions)"+ ,"all - also round cost amounts to precision"+ ," (can unbalance transactions)"+ ]++-- | Get the --round option's value, if any. Can fail with a parse error.+roundFromRawOpts :: RawOpts -> Maybe Rounding+roundFromRawOpts = lastMay . collectopts roundfromrawopt+ where+ roundfromrawopt (n,v)+ | n=="round", v=="none" = Just NoRounding+ | n=="round", v=="soft" = Just SoftRounding+ | n=="round", v=="hard" = Just HardRounding+ | n=="round", v=="all" = Just AllRounding+ | n=="round" = error' $ "--round's value should be none, soft, hard or all; got: "++v+ | otherwise = Nothing++-- | Set these amount styles' rounding strategy when they are being applied to amounts,+-- according to the value of the --round option, if any.+amountStylesSetRoundingFromRawOpts :: RawOpts -> Map CommoditySymbol AmountStyle -> Map CommoditySymbol AmountStyle+amountStylesSetRoundingFromRawOpts rawopts styles =+ case roundFromRawOpts rawopts of+ Just r -> amountStylesSetRounding r styles+ Nothing -> styles+ -- | Print journal transactions in standard format. print' :: CliOpts -> Journal -> IO ()-print' opts j = do+print' opts@CliOpts{rawopts_=rawopts} j = do+ -- The print command should show all amounts with their original decimal places,+ -- but as part of journal reading the posting amounts have already been normalised+ -- according to commodity display styles, and currently it's not easy to avoid+ -- that. For now we try to reverse it by increasing all amounts' decimal places + -- sufficiently to show the amount exactly. The displayed amounts may have minor+ -- differences from the originals, such as trailing zeroes added.+ let+ -- lbl = lbl_ "print'"+ j' = j+ -- & dbg9With (lbl "amounts before setting full precision".showJournalPostingAmountsDebug)+ & journalMapPostingAmounts mixedAmountSetFullPrecision+ -- & dbg9With (lbl "amounts after setting full precision: ".showJournalPostingAmountsDebug)+ & if boolopt "locations" rawopts then journalMapTransactions addLocationTag else id+ case maybestringopt "match" $ rawopts_ opts of- Nothing -> printEntries opts j- Just desc -> printMatch opts j $ T.pack desc+ Nothing -> printEntries opts j'+ Just desc -> + -- match mode, prints one recent transaction most similar to given description+ -- XXX should match similarly to register --match+ case journalSimilarTransaction opts j' (dbg1 "finding best match for description" $ T.pack desc) of+ Just t -> printEntries opts j'{jtxns=[t]}+ Nothing -> error' $ "no transactions found with descriptions like " <> show desc printEntries :: CliOpts -> Journal -> IO ()-printEntries opts@CliOpts{reportopts_=ropts} j = do- d <- getCurrentDay- let q = queryFromOpts d ropts- fmt = outputFormatFromOpts opts- (render, ropts') = case fmt of- "csv" -> ((++"\n") . printCSV . entriesReportAsCsv, ropts{accountlistmode_=ALFlat})- "html" -> (const $ error' "Sorry, HTML output is not yet implemented for this kind of report.", ropts{accountlistmode_=ALFlat}) -- TODO- _ -> (entriesReportAsText opts, ropts)- writeOutput opts $ render $ entriesReport ropts' q j+printEntries opts@CliOpts{rawopts_=rawopts, reportspec_=rspec} j =+ writeOutputLazyText opts $ render $ entriesReport rspec j+ where+ -- print does user-specified rounding or (by default) no rounding, in all output formats+ styles = amountStylesSetRoundingFromRawOpts rawopts $ journalCommodityStyles j -entriesReportAsText :: CliOpts -> EntriesReport -> String-entriesReportAsText opts = concatMap (showTransactionUnelided . gettxn) + fmt = outputFormatFromOpts opts+ baseUrl = balance_base_url_ $ _rsReportOpts rspec+ query = querystring_ $ _rsReportOpts rspec+ render | fmt=="txt" = entriesReportAsText . styleAmounts styles . map maybeoriginalamounts+ | fmt=="beancount" = entriesReportAsBeancount (jdeclaredaccounttags j) . styleAmounts styles . map maybeoriginalamounts+ | fmt=="csv" = printCSV . entriesReportAsCsv . styleAmounts styles+ | fmt=="tsv" = printTSV . entriesReportAsCsv . styleAmounts styles+ | fmt=="json" = toJsonText . styleAmounts styles+ | fmt=="sql" = entriesReportAsSql . styleAmounts styles+ | fmt=="html" =+ (<>"\n") . Lucid.renderText . styledTableHtml .+ map (map (fmap Lucid.toHtml)) .+ entriesReportAsSpreadsheet oneLineNoCostFmt baseUrl query .+ styleAmounts styles+ | fmt=="fods" =+ printFods IO.localeEncoding . Map.singleton "Print" .+ (,) (1,0) .+ entriesReportAsSpreadsheet oneLineNoCostFmt baseUrl query .+ styleAmounts styles+ | otherwise = error' $ unsupportedOutputFormatError fmt -- PARTIAL:+ where+ maybeoriginalamounts+ -- Use the fully inferred and amount-styled/rounded transaction in the following situations:+ -- with -x/--explicit:+ | boolopt "explicit" (rawopts_ opts) = id+ -- with --infer-costs+ | opts ^. infer_costs = id+ -- with -B/-V/-X/--value ("because of #551, and because of print -V valuing only one posting when there's an implicit txn price.")+ | has (value . _Just) opts = id+ -- Otherwise, keep the transaction's amounts close to how they were written in the journal.+ | otherwise = transactionWithMostlyOriginalPostings++-- | Replace this transaction's postings with the original postings if any, but keep the+-- current possibly rewritten account names, and the inferred values of any auto postings.+-- This is mainly for showing transactions with the amounts in their original journal format.+transactionWithMostlyOriginalPostings :: Transaction -> Transaction+transactionWithMostlyOriginalPostings = transactionMapPostings postingMostlyOriginal where- gettxn | useexplicittxn = id -- use fully inferred amounts & txn prices - | otherwise = originalTransaction -- use original as-written amounts/txn prices- -- Original vs inferred transactions/postings were causing problems here, disabling -B (#551).- -- Use the explicit one if -B or -x are active.- -- This passes tests; does it also mean -B sometimes shows missing amounts unnecessarily ? - useexplicittxn = boolopt "explicit" (rawopts_ opts) || cost_ (reportopts_ opts)+ postingMostlyOriginal p = orig+ { paccount = paccount p+ , pamount = pamount $ if isGenerated then p else orig }+ where+ orig = originalPosting p+ isGenerated = "_generated-posting" `elem` map fst (ptags p) --- Replace this transaction's postings with the original postings if any, but keep the--- current possibly rewritten account names.-originalTransaction t = t { tpostings = map originalPostingPreservingAccount $ tpostings t }+entriesReportAsText :: EntriesReport -> TL.Text+entriesReportAsText = entriesReportAsTextHelper showTransaction --- Get the original posting if any, but keep the current possibly rewritten account name.-originalPostingPreservingAccount p = (originalPosting p) { paccount = paccount p }+entriesReportAsTextHelper :: (Transaction -> T.Text) -> EntriesReport -> TL.Text+entriesReportAsTextHelper showtxn = TB.toLazyText . foldMap (TB.fromText . showtxn) --- XXX--- tests_showTransactions = [--- "showTransactions" ~: do+-- | This generates Beancount-compatible journal output, transforming/encoding the data+-- in various ways when necessary (see Beancount.hs). It renders:+-- account open directives for each account used (on their earliest posting dates),+-- operating_currency directives (based on currencies used in costs),+-- and transaction entries.+-- Transaction and posting tags are converted to metadata lines.+-- Account tags are not propagated to the open directive, currently.+entriesReportAsBeancount :: Map AccountName [Tag] -> EntriesReport -> TL.Text+entriesReportAsBeancount atags ts =+ -- PERF: gathers and converts all account names, then repeats that work when showing each transaction+ TL.concat [+ TL.fromStrict operatingcurrencydirectives+ ,TL.fromStrict openaccountdirectives+ ,"\n"+ ,entriesReportAsTextHelper showTransactionBeancount ts3+ ]+ where+ -- Remove any virtual postings.+ ts2 = [t{tpostings=filter isReal $ tpostings t} | t <- ts] --- -- "print expenses" ~:--- do--- let opts = defreportopts{query_="expenses"}--- d <- getCurrentDay--- showTransactions opts (queryFromOpts d opts) samplejournal `is` unlines--- ["2008/06/03 * eat & shop"--- ," expenses:food $1"--- ," expenses:supplies $1"--- ," assets:cash $-2"--- ,""--- ]+ -- Remove any conversion postings that are redundant with costs.+ -- It would be easier to remove the costs instead,+ -- but those are more useful to Beancount than conversion postings.+ ts3 =+ [ t{tpostings=filter (not . isredundantconvp) $ tpostings t}+ | t <- ts2+ -- XXX But conversion-posting tag is on non-redundant postings too, so how to do it ?+ -- Assume the simple case of no more than one cost + conversion posting group in each transaction.+ -- Actually that seems to be required by hledger right now.+ , let isredundantconvp p =+ matchesPosting (Tag (toRegex' "conversion-posting") Nothing) p+ && any (any (isJust.acost) . amounts . pamount) (tpostings t)+ ] --- -- , "print report with depth arg" ~:--- do--- let opts = defreportopts{depth_=Just 2}--- d <- getCurrentDay--- showTransactions opts (queryFromOpts d opts) samplejournal `is` unlines--- ["2008/01/01 income"--- ," assets:bank:checking $1"--- ," income:salary $-1"--- ,""--- ,"2008/06/01 gift"--- ," assets:bank:checking $1"--- ," income:gifts $-1"--- ,""--- ,"2008/06/03 * eat & shop"--- ," expenses:food $1"--- ," expenses:supplies $1"--- ," assets:cash $-2"--- ,""--- ,"2008/12/31 * pay off"--- ," liabilities:debts $1"--- ," assets:bank:checking $-1"--- ,""--- ]--- ]+ -- https://fava.pythonanywhere.com/example-beancount-file/help/beancount_syntax+ -- https://fava.pythonanywhere.com/example-beancount-file/help/options+ -- "conversion-currencies+ -- When set, the currency conversion select dropdown in all charts will show the list of currencies specified in this option.+ -- By default, Fava lists all operating currencies and those currencies that match ISO 4217 currency codes." + -- http://furius.ca/beancount/doc/syntax+ -- http://furius.ca/beancount/doc/options+ -- "This option may be supplied multiple times ...+ -- A list of currencies that we single out during reporting and create dedicated columns for ...+ -- we use this to display these values in table cells without their associated unit strings ...+ -- This is used to indicate the main currencies that you work with in real life"+ -- We use: all currencies used in costs.+ operatingcurrencydirectives+ | null basecurrencies = ""+ | otherwise = T.unlines (map (todirective . commodityToBeancount) basecurrencies) <> "\n"+ where+ todirective c = "option \"operating_currency\" \"" <> c <> "\""+ basecurrencies = allcostcurrencies+ where+ allcostcurrencies = nubSort $ map acommodity costamounts+ where+ costamounts =+ map (\c -> case c of+ UnitCost a -> a+ TotalCost a -> a+ ) $ + catMaybes $+ map acost $+ concatMap (amounts . pamount) $+ concatMap tpostings+ ts3++ -- http://furius.ca/beancount/doc/syntax+ -- "there exists an “Open” directive that is used to provide the start date of each account. + -- That can be located anywhere in the file, it does not have to appear in the file somewhere before you use an account name.+ -- You can just start using account names in transactions right away,+ -- though all account names that receive postings to them will eventually have to have+ -- a corresponding Open directive with a date that precedes all transactions posted to the account in the input file."+ openaccountdirectives+ | null ts = ""+ | otherwise = T.unlines [+ T.intercalate "\n" $+ firstdate <> " open " <> accountNameToBeancount a :+ mdlines+ | a <- nubSort $ concatMap (map paccount.tpostings) ts3+ , let mds = tagsToBeancountMetadata $ fromMaybe [] $ Map.lookup a atags+ , let maxwidth = maximum' $ map (T.length . fst) mds+ , let mdlines = map (postingIndent . showBeancountMetadata (Just maxwidth)) mds+ ]+ where+ firstdate = showDate $ minimumDef err $ map tdate ts3+ where err = error' "entriesReportAsBeancount: should not happen"++entriesReportAsSql :: EntriesReport -> TL.Text+entriesReportAsSql txns = TB.toLazyText $ mconcat+ [ TB.fromText "create table if not exists postings(id serial,txnidx int,date1 date,date2 date,status text,code text,description text,comment text,account text,amount numeric,commodity text,credit numeric,debit numeric,posting_status text,posting_comment text);\n"+ , TB.fromText "insert into postings(txnidx,date1,date2,status,code,description,comment,account,amount,commodity,credit,debit,posting_status,posting_comment) values\n"+ , mconcat . intersperse (TB.fromText ",") $ map values csv+ , TB.fromText ";\n"+ ]+ where+ values vs = TB.fromText "(" <> mconcat (intersperse (TB.fromText ",") $ map toSql vs) <> TB.fromText ")\n"+ toSql "" = TB.fromText "NULL"+ toSql s = TB.fromText "'" <> TB.fromText (T.replace "'" "''" s) <> TB.fromText "'"+ csv =+ Spr.rawTableContent . transactionToSpreadsheet machineFmt Nothing [] .+ transactionMapPostingAmounts (mapMixedAmount setDecimalPoint)+ =<< txns+ where+ setDecimalPoint a = a{astyle=(astyle a){asdecimalmark=Just '.'}}+ entriesReportAsCsv :: EntriesReport -> CSV-entriesReportAsCsv txns =- ["txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"] :- concatMap transactionToCSV txns+entriesReportAsCsv =+ Spr.rawTableContent . entriesReportAsSpreadsheet machineFmt Nothing [] --- | Generate one CSV record per posting, duplicating the common transaction fields.+entriesReportAsSpreadsheet ::+ AmountFormat -> Maybe Text -> [Text] ->+ EntriesReport -> [[Spr.Cell Spr.NumLines Text]]+entriesReportAsSpreadsheet fmt baseUrl query txns =+ Spr.addHeaderBorders+ (map Spr.headerCell+ ["txnidx","date","date2","status","code","description","comment",+ "account","amount","commodity","credit","debit",+ "posting-status","posting-comment"])+ :+ concatMap (transactionToSpreadsheet fmt baseUrl query) txns++-- | Generate one record per posting, duplicating the common transaction fields. -- The txnidx field (transaction index) allows postings to be grouped back into transactions.-transactionToCSV :: Transaction -> CSV-transactionToCSV t =- map (\p -> show idx:date:date2:status:code:description:comment:p)- (concatMap postingToCSV $ tpostings t)+transactionToSpreadsheet ::+ AmountFormat -> Maybe Text -> [Text] ->+ Transaction -> [[Spr.Cell Spr.NumLines Text]]+transactionToSpreadsheet fmt baseUrl query t =+ addRowSpanHeader (idx:d:d2:status:code:description:comment:[])+ (postingToSpreadsheet fmt baseUrl query =<< tpostings t) where- idx = tindex t- description = T.unpack $ tdescription t- date = showDate (tdate t)- date2 = maybe "" showDate (tdate2 t)- status = show $ tstatus t- code = T.unpack $ tcode t- comment = chomp $ strip $ T.unpack $ tcomment t+ cell = Spr.defaultCell+ idx = Spr.integerCell $ tindex t+ description = cell $ tdescription t+ dateCell date =+ (Spr.defaultCell $ showDate date) {Spr.cellType = Spr.TypeDate}+ d = dateCell $ tdate t+ d2 = maybe Spr.emptyCell dateCell $ tdate2 t+ status = cell $ T.pack . show $ tstatus t+ code = cell $ tcode t+ comment = cell $ T.strip $ tcomment t -postingToCSV :: Posting -> CSV-postingToCSV p =+addRowSpanHeader ::+ [Spr.Cell border text] ->+ [[Spr.Cell border text]] -> [[Spr.Cell border text]]+addRowSpanHeader common rows =+ case rows of+ [] -> []+ [row] -> [common++row]+ _ ->+ let setSpan spn cell = cell{Spr.cellSpan = spn} in+ zipWith (++)+ (map (setSpan $ Spr.SpanVertical $ length rows) common :+ repeat (map (setSpan Spr.Covered) common))+ rows++postingToSpreadsheet ::+ (Spr.Lines border) =>+ AmountFormat -> Maybe Text -> [Text] ->+ Posting -> [[Spr.Cell border Text]]+postingToSpreadsheet fmt baseUrl query p = map (\(a@(Amount {aquantity=q,acommodity=c})) ->- let a_ = a{acommodity=""} in- let amount = showAmount a_ in- let commodity = T.unpack c in- let credit = if q < 0 then showAmount $ negate a_ else "" in- let debit = if q >= 0 then showAmount a_ else "" in- [account, amount, commodity, credit, debit, status, comment])- amounts+ -- commodity goes into separate column, so we suppress it, along with digit group+ -- separators and prices+ let a_ = amountStripCost a{acommodity=""} in+ let credit = if q < 0 then amountCell $ negate a_ else Spr.emptyCell in+ let debit = if q >= 0 then amountCell a_ else Spr.emptyCell in+ [setAccountAnchor baseUrl query (paccount p) $ cell account,+ amountCell a_, cell c,+ credit, debit, cell status, cell comment])+ . amounts $ pamount p where- Mixed amounts = pamount p- status = show $ pstatus p+ cell = Spr.defaultCell+ amountCell amt =+ Spr.cellFromAmount fmt+ (Spr.Class "amount", (wbToText $ showAmountB machineFmt amt, amt))+ status = T.pack . show $ pstatus p account = showAccountName Nothing (ptype p) (paccount p)- comment = chomp $ strip $ T.unpack $ pcomment p---- --match---- | Print the transaction most closely and recently matching a description--- (and the query, if any).-printMatch :: CliOpts -> Journal -> Text -> IO ()-printMatch CliOpts{reportopts_=ropts} j desc = do- d <- getCurrentDay- let q = queryFromOpts d ropts- case similarTransaction' j q desc of- Nothing -> putStrLn "no matches found."- Just t -> putStr $ showTransactionUnelided t+ comment = T.strip $ pcomment p +addLocationTag :: Transaction -> Transaction+addLocationTag t = t{tcomment = tcomment t `commentAddTagNextLine` loctag} where- -- Identify the closest recent match for this description in past transactions.- similarTransaction' :: Journal -> Query -> Text -> Maybe Transaction- similarTransaction' j q desc- | null historymatches = Nothing- | otherwise = Just $ snd $ head historymatches- where- historymatches = transactionsSimilarTo j q desc+ loctag = ("location", T.pack . sourcePosPairPretty $ tsourcepos t)
Hledger/Cli/Commands/Print.txt view
@@ -1,21 +1,44 @@-print, txns, p-Show transaction journal entries, sorted by date.+print -_FLAGS_+Show full journal entries, representing transactions. +Flags:+ -x --explicit show all amounts explicitly+ --invert display all amounts with reversed sign+ --locations add tags showing file paths and line numbers+ -m --match=DESC fuzzy search for one recent transaction with+ description closest to DESC+ --new show only newer-dated transactions added in each+ file since last run+ --round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none - show original decimal digits,+ as in journal (default)+ soft - just add or remove decimal zeros+ to match precision+ hard - round posting amounts to precision+ (can unbalance transactions)+ all - also round cost amounts to precision+ (can unbalance transactions)+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, beancount, csv, tsv, html, fods, json, sql.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+ The print command displays full journal entries (transactions) from the-journal file in date order, tidily formatted. With --date2, transactions-are sorted by secondary date instead.+journal file, sorted by date (or with --date2, by secondary date). -print's output is always a valid hledger journal.-It preserves all transaction information, but it does not preserve-directives or inter-transaction comments+Directives and inter-transaction comments are not shown, currently. This+means the print command is somewhat lossy, and if you are using it to+reformat/regenerate your journal you should take care to also copy over+the directives and inter-transaction comments. -$ hledger print-2008/01/01 income- assets:bank:checking $1- income:salary $-1+Eg: +$ hledger print -f examples/sample.journal date:200806 2008/06/01 gift assets:bank:checking $1 income:gifts $-1@@ -29,45 +52,133 @@ expenses:supplies $1 assets:cash $-2 -2008/12/31 * pay off- liabilities:debts $1- assets:bank:checking $-1+print amount explicitness -Normally, the journal entry's explicit or implicit amount style is-preserved. Ie when an amount is omitted in the journal, it will be-omitted in the output. You can use the -x/--explicit flag to make all-amounts explicit, which can be useful for troubleshooting or for making-your journal more readable and robust against data entry errors. Note,--x will cause postings with a multi-commodity amount (these can arise-when a multi-commodity transaction has an implicit amount) will be split-into multiple single-commodity postings, for valid journal output.+Normally, whether posting amounts are implicit or explicit is preserved.+For example, when an amount is omitted in the journal, it will not+appear in the output. Similarly, if a conversion cost is implied but not+written, it will not appear in the output. -With -B/--cost, amounts with transaction prices are converted to cost-using that price. This can be used for troubleshooting.+You can use the -x/--explicit flag to force explicit display of all+amounts and costs. This can be useful for troubleshooting or for making+your journal more readable and robust against data entry errors. -x is+also implied by using any of -B,-V,-X,--value. -With -m/--match and a STR argument, print will show at most one-transaction: the one one whose description is most similar to STR, and-is most recent. STR should contain at least two characters. If there is-no similar-enough match, no transaction will be shown.+The -x/--explicit flag will cause any postings with a multi-commodity+amount (which can arise when a multi-commodity transaction has an+implicit amount) to be split into multiple single-commodity postings,+keeping the output parseable. -With --new, for each FILE being read, hledger reads (and writes) a-special state file (.latest.FILE in the same directory), containing the-latest transaction date(s) that were seen last time FILE was read. When-this file is found, only transactions 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:+print alignment -$ hledger -f bank1.csv print --new-# shows transactions added since last print --new on this file+Amounts are shown right-aligned within each transaction (but not aligned+across all transactions; you can achieve that with ledger-mode in+Emacs). -This assumes that transactions added to FILE always have same or-increasing dates, and that transactions on the same day do not get-reordered. See also the import command.+print amount style -This command also supports output destination and output format-selection. Here's an example of print's CSV output:+Amounts will be displayed mostly in their commodity's display style,+with standardised symbol placement, decimal mark, and digit group marks.+This does not apply to their decimal digits; print normally shows the+same decimal digits that are recorded in each journal entry. +You can override the decimal precisions with print's special --round+option (since 1.32). --round tries to show amounts with their+commodities' standard decimal precisions, increasingly strongly:++- --round=none show amounts with original precisions (default)+- --round=soft add/remove decimal zeros in amounts (except costs)+- --round=hard round amounts (except costs), possibly hiding significant+ digits+- --round=all round all amounts and costs++soft is good for non-lossy cleanup, displaying more consistent decimals+where possible, without making entries unbalanced.++hard or all can be good for stronger cleanup, when decimal rounding is+wanted. Note rounding can produce unbalanced journal entries, perhaps+requiring manual fixup.++print parseability++Normally, print's output is a valid hledger journal, which you can+"pipe" to a second hledger command for further processing. This is+sometimes convenient for achieving certain kinds of query (though less+needed now that queries have become more powerful):++# Show running total of food expenses paid from cash.+# -f- reads from stdin. -I/--ignore-assertions is sometimes needed.+$ hledger print assets:cash | hledger -f- -I reg expenses:food++But here are some things which can cause print's output to become+unparseable:++- --round (see above) can disrupt transaction balancing.+- Account aliases or pivoting can disrupt account names, balance+ assertions, or balance assignments.+- Value reporting also can disrupt balance assertions or balance+ assignments.+- Auto postings can generate too many amountless postings.+- --infer-costs or --infer-equity can generate too-complex redundant+ costs.+- Because print always shows transactions in date order, balance+ assertions involving non-date-ordered transactions (and same-day+ postings) could be disrupted.++print, other features++With -B/--cost, amounts with costs are shown converted to cost.++With --invert, posting amounts are shown with their sign flipped. It+could be useful if you have accidentally recorded some transactions with+the wrong signs.++With --new, print shows only transactions it has not seen on a previous+run. This uses the same deduplication system as the import command. (See+import's docs for details.)++With -m DESC/--match=DESC, print shows one recent transaction whose+description is most similar to DESC. DESC should contain at least two+characters. If there is no similar-enough match, no transaction will be+shown and the program exit code will be non-zero.++With --locations, print adds the source file and line number to every+transaction, as a tag.++print output format++This command also supports the output destination and output format+options The output formats supported are txt, beancount (Added in 1.32),+csv, tsv (Added in 1.32), json and sql.++The beancount format tries to produce Beancount-compatible output, as+follows:++- Transaction and postings with unmarked status are converted to cleared+ (*) status.+- Transactions' payee and note are backslash-escaped and+ double-quote-escaped and wrapped in double quotes.+- Transaction tags are copied to Beancount #tag format.+- Commodity symbols are converted to upper case, and a small number of+ currency symbols like $ are converted to the corresponding currency+ names.+- Account name parts are capitalised and unsupported characters are+ replaced with -. If an account name part does not begin with a letter,+ or if the first part is not Assets, Liabilities, Equity, Income, or+ Expenses, an error is raised. (Use --alias options to bring your+ accounts into compliance.)+- An open directive is generated for each account used, on the earliest+ transaction date.++Some limitations:++- Balance assertions are removed.+- Balance assignments become missing amounts.+- Virtual and balanced virtual postings become regular postings.+- Directives are not converted.++Here's an example of print's CSV output:+ $ hledger print -Ocsv "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment" "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""@@ -82,15 +193,15 @@ "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","","" "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","","" -- There is one CSV record per posting, with the parent transaction's- fields repeated.-- The "txnidx" (transaction index) field shows which postings belong- to the same transaction. (This number might change if transactions- are reordered within the file, files are parsed/included in a- different order, etc.)-- The amount is separated into "commodity" (the symbol) and "amount"- (numeric quantity) fields.-- The numeric amount is repeated in either the "credit" or "debit"- column, for convenience. (Those names are not accurate in the- accounting sense; it just puts negative amounts under credit and- zero or greater amounts under debit.)+- There is one CSV record per posting, with the parent transaction's+ fields repeated.+- The "txnidx" (transaction index) field shows which postings belong to+ the same transaction. (This number might change if transactions are+ reordered within the file, files are parsed/included in a different+ order, etc.)+- The amount is separated into "commodity" (the symbol) and "amount"+ (numeric quantity) fields.+- The numeric amount is repeated in either the "credit" or "debit"+ column, for convenience. (Those names are not accurate in the+ accounting sense; it just puts negative amounts under credit and zero+ or greater amounts under debit.)
− Hledger/Cli/Commands/Printunique.hs
@@ -1,26 +0,0 @@-{-# LANGUAGE TemplateHaskell #-}--module Hledger.Cli.Commands.Printunique (- printuniquemode- ,printunique-) -where--import Data.List-import Hledger-import Hledger.Cli.CliOptions-import Hledger.Cli.Commands.Print--printuniquemode = hledgerCommandMode- $(embedFileRelative "Hledger/Cli/Commands/Printunique.txt")- []- [generalflagsgroup1]- []- ([], Nothing)--printunique opts j@Journal{jtxns=ts} = do- print' opts j{jtxns=uniquify ts}- where- uniquify = nubBy (\t1 t2 -> thingToCompare t1 == thingToCompare t2) . sortOn thingToCompare- thingToCompare = tdescription- -- thingToCompare = tdate
− Hledger/Cli/Commands/Printunique.txt
@@ -1,16 +0,0 @@-print-unique-Print transactions which do not reuse an already-seen description.--_FLAGS_--Example:--$ cat unique.journal-1/1 test- (acct:one) 1-2/2 test- (acct:two) 2-$ LEDGER_FILE=unique.journal hledger print-unique-(-f option not supported)-2015/01/01 test- (acct:one) 1
Hledger/Cli/Commands/Register.hs view
@@ -4,8 +4,10 @@ -} -{-# LANGUAGE CPP, OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE TemplateHaskell #-} module Hledger.Cli.Commands.Register ( registermode@@ -16,27 +18,49 @@ ,tests_Register ) where -import Data.List-import Data.Maybe--- import Data.Text (Text)-import qualified Data.Text as T-import System.Console.CmdArgs.Explicit-import Hledger.Read.CsvReader (CSV, Record, printCSV)+import Data.Default (def)+import Data.Maybe (fromMaybe, isJust)+import Data.Text (Text)+import Data.Map qualified as Map+import Data.Text qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.IO qualified as TL+import Data.Text.Lazy.Builder qualified as TB+import Safe (readMay)+import System.Console.CmdArgs.Explicit (flagNone, flagReq) -import Hledger+import Hledger hiding (per)+import Hledger.Write.Csv (CSV, printCSV, printTSV)+import Hledger.Write.Ods (printFods)+import Hledger.Write.Html.Lucid (styledTableHtml)+import Hledger.Write.Spreadsheet qualified as Spr import Hledger.Cli.CliOptions import Hledger.Cli.Utils+import Hledger.Cli.Anchor (setAccountAnchor, dateCell)+import Text.Tabular.AsciiWide (Cell(..), Align(..), Properties(..), Header(Header, Group), renderRowB, textCell, tableBorders, borderSpaces)+import Lucid qualified+import Data.List (sortBy)+import Data.Char (toUpper)+import Data.List.Extra (intersect)+import System.IO qualified as IO registermode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Register.txt")- ([flagNone ["cumulative"] (setboolopt "change")- "show running total from report start date (default)"+ ([flagNone ["cumulative"] (setboolopt "cumulative")+ (accumprefix ++ "show running total from report start date (default)") ,flagNone ["historical","H"] (setboolopt "historical")- "show historical running total/balance (includes postings before report start date)\n "+ (accumprefix ++ "show historical running total/balance (includes postings before report start date)") ,flagNone ["average","A"] (setboolopt "average") "show running average of posting amounts instead of total (implies --empty)"+ ,let arg = "DESC" in+ flagReq ["match","m"] (\s opts -> Right $ setopt "match" s opts) arg+ ("fuzzy search for one recent posting with description closest to "++arg) ,flagNone ["related","r"] (setboolopt "related") "show postings' siblings instead" ,flagNone ["invert"] (setboolopt "invert") "display all amounts with reversed sign"+ ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "omit N leading account name parts"+ ,flagReq ["sort"] (\s opts -> Right $ setopt "sort" s opts) "FIELDS" + ("sort by: " <> sortKeysDescription+ <> ", or a comma-separated combination of these. For a descending sort, prefix with -. (Default: date)") ,flagReq ["width","w"] (\s opts -> Right $ setopt "width" s opts) "N" ("set output width (default: " ++ #ifdef mingw32_HOST_OS@@ -44,51 +68,111 @@ #else "terminal width" #endif- ++ " or $COLUMNS). -wN,M sets description width as well."+ ++ "). -wN,M sets description width as well." )- ] ++ outputflags)- [generalflagsgroup1]- []+ ,flagNone ["align-all"] (setboolopt "align-all") "guarantee alignment across all lines (slower)"+ ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX" "in html output, generate links to hledger-web, with this prefix. (Usually the base url shown by hledger-web; can also be relative.)"+ ,outputFormatFlag ["txt","csv","tsv","html","fods","json"]+ ,outputFileFlag+ ])+ cligeneralflagsgroups1+ hiddenflags ([], Just $ argsFlag "[QUERY]")+ where+ accumprefix = "accumulation mode: " -- | Print a (posting) register report. register :: CliOpts -> Journal -> IO ()-register opts@CliOpts{reportopts_=ropts} j = do- d <- getCurrentDay- let fmt = outputFormatFromOpts opts- render | fmt=="csv" = const ((++"\n") . printCSV . postingsReportAsCsv)- | fmt=="html" = const $ error' "Sorry, HTML output is not yet implemented for this kind of report." -- TODO- | otherwise = postingsReportAsText- writeOutput opts $ render opts $ postingsReport ropts (queryFromOpts d ropts) j+register opts@CliOpts{rawopts_=rawopts, reportspec_=rspec} j+ -- match mode, print one recent posting most similar to given description, if any+ -- XXX should match similarly to print --match+ | Just desc <- maybestringopt "match" rawopts = do+ let ps = [p | (_,_,_,p,_) <- rpt]+ case similarPosting ps desc of+ Nothing -> error' $ "no postings found with description like " <> show desc+ Just p -> TL.putStr $ postingsReportAsText opts [pri]+ where pri = (Just (postingDate p)+ ,Nothing+ ,tdescription <$> ptransaction p+ ,styleAmounts styles p+ ,styleAmounts styles nullmixedamt)+ -- normal register report, list postings+ | otherwise = writeOutputLazyText opts $ render $ styleAmounts styles rpt+ where+ styles = journalCommodityStylesWith HardRounding j+ rpt = postingsReport rspec j+ render | fmt=="txt" = postingsReportAsText opts+ | fmt=="json" = toJsonText+ | fmt=="csv" = printCSV . postingsReportAsCsv opts+ | fmt=="tsv" = printTSV . postingsReportAsCsv opts+ | fmt=="html" =+ (<>"\n") . Lucid.renderText . styledTableHtml .+ map (map (fmap Lucid.toHtml)) .+ postingsReportAsSpreadsheet opts oneLineNoCostFmt baseUrl query+ | fmt=="fods" =+ printFods IO.localeEncoding . Map.singleton "Register" .+ (,) (1,0) .+ postingsReportAsSpreadsheet opts oneLineNoCostFmt baseUrl query+ | otherwise = error' $ unsupportedOutputFormatError fmt -- PARTIAL:+ where fmt = outputFormatFromOpts opts+ baseUrl = balance_base_url_ $ _rsReportOpts rspec+ query = querystring_ $ _rsReportOpts rspec -postingsReportAsCsv :: PostingsReport -> CSV-postingsReportAsCsv (_,is) =- ["txnidx","date","code","description","account","amount","total"]+postingsReportAsCsv :: CliOpts -> PostingsReport -> CSV+postingsReportAsCsv opts =+ Spr.rawTableContent . postingsReportAsSpreadsheet opts machineFmt Nothing []++-- ToDo: --layout=bare etc.+-- ToDo: Text output does not show headers, but Spreadsheet does+postingsReportAsSpreadsheet ::+ CliOpts -> AmountFormat -> Maybe Text -> [Text] ->+ PostingsReport -> [[Spr.Cell Spr.NumLines Text]]+postingsReportAsSpreadsheet opts fmt baseUrl query is =+ Spr.addHeaderBorders+ (map Spr.headerCell+ ["txnidx","date","code","description","account","amount","total"]) :- map postingsReportItemAsCsvRecord is+ map (postingsReportItemAsRecord opts fmt baseUrl query) is -postingsReportItemAsCsvRecord :: PostingsReportItem -> Record-postingsReportItemAsCsvRecord (_, _, _, p, b) = [idx,date,code,desc,acct,amt,bal]+{- ToDo:+link txnidx to journal URL,+ however, requires Web.Widget.Common.transactionFragment+-}+postingsReportItemAsRecord ::+ (Spr.Lines border) =>+ CliOpts -> AmountFormat -> Maybe Text -> [Text] ->+ PostingsReportItem -> [Spr.Cell border Text]+postingsReportItemAsRecord opts@CliOpts{reportspec_=rspec} fmt baseUrl query (_, _, _, p, b) =+ [idx,+ (dateCell baseUrl query (paccount p) date) {Spr.cellType = Spr.TypeDate},+ cell code, cell desc,+ setAccountAnchor baseUrl query (paccount p) $ cell acct,+ amountCell (pamount p),+ amountCell b] where- idx = show $ maybe 0 tindex $ ptransaction p- date = showDate $ postingDate p -- XXX csv should show date2 with --date2- code = maybe "" (T.unpack . tcode) $ ptransaction p- desc = T.unpack $ maybe "" tdescription $ ptransaction p- acct = bracket $ T.unpack $ paccount p+ cell = Spr.defaultCell+ idx = Spr.integerCell . maybe 0 tindex $ ptransaction p+ date = postingDate p -- XXX csv should show date2 with --date2+ code = maybe "" tcode $ ptransaction p+ desc = maybe "" tdescription $ ptransaction p+ acct = bracket . dropAcct . clipAcct $ paccount p where+ clipAcct = clipOrEllipsifyAccountName (depth_ $ _rsReportOpts rspec)+ dropAcct = accountNameDrop (fromMaybe 0 $ readMay =<< maybestringopt "drop" (rawopts_ opts)) bracket = case ptype p of- BalancedVirtualPosting -> (\s -> "["++s++"]")- VirtualPosting -> (\s -> "("++s++")")+ BalancedVirtualPosting -> wrap "[" "]"+ VirtualPosting -> wrap "(" ")" _ -> id- amt = showMixedAmountOneLineWithoutPrice $ pamount p- bal = showMixedAmountOneLineWithoutPrice b+ -- Since postingsReport strips prices from all Amounts when not used, we can display prices.+ amountCell amt =+ wbToText <$> Spr.cellFromMixedAmount fmt (Spr.Class "amount", amt) -- | Render a register report as plain text suitable for console output.-postingsReportAsText :: CliOpts -> PostingsReport -> String-postingsReportAsText opts (_,items) = unlines $ map (postingsReportItemAsText opts amtwidth balwidth) items+postingsReportAsText :: CliOpts -> PostingsReport -> TL.Text+postingsReportAsText opts = TB.toLazyText .+ postingsOrTransactionsReportAsText alignAll opts (postingsReportItemAsText opts) itemamt itembal where- amtwidth = maximumStrict $ 12 : map (strWidth . showMixedAmount . itemamt) items- balwidth = maximumStrict $ 12 : map (strWidth . showMixedAmount . itembal) items+ alignAll = boolopt "align-all" $ rawopts_ opts itemamt (_,_,_,Posting{pamount=a},_) = a itembal (_,_,_,_,a) = a @@ -114,87 +198,125 @@ -- has multiple commodities. Does not yet support formatting control -- like balance reports. ---postingsReportItemAsText :: CliOpts -> Int -> Int -> PostingsReportItem -> String-postingsReportItemAsText opts preferredamtwidth preferredbalwidth (mdate, menddate, mdesc, p, b) =- -- use elide*Width to be wide-char-aware- -- trace (show (totalwidth, datewidth, descwidth, acctwidth, amtwidth, balwidth)) $- intercalate "\n" $- concat [fitString (Just datewidth) (Just datewidth) True True date- ," "- ,fitString (Just descwidth) (Just descwidth) True True desc- ," "- ,fitString (Just acctwidth) (Just acctwidth) True True acct- ," "- ,fitString (Just amtwidth) (Just amtwidth) True False amtfirstline- ," "- ,fitString (Just balwidth) (Just balwidth) True False balfirstline- ]- :- [concat [spacer- ,fitString (Just amtwidth) (Just amtwidth) True False a- ," "- ,fitString (Just balwidth) (Just balwidth) True False b- ]- | (a,b) <- zip amtrest balrest- ]+-- Also returns the natural width (without padding) of the amount and balance+-- fields.+postingsReportItemAsText :: CliOpts -> Int -> Int+ -> (PostingsReportItem, [WideBuilder], [WideBuilder])+ -> TB.Builder+postingsReportItemAsText opts@CliOpts{reportspec_=rspec} preferredamtwidth preferredbalwidth ((mdate, mperiod, mdesc, p, _), amt, bal) =+ table <> TB.singleton '\n'+ where+ table = renderRowB def{tableBorders=False, borderSpaces=False} . Group NoLine $ map Header+ [ textCell TopLeft $ fitText (Just datewidth) (Just datewidth) True True date+ , spacerCell+ , textCell TopLeft $ fitText (Just descwidth) (Just descwidth) True True desc+ , spacerCell2+ , textCell TopLeft $ fitText (Just acctwidth) (Just acctwidth) True True acct+ , spacerCell2+ , Cell TopRight $ map (pad amtwidth) amt+ , spacerCell2+ , Cell BottomRight $ map (pad balwidth) bal+ ]+ spacerCell = Cell BottomLeft [WideBuilder (TB.singleton ' ') 1]+ spacerCell2 = Cell BottomLeft [WideBuilder (TB.fromString " ") 2]+ pad fullwidth amt' = WideBuilder (TB.fromText $ T.replicate w " ") w <> amt'+ where w = fullwidth - wbWidth amt'+ -- calculate widths+ (totalwidth,mdescwidth) = registerWidthsFromOpts opts+ datewidth = maybe 10 periodTextWidth mperiod+ date = case mperiod of+ Just per -> if isJust mdate then showPeriod per else ""+ Nothing -> maybe "" showDate mdate+ (amtwidth, balwidth)+ | shortfall <= 0 = (preferredamtwidth, preferredbalwidth)+ | otherwise = (adjustedamtwidth, adjustedbalwidth)+ where+ mincolwidth = 2 -- columns always show at least an ellipsis+ maxamtswidth = max 0 (totalwidth - (datewidth + 1 + mincolwidth + 2 + mincolwidth + 2 + 2))+ shortfall = (preferredamtwidth + preferredbalwidth) - maxamtswidth+ amtwidthproportion = fromIntegral preferredamtwidth / fromIntegral (preferredamtwidth + preferredbalwidth)+ adjustedamtwidth = round $ amtwidthproportion * fromIntegral maxamtswidth+ adjustedbalwidth = maxamtswidth - adjustedamtwidth++ remaining = totalwidth - (datewidth + 1 + 2 + amtwidth + 2 + balwidth)+ (descwidth, acctwidth)+ | isJust mperiod = (0, remaining - 2)+ | otherwise = (w, remaining - 2 - w)+ where+ w = fromMaybe ((remaining - 2) `div` 2) mdescwidth++ -- gather content+ desc = fromMaybe "" mdesc+ acct = parenthesise . elideAccountName awidth . dropAcct . clipAcct $ paccount p+ where+ clipAcct = clipOrEllipsifyAccountName (depth_ $ _rsReportOpts rspec)+ dropAcct = accountNameDrop (fromMaybe 0 $ readMay =<< maybestringopt "drop" (rawopts_ opts))+ (parenthesise, awidth) = case ptype p of+ BalancedVirtualPosting -> (wrap "[" "]", acctwidth-2)+ VirtualPosting -> (wrap "(" ")", acctwidth-2)+ _ -> (id,acctwidth)++-- for register --match:++-- Identify the closest recent match for this description in the given date-sorted postings.+similarPosting :: [Posting] -> String -> Maybe Posting+similarPosting ps desc =+ let matches =+ sortBy compareRelevanceAndRecency+ $ filter ((> threshold).fst)+ [(maybe 0 (\t -> compareDescriptions desc (T.unpack $ tdescription t)) (ptransaction p), p) | p <- ps]+ where+ compareRelevanceAndRecency (n1,p1) (n2,p2) = compare (n2,postingDate p2) (n1,postingDate p1)+ threshold = 0+ in case matches of [] -> Nothing+ m:_ -> Just $ snd m++-- -- Identify the closest recent match for this description in past transactions.+-- similarTransaction :: Journal -> Query -> String -> Maybe Transaction+-- similarTransaction j q desc =+-- case historymatches = transactionsSimilarTo j q desc of+-- ((,t):_) = Just t+-- [] = Nothing++compareDescriptions :: String -> String -> Double+compareDescriptions s t = compareStrings s' t'+ where s' = simplify s+ t' = simplify t+ simplify = filter (not . (`elem` ("0123456789"::String)))++-- | Return a similarity measure, from 0 to 1, for two strings.+-- This is Simon White's letter pairs algorithm from+-- http://www.catalysoft.com/articles/StrikeAMatch.html+-- with a modification for short strings.+compareStrings :: String -> String -> Double+compareStrings "" "" = 1+compareStrings [_] "" = 0+compareStrings "" [_] = 0+compareStrings [a] [b] = if toUpper a == toUpper b then 1 else 0+compareStrings s1 s2 = 2.0 * fromIntegral i / fromIntegral u where- -- calculate widths- (totalwidth,mdescwidth) = registerWidthsFromOpts opts- (datewidth, date) = case (mdate,menddate) of- (Just _, Just _) -> (21, showDateSpan (DateSpan mdate menddate))- (Nothing, Just _) -> (21, "")- (Just d, Nothing) -> (10, showDate d)- _ -> (10, "")- (amtwidth, balwidth)- | shortfall <= 0 = (preferredamtwidth, preferredbalwidth)- | otherwise = (adjustedamtwidth, adjustedbalwidth)- where- mincolwidth = 2 -- columns always show at least an ellipsis- maxamtswidth = max 0 (totalwidth - (datewidth + 1 + mincolwidth + 2 + mincolwidth + 2 + 2))- shortfall = (preferredamtwidth + preferredbalwidth) - maxamtswidth- amtwidthproportion = fromIntegral preferredamtwidth / fromIntegral (preferredamtwidth + preferredbalwidth)- adjustedamtwidth = round $ amtwidthproportion * fromIntegral maxamtswidth- adjustedbalwidth = maxamtswidth - adjustedamtwidth+ i = length $ intersect pairs1 pairs2+ u = length pairs1 + length pairs2+ pairs1 = wordLetterPairs $ uppercase s1+ pairs2 = wordLetterPairs $ uppercase s2 - remaining = totalwidth - (datewidth + 1 + 2 + amtwidth + 2 + balwidth)- (descwidth, acctwidth)- | hasinterval = (0, remaining - 2)- | otherwise = (w, remaining - 2 - w)- where- hasinterval = isJust menddate- w = fromMaybe ((remaining - 2) `div` 2) mdescwidth+wordLetterPairs = concatMap letterPairs . words - -- gather content- desc = fromMaybe "" mdesc- acct = parenthesise $ T.unpack $ elideAccountName awidth $ paccount p- where- (parenthesise, awidth) =- case ptype p of- BalancedVirtualPosting -> (\s -> "["++s++"]", acctwidth-2)- VirtualPosting -> (\s -> "("++s++")", acctwidth-2)- _ -> (id,acctwidth)- amt = showMixedAmountWithoutPrice $ pamount p- bal = showMixedAmountWithoutPrice b- -- alternate behaviour, show null amounts as 0 instead of blank- -- amt = if null amt' then "0" else amt'- -- bal = if null bal' then "0" else bal'- (amtlines, ballines) = (lines amt, lines bal)- (amtlen, ballen) = (length amtlines, length ballines)- numlines = max 1 (max amtlen ballen)- (amtfirstline:amtrest) = take numlines $ amtlines ++ repeat "" -- posting amount is top-aligned- (balfirstline:balrest) = take numlines $ replicate (numlines - ballen) "" ++ ballines -- balance amount is bottom-aligned- spacer = replicate (totalwidth - (amtwidth + 2 + balwidth)) ' '+letterPairs (a:b:rest) = [a,b] : letterPairs (b:rest)+letterPairs _ = [] -- tests -tests_Register = tests "Register" [+tests_Register = testGroup "Register" [ - tests "postingsReportAsText" [- test "unicode in register layout" $ do- j <- io $ readJournal' "2009/01/01 * медвежья шкура\n расходы:покупки 100\n актив:наличные\n"- let opts = defreportopts- (postingsReportAsText defcliopts $ postingsReport opts (queryFromOpts (parsedate "2008/11/26") opts) j) `is` unlines- ["2009/01/01 медвежья шкура расходы:покупки 100 100"+ testGroup "postingsReportAsText" [+ testCase "unicode in register layout" $ do+ j <- readJournal'' "2009/01/01 * медвежья шкура\n расходы:покупки 100\n актив:наличные\n"+ let rspec = defreportspec+ (TL.unpack . postingsReportAsText defcliopts $ postingsReport rspec j)+ @?=+ unlines+ ["2009-01-01 медвежья шкура расходы:покупки 100 100" ," актив:наличные -100 0"] ]
Hledger/Cli/Commands/Register.txt view
@@ -1,12 +1,47 @@-register, reg, r+register++(reg)+ Show postings and their running total. -_FLAGS_+Flags:+ --cumulative accumulation mode: show running total from report+ start date (default)+ -H --historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date)+ -A --average show running average of posting amounts instead+ of total (implies --empty)+ -m --match=DESC fuzzy search for one recent posting with+ description closest to DESC+ -r --related show postings' siblings instead+ --invert display all amounts with reversed sign+ --drop=N omit N leading account name parts+ --sort=FIELDS sort by: date, desc, account, amount, absamount,+ or a comma-separated combination of these. For a+ descending sort, prefix with -. (Default: date)+ -w --width=N set output width (default: terminal width). -wN,M+ sets description width as well.+ --align-all guarantee alignment across all lines (slower)+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, csv, tsv, html, fods, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format. -The register command displays postings in date order, one per line, and-their running total. This is typically used with a query selecting a-particular account, to see that account's activity:+The register command displays matched postings, across all accounts, in+date order, with their running total or running historical balance. (See+also the aregister command, which shows matched transactions in a+specific account.) +register normally shows line per posting, but note that multi-commodity+amounts will occupy multiple lines (one line per commodity).++It is typically used with a query selecting a particular account, to see+that account's activity:+ $ hledger register checking 2008/01/01 income assets:bank:checking $1 $1 2008/06/01 gift assets:bank:checking $1 $2@@ -15,6 +50,12 @@ With --date2, it shows and sorts by secondary date instead. +For performance reasons, column widths are chosen based on the first+1000 lines; this means unusually wide values in later lines can cause+visual discontinuities as column widths are adjusted. If you want to+ensure perfect alignment, at the cost of more time and memory, use the+--align-all flag.+ The --historical/-H flag adds the balance from any undisplayed prior postings to the running total. This is useful when you want to see only recent activity, with a historically accurate running balance:@@ -26,13 +67,15 @@ The --depth option limits the amount of sub-account detail displayed. +The --drop option will trim leading segments from account names.+ The --average/-A flag shows the running average posting amount instead of the running total (so, the final number displayed is the average for the whole report period). This flag implies --empty (see below). It is affected by --historical. It works best when showing just one account and one commodity. -The --related/-r flag shows the _other_ postings in the transactions of+The --related/-r flag shows the other postings in the transactions of the postings which would normally be shown. The --invert flag negates all amounts. For example, it can be used on an@@ -40,6 +83,13 @@ It's also useful to show postings on the checking account together with the related account: +The --sort=FIELDS flag sorts by the fields given, which can be any of+account, amount, absamount, date, or desc/description, optionally+separated by commas. For example, --sort account,amount will group all+transactions in each account, sorted by transaction amount. Each field+can be negated by a preceding -, so --sort -amount will show+transactions ordered from smallest amount to largest amount.+ $ hledger register --related --invert assets:checking With a reporting interval, register shows summary postings, one per@@ -69,7 +119,7 @@ Often, you'll want to see just one line per interval. The --depth option helps with this, causing subaccounts to be aggregated: -$ hledger register --monthly assets --depth 1h+$ hledger register --monthly assets --depth 1 2008/01 assets $1 $1 2008/06 assets $-1 0 2008/12 assets $-1 $-1@@ -79,11 +129,22 @@ intervals. This ensures that the first and last intervals are full length and comparable to the others in the report. +If you have a deeply nested account tree some reports might benefit from+trimming leading segments from the account names using --drop.++$ hledger register --monthly income --drop 1+2008/01 salary $-1 $-1+2008/06 gifts $-1 $-2++With -m DESC/--match=DESC, register does a fuzzy search for one recent+posting whose description is most similar to DESC. DESC should contain+at least two characters. If there is no similar-enough match, no posting+will be shown and the program exit code will be non-zero.+ Custom register output -register uses the full terminal width by default, except on windows. You-can override this by setting the COLUMNS environment variable (not a-bash shell variable) or by using the --width/-w option.+register normally uses the full terminal width (or 80 columns if it+can't detect that). You can override this with the --width/-w option. The description and account columns normally share the space equally (about half of (width - 40) each). You can adjust this by adding a@@ -98,10 +159,8 @@ $ hledger reg # use terminal width (or 80 on windows) $ hledger reg -w 100 # use width 100-$ COLUMNS=100 hledger reg # set with one-time environment variable-$ export COLUMNS=100; hledger reg # set till session end (or window resize) $ hledger reg -w 100,40 # set overall width 100, description width 40-$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40 -This command also supports output destination and output format-selection.+This command also supports the output destination and output format+options The output formats supported are txt, csv, tsv (Added in 1.32),+and json.
− Hledger/Cli/Commands/Registermatch.hs
@@ -1,89 +0,0 @@-{-# LANGUAGE OverloadedStrings #-}-{-# LANGUAGE TemplateHaskell #-}--module Hledger.Cli.Commands.Registermatch (- registermatchmode- ,registermatch-) -where--import Data.Char (toUpper)-import Data.List-import qualified Data.Text as T-import Hledger-import Hledger.Cli.CliOptions-import Hledger.Cli.Commands.Register--registermatchmode = hledgerCommandMode- $(embedFileRelative "Hledger/Cli/Commands/Registermatch.txt")- []- [generalflagsgroup1]- []- ([], Just $ argsFlag "DESC")--registermatch :: CliOpts -> Journal -> IO ()-registermatch opts@CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do- let args' = listofstringopt "args" rawopts- case args' of- [desc] -> do- d <- getCurrentDay- let q = queryFromOptsOnly d ropts- (_,pris) = postingsReport ropts q j- ps = [p | (_,_,_,p,_) <- pris]- case similarPosting ps desc of- Nothing -> putStrLn "no matches found."- Just p -> putStr $ postingsReportAsText opts ("",[pri])- where pri = (Just (postingDate p)- ,Nothing- ,Just $ T.unpack (maybe "" tdescription $ ptransaction p)- ,p- ,0)- _ -> putStrLn "please provide one description argument."---- Identify the closest recent match for this description in the given date-sorted postings.-similarPosting :: [Posting] -> String -> Maybe Posting-similarPosting ps desc =- let matches =- sortBy compareRelevanceAndRecency- $ filter ((> threshold).fst)- [(maybe 0 (\t -> compareDescriptions desc (T.unpack $ tdescription t)) (ptransaction p), p) | p <- ps]- where- compareRelevanceAndRecency (n1,p1) (n2,p2) = compare (n2,postingDate p2) (n1,postingDate p1)- threshold = 0- in case matches of [] -> Nothing- m:_ -> Just $ snd m---- -- Identify the closest recent match for this description in past transactions.--- similarTransaction :: Journal -> Query -> String -> Maybe Transaction--- similarTransaction j q desc =--- case historymatches = transactionsSimilarTo j q desc of--- ((,t):_) = Just t--- [] = Nothing--compareDescriptions :: String -> String -> Double-compareDescriptions s t = compareStrings s' t'- where s' = simplify s- t' = simplify t- simplify = filter (not . (`elem` ("0123456789"::String)))---- | Return a similarity measure, from 0 to 1, for two strings.--- This is Simon White's letter pairs algorithm from--- http://www.catalysoft.com/articles/StrikeAMatch.html--- with a modification for short strings.-compareStrings :: String -> String -> Double-compareStrings "" "" = 1-compareStrings [_] "" = 0-compareStrings "" [_] = 0-compareStrings [a] [b] = if toUpper a == toUpper b then 1 else 0-compareStrings s1 s2 = 2.0 * fromIntegral i / fromIntegral u- where- i = length $ intersect pairs1 pairs2- u = length pairs1 + length pairs2- pairs1 = wordLetterPairs $ uppercase s1- pairs2 = wordLetterPairs $ uppercase s2--wordLetterPairs = concatMap letterPairs . words--letterPairs (a:b:rest) = [a,b] : letterPairs (b:rest)-letterPairs _ = []-
− Hledger/Cli/Commands/Registermatch.txt
@@ -1,8 +0,0 @@-register-match-Print the one posting whose transaction description is closest to DESC,-in the style of the register command. If there are multiple equally good-matches, it shows the most recent. Query options (options, not-arguments) can be used to restrict the search space. Helps-ledger-autosync detect already-seen transactions when importing.--_FLAGS_
+ Hledger/Cli/Commands/Repl.txt view
@@ -0,0 +1,78 @@+repl++Start an interactive prompt, where you can run any of hledger's+commands. Data files are parsed just once, so the commands run faster.++Flags:+no command-specific flags++This command is experimental and could change in the future.++hledger repl starts a read-eval-print loop (REPL) where you can enter+commands interactively. As with the run command, each input file (or+each input file/input options combination) is parsed just once, so+commands will run more quickly than if you ran them individually at the+command line.++Also like run, the input file(s) specified for the repl command will be+the default input for all interactive commands. You can override this+temporarily by specifying an -f option in particular commands. But note+that commands will not see any changes made to input files (eg by add)+until you exit and restart the REPL.++The command syntax is the same as with run:++- enter one hledger command at a time, without the usual hledger first+ word+- empty lines and comment text from # to end of line are ignored+- use single or double quotes to quote arguments when needed+- type exit or quit or control-D to exit the REPL.++While it is running, the REPL remembers your command history, and you+can navigate in the usual ways:++- Keypad or Emacs navigation keys to edit the current command line+- UP/DOWN or control-P/control-N to step back/forward through history+- control-R to search for a past command+- TAB to complete file paths.++Generally repl command lines should feel much like the normal hledger+CLI, but you may find differences. repl is a little stricter; eg it+requires full command names or official abbreviations (as seen in the+commands list).++The commands and help commands, and the command help flags (CMD --tldr,+CMD -h/--help, CMD --info, CMD --man), can be useful.++You can type control-C to cancel a long-running command (but only once;+typing it a second time will exit the REPL).++And in most shells you can type control-Z to temporarily exit to the+shell (and then fg to return to the REPL).++Examples++Start the REPL and enter some commands:++$ hledger repl +Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.+% stats+Main file : .../2025.journal+...+% stats -f 2024/2024.journal +Main file : .../2024.journal+...+% stats+Main file : .../2025.journal+...++or:++$ hledger repl -f some.journal+Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.+% bs+...+% print -b 'last week'+...+% bs -f other.journal+...
Hledger/Cli/Commands/Rewrite.hs view
@@ -1,26 +1,31 @@-{-# LANGUAGE OverloadedStrings, LambdaCase, DeriveTraversable, ViewPatterns #-}-{-# LANGUAGE CPP #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE CPP #-}+{-# LANGUAGE DeriveTraversable #-}+{-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE ViewPatterns #-} module Hledger.Cli.Commands.Rewrite ( rewritemode ,rewrite-) +) where -#if !(MIN_VERSION_base(4,11,0))-import Control.Monad.Writer-#endif import Data.Functor.Identity-import Data.List (sortOn, foldl')-import qualified Data.Text as T+import Data.List (sortOn)+#if !MIN_VERSION_base(4,20,0)+import Data.List (foldl')+#endif+import Data.Text (Text)+import Data.Text qualified as T+import Data.Text.IO qualified as T import Hledger import Hledger.Cli.CliOptions import Hledger.Cli.Commands.Print import System.Console.CmdArgs.Explicit import Text.Printf-import Text.Megaparsec-import qualified Data.Algorithm.Diff as D+import Text.Megaparsec hiding (pos1)+import Data.Algorithm.Diff qualified as D rewritemode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Rewrite.txt")@@ -28,32 +33,35 @@ "add a posting to ACCT, which may be parenthesised. AMTEXPR is either a literal amount, or *N which means the transaction's first matched amount multiplied by N (a decimal number). Two spaces separate ACCT and AMTEXPR." ,flagNone ["diff"] (setboolopt "diff") "generate diff suitable as an input for patch tool" ]- [generalflagsgroup1]- []+ cligeneralflagsgroups1+ hiddenflags ([], Just $ argsFlag "[QUERY] --add-posting \"ACCT AMTEXPR\" ...") -- TODO regex matching and interpolating matched name in replacement -- TODO interpolating match groups in replacement -- TODO allow using this on unbalanced entries, eg to rewrite while editing -rewrite opts@CliOpts{rawopts_=rawopts,reportopts_=ropts} j@Journal{jtxns=ts} = do +rewrite opts@CliOpts{rawopts_=rawopts,reportspec_=rspec} j@Journal{jtxns=ts} = do -- rewrite matched transactions- let modifiers = transactionModifierFromOpts opts : jtxnmodifiers j- let j' = j{jtxns=modifyTransactions modifiers ts}+ let+ today = _rsDay rspec+ verbosetags = boolopt "verbose-tags" rawopts+ modifiers = transactionModifierFromOpts opts : jtxnmodifiers j+ let j' = j{jtxns=either error' id $ modifyTransactions (journalAccountType j) (journalInheritedAccountTags j) mempty today verbosetags modifiers ts} -- PARTIAL: -- run the print command, showing all transactions, or show diffs- printOrDiff rawopts opts{reportopts_=ropts{query_=""}} j j'+ printOrDiff rawopts opts{reportspec_=rspec{_rsQuery=Any}} j j' -- | Build a 'TransactionModifier' from any query arguments and --add-posting flags -- provided on the command line, or throw a parse error. transactionModifierFromOpts :: CliOpts -> TransactionModifier-transactionModifierFromOpts CliOpts{rawopts_=rawopts,reportopts_=ropts} = - TransactionModifier{tmquerytxt=q, tmpostingrules=ps}+transactionModifierFromOpts CliOpts{rawopts_=rawopts} =+ TransactionModifier{tmquerytxt=q, tmpostingrules=ps} where- q = T.pack $ query_ ropts- ps = map (parseposting . stripquotes . T.pack) $ listofstringopt "add-posting" rawopts- parseposting t = either (error' . errorBundlePretty) id ep+ q = T.pack . unwords . map quoteIfNeeded $ listofstringopt "args" rawopts+ ps = map (parseposting . T.pack) $ listofstringopt "add-posting" rawopts+ parseposting t = either (error' . errorBundlePretty) id ep -- PARTIAL: where- ep = runIdentity (runJournalParser (postingp Nothing <* eof) t')+ ep = runIdentity (runJournalParser (tmpostingrulep Nothing <* eof) t') t' = " " <> t <> "\n" -- inject space and newline for proper parsing printOrDiff :: RawOpts -> (CliOpts -> Journal -> Journal -> IO ())@@ -63,10 +71,10 @@ diffOutput :: Journal -> Journal -> IO () diffOutput j j' = do- let changed = [(originalTransaction t, originalTransaction t') | (t, t') <- zip (jtxns j) (jtxns j'), t /= t']- putStr $ renderPatch $ map (uncurry $ diffTxn j) changed+ let changed = [(transactionWithMostlyOriginalPostings t, transactionWithMostlyOriginalPostings t') | (t, t') <- zip (jtxns j) (jtxns j'), t /= t']+ T.putStr $ renderPatch $ map (uncurry $ diffTxn j) changed -type Chunk = (GenericSourcePos, [DiffLine String])+type Chunk = (SourcePos, [DiffLine Text]) -- XXX doctests, update needed: -- >>> putStr $ renderPatch [(GenericSourcePos "a" 1 1, [D.First "x", D.Second "y"])]@@ -94,17 +102,17 @@ -- @@ -5,0 +5,1 @@ -- +z -- | Render list of changed lines as a unified diff-renderPatch :: [Chunk] -> String+renderPatch :: [Chunk] -> Text renderPatch = go Nothing . sortOn fst where go _ [] = ""- go Nothing cs@((sourceFilePath -> fp, _):_) = fileHeader fp ++ go (Just (fp, 0)) cs- go (Just (fp, _)) cs@((sourceFilePath -> fp', _):_) | fp /= fp' = go Nothing cs- go (Just (fp, offs)) ((sourceFirstLine -> lineno, diffs):cs) = chunkHeader ++ chunk ++ go (Just (fp, offs + adds - dels)) cs+ go Nothing cs@((SourcePos fp _ _, _):_) = fileHeader fp <> go (Just (fp, 0)) cs+ go (Just (fp, _)) cs@((SourcePos fp' _ _, _):_) | fp /= fp' = go Nothing cs+ go (Just (fp, offs)) ((SourcePos _ lineno _, diffs):cs) = chunkHeader <> chnk <> go (Just (fp, offs + adds - dels)) cs where- chunkHeader = printf "@@ -%d,%d +%d,%d @@\n" lineno dels (lineno+offs) adds where+ chunkHeader = T.pack $ printf "@@ -%d,%d +%d,%d @@\n" (unPos lineno) dels (unPos lineno+offs) adds (dels, adds) = foldl' countDiff (0, 0) diffs- chunk = concatMap renderLine diffs- fileHeader fp = printf "--- %s\n+++ %s\n" fp fp+ chnk = foldMap renderLine diffs+ fileHeader fp = "--- " <> T.pack fp <> "\n+++ " <> T.pack fp <> "\n" countDiff (dels, adds) = \case Del _ -> (dels + 1, adds)@@ -112,30 +120,29 @@ Ctx _ -> (dels + 1, adds + 1) renderLine = \case- Del s -> '-' : s ++ "\n"- Add s -> '+' : s ++ "\n"- Ctx s -> ' ' : s ++ "\n"+ Del s -> "-" <> s <> "\n"+ Add s -> "+" <> s <> "\n"+ Ctx s -> " " <> s <> "\n" diffTxn :: Journal -> Transaction -> Transaction -> Chunk-diffTxn j t t' =- case tsourcepos t of- GenericSourcePos fp lineno _ -> (GenericSourcePos fp (lineno+1) 1, diffs) where- -- TODO: use range and produce two chunks: one removes part of- -- original file, other adds transaction to new file with- -- suffix .ledger (generated). I.e. move transaction from one file to another.- diffs :: [DiffLine String]- diffs = concat . map (traverse showPostingLines . mapDiff) $ D.getDiff (tpostings t) (tpostings t')- pos@(JournalSourcePos fp (line, line')) -> (pos, diffs) where- -- We do diff for original lines vs generated ones. Often leads- -- to big diff because of re-format effect.- diffs :: [DiffLine String]- diffs = map mapDiff $ D.getDiff source changed'- source | Just contents <- lookup fp $ jfiles j = map T.unpack . drop (line-1) . take line' $ T.lines contents- | otherwise = []- changed = lines $ showTransactionUnelided t'- changed' | null changed = changed- | null $ last changed = init changed- | otherwise = changed+diffTxn j t t' = case tsourcepos t of+ (pos1@(SourcePos fp line col), pos2) | pos1 == pos2 -> (SourcePos fp (line <> mkPos 1) col, diffs) where+ -- TODO: use range and produce two chunks: one removes part of+ -- original file, other adds transaction to new file with+ -- suffix .ledger (generated). I.e. move transaction from one file to another.+ diffs :: [DiffLine Text]+ diffs = concatMap (traverse showPostingLines . mapDiff) $ D.getDiff (tpostings t) (tpostings t')+ (pos1@(SourcePos fp line _), SourcePos _ line' _) -> (pos1, diffs) where+ -- We do diff for original lines vs generated ones. Often leads+ -- to big diff because of re-format effect.+ diffs :: [DiffLine Text]+ diffs = map mapDiff $ D.getDiff source changed'+ source | Just contents <- lookup fp $ jfiles j = drop (unPos line-1) . take (unPos line' - 1) $ T.lines contents+ | otherwise = []+ changed = T.lines $ showTransaction t'+ changed' | null changed = changed+ | T.null $ last changed = init changed+ | otherwise = changed data DiffLine a = Del a | Add a | Ctx a deriving (Show, Functor, Foldable, Traversable)
Hledger/Cli/Commands/Rewrite.txt view
@@ -1,9 +1,18 @@ rewrite+ Print all transactions, rewriting the postings of matched transactions. For now the only rewrite available is adding new postings, like print --auto. -_FLAGS_+Flags:+ --add-posting='ACCT AMTEXPR' add a posting to ACCT, which may be+ parenthesised. AMTEXPR is either a literal+ amount, or *N which means the transaction's+ first matched amount multiplied by N (a+ decimal number). Two spaces separate ACCT+ and AMTEXPR.+ --diff generate diff suitable as an input for+ patch tool This is a start at a generic rewriter of transaction entries. It reads the default journal and prints the transactions, like print, but adds@@ -13,9 +22,9 @@ 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+$ 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: @@ -29,10 +38,10 @@ More: -$ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...-$ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'-$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'-$ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'+$ hledger rewrite [QUERY] --add-posting "ACCT AMTEXPR" ...+$ hledger rewrite ^income --add-posting '(liabilities:tax) *.33'+$ hledger rewrite expenses:gifts --add-posting '(budget:gifts) *-1"'+$ hledger rewrite ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify' Argument for --add-posting option is a usual posting of transaction with an exception for amount specification. More precisely, you can use '*'@@ -62,12 +71,12 @@ transactions you usually write. It indicates the query by which you want to match the posting to add new ones. -$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal+$ hledger rewrite -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal This is something similar to the commands pipeline: -$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \- | hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \+$ hledger rewrite -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \+ | hledger rewrite -f - expenses:gifts --add-posting 'budget:gifts *-1' \ --add-posting 'assets:budget *1' \ > rewritten-tidy-output.journal @@ -80,7 +89,7 @@ To use this tool for batch modification of your journal files you may find useful output in form of unified diff. -$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33'+$ hledger rewrite --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33' Output might look like: @@ -117,12 +126,12 @@ This command predates print --auto, and currently does much the same thing, but with these differences: -- with multiple files, rewrite lets rules in any file affect all other- files. print --auto uses standard directive scoping; rules affect- only child files.+- with multiple files, rewrite lets rules in any file affect all other+ files. print --auto uses standard directive scoping; rules affect only+ child files. -- rewrite's query limits which transactions can be rewritten; all are- printed. print --auto's query limits which transactions are printed.+- rewrite's query limits which transactions can be rewritten; all are+ printed. print --auto's query limits which transactions are printed. -- rewrite applies rules specified on command line or in the journal.- print --auto applies rules specified in the journal.+- rewrite applies rules specified on command line or in the journal.+ print --auto applies rules specified in the journal.
Hledger/Cli/Commands/Roi.hs view
@@ -1,28 +1,35 @@-{-# LANGUAGE ParallelListComp, CPP #-}-{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ParallelListComp #-}+{-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TupleSections #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ViewPatterns #-} {-| The @roi@ command prints internal rate of return and time-weighted rate of return for and investment. -} -module Hledger.Cli.Commands.Roi ( +module Hledger.Cli.Commands.Roi ( roimode , roi ) where import Control.Monad-import System.Exit import Data.Time.Calendar import Text.Printf+import Data.Bifunctor (second) import Data.Function (on) import Data.List import Numeric.RootFinding import Data.Decimal+import Data.Set qualified as S+import Data.Text qualified as T+import Data.Text.Lazy.IO qualified as TL+import Safe (headDef) import System.Console.CmdArgs.Explicit as CmdArgs -import Text.Tabular as Tbl-import Text.Tabular.AsciiWide as Ascii+import Text.Tabular.AsciiWide as Tab import Hledger import Hledger.Cli.CliOptions@@ -36,201 +43,300 @@ ,flagReq ["profit-loss","pnl"] (\s opts -> Right $ setopt "pnl" s opts) "QUERY" "query to select profit-and-loss or appreciation/valuation transactions" ]- [generalflagsgroup1]- []+ cligeneralflagsgroups1+ hiddenflags ([], Just $ argsFlag "[QUERY]") --- One reporting span, -data OneSpan = OneSpan +-- One reporting span,+data OneSpan = OneSpan Day -- start date, inclusive Day -- end date, exclusive- Quantity -- value of investment at the beginning of day on spanBegin_- Quantity -- value of investment at the end of day on spanEnd_- [(Day,Quantity)] -- all deposits and withdrawals (but not changes of value) in the DateSpan [spanBegin_,spanEnd_)+ MixedAmount -- value of investment at the beginning of day on spanBegin_+ MixedAmount -- value of investment at the end of day on spanEnd_+ [(Day,MixedAmount)] -- all deposits and withdrawals (but not changes of value) in the DateSpan [spanBegin_,spanEnd_)+ [(Day,MixedAmount)] -- all PnL changes of the value of investment in the DateSpan [spanBegin_,spanEnd_) deriving (Show)- + roi :: CliOpts -> Journal -> IO ()-roi CliOpts{rawopts_=rawopts, reportopts_=ropts} j = do- d <- getCurrentDay- let - investmentsQuery = queryFromOpts d $ ropts{query_ = stringopt "investment" rawopts,period_=PeriodAll}- pnlQuery = queryFromOpts d $ ropts{query_ = stringopt "pnl" rawopts,period_=PeriodAll}- showCashFlow = boolopt "cashflow" rawopts- prettyTables = pretty_tables_ ropts- - trans = dbg3 "investments" $ jtxns $ filterJournalTransactions investmentsQuery j- - journalSpan = - let dates = map transactionDate2 trans in - DateSpan (Just $ minimum dates) (Just $ addDays 1 $ maximum dates) - - requestedSpan = periodAsDateSpan $ period_ ropts- requestedInterval = interval_ ropts- - wholeSpan = spanDefaultsFrom requestedSpan journalSpan +roi CliOpts{rawopts_=rawopts, reportspec_=rspec@ReportSpec{_rsReportOpts=ReportOpts{..}}} j = do+ -- We may be converting posting amounts to value, per hledger_options.m4.md "Effect of --value on reports".+ let+ -- lbl = lbl_ "roi"+ today = _rsDay rspec+ priceOracle = journalPriceOracle infer_prices_ j+ styles = journalCommodityStylesWith HardRounding j+ mixedAmountValue periodlast date =+ -- These calculations can generate very precise decimals. To avoid showing too many digits:+ -- If we have no style for the valuation commodity, generate one that will limit the precision ?+ -- But it's not easy to find out the valuation commodity (or commodities) here if it's implicit,+ -- as that information is buried in the price graph.+ -- Instead, do what we don't like to do: hard code a max precision, overriding commodity styles.+ mixedAmountSetPrecisionMax defaultMaxPrecision+ . maybe id (mixedAmountApplyValuation priceOracle styles periodlast today date) value_+ . maybe id (mixedAmountToCost styles) conversionop_ - when (null trans) $ do- putStrLn "No relevant transactions found. Check your investments query"- exitFailure- - let spans = case requestedInterval of- NoInterval -> [wholeSpan]- interval ->- splitSpan interval $- spanIntersect journalSpan wholeSpan+ let+ ropts = _rsReportOpts rspec+ wd = whichDate ropts+ showCashFlow = boolopt "cashflow" rawopts+ prettyTables = pretty_+ makeQuery flag = do+ q <- either usageError (return . fst) . parseQuery today . T.pack $ stringopt flag rawopts+ return . simplifyQuery $ And [queryFromFlags ropts{period_=PeriodAll}, q]+ cantCompute msg = error' $ msg ++ " - will be unable to compute the rates of return" - tableBody <- forM spans $ \(DateSpan (Just spanBegin) (Just spanEnd)) -> do- -- Spans are [spanBegin,spanEnd), and spanEnd is 1 day after then actual end date we are interested in- let - valueBefore =- total trans (And [ investmentsQuery- , Date (DateSpan Nothing (Just spanBegin))])- - valueAfter = - total trans (And [investmentsQuery- , Date (DateSpan Nothing (Just spanEnd))])- - cashFlow = - calculateCashFlow trans (And [ Not investmentsQuery- , Not pnlQuery- , Date (DateSpan (Just spanBegin) (Just spanEnd)) ] )- - thisSpan = dbg3 "processing span" $ - OneSpan spanBegin spanEnd valueBefore valueAfter cashFlow- - irr <- internalRateOfReturn showCashFlow prettyTables thisSpan- twr <- timeWeightedReturn showCashFlow prettyTables investmentsQuery trans thisSpan- let cashFlowAmt = negate $ sum $ map snd cashFlow- let smallIsZero x = if abs x < 0.01 then 0.0 else x- return [ showDate spanBegin- , showDate (addDays (-1) spanEnd)- , show valueBefore- , show cashFlowAmt- , show valueAfter- , show (valueAfter - (valueBefore + cashFlowAmt))- , printf "%0.2f%%" $ smallIsZero irr- , printf "%0.2f%%" $ smallIsZero twr ]+ investmentsQuery <- makeQuery "investment"+ pnlQuery <- makeQuery "pnl" - let table = Table - (Tbl.Group NoLine (map (Header . show) (take (length tableBody) [1..]))) - (Tbl.Group DoubleLine - [ Tbl.Group SingleLine [Header "Begin", Header "End"]- , Tbl.Group SingleLine [Header "Value (begin)", Header "Cashflow", Header "Value (end)", Header "PnL"]- , Tbl.Group SingleLine [Header "IRR", Header "TWR"]])- tableBody- - putStrLn $ Ascii.render prettyTables id id id table+ when (pnlQuery == Any) $+ cantCompute "Need some transactions classed as investment and not pnl, but the pnl query matches any transaction" -timeWeightedReturn showCashFlow prettyTables investmentsQuery trans (OneSpan spanBegin spanEnd valueBefore valueAfter cashFlow) = do- let initialUnitPrice = 100- let initialUnits = valueBefore / initialUnitPrice- let cashflow = + let+ filteredj = filterJournalTransactions investmentsQuery j+ trans = dbg3 "investments" $ jtxns filteredj++ when (null trans) $+ error' "No relevant transactions found. Check your investments query"++ let (fullPeriodDateSpan, mspans) = reportSpan filteredj rspec++ let err = cantCompute "Undefined start or end of the period"+ spans = maybe err (map (second (addDays 1)) . dayPartitionToList) mspans+ fullPeriod = case fullPeriodDateSpan of+ DateSpan (Just b) (Just e) -> (fromEFDay b, fromEFDay e)+ _ -> err++ let processSpan (b, e) = do+ -- Spans are [begin,end), and end is 1 day after the actual end date we are interested in+ let+ spn = DateSpan (Just $ Exact b) (Just $ Exact e)++ cashFlowApplyCostValue = map (\(d,amt) -> (d,mixedAmountValue e d amt))++ valueBefore = dbg3 "valueBefore" $+ mixedAmountValue e b $+ total trans (And [ investmentsQuery+ , Date (DateSpan Nothing (Just $ Exact b))])++ valueAfter = dbg3 "valueAfter" $+ mixedAmountValue e e $+ total trans (And [investmentsQuery+ , Date (DateSpan Nothing (Just $ Exact e))])++ cashFlow = dbg3 "cashFlow" $+ cashFlowApplyCostValue $+ calculateCashFlow wd trans (And [ Not investmentsQuery+ , Not pnlQuery+ , Date spn ] )++ pnl = dbg3 "pnl" $+ cashFlowApplyCostValue $+ calculateCashFlow wd trans (And [ Not investmentsQuery+ , pnlQuery+ , Date spn ] )++ spanCommodities = dbg3 "spanCommodities" $+ S.unions $ (maCommodities valueBefore) : (maCommodities valueAfter) : map (maCommodities.snd) (cashFlow ++ pnl)++ thisSpan = dbg3 "processing span" $+ OneSpan b e valueBefore valueAfter cashFlow pnl++ when (S.size spanCommodities > 1) $+ multiCommodityError $ "Period " ++ show (b,e) ++ " has multiple commodities: " ++ (T.unpack $ T.intercalate ", " $ map showCommoditySymbol (S.toList spanCommodities))++ irr <- internalRateOfReturn styles showCashFlow prettyTables thisSpan+ (periodTwr, annualizedTwr) <- timeWeightedReturn styles showCashFlow prettyTables investmentsQuery trans mixedAmountValue thisSpan+ let cashFlowAmt = maNegate . maSum $ map snd cashFlow+ let smallIsZero x = if abs x < 0.01 then 0.0 else x+ return [ showDate b+ , showDate (addDays (-1) e)+ , T.pack $ showMixedAmountOneLineWithoutCost False $ styleAmounts styles $ valueBefore+ , T.pack $ showMixedAmountOneLineWithoutCost False $ styleAmounts styles $ cashFlowAmt+ -- , T.pack $ showMixedAmount $+ -- -- dbg0With (lbl "cashflow after styling".showMixedAmountOneLine) $+ -- mapMixedAmount (amountSetFullPrecisionUpTo (Just defaultMaxPrecision)) $+ -- styleAmounts (styles+ -- -- & dbg0With (lbl "styles".show))+ -- cashFlowAmt+ -- -- & dbg0With (lbl "cashflow before styling".showMixedAmountOneLine)+ , T.pack $ showMixedAmountOneLineWithoutCost False $ styleAmounts styles $ valueAfter+ , T.pack $ showMixedAmountOneLineWithoutCost False $ styleAmounts styles $ (valueAfter `maMinus` (valueBefore `maPlus` cashFlowAmt))+ , T.pack $ printf "%0.2f%%" $ smallIsZero irr+ , T.pack $ printf "%0.2f%%" $ smallIsZero periodTwr+ , T.pack $ printf "%0.2f%%" $ smallIsZero annualizedTwr ]++ periodRows <- forM spans processSpan+ totalRow <- case periodRows of+ [singleRow] -> return singleRow+ _ -> processSpan fullPeriod++ let rowTitles = Tab.Group Tab.NoLine (map (Header . T.pack . show) (take (length periodRows) [1..]))++ let isSingleSpan = length spans == 1++ let table = Table+ (if isSingleSpan+ then rowTitles+ else Tab.Group Tab.SingleLine [ rowTitles, Tab.Group Tab.NoLine [ Header "Total" ]]+ )+ (Tab.Group Tab.DoubleLine+ [ Tab.Group Tab.SingleLine [Header "Begin", Header "End"]+ , Tab.Group Tab.SingleLine [Header "Value (begin)", Header "Cashflow", Header "Value (end)", Header "PnL"]+ , Tab.Group Tab.SingleLine [Header "IRR"]+ , Tab.Group Tab.SingleLine [Header "TWR/period", Header "TWR/year"]])+ (if isSingleSpan then periodRows else periodRows ++ [totalRow])++ TL.putStrLn $ Tab.render prettyTables id id id table++-- Entry for TWR computation, capturing all cashflows that are potentially accompanied by pnl change on the same day (if not, it is zero)+data TwrPeriod = TwrPeriod { twrStartDate :: Day, twrEndDate :: Day, twrStartValue :: Decimal, twrValueBeforeCashflow :: Decimal, twrPnl :: Decimal, twrCashflow :: Decimal, twrValueAfterCashflow :: Decimal } deriving (Eq, Show)++timeWeightedReturn _styles showCashFlow prettyTables investmentsQuery trans mixedAmountValue (OneSpan begin end valueBeforeAmt valueAfterAmt cashflows pnls) = do+ let datedCashflows = -- Aggregate all entries for a single day, assuming that intraday interest is negligible- map (\date_cash -> let (dates, cash) = unzip date_cash in (head dates, sum cash))+ dbg3 "datedCashflows"+ $ sort+ $ map (\datecashes -> let (dates, cash) = unzip datecashes in (headDef (error' "Roi.hs: datecashes was null, please report a bug") dates, maSum cash)) $ groupBy ((==) `on` fst)- $ sortOn fst - $ map (\(d,a) -> (d, negate a)) - $ filter ((/=0).snd) cashFlow- - let units = - tail $- scanl- (\(_, _, _, unitBalance) (date, amt) ->- let valueOnDate = total trans (And [investmentsQuery, Date (DateSpan Nothing (Just date))])- unitPrice =- if unitBalance == 0.0- then initialUnitPrice- else valueOnDate / unitBalance- unitsBoughtOrSold = amt / unitPrice- in (valueOnDate, unitsBoughtOrSold, unitPrice, unitBalance + unitsBoughtOrSold))- (0, 0, 0, initialUnits)- cashflow- - let finalUnitBalance = if null units then initialUnits else let (_,_,_,u) = last units in u- finalUnitPrice = valueAfter / finalUnitBalance- totalTWR = roundTo 2 $ (finalUnitPrice - initialUnitPrice)- years = fromIntegral (diffDays spanEnd spanBegin) / 365 :: Double- annualizedTWR = 100*((1+(realToFrac totalTWR/100))**(1/years)-1) :: Double- - let s d = show $ roundTo 2 d + $ sortOn fst+ $ map (second maNegate)+ $ cashflows++ valueBefore = dbg3 ("value at the start of the interval, "++show begin) $ unMix valueBeforeAmt+ valueAfter = dbg3 ("value at the end of the interval, "++show end) $ unMix valueAfterAmt++ investmentPostings = concatMap (filter (matchesPosting investmentsQuery) . realPostings) trans++ totalInvestmentPostingsTill date = sumPostings $ filter (matchesPosting (Date (DateSpan Nothing (Just $ Exact date)))) investmentPostings++ -- filter span is (-infinity, date+1), which gives us effectively (-infinity, date]+ valueAfterDate date = unMix $ mixedAmountValue end date $ totalInvestmentPostingsTill (addDays 1 date)++ pnlOn date = unMix $ maNegate $ sum $ map snd $ filter ((==date).fst) pnls++ -- We are dividing the period [begin, end) into subperiods on each cashflow, and then compute+ -- the rate of return for each subperiod. For this we need to know the value of the investment+ -- at the beginning and end of each subperiod, adjusted for cashflow.+ --+ -- Subperiods are going to be [valueBefore ... (c_0,v_0)][... (c_1, v_1)][... (c_2,v_2)] ... [... (c_n,v_n)][... valueAfter]+ -- , where v_i is the value of investment computed immediately after cashflow c_i+ --+ -- Calculate interest for each subperiod, adjusting the value at the start of the period by the cashflow+ -- For subperiods [valueBefore ... (c_0,v_0)][... (c_1, v_1)][... (c_2,v_2)] ... [... (c_n,v_n)][... valueAfter], the computation is going to be+ -- 1 + twr = (v_0 - c_0)/valueBefore + (v_1 - c_1) / v_0 + ... + valueAfter/v_n+ -- See https://en.wikipedia.org/wiki/Time-weighted_return#Time-weighted_return_compensating_for_external_flows+ let calculateSubPeriods (startDate,startValue) [] =+ let subPeriodReturn =+ if startValue == 0 || valueAfter == 0+ then 0+ else valueAfter/startValue - 1+ in+ [(subPeriodReturn, TwrPeriod startDate end startValue valueAfter 0 0 valueAfter)]+ calculateSubPeriods (startDate,startValue) ((date,cashflow):rest) =+ let (valueBeforeCashflow, valueAfterCashflow, pnl) =+ let valueAfterPrevDay = valueAfterDate (addDays (-1) date)+ pnlOnDay = pnlOn date+ in+ -- If value was zero at the start of the period, then any PnL on cashflow date would accrue after it, not before.+ -- If there was some value already, we can assume that PnL contributes to this period's rate+ if startValue == 0+ then (valueAfterPrevDay, valueAfterDate date - pnlOnDay, 0)+ else (valueAfterPrevDay + pnl, valueAfterDate date, pnlOnDay)+ subPeriodReturn =+ if valueBeforeCashflow == 0 || startValue == 0+ then 0+ else (valueBeforeCashflow / startValue) - 1+ in+ (subPeriodReturn, (TwrPeriod startDate date startValue valueBeforeCashflow pnl (unMix cashflow) valueAfterCashflow)) : calculateSubPeriods (date,valueAfterCashflow) rest++ let subPeriods = dbg3 "subPeriods" $ calculateSubPeriods (begin,valueBefore) datedCashflows++ -- Compute overall time-weighted rate of return+ let twr =+ dbg3 "twr" $+ if subPeriods == []+ then if valueBefore == 0 then 0 else (valueAfter - valueBefore)/valueBefore+ else foldl (\acc periodRate -> (1+acc)*(1+periodRate)-1) 0 (map fst subPeriods)+ (startYear, _, _) = toGregorian begin+ years = fromIntegral (diffDays end begin) / (if isLeapYear startYear then 366 else 365) :: Double+ periodTWR = roundTo 2 $ 100 * twr+ annualizedTWR = 100*((1+(realToFrac twr))**(1/years)-1) :: Double+ when showCashFlow $ do- printf "\nTWR cash flow for %s - %s\n" (showDate spanBegin) (showDate (addDays (-1) spanEnd))- let (dates', amounts') = unzip cashflow- (valuesOnDate',unitsBoughtOrSold', unitPrices', unitBalances') = unzip4 units- add x lst = if valueBefore/=0 then x:lst else lst- dates = add spanBegin dates'- amounts = add valueBefore amounts'- unitsBoughtOrSold = add initialUnits unitsBoughtOrSold'- unitPrices = add initialUnitPrice unitPrices'- unitBalances = add initialUnits unitBalances'- valuesOnDate = add 0 valuesOnDate'- - putStr $ Ascii.render prettyTables id id id - (Table - (Tbl.Group NoLine (map (Header . showDate) dates))- (Tbl.Group DoubleLine [ Tbl.Group SingleLine [Header "Portfolio value", Header "Unit balance"] - , Tbl.Group SingleLine [Header "Cash", Header "Unit price", Header "Units"]- , Tbl.Group SingleLine [Header "New Unit Balance"]])- [ [value, oldBalance, amt, prc, udelta, balance] - | value <- map s valuesOnDate- | oldBalance <- map s (0:unitBalances)- | balance <- map s unitBalances- | amt <- map s amounts- | prc <- map s unitPrices- | udelta <- map s unitsBoughtOrSold ])- - printf "Final unit price: %s/%s=%s U.\nTotal TWR: %s%%.\nPeriod: %.2f years.\nAnnualized TWR: %.2f%%\n\n" (s valueAfter) (s finalUnitBalance) (s finalUnitPrice) (s totalTWR) years annualizedTWR- - return annualizedTWR- + printf "\nTWR cash flow entries and subperiod rates for period %s - %s\n" (showDate begin) (showDate (addDays (-1) end))+ let showDecimalT = T.pack . showDecimal+ TL.putStr $ Tab.render prettyTables T.pack id id+ (Table+ (Tab.Group Tab.NoLine [ Header (show n) | n <-[1..length subPeriods]])+ (Tab.Group DoubleLine [ Tab.Group Tab.SingleLine [Tab.Header "Subperiod start", Tab.Header "Cashflow date"]+ , Tab.Group Tab.SingleLine [Tab.Header "Value at start", Tab.Header "Value before cashflow (inc PnL)", Tab.Header "PnL on day", Tab.Header "Cashflow", Tab.Header "Value after cashflow"]+ , Tab.Group Tab.SingleLine [Tab.Header "Subperiod rate, %"]])+ [ [ showDate (twrStartDate sp), showDate (twrEndDate sp)+ , showDecimalT (twrStartValue sp), showDecimalT (twrValueBeforeCashflow sp), showDecimalT (twrPnl sp), showDecimalT (twrCashflow sp), showDecimalT (twrValueAfterCashflow sp)+ , showDecimalT (roundTo 2 (100*rate)) ]+ | (rate, sp) <- subPeriods+ ]) -internalRateOfReturn showCashFlow prettyTables (OneSpan spanBegin spanEnd valueBefore valueAfter cashFlow) = do - let prefix = (spanBegin, negate valueBefore)+ printf "Total period TWR: %s%%.\nPeriod: %.2f years.\nAnnualized TWR: %.2f%%\n\n"+ (showDecimal periodTWR) years annualizedTWR - postfix = (spanEnd, valueAfter)+ return ((realToFrac periodTWR) :: Double, annualizedTWR) - totalCF = filter ((/=0) . snd) $ prefix : (sortOn fst cashFlow) ++ [postfix]+internalRateOfReturn styles showCashFlow prettyTables (OneSpan begin end valueBefore valueAfter cashFlow _pnl) = do+ let prefix = (begin, maNegate valueBefore) + postfix = (end, valueAfter)++ totalCF = filter (maIsNonZero . snd) $ prefix : (sortOn fst cashFlow) ++ [postfix]+ when showCashFlow $ do- printf "\nIRR cash flow for %s - %s\n" (showDate spanBegin) (showDate (addDays (-1) spanEnd)) - let (dates, amounts) = unzip totalCF- putStrLn $ Ascii.render prettyTables id id id - (Table - (Tbl.Group NoLine (map (Header . showDate) dates))- (Tbl.Group SingleLine [Header "Amount"])- (map ((:[]) . show) amounts))- + printf "\nIRR cash flow for %s - %s\n" (showDate begin) (showDate (addDays (-1) end))+ let (dates, amts) = unzip totalCF+ TL.putStrLn $ Tab.render prettyTables id id id+ (Table+ (Tab.Group Tab.NoLine (map (Header . showDate) dates))+ (Tab.Group Tab.SingleLine [Header "Amount"])+ (map ((:[]) . T.pack . showMixedAmountOneLineWithoutCost False . styleAmounts styles) amts))+ -- 0% is always a solution, so require at least something here- case ridders -#if MIN_VERSION_math_functions(0,3,0)- (RiddersParam 100 (AbsTol 0.00001)) -#else- 0.00001-#endif- (0.000000000001,10000) (interestSum spanEnd totalCF) of- Root rate -> return ((rate-1)*100)- NotBracketed -> error "Error: No solution -- not bracketed."- SearchFailed -> error "Error: Failed to find solution."+ case totalCF of+ [] -> return 0+ _ -> case ridders (RiddersParam 100 (AbsTol 0.00001))+ (0.000000000001,10000)+ (interestSum end totalCF) of+ Root rate -> return ((rate-1)*100)+ NotBracketed -> error' $ "Equation for Internal Rate of Return (IRR) can not be solved.\n"+ ++ " Possible causes: IRR is huge (>1000000%), balance of investment becomes negative at some point in time."+ SearchFailed -> error' $ "Equation for Internal Rate of Return (IRR) can not be solved.\n"+ ++ " Either search does not converge to a solution, or converges too slowly." -type CashFlow = [(Day, Quantity)]+type CashFlow = [(Day, MixedAmount)] interestSum :: Day -> CashFlow -> Double -> Double interestSum referenceDay cf rate = sum $ map go cf- where go (t,m) = fromRational (toRational m) * (rate ** (fromIntegral (referenceDay `diffDays` t) / 365))+ where go (t,m) = realToFrac (unMix m) * rate ** (fromIntegral (referenceDay `diffDays` t) / 365) -calculateCashFlow :: [Transaction] -> Query -> CashFlow-calculateCashFlow trans query = map go trans- where- go t = (transactionDate2 t, total [t] query)+calculateCashFlow :: WhichDate -> [Transaction] -> Query -> CashFlow+calculateCashFlow wd trans query =+ [ (postingDateOrDate2 wd p, pamount p) | p <- concatMap (filter (matchesPosting query) . realPostings) trans, maIsNonZero (pamount p) ] -total :: [Transaction] -> Query -> Quantity-total trans query = unMix $ sumPostings $ filter (matchesPosting query) $ concatMap realPostings trans- -unMix :: MixedAmount -> Quantity -unMix a = - case (normaliseMixedAmount $ costOfMixedAmount a) of- (Mixed [a]) -> aquantity a- _ -> error "MixedAmount failed to normalize"+total :: [Transaction] -> Query -> MixedAmount+total trans query = sumPostings (concatMap (filter (matchesPosting query) . realPostings) trans) +unMix :: MixedAmount -> Quantity+unMix a =+ case (unifyMixedAmount a) of+ Just a' -> aquantity a'+ Nothing -> multiCommodityError $ "Amounts could not be converted to a single commodity: " ++ show (map showAmount $ amounts a)++multiCommodityError msg = error' $ msg +++ "\nConsider using --value to force all costs to be in a single commodity." +++ "\nFor example, \"--value=end,<commodity> --infer-market-prices\", where commodity is the one that you want to value the investment in."++-- Show Decimal rounded to two decimal places, unless it has less places already. This ensures that "2" won't be shown as "2.00"+showDecimal :: Decimal -> String+showDecimal d = if d == rounded then show d else show rounded+ where+ rounded = roundTo 2 d
Hledger/Cli/Commands/Roi.txt view
@@ -1,23 +1,175 @@ roi+ Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on your investments. -_FLAGS_--This command assumes that you have account(s) that hold nothing but your-investments and whenever you record current appraisal/valuation of these-investments you offset unrealized profit and loss into account(s) that,-again, hold nothing but unrealized profit and loss.--Any transactions affecting balance of investment account(s) and not-originating from unrealized profit and loss account(s) are assumed to be-your investments or withdrawals.+Flags:+ --cashflow show all amounts that were used to compute+ returns+ --investment=QUERY query to select your investment transactions+ --profit-loss=QUERY --pnl query to select profit-and-loss or+ appreciation/valuation transactions At a minimum, you need to supply a query (which could be just an account-name) to select your investments with --inv, and another query to+name) to select your investment(s) with --inv, and another query to identify your profit and loss transactions with --pnl. -It will compute and display the internalized rate of return (IRR) and-time-weighted rate of return (TWR) for your investments for the time-period requested. Both rates of return are annualized before display,-regardless of the length of reporting interval.+If you do not record changes in the value of your investment manually,+or do not require computation of time-weighted return (TWR), --pnl could+be an empty query (--pnl "" or --pnl STR where STR does not match any of+your accounts).++This command will compute and display the internalized rate of return+(IRR, also known as money-weighted rate of return) and time-weighted+rate of return (TWR) for your investments for the time period requested.+IRR is always annualized due to the way it is computed, but TWR is+reported both as a rate over the chosen reporting period and as an+annual rate.++Price directives will be taken into account if you supply appropriate+--cost or --value flags (see VALUATION).++Note, in some cases this report can fail, for these reasons:++- Error (NotBracketed): No solution for Internal Rate of Return (IRR).+ Possible causes: IRR is huge (>1000000%), balance of investment+ becomes negative at some point in time.+- Error (SearchFailed): Failed to find solution for Internal Rate of+ Return (IRR). Either search does not converge to a solution, or+ converges too slowly.++Examples:++- Using roi to compute total return of investment in stocks:+ https://github.com/simonmichael/hledger/blob/master/examples/investing/roi-unrealised.ledger++- Cookbook > Return on Investment: https://hledger.org/roi.html++Spaces and special characters in --inv and --pnl++Note that --inv and --pnl's argument is a query, and queries could have+several space-separated terms (see QUERIES).++To indicate that all search terms form single command-line argument, you+will need to put them in quotes (see Special characters):++$ hledger roi --inv 'term1 term2 term3 ...'++If any query terms contain spaces themselves, you will need an extra+level of nested quoting, eg:++$ hledger roi --inv="'Assets:Test 1'" --pnl="'Equity:Unrealized Profit and Loss'"++Semantics of --inv and --pnl++Query supplied to --inv has to match all transactions that are related+to your investment. Transactions not matching --inv will be ignored.++In these transactions, ROI will conside postings that match --inv to be+"investment postings" and other postings (not matching --inv) will be+sorted into two categories: "cash flow" and "profit and loss", as ROI+needs to know which part of the investment value is your contributions+and which is due to the return on investment.++- "Cash flow" is depositing or withdrawing money, buying or selling+ assets, or otherwise converting between your investment commodity and+ any other commodity. Example:++ 2019-01-01 Investing in Snake Oil+ assets:cash -$100+ investment:snake oil++ 2020-01-01 Selling my Snake Oil+ assets:cash $10+ investment:snake oil = 0++- "Profit and loss" is change in the value of your investment:++ 2019-06-01 Snake Oil falls in value+ investment:snake oil = $57+ equity:unrealized profit or loss++All non-investment postings are assumed to be "cash flow", unless they+match --pnl query. Changes in value of your investment due to "profit+and loss" postings will be considered as part of your investment return.++Example: if you use --inv snake --pnl equity:unrealized, then postings+in the example below would be classifed as:++2019-01-01 Snake Oil #1+ assets:cash -$100 ; cash flow posting+ investment:snake oil ; investment posting++2019-03-01 Snake Oil #2+ equity:unrealized pnl -$100 ; profit and loss posting+ snake oil ; investment posting++2019-07-01 Snake Oil #3+ equity:unrealized pnl ; profit and loss posting+ cash -$100 ; cash flow posting+ snake oil $50 ; investment posting++IRR and TWR explained++"ROI" stands for "return on investment". Traditionally this was computed+as a difference between current value of investment and its initial+value, expressed in percentage of the initial value.++However, this approach is only practical in simple cases, where+investments receives no in-flows or out-flows of money, and where rate+of growth is fixed over time. For more complex scenarios you need+different ways to compute rate of return, and this command implements+two of them: IRR and TWR.++Internal rate of return, or "IRR" (also called "money-weighted rate of+return") takes into account effects of in-flows and out-flows, and the+time between them. Investment at a particular fixed interest rate is+going to give you more interest than the same amount invested at the+same interest rate, but made later in time. If you are withdrawing from+your investment, your future gains would be smaller (in absolute+numbers), and will be a smaller percentage of your initial investment,+so your IRR will be smaller. And if you are adding to your investment,+you will receive bigger absolute gains, which will be a bigger+percentage of your initial investment, so your IRR will be larger.++As mentioned before, in-flows and out-flows would be any cash that you+personally put in or withdraw, and for the "roi" command, these are the+postings that match the query in the--inv argument and NOT match the+query in the--pnl argument.++If you manually record changes in the value of your investment as+transactions that balance them against "profit and loss" (or "unrealized+gains") account or use price directives, then in order for IRR to+compute the precise effect of your in-flows and out-flows on the rate of+return, you will need to record the value of your investement on or+close to the days when in- or out-flows occur.++In technical terms, IRR uses the same approach as computation of net+present value, and tries to find a discount rate that makes net present+value of all the cash flows of your investment to add up to zero. This+could be hard to wrap your head around, especially if you haven't done+discounted cash flow analysis before. Implementation of IRR in hledger+should produce results that match the =XIRR formula in Excel.++Second way to compute rate of return that roi command implements is+called "time-weighted rate of return" or "TWR". Like IRR, it will+account for the effect of your in-flows and out-flows, but unlike IRR it+will try to compute the true rate of return of the underlying asset,+compensating for the effect that deposits and withdrawas have on the+apparent rate of growth of your investment.++TWR represents your investment as an imaginary "unit fund" where+in-flows/ out-flows lead to buying or selling "units" of your investment+and changes in its value change the value of "investment unit". Change+in "unit price" over the reporting period gives you rate of return of+your investment, and make TWR less sensitive than IRR to the effects of+cash in-flows and out-flows.++References:++- Explanation of rate of return+- Explanation of IRR+- Explanation of TWR+- IRR vs TWR+- Examples of computing IRR and TWR and discussion of the limitations of+ both metrics
+ Hledger/Cli/Commands/Run.hs view
@@ -0,0 +1,275 @@+{-|++The @run@ command allows you to run multiple commands via REPL or from the supplied file(s).++-}++{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++module Hledger.Cli.Commands.Run (+ runmode+ ,run+ ,replmode+ ,repl+ ,runOrReplStub+) where++import Data.List.NonEmpty qualified as NE+import Data.Map.Strict qualified as Map+import Data.Semigroup (sconcat)+import Data.Text qualified as T+import Data.Text.IO qualified as T+import System.Console.CmdArgs.Explicit as C ( Mode )+import Hledger+import Hledger.Cli.CliOptions++import Control.Exception+import Control.Concurrent.MVar+import Control.Monad (forM_)+import Control.Monad.IO.Class (liftIO)+import Control.Monad.Extra (concatMapM)++import System.Exit (ExitCode, exitWith)+import System.Console.CmdArgs.Explicit (expandArgsAt, modeNames)+import System.IO (stdin, hIsTerminalDevice, hIsOpen)+import System.IO.Unsafe (unsafePerformIO)+import System.Console.Haskeline++import Safe (headMay)+import Hledger.Cli.DocFiles (runTldrForPage, runInfoForTopic, runManForTopic)+import Hledger.Cli.Utils (journalTransform)+import Text.Printf (printf)+import System.Process (system)++-- | Command line options for this command.+runmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Run.txt")+ (+ []+ )+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[COMMANDS_FILE1 COMMANDS_FILE2 ...] OR [-- command1 args... -- command2 args... -- command3 args...]")++replmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Repl.txt")+ (+ []+ )+ cligeneralflagsgroups1+ hiddenflags+ ([], Nothing)++-- | The fake run/repl command introduced to break circular dependency.+-- This module needs access to `findBuiltinCommand`, which is defined in Hledger.Cli.Commands+-- However, Hledger.Cli.Commands imports this module, which creates circular dependency.+-- We expose this do-nothing function so that it could be included in the list of all commands inside+-- Hledger.Cli.Commands and ensure that "run" is recognized as a valid command by the Hledger.Cli top-level+-- command line parser. That parser, however, would not call run'. It has a special case for "run", and+-- will call "run" (see below), passing it `findBuiltinCommand`, thus breaking circular dependency.+runOrReplStub :: CliOpts -> Journal -> IO ()+runOrReplStub _opts _j = return ()++-- | Default input files that would be used by commands if+-- there is no explicit alternative given+newtype DefaultRunJournal = DefaultRunJournal (NE.NonEmpty String) deriving (Show)++-- | The actual run command.+run :: Maybe DefaultRunJournal -> (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> [String] -> CliOpts -> IO ()+run defaultJournalOverride findBuiltinCommand addons cliopts@CliOpts{rawopts_=rawopts} = do+ jpaths <- DefaultRunJournal <$> journalFilePathFromOptsOrDefault defaultJournalOverride cliopts+ let args = dbg1 "args" $ listofstringopt "args" rawopts+ isTerminal <- isStdinTerminal+ if args == [] && not isTerminal+ then do+ inputFiles <- journalFilePathFromOpts cliopts+ let journalFromStdin = any (== "-") $ map (snd . splitReaderPrefix) $ NE.toList inputFiles+ if journalFromStdin+ then error' "'run' can't read commands from stdin, as one of the input files was stdin as well"+ else runREPL jpaths findBuiltinCommand addons+ else do+ -- Check if arguments start with "--".+ -- If not, assume that they are files with commands+ case args of+ "--":_ -> runFromArgs jpaths findBuiltinCommand addons args+ _ -> runFromFiles jpaths findBuiltinCommand addons args++-- | The actual repl command.+repl :: (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> [String] -> CliOpts -> IO ()+repl findBuiltinCommand addons cliopts = do+ jpaths <- DefaultRunJournal <$> journalFilePathFromOptsOrDefault Nothing cliopts+ runREPL jpaths findBuiltinCommand addons++-- | Run commands from files given to "run".+runFromFiles :: DefaultRunJournal -> (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> [String] -> [String] -> IO ()+runFromFiles defaultJournalOverride findBuiltinCommand addons inputfiles = do+ dbg1IO "inputfiles" inputfiles+ -- read commands from all the inputfiles+ commands <- (flip concatMapM) inputfiles $ \f -> do+ dbg1IO "reading commands" f+ lines . T.unpack <$> T.readFile f++ forM_ commands (runCommand defaultJournalOverride findBuiltinCommand addons . parseCommand)++-- | Run commands from command line arguments given to "run".+runFromArgs :: DefaultRunJournal -> (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> [String] -> [String] -> IO ()+runFromArgs defaultJournalOverride findBuiltinCommand addons args = do+ -- read commands from all the inputfiles+ let commands = dbg1 "commands from args" $ splitAtElement "--" args+ forM_ commands (runCommand defaultJournalOverride findBuiltinCommand addons)++-- When commands are passed on the command line, shell will parse them for us+-- When commands are read from file, we need to split the line into command and arguments+parseCommand :: String -> [String]+parseCommand line =+ -- # begins a comment, ignore everything after #+ takeWhile (not. ((Just '#')==) . headMay) $ words' (strip line)++-- | Take a single command line (from file, or REPL, or "--"-surrounded block of the args), and run it.+runCommand :: DefaultRunJournal -> (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> [String] -> [String] -> IO ()+runCommand defaultJournalOverride findBuiltinCommand addons cmdline = do+ dbg1IO "runCommand for" cmdline+ case cmdline of+ "echo":args -> putStrLn $ unwords $ args+ cmdname:args ->+ case findBuiltinCommand cmdname of+ Just (cmdmode,cmdaction) -> do+ -- Even though expandArgsAt is done by the Cli.hs, it stops at the first '--', so we need+ -- to do it here as well to make sure that each command can use @ARGFILEs+ args' <- replaceNumericFlags <$> expandArgsAt args+ dbg1IO "runCommand final args" (cmdname,args')+ opts <- getHledgerCliOpts' cmdmode args'+ let+ rawopts = rawopts_ opts+ mmodecmdname = headMay $ modeNames cmdmode+ helpFlag = boolopt "help" rawopts+ tldrFlag = boolopt "tldr" rawopts+ infoFlag = boolopt "info" rawopts+ manFlag = boolopt "man" rawopts+ if+ | helpFlag -> runPager $ showModeUsage cmdmode ++ "\n"+ | tldrFlag -> runTldrForPage $ maybe "hledger" (("hledger-"<>)) mmodecmdname+ | infoFlag -> runInfoForTopic "hledger" mmodecmdname+ | manFlag -> runManForTopic "hledger" mmodecmdname+ | otherwise -> do+ withJournalCached (Just defaultJournalOverride) opts $ \(j,jpaths) -> do+ if cmdname == "run" -- allow "run" to call "run"+ then run (Just jpaths) findBuiltinCommand addons opts+ else cmdaction opts j+ Nothing | cmdname `elem` addons ->+ system (printf "%s-%s %s" progname cmdname (unwords $ map quoteForCommandLine args)) >>= exitWith+ Nothing ->+ error' $ "Unrecognized command: " ++ unwords (cmdname:args)+ [] -> return ()++-- | Run an interactive REPL.+runREPL :: DefaultRunJournal -> (String -> Maybe (Mode RawOpts, CliOpts -> Journal -> IO ())) -> [String] -> IO ()+runREPL defaultJournalOverride findBuiltinCommand addons = do+ isTerminal <- isStdinTerminal+ if not isTerminal+ then runInputT defaultSettings (loop False "")+ else do+ putStrLn "Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF."+ runInputT defaultSettings (loop True "% ")+ where+ loop :: Bool -> String -> InputT IO ()+ loop interactive prompt = do+ minput <- getInputLine prompt+ case minput of+ Nothing -> return ()+ Just "quit" -> return ()+ Just "exit" -> return ()+ Just input -> do+ let cmd = runCommand defaultJournalOverride findBuiltinCommand addons $ argsAddDoubleDash $ parseCommand input+ liftIO $ if interactive+ then cmd `catches`+ [Handler (\(e::ErrorCall) -> putStrLn $ rstrip $ show e)+ ,Handler (\(e::IOError) -> putStrLn $ rstrip $ show e)+ ,Handler (\(_::ExitCode) -> return ())+ ,Handler (\UserInterrupt -> return ())+ ]+ else cmd+ loop interactive prompt++isStdinTerminal = do+ op <- hIsOpen stdin+ if op then hIsTerminalDevice stdin else return False++-- | Cache of all journals that have been read by commands given to "run",+-- keyed by the fully-expanded filename.+journalCache :: MVar (Map.Map (InputOpts,PrefixedFilePath) Journal)+journalCache = unsafePerformIO $ newMVar Map.empty+{-# NOINLINE journalCache #-}++-- | Cache of stdin contents, so that we can re-read it if InputOptions change+stdinCache :: MVar (Maybe T.Text)+stdinCache = unsafePerformIO $ newMVar Nothing+{-# NOINLINE stdinCache #-}++-- | Get the journal(s) to read, either from the defaultJournalOverride or from the cliopts+journalFilePathFromOptsOrDefault :: Maybe DefaultRunJournal -> CliOpts -> IO (NE.NonEmpty PrefixedFilePath)+journalFilePathFromOptsOrDefault defaultJournalOverride cliopts = do+ case defaultJournalOverride of+ Nothing -> journalFilePathFromOpts cliopts+ Just (DefaultRunJournal defaultFiles) -> do+ mbjournalpaths <- journalFilePathFromOptsNoDefault cliopts+ case mbjournalpaths of+ Nothing -> return defaultFiles -- use the journal(s) given to the "run" itself+ Just journalpaths -> return journalpaths++-- | Similar to `withJournal`, but caches all the journals it reads.+-- When reading from stdin, also caches the stdin contents so that we could reprocess+-- it if a read with different InputOptions is requested.+withJournalCached :: Maybe DefaultRunJournal -> CliOpts -> ((Journal, DefaultRunJournal) -> IO ()) -> IO ()+withJournalCached defaultJournalOverride cliopts cmd = do+ journalpaths <- journalFilePathFromOptsOrDefault defaultJournalOverride cliopts+ j <- readFiles journalpaths+ cmd (j,DefaultRunJournal journalpaths)+ where+ readFiles journalpaths =+ journalTransform cliopts . sconcat <$> mapM (readAndCacheJournalFile (inputopts_ cliopts)) journalpaths+ -- | Read a journal file, caching it (and InputOptions used to read it) if it has not been seen before.+ -- If the same file is requested with different InputOptions, we read it anew and cache+ -- it separately.+ readAndCacheJournalFile :: InputOpts -> PrefixedFilePath -> IO Journal+ readAndCacheJournalFile iopts fp = do+ modifyMVar journalCache $ \cache ->+ case Map.lookup (ioptsWithoutReportSpan,fp) cache of+ Just journal -> do+ dbg1IO ("readAndCacheJournalFile using cache for "++fp) iopts+ return (cache, journal)+ Nothing -> do+ dbg1IO ("readAndCacheJournalFile reading and caching "++fp) iopts+ journal <- runExceptT $ if isStdin fp then readStdin else readJournalFile iopts fp+ either error' (\j -> return (Map.insert (ioptsWithoutReportSpan,fp) j cache, j)) journal+ where+ -- InputOptions contain reportspan_ that is used to calculate forecast period,+ -- that is used by journalFinalise to insert forecast transactions.+ -- For the purposes of caching, we want to ignore it whenever+ -- --forecast is not used, or when explicit dates are requested.+ ioptsWithoutReportSpan = iopts{ reportspan_ = forecastreportspan }+ where+ forecastreportspan = case forecast_ iopts of+ Nothing -> emptydatespan+ -- This could be better if we had access to the journal (as we+ -- could use 'forecastPeriod') or to the journal end date (as+ -- forecast transactions are never generated before journal end+ -- unless specifically requested).+ Just forecastspan -> forecastspan `spanValidDefaultsFrom` reportspan_ iopts+ -- Read stdin, or if we read it already, use a cache+ -- readStdin :: InputOpts -> ExceptT String IO Journal+ readStdin = do+ stdinContent <- liftIO $ modifyMVar stdinCache $ \cache ->+ case cache of+ Just cached -> do+ dbg1IO "readStdin using cached stdin" "-"+ return (cache, cached)+ Nothing -> do+ dbg1IO "readStdin reading and caching stdin" "-"+ stdinContent <- readFileOrStdinPortably "-"+ return (Just stdinContent, stdinContent)+ hndl <- liftIO $ textToHandle stdinContent+ readJournal iopts Nothing hndl
+ Hledger/Cli/Commands/Run.txt view
@@ -0,0 +1,88 @@+run++Run a sequence of hledger commands, provided as files or command line+arguments. Data files are parsed just once, so the commands run faster.++Flags:+no command-specific flags++This command is experimental and could change in the future.++You can use run in three ways:++- hledger run -- CMD1 -- CMD2 -- CMD3 - read commands from the command+ line, separated by --+- hledger run SCRIPTFILE1 SCRIPTFILE2 - read commands from one or more+ files+- cat SCRIPTFILE1 | hledger run - read commands from standard input.++run first loads the input file(s) specified by LEDGER_FILE or by -f+options, in the usual way. Then it runs each command in turn, each using+the same input data. But if you want a particular command to use+different input, you can specify an -f option within that command. This+will override (not add to) the default input, just for that command.++Each input file (more precisely, each combination of input file and+input options) is parsed only once. This means that commands will not+see any changes made to these files, until the next run. But the+commands will run more quickly than if run individually (typically about+twice as fast).++Command scripts, whether in a file or written on the command line, have+a simple syntax:++- each line may contain a single hledger command and its arguments,+ without the usual hledger first word+- empty lines are ignored+- text from # to end of line is a comment, and ignored+- you can use single or double quotes to quote arguments when needed, as+ on the command line+- these extra commands are available: echo TEXT prints some text, and+ exit or quit ends the run.++On unix systems you can use #!/usr/bin/env hledger run in the first line+of a command file to make it a runnable script. If that gives an error,+use #!/usr/bin/env -S hledger run.++It's ok to use the run command recursively within a command script.++You may find some differences in behaviour between run command lines and+normal hledger command lines. run is a little stricter; eg it requires+full command names or official abbreviations (as seen in the commands+list), and command options must be written after the command name.++Examples++Run commands from the command line:++hledger -f some.journal run -- balance assets --depth 2 -- balance liabilities -f /some/other.journal --depth 3 --transpose -- stats++This would load some.journal, run balance assets --depth 2 on it, then+run balance liabilities --depth 3 --transpose on /some/other.journal,+and finally run stats on some.journal++Run commands from standard input:++(echo "files"; echo "stats") | hledger -f some.journal run++Run commands as a script:++$ cat report+#!/usr/bin/env -S hledger run -f some.journal++echo "List of accounts in some.journal"+accounts++echo "Assets of some.journal"+balance assets --depth 2++echo "Liabilities from /some/other.journal"+balance liabilities -f /some/other.journal --depth 3 --transpose++echo "Commands from another.script, applied to another.journal"+run -f another.journal another.script++$ chmod +x report+$ ./report+List of accounts in some.journal+...
+ Hledger/Cli/Commands/Setup.hs view
@@ -0,0 +1,624 @@+{-|++Check and show the status of the hledger installation.++-}+{-+Old design notes:++## Goals+- Make getting started with hledger and PTA easier and quicker, to+ (a) make this practical for more people (non techies, busy techies..)+ (b) free up more time and energy for learning and doing PTA and finance++Subgoals:+- Reduce the special knowledge and docs needed after install, to get a standard setup working (especially on windows)+- Help with discovery and setup of advanced quality of life terminal features+- Assist with setting up a first or new journal file+- Deliver relevant install/setup/config expertise more efficiently, freeing up dev and support time++## Design+Why a built in command and not a shell script, haskell script, or docs ?+So it is available and runs reliably anywhere a hledger executable runs, and so it can detect more context-specific advice.+(Optionally use shell or haskell scripts for prototyping, if that's helpful)++## Setup checks+Somewhat ordered.+These deal with the complexities of terminals, the shell, GHC, hledger, and the user's machine, locale, and data.+Initially just informational hints.+Later, add automated or interactive diagnosis and repair attempts,+and semi-persistent state (invalidated at suitable times).+These checks are a necessary evil/stopgap; long term, automate/replace/remove them whenever possible.++-}++-- {-# LANGUAGE DeriveGeneric #-}+{-# LANGUAGE OverloadedStrings #-}+-- {-# LANGUAGE NamedFieldPuns #-}+-- {-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-}++{-# OPTIONS_GHC -Wno-name-shadowing #-}+{-# OPTIONS_GHC -Wno-unused-top-binds #-}+{-# LANGUAGE MultiWayIf #-}+{-# LANGUAGE RecordWildCards #-}+-- {-# OPTIONS_GHC -Wno-unused-matches #-}++module Hledger.Cli.Commands.Setup (+ setupmode+ ,setup+)+where++import Control.Concurrent (rtsSupportsBoundThreads)+import Control.Exception+import Control.Monad+-- import Data.ByteString qualified as B+import Data.Char+import Data.Default (def)+import Data.List+import Data.Map qualified as M+import Data.Maybe+import Data.Text qualified as T+import Data.Text.Encoding qualified as T+import Data.Version qualified (showVersion)+import Network.HTTP.Client+import Network.HTTP.Types (statusCode, hLocation)+import Network.HTTP.Req as R+import Safe+import System.Directory+import System.Environment (getEnvironment, lookupEnv)+import System.Exit+import System.FilePath+import System.Info+import System.Process+import Text.Printf (printf)++import Hledger+import Hledger.Cli.CliOptions+import Hledger.Cli.Conf+import Hledger.Cli.Version+import System.IO (localeEncoding, stdout, hFlush)+++setupmode = hledgerCommandMode+ $(embedFileRelative "Hledger/Cli/Commands/Setup.txt")+ []+ [generalflagsgroup3]+ []+ ([], Nothing)+++{- | Test and print the status of various aspects of the hledger installation.+May also show extra info and hints on how to fix problems.+The goal is to detect and show as much useful information as possible,+and to complete this task reliably regardless of what we find,+without premature termination or misformatting.++The tests are grouped into setup* routines, so named because they might do more+than just test in future.++This is the second version of setup. If it finds that the currently+running hledger is not the one installed in PATH (by comparing --version output),+it refuses to proceed further until that has been done.+This means it can rely on all the latest features and use the hledger API+within this process, simplifying things greatly.+-}+setup :: CliOpts -> Journal -> IO ()+setup _opts@CliOpts{rawopts_=_rawopts, reportspec_=_rspec} _ignoredj = do+ -- This command is not given a journal and should not use _ignoredj;+ -- instead read it ourselves when we are ready.+ putStrLn "Checking your hledger setup.."+ color <- useColorOnStdout+ when color $ + putStrLn $ "Legend: " <> intercalate ", " [+ good "good"+ ,neutral "neutral"+ ,warning "unknown"+ ,bad "warning"+ ]+ meconf <- setupHledger+ setupTerminal meconf+ setupJournal meconf+ putStr "\n"++------------------------------------------------------------------------------++-- Returns Nothing if no config file was found,+-- or Just the read error or config if it was found.+setupHledger :: IO (Maybe (Either String Conf))+setupHledger = do+ pgroup "hledger"++ let+ os'+ | os=="darwin" = "macos"+ | os=="mingw32" = "windows"+ | otherwise = os+ mosversion <- getOSVersion+ let osdesc = os' <> maybe "" (" "<>) mosversion+ pdesc "is running on"+ putStrLn $ " " <> osdesc <> " on " <> arch++ pdesc "is built with a supported compiler/RTS"+ p (if rtsSupportsBoundThreads then Y else N) $ + compilerName <> " " <> Data.Version.showVersion fullCompilerVersion+ <> if rtsSupportsBoundThreads then ", using threaded RTS" else ", RTS does not have threads enabled"++ pdesc "is a native binary for this machine ?"+ case hbinArch binaryinfo of+ Nothing -> p U $ "couldn't detect this binary's architecture"+ Just a | a /= arch -> p N $ "binary is for " <> a <> ", system is " <> arch <> ", may run slowly"+ Just a -> p Y a++ pdesc "is a released version ?"+ if isReleaseVersion $ hbinPackageVersion binaryinfo+ then p Y prognameandversion+ else i N prognameandversion++ pdesc "is up to date ? checking latest..." >> hFlush stdout+ elatestversionnumstr <- getLatestHledgerVersion+ case elatestversionnumstr of+ Left e -> p U ("couldn't read " <> latestHledgerVersionUrlStr <> " " <> e)+ Right latestversionnumstr ->+ case toVersion latestversionnumstr of+ Nothing -> p U "couldn't parse latest version number"+ Just latestversion -> p+ (if hbinPackageVersion binaryinfo >= latestversion then Y else N)+ ("latest is " <> latestversionnumstr <> ", " <> showVersion (hbinPackageVersion binaryinfo) <> " is installed")++ pdesc "is installed in PATH (this version) ?"+ pathexes <- findExecutables progname+ let+ (failaction, failmsg) =+ -- (exitFailure , "Please install this hledger in PATH then run setup again.")+ (return () , " Some of this info may not apply to that hledger version. Continuing anyway..")+ case pathexes of+ [] -> p N failmsg >> failaction+ exe:_ -> do+ eerrout <- tryHledgerArgs [["--version", "--no-conf"], ["--version"]]+ case eerrout of+ Left err -> p U (progname <> " --version failed: " <> err) >> failaction+ Right out -> do+ case parseHledgerVersion out of+ Left _ -> p U ("couldn't parse " <> progname <> " --version: " <> rstrip out) >> exitFailure+ Right pathbin -> do+ let pathversion = hbinVersionOutput pathbin+ if pathversion /= prognameandversion+ then p N (chomp $ unlines [+ ""+ ," A different hledger version was found in PATH: " <> pathversion+ ," at: " <> exe+ ,failmsg+ ]) >> failaction+ else p Y exe++ pdesc "has a system text encoding configured ?"+ let encoding = localeEncoding -- the initial system encoding+ if map toLower (show encoding) == "ascii"+ then p N (show encoding <> ", please configure an encoding for non-ascii data")+ else p Y (show encoding <> ", data files must use this encoding")++ -- pdesc "can handle UTF-8 text ?"+ -- let+ -- eAcuteUtf8 = B.pack [0xC3, 0xA9]+ -- eAcuteLatin1 = B.pack [0xE9]+ -- case T.decodeUtf8' eAcuteUtf8 of+ -- Left _ -> p N "hledger's docs and examples use UTF-8"+ -- Right t -> p Y (T.unpack t)++ -- pdesc "can report text decoding failures ?"+ -- i U (T.unpack $ T.decodeUtf8 eAcuteLatin1)++ pdesc "has a user config file ?"+ muf <- activeUserConfFile+ mlf <- activeLocalConfFile+ let+ (ok, msg) = case muf of+ Just f -> (Y, f <> if isJust mlf then " (overridden)" else "")+ Nothing -> (N, "")+ i ok msg++ pdesc "has a local config file ?"+ let+ (ok, msg) = case mlf of+ Just f -> (Y, f)+ Nothing -> (N, "")+ i ok msg++ if (isJust muf || isJust mlf) then do+ pdesc "the config file is readable ?"+ econf <- getConf def+ case econf of+ Left e -> p N e >> return (Just $ Left e)+ Right (conf, _) -> do+ p Y ""++ -- pdesc "common general options are configured ?"+ -- --infer-costs"+ -- print --explicit --infer-costs"++ return $ Just $ Right conf+ else+ return Nothing++------------------------------------------------------------------------------++setupTerminal meconf = do+ pgroup "terminal"+ let+ -- Find the last opt/arg matched by a predicate in the general config, if there is one.+ conflookup predicate = case meconf of+ Just (Right conf) -> find predicate $ reverse $ confLookup "general" conf+ _ -> Nothing++ pdesc "the NO_COLOR variable is defined ?"+ mnocolor <- lookupEnv "NO_COLOR"+ case mnocolor of+ Nothing -> i N ""+ Just _ -> i Y ""++ meconfigcolor <- do+ pdesc "--color is configured by config file ?"+ let mcolorarg = conflookup (\a -> any (`isPrefixOf` a) ["--color", "--colour"])+ case mcolorarg of+ Nothing -> i N "" >> return Nothing+ Just a -> do+ i Y a+ let+ arg = reverse $ takeWhile (`notElem` ['=',' ']) $ reverse a+ return $ Just $ parseYNA arg++ pdesc "hledger will use color by default ?"+ case (meconfigcolor, isJust mnocolor) of+ (Just (Right Yes), _) -> p Y ""+ (Just (Right No), _) -> i N ""+ (_, True) -> i N ""+ (_, False) -> p Y ""++ pdesc "the PAGER variable is defined ?"+ mv <- lookupEnv "PAGER"+ case mv of+ Nothing -> i N ""+ Just v -> i Y v++ pdesc "--pager is configured by config file ?"+ let mpagerarg = conflookup ("--pager" `isPrefixOf`)+ meconfpager <- case mpagerarg of+ Nothing -> i N "" >> return Nothing+ Just a -> do+ i Y a+ let arg = reverse $ takeWhile (`notElem` ['=',' ']) $ reverse a+ return $ Just $ parseYNA arg++ pdesc "hledger will use a pager when needed ?"+ mpager <- findPager+ case mpager of+ Nothing -> i N "no pager was found"+ Just pager ->+ case meconfpager of+ Just (Right No) -> i N "disabled in config file"+ _ -> do+ p Y pager++ when (map toLower (takeBaseName pager) == "more") $ do+ pdesc "the MORE variable is defined ?"+ mv <- lookupEnv "MORE"+ case mv of+ Nothing -> i N ""+ Just v -> i Y v++ when (map toLower (takeBaseName pager) == "less") $ do+ mHLEDGER_LESS <- lookupEnv "HLEDGER_LESS"+ mLESS <- lookupEnv "LESS"++ pdesc "the LESS variable is defined ?"+ case mLESS of+ Nothing -> i N ""+ Just v -> i Y $ v <> if isJust mHLEDGER_LESS then " (overridden)" else ""++ pdesc "the HLEDGER_LESS variable is defined ?"+ case mHLEDGER_LESS of+ Nothing -> i N ""+ Just v -> i Y v++ when (isNothing mHLEDGER_LESS) $ do+ pdesc "adjusting LESS var for consistent UX ?"+ usecolor <- useColorOnStdout+ i Y $ lessVarValue mHLEDGER_LESS mLESS usecolor++ pdesc "less is working with these options ?"+ usecolor <- useColorOnStdout+ let newlessvar = lessVarValue mHLEDGER_LESS mLESS usecolor+ env <- getEnvironment+ let customEnv = ("LESS", newlessvar) : filter ((/= "LESS") . fst) env+ lessHasError <- lessIsWorking (Just customEnv)+ if lessHasError+ then p N "less --version shows a problem, check LESS/HLEDGER_LESS settings"+ else p Y ""++ pdesc "box-drawing chars are used by default ?"+ if isJust $ conflookup ("--pretty"==)+ then p Y ""+ else i N "you can use --pretty to enable them"++ -- pdesc "bash shell completions are installed ?" >> p U ""+ -- pdesc "zsh shell completions are installed ?" >> p U ""++------------------------------------------------------------------------------++setupJournal meconf = do+ pgroup "journal"+ let+ -- Find the last opt/arg matched by a predicate in the general config, if there is one.+ conflookup predicate = case meconf of+ Just (Right conf) -> find predicate $ reverse $ confLookup "general" conf+ _ -> Nothing++ -- pdesc "a home directory journal file exists ?"+ -- mh <- getHomeSafe+ -- (ok,msg) <- case mh of+ -- Just h -> do+ -- let f = h </> journalDefaultFilename+ -- e <- doesFileExist f+ -- return (if e then Y else N, if e then f else "")+ -- Nothing -> return (N, "")+ -- i ok msg++ pdesc "the LEDGER_FILE variable is defined ?"+ mf <- lookupEnv journalEnvVar+ let+ (ok, msg) = case mf of+ Just f -> (Y, f)+ Nothing -> (N, "")+ i ok msg++ -- case mf of+ -- Nothing -> return ()+ -- Just f -> do+ -- pdesc "$LEDGER_FILE journal exists ?"+ -- e <- doesFileExist f+ -- i e "" ""++ -- when (isJust mh && isJust mf) $ do+ -- pdesc "$LEDGER_FILE is masking home journal ?"+ -- i Y ""++ pdesc "a default journal file is readable ?"+ ef <- defaultJournalPathSafely+ -- let+ -- args = concat [+ -- ["print"],+ -- ["--ignore-assertions" | supportsIgnoreAssertions version],+ -- ["--no-conf" | supportsConfigFiles version]+ -- ]+ -- (exit, _, err) <- readProcessWithExitCode progname args ""+ -- XXX can this ignore assertions and config files, like the above ?+ ej <- defaultJournalSafely+ let trim s = either (const s) id $ regexReplace (toRegex' "^Error: ") "" s+ case (ef, ej) of+ (Left err, _) -> p N $ trim err+ (Right f, Left err) -> p N (f <> ":\n" <> trim err)+ (Right f, Right j@Journal{..}) -> do+ p Y f++ pdesc "it includes additional files ?"+ let numfiles = length jfiles+ if numfiles > 1+ then i Y (show (numfiles - 1) <> " files")+ else i N ""++ pdesc "all commodities are declared ?"+ let+ numcommodities = length $ journalCommodities j+ undeclaredcommodities = journalCommoditiesUsed j \\ journalCommoditiesDeclared j+ if null undeclaredcommodities+ then p Y (show numcommodities <> " commodities")+ else p N (show (length undeclaredcommodities) <> " undeclared commodities")++ let+ accttypes = [Asset, Liability, Equity, Revenue, Expense, Cash, Conversion]+ typesdeclaredorinferred = nub $ M.elems jaccounttypes+ typesnotfound = filter (not.(`elem` typesdeclaredorinferred)) accttypes+ acctswithdeclaredorinferredtype = nub (M.keys jaccounttypes)+ numaccts = length $ journalAccountNames j+ untypedaccts = journalAccountNames j \\ acctswithdeclaredorinferredtype+ undeclaredaccts = journalAccountNamesUsed j \\ journalAccountNamesDeclared j+ -- hasdeclaredaccts t = case M.lookup t jdeclaredaccounttypes of+ -- Just (_ : _) -> True+ -- _ -> False++ -- pdesc "Asset accounts declared ?" + -- if hasdeclaredaccts Asset then i Y "" else i N ""++ -- pdesc "Liability accounts declared ?"+ -- if hasdeclaredaccts Liability then i Y "" else i N ""++ -- pdesc "Equity accounts declared ?"+ -- if hasdeclaredaccts Equity then i Y "" else i N ""++ -- pdesc "Revenue accounts declared ?"+ -- if hasdeclaredaccts Revenue then i Y "" else i N ""++ -- pdesc "Expense accounts declared ?"+ -- if hasdeclaredaccts Expense then i Y "" else i N ""++ -- pdesc "Cash accounts declared ?"+ -- if hasdeclaredaccts Cash then i Y "" else i N ""++ -- pdesc "Conversion accounts declared ?"+ -- if hasdeclaredaccts Conversion then i Y "" else i N "" -- ("--infer-equity will use a default conversion account name")++ -- XXX hard to detect accounts where type was inferred from name+ -- unless arealltypesdeclared $ do+ -- let+ -- acctswithdeclaredtype = concat (M.elems jdeclaredaccounttypes)+ -- acctswithinferredtype = acctswithdeclaredorinferredtype \\ acctswithdeclaredtype+ -- arealltypesdeclared = all hasdeclaredaccts accttypes+ -- typesinferredfromnames =+ -- if arealltypesdeclared then []+ -- else sort $ nub $ catMaybes $ map (flip M.lookup jaccounttypes) acctswithinferredtype+ -- pdesc "types detected from account names ?"+ -- if null typesinferredfromnames then i N "" else i Y (concatMap show typesinferredfromnames)++ pdesc "all accounts are declared ?"+ if null undeclaredaccts then p Y (show numaccts <> " accounts") else i N (show (length undeclaredaccts) <> " undeclared accounts")++ pdesc "all accounts have types ?"+ if null untypedaccts then p Y "" else i N (show (length untypedaccts) <> " accounts without types")++ pdesc "accounts of all types exist ?"+ if null typesnotfound+ then p Y (concatMap show accttypes <> " accounts detected")+ else p N (concatMap show typesnotfound <> " accounts not found; some reports may not work")++ pdesc "commodities/accounts are being checked ?"+ let strict = isJust $ conflookup (\a -> any (==a) ["-s", "--strict"])+ if strict+ then i Y "commodities and accounts must be declared"+ else i N "you can use -s to check them"++ pdesc "balance assertions are being checked ?"+ let ignoreassertions = isJust $ conflookup (\a -> any (==a) ["-I", "--ignore-assertions"])+ if + | ignoreassertions && not strict -> i N "you can use -s to check them"+ | not strict -> i Y "you can use -I to ignore them"+ | otherwise -> i Y "can't ignore assertions (-s in config file)"++------------------------------------------------------------------------------++-- Test a hledger version for support of various features.+ver >=! str = ver >= (fromJust $ toVersion str)+supportsIgnoreAssertions = (>=! "0.24") -- --ignore-assertions (2014)+supportsCommodityDirective = (>=! "1.0") -- commodity directive (2016)+supportsPretty = (>=! "1.2") -- --pretty, to use box-drawing characters (2017)+supportsAccountDirective = (>=! "1.9") -- account directive (2018)+supportsAccountTypes = (>=! "1.13") -- ALERX account types, type: tag (2019)+supportsCashAccountType = (>=! "1.19") -- C/Cash account type (2020)+supportsBasicColor = (>=! "1.19") -- basic color detection/control (2020)+supportsConversionAccountType = (>=! "1.25") -- V/Conversion account type, accounts --types (2022)+supportsConfigFiles = (>=! "1.40") -- config files (2024)+supportsColor = (>=! "1.41") -- robust color detection/control (2024)+supportsPager = (>=! "1.41") -- use a pager for all output (2024)+supportsBashCompletions = (>=! "1.41") -- up to date bash shell completions (2024)++-- yes, no, unknown+data YNU = Y | N | U deriving (Eq)++-- ANSI styles+good = bold' . brightGreen'+neutral = bold' . brightBlue'+warning = bold' . brightYellow'+bad = bold' . brightRed'++-- Show status, in red/green/yellow if supported.+instance Show YNU where+ show Y = good "yes" -- ✅ apple emojis - won't work everywhere+ show N = bad " no" -- ❌+ show U = warning " ?"++-- Show status, in blue/yellow if supported.+showInfo Y = neutral "yes" -- ℹ️+showInfo N = neutral " no" -- ℹ️+showInfo U = warning " ?"++-- | Print a test's pass or fail status, as "yes" or "no" or "",+-- in green/red if supported, and the (possibly empty) provided message.+p :: YNU -> String -> IO ()+p ok msg = putStrLn $ unwords ["", show ok, "", msg]++-- | Like p, but display the status as info, in neutral blue.+i :: YNU -> String -> IO ()+i ok msg = putStrLn $ unwords ["", showInfo ok, "", msg]++-- | Print a setup test groups heading.+pgroup :: String -> IO ()+pgroup s = putStrLn $ "\n" <> bold' s++-- | Print a setup test's description, formatting and padding it to a fixed width.+pdesc :: String -> IO ()+pdesc s = printf "* %-40s" s++(getLatestHledgerVersion, latestHledgerVersionUrlStr) =+ -- (getLatestHledgerVersionFromHackage, "https://hackage.haskell.org/package/hledger/docs")+ (getLatestHledgerVersionFromHledgerOrg, "https://hledger.org/install.html")++httptimeout = 10000000 -- 10s++-- | Get the current hledger release version from the internet.+-- Currently requests the latest doc page from Hackage and inspects the redirect path.+-- Should catch all normal errors, and time out after 10 seconds.+getLatestHledgerVersionFromHackage :: IO (Either String String)+getLatestHledgerVersionFromHackage = do+ let url = https "hackage.haskell.org" /: "package" /: "hledger" /: "docs" /: ""+ result <- try $ runReq defaultHttpConfig{httpConfigRedirectCount=0} $+ req HEAD url NoReqBody bsResponse (R.responseTimeout httptimeout)+ case result of+ Right _ -> return $ Left "expected a redirect"+ Left (VanillaHttpException (HttpExceptionRequest _ (StatusCodeException rsp _))) -> do+ let status = statusCode $ responseStatus rsp+ if status >= 300 && status < 400+ then do+ let locationHeader = lookup hLocation (responseHeaders rsp)+ case fmap T.decodeUtf8 locationHeader of+ Nothing -> return $ Left "no Location header"+ Just location -> do+ let packagename = take 1 $ drop 1 $ reverse $ T.splitOn "/" location+ case packagename of+ [n] -> return $ Right $ dropWhile (`notElem` ['0'..'9']) $ T.unpack n+ _ -> return $ Left "couldn't parse Location"+ else return $ Left $ "HTTP status " ++ show status+ Left err -> return $ Left $ "other exception: " ++ show err++-- | Like the above, but get the version from the first number on the hledger.org Install page.+getLatestHledgerVersionFromHledgerOrg :: IO (Either String String)+getLatestHledgerVersionFromHledgerOrg = do+ let url = https "hledger.org" /: "install.html"+ do+ result <- try $ runReq defaultHttpConfig $ req GET url NoReqBody bsResponse (R.responseTimeout httptimeout)+ case result of+ Left (_ :: R.HttpException) -> return $ Left "(HTTP failure)"+ Right rsp -> case T.decodeUtf8' $ R.responseBody rsp of+ Left e -> return $ Left $ show e+ Right t -> return $+ if null version then Left "couldn't parse version" else Right version+ where+ -- keep synced+ versionline = take 1 $ dropWhile (not . ("current hledger release" `isInfixOf`)) $ lines $ T.unpack t+ version = takeWhile (`elem` ("0123456789."::[Char])) $ dropWhile (not . isDigit) $ headDef "" $ versionline+ -- work around potential failure on mac (& possible security issue, reported upstream)+ `catch` (\(_ :: IOError) -> return $ Left $ "(IO error" <> if os=="darwin" then " - mac PATH issue ?)" else ")")++-- | Try to run the hledger in PATH with one or more sets of command line arguments.+-- Returns the output from the first set of arguments that runs successfully,+-- or the error output from the last set.+tryHledgerArgs :: [[String]] -> IO (Either String String)+tryHledgerArgs [] = pure $ Left "tryHledgerArgs: no arguments provided"+tryHledgerArgs (args:rest) = do+ eresult <- runHledger args+ case eresult of+ Right out -> pure $ Right out+ Left err -> if null rest then pure $ Left err else tryHledgerArgs rest++-- | Run the hledger in PATH with the given command line arguments,+-- returning the output on success or the error output on failure.+runHledger :: [String] -> IO (Either String String)+runHledger args = do+ (exit, out, err) <- readProcessWithExitCode "hledger" args ""+ pure $ case exit of+ ExitSuccess -> Right out+ ExitFailure _ -> Left err++-- | Get the operating system version string, if possible.+-- Uses platform-specific commands to detect the OS version.+getOSVersion :: IO (Maybe String)+getOSVersion = case os of+ "darwin" -> tryCommand "sw_vers" ["-productVersion"]+ "mingw32" -> tryCommand "cmd" ["/c", "ver"]+ "linux" -> tryCommand "uname" ["-r"]+ _ -> return Nothing+ where+ tryCommand cmd args =+ (Just . strip <$> readProcess cmd args "")+ `catch` (\(_ :: SomeException) -> return Nothing)
+ Hledger/Cli/Commands/Setup.txt view
@@ -0,0 +1,61 @@+setup++Check the status of the hledger installation.++Flags:+no command-specific flags++setup tests your hledger installation and prints a list of results,+sometimes with helpful hints. This is a good first command to run after+installing hledger. Also after upgrading, or when something's not+working, or just when you want a reminder of where things are.++It makes one network request to detect the latest hledger release+version. It's ok if this fails or times out. It will use ANSI color by+default, unless disabled by NO_COLOR or --color=n. It does not use a+pager or a config file.++It expects that the hledger version you are running is installed in your+PATH. If not, it will stop until you have done that (to keep things+simple).++Example:++$ hledger setup+Checking your hledger setup..+Legend: good, neutral, unknown, warning++hledger+* is a released version ? no hledger 1.42.99-gbca4b39c5-20250425, mac-aarch64+* is up to date ? yes 1.42.99 installed, latest is 1.42.1+* is a native binary for this machine ? yes aarch64+* is installed in PATH ? yes /Users/simon/.local/bin/hledger+* has a system text encoding configured ? yes UTF-8, data files should use this encoding+* has a user config file ? (optional) no +* current directory has a local config ? yes /Users/simon/src/hledger/hledger.conf+* the config file is readable ? yes /Users/simon/src/hledger/hledger.conf++terminal+* the NO_COLOR variable is defined ? no +* --color is configured by config file ? no +* hledger will use color by default ? yes +* the PAGER variable is defined ? yes less+* --pager is configured by config file ? no +* hledger will use a pager when needed ? yes /opt/homebrew/bin/less+* the LESS variable is defined ? yes +* the HLEDGER_LESS variable is defined ? no +* adjusting LESS variable for color etc. ? yes +* --pretty is enabled by config file ? no tables will use ASCII characters+* bash shell completions are installed ? ? +* zsh shell completions are installed ? ? ++journal+* the LEDGER_FILE variable is defined ? yes /Users/simon/finance/2025/2025.journal+* a default journal file is readable ? yes /Users/simon/finance/2025/2025.journal+* it includes additional files ? yes 15+* all commodities are declared ? yes 10+* all accounts are declared ? yes 160+* all accounts have types ? no 14 untyped+* accounts of each type were detected ? yes ALERXCV+* commodities/accounts are checked ? no use -s to check commodities/accounts+* balance assertions are checked ? yes use -I to ignore assertions
Hledger/Cli/Commands/Stats.hs view
@@ -6,6 +6,8 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE RecordWildCards #-} module Hledger.Cli.Commands.Stats ( statsmode@@ -13,97 +15,170 @@ ) where -import Data.List-import Data.Maybe-import Data.Ord+import Control.Monad (when)+import Data.Default (def)+import Data.List (intercalate, nub, sortOn)+import Data.List.Extra (nubSort)+import Data.Map qualified as Map+import Data.Maybe (fromMaybe) import Data.HashSet (size, fromList)--- import Data.Text (Text)-import qualified Data.Text as T-import Data.Time.Calendar-import System.Console.CmdArgs.Explicit-import Text.Printf-import qualified Data.Map as Map+import Data.Text qualified as T+import Data.Text.Lazy qualified as TL+import Data.Time.Calendar (Day, addDays, diffDays)+import Data.Time.Clock.POSIX (getPOSIXTime)+import GHC.Stats+import GitHash (tGitInfoCwdTry)+import System.Console.CmdArgs.Explicit hiding (Group)+import System.FilePath (takeFileName)+import System.Mem (performMajorGC)+import Text.Printf (printf)+import Text.Tabular.AsciiWide import Hledger import Hledger.Cli.CliOptions-import Prelude hiding (putStr) import Hledger.Cli.Utils (writeOutput)+import Hledger.Cli.Version (packageversion, versionStringWith) statsmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Stats.txt")- [flagReq ["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE."+ [ flagNone ["1"] (setboolopt "") "show a single line of output"+ -- Cli.hs converts -1 to --depth=1, no point giving it another name here+ , flagNone ["verbose","v"] (setboolopt "verbose") "show more detailed output"+ ,flagReq ["output-file","o"] (\s opts -> Right $ setopt "output-file" s opts) "FILE" "write output to FILE." ]- [generalflagsgroup1]- []+ cligeneralflagsgroups1+ hiddenflags ([], Just $ argsFlag "[QUERY]") -- like Register.summarisePostings -- | Print various statistics for the journal. stats :: CliOpts -> Journal -> IO ()-stats opts@CliOpts{reportopts_=reportopts_} j = do- d <- getCurrentDay- let q = queryFromOpts d reportopts_- l = ledgerFromJournal q j- reportspan = (ledgerDateSpan l) `spanDefaultsFrom` (queryDateSpan False q)- intervalspans = splitSpan (interval_ reportopts_) reportspan- showstats = showLedgerStats l d- s = intercalate "\n" $ map showstats intervalspans- writeOutput opts s+stats opts@CliOpts{rawopts_=rawopts, reportspec_=rspec, progstarttime_} j = do+ t <- getPOSIXTime+ -- the first lines - general journal stats for one or more periods+ let+ today = _rsDay rspec+ oneline = intopt "depth" rawopts == 1+ verbose = boolopt "verbose" rawopts+ q = _rsQuery rspec+ l = ledgerFromJournal q j+ intervalspans = snd $ reportSpanBothDates j rspec+ ismultiperiod = length intervalspans > 1+ (txts, tnums) = unzip . map (showLedgerStats verbose l today) $ maybeDayPartitionToDateSpans intervalspans+ out1 = (if ismultiperiod then id else init) $ unlines txts -showLedgerStats :: Ledger -> Day -> DateSpan -> String-showLedgerStats l today span =- unlines $ map (\(label,value) -> concatBottomPadded [printf fmt1 label, value]) stats- where- fmt1 = "%-" ++ show w1 ++ "s: "- -- fmt2 = "%-" ++ show w2 ++ "s"- w1 = maximum $ map (length . fst) stats- -- w2 = maximum $ map (length . show . snd) stats- stats = [- ("Main file" :: String, path) -- ++ " (from " ++ source ++ ")")- ,("Included files", unlines $ drop 1 $ journalFilePaths j)- ,("Transactions span", printf "%s to %s (%d days)" (start span) (end span) days)- ,("Last transaction", maybe "none" show lastdate ++ showelapsed lastelapsed)- ,("Transactions", printf "%d (%0.1f per day)" tnum txnrate)- ,("Transactions last 30 days", printf "%d (%0.1f per day)" tnum30 txnrate30)- ,("Transactions last 7 days", printf "%d (%0.1f per day)" tnum7 txnrate7)- ,("Payees/descriptions", show $ size $ fromList $ map (tdescription) ts)- ,("Accounts", printf "%d (depth %d)" acctnum acctdepth)- ,("Commodities", printf "%s (%s)" (show $ length cs) (T.intercalate ", " cs))- -- Transactions this month : %(monthtxns)s (last month in the same period: %(lastmonthtxns)s)- -- Unmarked transactions : %(unmarked)s- -- Days since reconciliation : %(reconcileelapsed)s- -- Days since last transaction : %(recentelapsed)s- ]- where- j = ljournal l- path = journalFilePath j- ts = sortOn tdate $ filter (spanContainsDate span . tdate) $ jtxns j- as = nub $ map paccount $ concatMap tpostings ts- cs = Map.keys $ commodityStylesFromAmounts $ concatMap (amounts . pamount) $ concatMap tpostings ts- lastdate | null ts = Nothing- | otherwise = Just $ tdate $ last ts- lastelapsed = fmap (diffDays today) lastdate- showelapsed Nothing = ""- showelapsed (Just days) = printf " (%d %s)" days' direction- where days' = abs days- direction | days >= 0 = "days ago" :: String- | otherwise = "days from now"- tnum = length ts- start (DateSpan (Just d) _) = show d- start _ = ""- end (DateSpan _ (Just d)) = show d- end _ = ""- days = fromMaybe 0 $ daysInSpan span- txnrate | days==0 = 0- | otherwise = fromIntegral tnum / fromIntegral days :: Double- tnum30 = length $ filter withinlast30 ts- withinlast30 t = d >= addDays (-30) today && (d<=today) where d = tdate t- txnrate30 = fromIntegral tnum30 / 30 :: Double- tnum7 = length $ filter withinlast7 ts- withinlast7 t = d >= addDays (-7) today && (d<=today) where d = tdate t- txnrate7 = fromIntegral tnum7 / 7 :: Double- acctnum = length as- acctdepth | null as = 0- | otherwise = maximum $ map accountNameLevel as+ -- the last line - overall performance stats, with memory info if available,+ -- in human-friendly or machine-friendly format+ -- normal:+ -- Runtime stats : 0.14 s elapsed, 7606 txns/s+ -- Runtime stats : 0.14 s elapsed, 7606 txns/s, 6 MB live, 18 MB alloc+ -- oneline:+ -- SHORTVERSION(<SPC><TAB>VALUE[<SPC>DESC])++ -- 1.50.99<SPC><TAB>hledger 1.50.99-g0835a2485-20251119, mac-aarch64<SPC><TAB>2025.journal<SPC><TAB>1.99 s elapsed<SPC><TAB>524 txns/s+ -- 1.50.99<SPC><TAB>hledger 1.50.99-g0835a2485-20251119, mac-aarch64<SPC><TAB>2025.journal<SPC><TAB>1.99 s elapsed<SPC><TAB>524 txns/s<SPC><TAB>788 MB live<SPC><TAB>2172 MB alloc+ -- + rtsstats <- getRTSStatsEnabled+ (maxlivemb, maxinusemb) <- if rtsstats+ then do+ -- do one last garbage collection; probably little effect, hopefully little wasted time+ performMajorGC+ RTSStats{..} <- getRTSStats+ return (toMegabytes max_live_bytes, toMegabytes max_mem_in_use_bytes)+ else+ return (0,0)+ let+ (label, sep)+ | oneline = (lstrip $ versionStringWith $$tGitInfoCwdTry False "" packageversion <> "\t", "\t")+ | otherwise = ("Runtime stats : ", ", ")+ dt = t - progstarttime_+ tnum = sum tnums+ ss =+ [ takeFileName $ journalFilePath j | oneline ]+ <> [+ printf "%.2f s elapsed" (realToFrac dt :: Float)+ ,printf "%.0f txns/s" (fromIntegral tnum / realToFrac dt :: Float)+ ]+ <> if rtsstats then [+ printf "%0.0f MB live" maxlivemb+ ,printf "%0.0f MB alloc" maxinusemb+ -- printf "%0.0f MB avg live" (toMegabytes $ fromIntegral cumulative_live_bytes / fromIntegral major_gcs)+ ]+ else [+ "(add +RTS -T -RTS for more)"+ ]+ out2 = label <> intercalate sep ss <> "\n" + when (not oneline) $ writeOutput opts out1+ when (oneline && debugLevel>0) $ do+ let tabstops = intercalate (replicate 7 ' ') (replicate 21 ".") <> "\n"+ writeOutput opts tabstops+ writeOutput opts $ (if ismultiperiod then "\n" else "") <> out2++toMegabytes n = realToFrac n / 1000000 ::Float -- SI preferred definition, 10^6+-- toMebibytes n = realToFrac n / 1048576 ::Float -- traditional computing definition, 2^20++-- | Generate multiline stats output, possibly verbose,+-- for the given ledger and date period and current date.+-- Also return the number of transactions in the period.+showLedgerStats :: Bool -> Ledger -> Day -> DateSpan -> (String, Int)+showLedgerStats verbose l today spn =+ (unlines $ map (TL.unpack . renderRow def{tableBorders=False, borderSpaces=False} . showRow) stts+ ,tnum)+ where+ showRow (label, val) = Group NoLine $ map (Header . textCell TopLeft)+ [fitText (Just w) (Just w) False True label `T.append` ": ", T.pack val]+ w = 20 -- keep synced with labels above+ -- w = maximum $ map (T.length . fst) stts+ (stts, tnum) = ([+ ("Main file", path' :: String) -- ++ " (from " ++ source ++ ")")+ ,("Included files", if verbose then unlines includedpaths else show (length includedpaths))+ ,("Txns span", printf "%s to %s (%d days)" (showstart spn) (showend spn) days)+ ,("Last txn", maybe "none" show lastdate ++ showelapsed lastelapsed)+ ,("Txns", printf "%d (%0.1f per day)" tnum txnrate)+ ,("Txns last 30 days", printf "%d (%0.1f per day)" tnum30 txnrate30)+ ,("Txns last 7 days", printf "%d (%0.1f per day)" tnum7 txnrate7)+ ,("Payees/descriptions", show $ size $ fromList $ map (tdescription) ts)+ ,("Accounts", printf "%d (depth %d)" acctnum acctdepth)+ ,("Commodities", printf "%s%s" (show $ length cs) (if verbose then " (" <> T.intercalate ", " cs <> ")" else ""))+ ,("Market prices", printf "%s%s" (show $ length mktprices) (if verbose then " (" <> T.intercalate ", " mktpricecommodities <> ")" else ""))+ -- Txns this month : %(monthtxns)s (last month in the same period: %(lastmonthtxns)s)+ -- Unmarked txns : %(unmarked)s+ -- Days since reconciliation : %(reconcileelapsed)s+ -- Days since last txn : %(recentelapsed)s+ ]+ ,tnum1)+ where+ j = ljournal l+ path' = if verbose then path else ".../" <> takeFileName path where path = journalFilePath j+ includedpaths = drop 1 $ journalFilePaths j+ ts = sortOn tdate $ filter (spanContainsDate spn . tdate) $ jtxns j+ as = nub $ map paccount $ concatMap tpostings ts+ cs = either error' Map.keys $ commodityStylesFromAmounts $ concatMap (amountsRaw . pamount) $ concatMap tpostings ts -- PARTIAL:+ lastdate | null ts = Nothing+ | otherwise = Just $ tdate $ last ts+ lastelapsed = fmap (diffDays today) lastdate+ showelapsed Nothing = ""+ showelapsed (Just dys) = printf " (%d %s)" dys' direction+ where dys' = abs dys+ direction | dys >= 0 = "days ago" :: String+ | otherwise = "days from now"+ tnum1 = length ts -- Integer would be better+ showstart (DateSpan (Just efd) _) = show $ fromEFDay efd+ showstart _ = ""+ showend (DateSpan _ (Just efd)) = show $ fromEFDay efd+ showend _ = ""+ days = fromMaybe 0 $ daysInSpan spn+ txnrate | days==0 = 0+ | otherwise = fromIntegral tnum1 / fromIntegral days :: Double+ tnum30 = length $ filter withinlast30 ts+ withinlast30 t = d >= addDays (-30) today && (d<=today) where d = tdate t+ txnrate30 = fromIntegral tnum30 / 30 :: Double+ tnum7 = length $ filter withinlast7 ts+ withinlast7 t = d >= addDays (-7) today && (d<=today) where d = tdate t+ txnrate7 = fromIntegral tnum7 / 7 :: Double+ acctnum = length as+ acctdepth | null as = 0+ | otherwise = maximum $ map accountNameLevel as+ mktprices = jpricedirectives j+ mktpricecommodities = nubSort $ map pdcommodity mktprices
Hledger/Cli/Commands/Stats.txt view
@@ -1,25 +1,53 @@ stats-Show some journal statistics. -_FLAGS_+Show journal and performance statistics. -The stats command displays summary information for the whole journal, or-a matched part of it. With a reporting interval, it shows a report for+Flags:+ -1 show a single line of output+ -v --verbose show more detailed output+ -o --output-file=FILE write output to FILE.++The stats command shows summary information for the whole journal, or a+matched part of it. With a reporting interval, it shows a report for each report period. +It also shows some performance statistics:++- how long the program ran for+- the number of transactions processed per second+- the peak live memory in use by the program to do its work+- the peak allocated memory as seen by the program++By default, the output is reasonably discreet; it reveals the main file+name, your activity level, and the speed of your machine.++With -v/--verbose, more details are shown: the full paths of all files,+and the names of the commodities you work with.++With -1, only one line of output is shown, in a machine-friendly+tab-separated format: the program version, the main journal file name,+and the performance stats,++The run time of stats is similar to that of a balance report.+ Example: -$ hledger stats-Main journal file : /src/hledger/examples/sample.journal-Included journal files : -Transactions span : 2008-01-01 to 2009-01-01 (366 days)-Last transaction : 2008-12-31 (2333 days ago)-Transactions : 5 (0.0 per day)-Transactions last 30 days: 0 (0.0 per day)-Transactions last 7 days : 0 (0.0 per day)-Payees/descriptions : 5-Accounts : 8 (depth 3)-Commodities : 1 ($)+$ hledger stats -f examples/1ktxns-1kaccts.journal +Main file : .../1ktxns-1kaccts.journal+Included files : 0+Txns span : 2000-01-01 to 2002-09-27 (1000 days)+Last txn : 2002-09-26 (7827 days ago)+Txns : 1000 (1.0 per day)+Txns last 30 days : 0 (0.0 per day)+Txns last 7 days : 0 (0.0 per day)+Payees/descriptions : 1000+Accounts : 1000 (depth 10)+Commodities : 26+Market prices : 1000+Runtime stats : 0.12 s elapsed, 8266 txns/s, 4 MB live, 16 MB alloc -This command also supports output destination and output format-selection.+$ hledger stats -1 -f examples/10ktxns-1kaccts.journal+1.50.99-g0835a2485-20251119, mac-aarch64 10ktxns-1kaccts.journal 0.66 s elapsed 15244 txns/s 28 MB live 86 MB alloc++This command supports the -o/--output-file option (but not+-O/--output-format).
Hledger/Cli/Commands/Tags.hs view
@@ -1,35 +1,100 @@ {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE TemplateHaskell #-}+{-# LANGUAGE TupleSections #-} module Hledger.Cli.Commands.Tags ( tagsmode ,tags-) +) where -import Data.List-import qualified Data.Text as T+import Control.Monad.Fail qualified as Fail+import Data.List.Extra (nubSort)+import Data.Text qualified as T+import Data.Text.IO qualified as T import Safe+import System.Console.CmdArgs.Explicit+ import Hledger import Hledger.Cli.CliOptions+import Data.Function ((&))+import Data.Maybe (fromMaybe)+import Data.List (find) + tagsmode = hledgerCommandMode $(embedFileRelative "Hledger/Cli/Commands/Tags.txt")- [] -- [flagNone ["strict"] (setboolopt "strict") "makes date comparing strict"] -- - [generalflagsgroup1]- []- ([], Just $ argsFlag "[TAGREGEX [QUERY...]]")+ [+ flagNone ["used"] (setboolopt "used") "list tags used"+ ,flagNone ["declared"] (setboolopt "declared") "list tags declared"+ ,flagNone ["undeclared"] (setboolopt "undeclared") "list tags used but not declared"+ ,flagNone ["unused"] (setboolopt "unused") "list tags declared but not used"+ ,flagNone ["find"] (setboolopt "find") "list the first tag whose name is matched by the first argument (a case-insensitive infix regexp)"+ ,flagNone ["values"] (setboolopt "values") "list tag values instead of tag names"+ ,flagNone ["parsed"] (setboolopt "parsed") "show them in the order they were parsed (mostly), including duplicates"+ ]+ cligeneralflagsgroups1+ hiddenflags+ ([], Just $ argsFlag "[TAGREGEX [QUERY..]]") -tags CliOpts{rawopts_=rawopts,reportopts_=ropts} j = do- d <- getCurrentDay+tags :: CliOpts -> Journal -> IO ()+tags opts@CliOpts{rawopts_=rawopts, reportspec_=rspec@ReportSpec{_rsQuery=_q, _rsReportOpts=ropts}} j = do+ let today = _rsDay rspec+ args = listofstringopt "args" rawopts+ -- For convenience/power, the first argument is a tag name regex, + -- separate from the main query arguments: hledger tags [TAGREGEX [QUERYARGS..]]+ -- So we have to re-parse the query here. Overcomplicated ?+ mtagpat <- mapM (either Fail.fail pure . toRegexCI . T.pack) $ headMay args let- args = listofstringopt "args" rawopts- mtagpats = headMay args- queryargs = drop 1 args- q = queryFromOpts d $ ropts{query_ = unwords queryargs} - txns = filter (q `matchesTransaction`) $ jtxns $ journalSelectingAmountFromOpts ropts j- tags = - nub $ sort $ - (maybe id (filter . regexMatchesCI) mtagpats) $ - map (T.unpack . fst) $ concatMap transactionAllTags txns- mapM_ putStrLn tags+ values = boolopt "values" rawopts+ parsed = boolopt "parsed" rawopts+ empty = empty_ ropts+ querystr = map T.pack $ drop 1 args+ query <- either usageError (return . fst) $ parseQueryList today querystr+ let+ q = simplifyQuery $ And [queryFromFlags ropts, query]+ txns = filter (q `matchesTransaction`) $ jtxns $ journalApplyValuationFromOpts rspec j+ accts =+ -- also search for tags in matched account declarations,+ -- unless there is a query for something transaction-specific, like date: or amt:.+ if dbg5 "queryIsTransactionRelated" $ queryIsTransactionRelated $ dbg4 "q" q+ then []+ else filter (matchesAccountExtra (journalAccountType j) (journalInheritedAccountTags j) q) $+ map fst $ jdeclaredaccounts j+ -- bit of a mess.+ used = dbg5 "used" $ concatMap (journalAccountTags j) accts ++ concatMap transactionAllTags txns+ declared' = dbg5 "declared'" $ map (,"") $ journalTagsDeclared j+ filtereddeclared = dbg5 "filtereddeclared'" $ filter (q `matchesTag`) declared'+ (usednames, declarednames) = (map fst used, map fst filtereddeclared)+ unused = dbg5 "unused" $ filter (not . (`elem` usednames) . fst) filtereddeclared+ undeclared = dbg5 "undeclared" $ filter (not . (`elem` declarednames) . fst) used+ all' = dbg5 "all''" $ filtereddeclared <> used+ found = dbg5 "found" $ foundtag+ where+ -- First find the name, then the first occurrence of that tag.+ -- So that --values and --parsed still work with --find (in some reasonably stable way).+ alltags = declared' <> used+ allnames = dbg5 "allnames" $ nubSort $ map fst alltags+ foundname = dbg5 "foundname" $ findMatchedByArgument rawopts "tag name" allnames+ foundtag = find ((==foundname).fst) alltags+ & fromMaybe (error' "tags: could not find a tag's first occurrence") -- PARTIAL: should not happen because allnames and alltags correspond++ tags' =+ case declarablesSelectorFromOpts opts of+ Nothing -> all'+ Just Used -> used+ Just Declared -> declared'+ Just Undeclared -> undeclared+ Just Unused -> unused+ Just Find -> [found]++ results =+ (if parsed then id else nubSort)+ [ r+ | (t,v) <- tags'+ , maybe True (`regexMatchText` t) mtagpat+ , let r = if values then v else t+ , not (values && T.null v && not empty)+ ]++ mapM_ T.putStrLn results
Hledger/Cli/Commands/Tags.txt view
@@ -1,7 +1,38 @@ tags-List all the tag names used in the journal. With a TAGREGEX argument,-only tag names matching the regular expression (case insensitive) are-shown. With QUERY arguments, only transactions matching the query are-considered. -_FLAGS_+List the tag names used or declared in the journal, or their values.++Flags:+ --used list tags used+ --declared list tags declared+ --undeclared list tags used but not declared+ --unused list tags declared but not used+ --find list the first tag whose name is matched by the+ first argument (a case-insensitive infix regexp)+ --values list tag values instead of tag names+ --parsed show them in the order they were parsed (mostly),+ including duplicates++This command lists tag names - all of them by default, or just the ones+which have been used on transactions/postings/accounts, or declared with+tag directives, or used but not declared, or declared but not used, or+just the first one matched by a pattern (with --find, returning a+non-zero exit code if it fails).++Note this command's non-standard first argument: it is a+case-insensitive infix regular expression for matching tag names, which+limits the tags shown. Any additional arguments are standard query+arguments, which limit the transactions, postings, or accounts providing+tags.++With --values, the tags' unique non-empty values are listed instead.++With -E/--empty, blank/empty values are also shown.++With --parsed, tags or values are shown in the order they were parsed,+with duplicates included. (Except, tags from account declarations are+always shown first.)++Remember that accounts also acquire tags from their parents; postings+also acquire tags from their account and transaction; and transactions+also acquire tags from their postings.
Hledger/Cli/Commands/Test.txt view
@@ -1,21 +1,25 @@ test+ Run built-in unit tests. -_FLAGS_+Flags:+no command-specific flags -This command runs the unit tests built in to hledger-lib and hledger,-printing test names and results on stdout. If any test fails, the exit-code will be non-zero.+This command runs the unit tests built in to hledger and hledger-lib,+printing the results on stdout. If any test fails, the exit code will be+non-zero. -Test names include a group prefix. If a (exact, case sensitive) group-prefix, or a full test name is provided as the first argument, only that-group or test is run.+This is mainly used by hledger developers, but you can also use it to+sanity-check the installed hledger executable on your platform. All+tests are expected to pass - if you ever see a failure, please report as+a bug! -If a numeric second argument is provided, it will set the randomness-seed, for repeatable results from tests using randomness (currently none-of them).+Any arguments before a -- argument will be passed to the tasty test+runner as test-selecting -p patterns, and any arguments after -- will be+passed to tasty unchanged. -This is mainly used by developers, but it's nice to be able to-sanity-check your installed hledger executable at any time. All tests-are expected to pass - if you ever see otherwise, something has gone-wrong, please report a bug!+Examples:++$ hledger test # run all unit tests+$ hledger test balance # run tests with "balance" in their name+$ hledger test -- -h # show tasty's options
Hledger/Cli/CompoundBalanceCommand.hs view
@@ -1,392 +1,405 @@-{-# LANGUAGE OverloadedStrings, RecordWildCards #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE RecordWildCards #-}+{-# LANGUAGE LambdaCase #-} {-| -Common helpers for making multi-section balance report commands +Common helpers for making multi-section balance report commands like balancesheet, cashflow, and incomestatement. -} module Hledger.Cli.CompoundBalanceCommand ( CompoundBalanceCommandSpec(..)- ,CBCSubreportSpec(..) ,compoundBalanceCommandMode ,compoundBalanceCommand ) where -import Data.List (foldl')-import Data.Maybe (fromMaybe,catMaybes)-import qualified Data.Text as TS-import qualified Data.Text.Lazy as TL-import System.Console.CmdArgs.Explicit as C-import Hledger.Read.CsvReader (CSV, printCSV)-import Lucid as L-import Text.Tabular as T+import Control.Monad (guard)+import Data.Bifunctor (second)+import Data.Foldable (traverse_)+import Data.Function ((&))+import Data.List.NonEmpty (NonEmpty((:|)))+import Data.Maybe (fromMaybe, mapMaybe, maybeToList)+import Data.Map qualified as Map+import Data.List qualified as List+import Data.List.NonEmpty qualified as NonEmpty+import Data.Text qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.Builder qualified as TB+import Data.Time.Calendar (Day, addDays)+import Lucid as L hiding (Html, value_)+import System.Console.CmdArgs.Explicit as C (Mode, flagNone, flagReq)+import System.IO qualified as IO+import Text.Tabular.AsciiWide as Tabular hiding (render) import Hledger import Hledger.Cli.Commands.Balance import Hledger.Cli.CliOptions-import Hledger.Cli.Utils (writeOutput)+import Hledger.Cli.Utils (unsupportedOutputFormatError, writeOutputLazyText)+import Hledger.Write.Csv (CSV, printCSV, printTSV)+import Hledger.Write.Html (formatRow, htmlAsLazyText, Html)+import Hledger.Write.Html.Attribute (stylesheet, tableStyle, alignleft)+import Hledger.Write.Ods (printFods)+import Hledger.Write.Spreadsheet qualified as Spr --- | Description of a compound balance report command, +-- | Description of a compound balance report command, -- from which we generate the command's cmdargs mode and IO action.--- A compound balance report command shows one or more sections/subreports, --- each with its own title and subtotals row, in a certain order, +-- A compound balance report command shows one or more sections/subreports,+-- each with its own title and subtotals row, in a certain order, -- plus a grand totals row if there's more than one section. -- Examples are the balancesheet, cashflow and incomestatement commands. ----- Compound balance reports do sign normalisation: they show all account balances +-- Compound balance reports do sign normalisation: they show all account balances -- as normally positive, unlike the ordinary BalanceReport and most hledger commands--- which show income/liability/equity balances as normally negative. +-- which show income/liability/equity balances as normally negative. -- Each subreport specifies the normal sign of its amounts, and whether -- it should be added to or subtracted from the grand total. -- data CompoundBalanceCommandSpec = CompoundBalanceCommandSpec {- cbcdoc :: CommandDoc, -- ^ the command's name(s) and documentation- cbctitle :: String, -- ^ overall report title- cbcqueries :: [CBCSubreportSpec], -- ^ subreport details- cbctype :: BalanceType -- ^ the "balance" type (change, cumulative, historical) - -- this report shows (overrides command line flags)-}---- | Description of one subreport within a compound balance report.-data CBCSubreportSpec = CBCSubreportSpec {- cbcsubreporttitle :: String- ,cbcsubreportquery :: Journal -> Query- ,cbcsubreportnormalsign :: NormalSign- ,cbcsubreportincreasestotal :: Bool+ cbcdoc :: CommandHelpStr, -- ^ the command's name(s) and documentation+ cbctitle :: String, -- ^ overall report title+ cbcqueries :: [CBCSubreportSpec DisplayName], -- ^ subreport details+ cbcaccum :: BalanceAccumulation -- ^ how to accumulate balances (per-period, cumulative, historical)+ -- (overrides command line flags) } --- | A compound balance report has:------ * an overall title------ * the period (date span) of each column------ * one or more named, normal-positive multi balance reports, --- with columns corresponding to the above, and a flag indicating--- whether they increased or decreased the overall totals------ * a list of overall totals for each column, and their grand total and average------ It is used in compound balance report commands like balancesheet, --- cashflow and incomestatement.-type CompoundBalanceReport = - ( String- , [DateSpan]- , [(String, MultiBalanceReport, Bool)]- , ([MixedAmount], MixedAmount, MixedAmount)- )----- | Generate a cmdargs option-parsing mode from a compound balance command +-- | Generate a cmdargs option-parsing mode from a compound balance command -- specification. compoundBalanceCommandMode :: CompoundBalanceCommandSpec -> Mode RawOpts compoundBalanceCommandMode CompoundBalanceCommandSpec{..} = hledgerCommandMode- cbcdoc- [flagNone ["change"] (setboolopt "change")- ("show balance change in each period" ++ defType PeriodChange)+ cbcdoc+ -- keep roughly consistent order with Balance.hs. XXX refactor+ (+ -- https://hledger.org/dev/hledger.html#calculation-mode :+ [flagNone ["sum"] (setboolopt "sum")+ (calcprefix ++ "show sum of posting amounts (default)")+ ,flagNone ["valuechange"] (setboolopt "valuechange")+ (calcprefix ++ "show total change of value of period-end historical balances (caused by deposits, withdrawals, market price fluctuations)")+ ,flagNone ["gain"] (setboolopt "gain")+ (calcprefix ++ "show unrealised capital gain/loss (historical balance value minus cost basis)")+ -- currently not supported by compound balance commands:+ -- ,flagNone ["budget"] (setboolopt "budget")+ -- (calcprefix ++ "show sum of posting amounts compared to budget goals defined by periodic transactions")+ ,flagNone ["count"] (setboolopt "count") (calcprefix ++ "show the count of postings")++ -- https://hledger.org/dev/hledger.html#accumulation-mode :+ ,flagNone ["change"] (setboolopt "change")+ (accumprefix ++ "accumulate amounts from column start to column end (in multicolumn reports)" ++ defaultMarker PerPeriod) ,flagNone ["cumulative"] (setboolopt "cumulative")- ("show balance change accumulated across periods (in multicolumn reports)"- ++ defType CumulativeChange- )+ (accumprefix ++ "accumulate amounts from report start (specified by e.g. -b/--begin) to column end" ++ defaultMarker Cumulative) ,flagNone ["historical","H"] (setboolopt "historical")- ("show historical ending balance in each period (includes postings before report start date)"- ++ defType HistoricalBalance- )- ,flagNone ["flat"] (setboolopt "flat") "show accounts as a list"- ,flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "flat mode: omit N leading account name parts"- ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"- ,flagNone ["tree"] (setboolopt "tree") "show accounts as a tree; amounts include subaccounts (default in simple reports)"+ (accumprefix ++ "accumulate amounts from journal start to column end (includes postings before report start date)" ++ defaultMarker Historical)+ ]++ ++ flattreeflags True +++ [flagReq ["drop"] (\s opts -> Right $ setopt "drop" s opts) "N" "in list mode, omit N leading account name parts"+ ,flagNone ["declared"] (setboolopt "declared") "include non-parent declared accounts (best used with -E)" ,flagNone ["average","A"] (setboolopt "average") "show a row average column (in multicolumn reports)" ,flagNone ["row-total","T"] (setboolopt "row-total") "show a row total column (in multicolumn reports)"- ,flagNone ["no-elide"] (setboolopt "no-elide") "don't squash boring parent accounts (in tree mode)"+ ,flagNone ["summary-only"] (setboolopt "summary-only") "display only row summaries (e.g. row total, average) (in multicolumn reports)"+ ,flagNone ["no-total","N"] (setboolopt "no-total") "omit the final total row"+ ,flagNone ["no-elide"] (setboolopt "no-elide") "in tree mode, don't squash boring parent accounts" ,flagReq ["format"] (\s opts -> Right $ setopt "format" s opts) "FORMATSTR" "use this custom line format (in simple reports)"- ,flagNone ["pretty-tables"] (setboolopt "pretty-tables") "use unicode when displaying tables" ,flagNone ["sort-amount","S"] (setboolopt "sort-amount") "sort by amount instead of account code/name"- ,outputFormatFlag+ ,flagNone ["percent", "%"] (setboolopt "percent") "express values in percentage of each column's total"+ ,flagReq ["layout"] (\s opts -> Right $ setopt "layout" s opts) "ARG"+ (unlines+ ["how to show multi-commodity amounts:"+ ,"'wide[,WIDTH]': all commodities on one line"+ ,"'tall' : each commodity on a new line"+ ,"'bare' : bare numbers, symbols in a column"+ ])+ ,flagReq ["base-url"] (\s opts -> Right $ setopt "base-url" s opts) "URLPREFIX" "in html output, generate hyperlinks to hledger-web, with this prefix. (Usually the base url shown by hledger-web; can also be relative.)"++ ,outputFormatFlag ["txt","html","csv","tsv","json"] ,outputFileFlag- ]- [generalflagsgroup1]- []++ ])+ cligeneralflagsgroups1+ (hiddenflags +++ [ flagNone ["commodity-column"] (setboolopt "commodity-column")+ "show commodity symbols in a separate column, amounts as bare numbers, one row per commodity"+ ]) ([], Just $ argsFlag "[QUERY]") where- defType :: BalanceType -> String- defType bt | bt == cbctype = " (default)"- | otherwise = ""+ calcprefix = "calculation mode: "+ accumprefix = "accumulation mode: "+ defaultMarker :: BalanceAccumulation -> String+ defaultMarker bacc | bacc == cbcaccum = " (default)"+ | otherwise = "" -- | Generate a runnable command from a compound balance command specification. compoundBalanceCommand :: CompoundBalanceCommandSpec -> (CliOpts -> Journal -> IO ())-compoundBalanceCommand CompoundBalanceCommandSpec{..} opts@CliOpts{reportopts_=ropts, rawopts_=rawopts} j = do- d <- getCurrentDay- let- -- use the default balance type for this report, unless the user overrides - mBalanceTypeOverride =- case reverse $ filter (`elem` ["change","cumulative","historical"]) $ map fst rawopts of- "historical":_ -> Just HistoricalBalance- "cumulative":_ -> Just CumulativeChange- "change":_ -> Just PeriodChange- _ -> Nothing- balancetype = fromMaybe cbctype mBalanceTypeOverride- title = cbctitle ++ " " ++ showDateSpan requestedspan ++ maybe "" (' ':) mtitleclarification- where- requestedspan = queryDateSpan (date2_ ropts) userq `spanDefaultsFrom` journalDateSpan (date2_ ropts) j- -- when user overrides, add an indication to the report title- mtitleclarification = flip fmap mBalanceTypeOverride $ \t ->- case t of- PeriodChange -> "(Balance Changes)"- CumulativeChange -> "(Cumulative Ending Balances)"- HistoricalBalance -> "(Historical Ending Balances)"- -- Set balance type in the report options.- -- Also, use tree mode (by default, at least?) if --cumulative/--historical - -- are used in single column mode, since in that situation we will be using - -- balanceReportFromMultiBalanceReport which does not support eliding boring parents,- -- and tree mode hides this.. or something.. XXX - ropts'- | not (flat_ ropts) && - interval_ ropts==NoInterval && - balancetype `elem` [CumulativeChange, HistoricalBalance]- = ropts{balancetype_=balancetype, accountlistmode_=ALTree}- | otherwise- = ropts{balancetype_=balancetype}- userq = queryFromOpts d ropts'- format = outputFormatFromOpts opts+compoundBalanceCommand CompoundBalanceCommandSpec{..} opts@CliOpts{reportspec_=rspec, rawopts_=rawopts} j = do+ writeOutputLazyText opts $ render $ styleAmounts styles cbr+ where+ styles = journalCommodityStylesWith HardRounding j+ ropts@ReportOpts{..} = _rsReportOpts rspec+ -- use the default balance type for this report, unless the user overrides+ mbalanceAccumulationOverride = balanceAccumulationOverride rawopts+ balanceaccumulation = fromMaybe cbcaccum mbalanceAccumulationOverride+ -- Set balance type in the report options.+ ropts' = ropts{balanceaccum_=balanceaccumulation} - -- make a CompoundBalanceReport- subreports = - map (\CBCSubreportSpec{..} -> - (cbcsubreporttitle- ,mbrNormaliseSign cbcsubreportnormalsign $ -- <- convert normal-negative to normal-positive- compoundBalanceSubreport ropts' userq j cbcsubreportquery cbcsubreportnormalsign- ,cbcsubreportincreasestotal- ))- cbcqueries- subtotalrows = - [(coltotals, increasesoveralltotal) - | (_, MultiBalanceReport (_,_,(coltotals,_,_)), increasesoveralltotal) <- subreports- ]- -- Sum the subreport totals by column. Handle these cases:- -- - no subreports- -- - empty subreports, having no subtotals (#588)- -- - subreports with a shorter subtotals row than the others - overalltotals = case subtotalrows of- [] -> ([], nullmixedamt, nullmixedamt)- rs ->- let- numcols = maximum $ map (length.fst) rs -- partial maximum is ok, rs is non-null- paddedsignedsubtotalrows = - [map (if increasesoveralltotal then id else negate) $ -- maybe flip the signs- take numcols $ as ++ repeat nullmixedamt -- pad short rows with zeros - | (as,increasesoveralltotal) <- rs- ]- coltotals = foldl' (zipWith (+)) zeros paddedsignedsubtotalrows -- sum the columns- where zeros = replicate numcols nullmixedamt- grandtotal = sum coltotals- grandavg | null coltotals = nullmixedamt- | otherwise = fromIntegral (length coltotals) `divideMixedAmount` grandtotal - in - (coltotals, grandtotal, grandavg)- colspans =- case subreports of- (_, MultiBalanceReport (ds,_,_), _):_ -> ds- [] -> []- cbr =- (title- ,colspans- ,subreports- ,overalltotals- )+ title =+ maybe "" (<>" ") mintervalstr+ <> T.pack cbctitle+ <> " "+ <> titledatestr+ <> maybe "" (" "<>) mtitleclarification+ <> valuationdesc+ where + -- XXX #1078 the title of ending balance reports+ -- (Historical) should mention the end date(s) shown as+ -- column heading(s) (not the date span of the transactions).+ -- Also the dates should not be simplified (it should show+ -- "2008/01/01-2008/12/31", not "2008").+ titledatestr = case balanceaccumulation of+ Historical -> showEndDates enddates+ _ -> showDateSpan requestedspan+ where+ enddates = map (addDays (-1)) . mapMaybe spanEnd $ cbrDates cbr -- these spans will always have a definite end date+ requestedspan = fst $ reportSpan j rspec++ mintervalstr = showInterval interval_++ -- when user overrides, add an indication to the report title+ -- Do we need to deal with overridden BalanceCalculation?+ mtitleclarification = case (balancecalc_, balanceaccumulation, mbalanceAccumulationOverride) of+ (CalcValueChange, PerPeriod, _ ) -> Just "(Period-End Value Changes)"+ (CalcValueChange, Cumulative, _ ) -> Just "(Cumulative Period-End Value Changes)"+ (CalcGain, PerPeriod, _ ) -> Just "(Incremental Gain)"+ (CalcGain, Cumulative, _ ) -> Just "(Cumulative Gain)"+ (CalcGain, Historical, _ ) -> Just "(Historical Gain)"+ (_, _, Just PerPeriod ) -> Just "(Balance Changes)"+ (_, _, Just Cumulative) -> Just "(Cumulative Ending Balances)"+ (_, _, Just Historical) -> Just "(Historical Ending Balances)"+ _ -> Nothing++ valuationdesc =+ (case conversionop_ of+ Just ToCost -> ", converted to cost"+ _ -> "")+ <> (case value_ of+ Just (AtThen _mc) -> ", valued at posting date"+ Just (AtEnd _mc) | changingValuation -> ""+ Just (AtEnd _mc) -> ", valued at period ends"+ Just (AtNow _mc) -> ", current value"+ Just (AtDate today _mc) -> ", valued at " <> showDate today+ Nothing -> "")++ changingValuation = case (balancecalc_, balanceaccum_) of+ (CalcValueChange, PerPeriod) -> True+ (CalcValueChange, Cumulative) -> True+ _ -> False++ -- make a CompoundBalanceReport.+ cbr' = compoundBalanceReport rspec{_rsReportOpts=ropts'} j cbcqueries+ cbr = cbr'{cbrTitle=title}+ -- render appropriately- writeOutput opts $- case format of- "csv" -> printCSV (compoundBalanceReportAsCsv ropts cbr) ++ "\n"- "html" -> (++ "\n") $ TL.unpack $ L.renderText $ compoundBalanceReportAsHtml ropts cbr- _ -> compoundBalanceReportAsText ropts' cbr+ render = case outputFormatFromOpts opts of+ "txt" -> compoundBalanceReportAsText ropts'+ "csv" -> printCSV . compoundBalanceReportAsCsv ropts'+ "tsv" -> printTSV . compoundBalanceReportAsCsv ropts'+ "html" -> htmlAsLazyText . compoundBalanceReportAsHtml ropts'+ "fods" -> printFods IO.localeEncoding .+ fmap (second NonEmpty.toList) . uncurry Map.singleton .+ compoundBalanceReportAsSpreadsheet+ oneLineNoCostFmt "Account" (Just "") ropts'+ "json" -> toJsonText+ x -> error' $ unsupportedOutputFormatError x --- | Run one subreport for a compound balance command in multi-column mode.--- This returns a MultiBalanceReport.-compoundBalanceSubreport :: ReportOpts -> Query -> Journal -> (Journal -> Query) -> NormalSign -> MultiBalanceReport-compoundBalanceSubreport ropts userq j subreportqfn subreportnormalsign = r'- where- -- force --empty to ensure same columns in all sections- ropts' = ropts { empty_=True, normalbalance_=Just subreportnormalsign }- -- run the report- q = And [subreportqfn j, userq]- r@(MultiBalanceReport (dates, rows, totals)) = multiBalanceReport ropts' q j- -- if user didn't specify --empty, now remove the all-zero rows, unless they have non-zero subaccounts- -- in this report- r' | empty_ ropts = r- | otherwise = MultiBalanceReport (dates, rows', totals) - where- nonzeroaccounts =- dbg1 "nonzeroaccounts" $- catMaybes $ map (\(act,_,_,amts,_,_) ->- if not (all isZeroMixedAmount amts) then Just act else Nothing) rows - rows' = filter (not . emptyRow) rows- where- emptyRow (act,_,_,amts,_,_) =- all isZeroMixedAmount amts && all (not . (act `isAccountNamePrefixOf`)) nonzeroaccounts+-- | Show a simplified description of an Interval.+showInterval :: Interval -> Maybe T.Text+showInterval = \case+ NoInterval -> Nothing+ Days 1 -> Just "Daily"+ Weeks 1 -> Just "Weekly"+ Weeks 2 -> Just "Biweekly"+ Months 1 -> Just "Monthly"+ Months 2 -> Just "Bimonthly"+ Months 3 -> Just "Quarterly"+ Months 6 -> Just "Half-yearly"+ Months 12 -> Just "Yearly"+ Quarters 1 -> Just "Quarterly"+ Quarters 2 -> Just "Half-yearly"+ Years 1 -> Just "Yearly"+ Years 2 -> Just "Biannual"+ _ -> Just "Periodic" +-- | Summarise one or more (inclusive) end dates, in a way that's+-- visually different from showDateSpan, suggesting discrete end dates+-- rather than a continuous span.+showEndDates :: [Day] -> T.Text+showEndDates es = case es of+ -- cf showPeriod+ (e:_:_) -> showDate e <> ".." <> showDate (last es)+ [e] -> showDate e+ [] -> ""+ -- | Render a compound balance report as plain text suitable for console output. {- Eg: Balance Sheet - || 2017/12/31 Total Average + || 2017/12/31 Total Average =============++===============================- Assets || + Assets || -------------++-------------------------------- assets:b || 1 1 1 + assets:b || 1 1 1 -------------++-------------------------------- || 1 1 1 + || 1 1 1 =============++===============================- Liabilities || + Liabilities || -------------++------------------------------- -------------++-------------------------------- || + || =============++===============================- Total || 1 1 1 + Total || 1 1 1 -}-compoundBalanceReportAsText :: ReportOpts -> CompoundBalanceReport -> String-compoundBalanceReportAsText ropts (title, _colspans, subreports, (coltotals, grandtotal, grandavg)) =- title ++ "\n\n" ++ - balanceReportTableAsText ropts bigtable'+compoundBalanceReportAsText :: ReportOpts -> CompoundPeriodicReport DisplayName MixedAmount -> TL.Text+compoundBalanceReportAsText ropts (CompoundPeriodicReport title _colspans subreports totalsrow) =+ TB.toLazyText $+ TB.fromText title <> TB.fromText "\n\n" <>+ multiBalanceReportTableAsText ropts bigtablewithtotalsrow where- singlesubreport = length subreports == 1- bigtable = - case map (subreportAsTable ropts singlesubreport) subreports of- [] -> T.empty- r:rs -> foldl' concatTables r rs- bigtable'- | no_total_ ropts || singlesubreport = - bigtable- | otherwise =- bigtable- +====+- row "Net:" (- coltotals- ++ (if row_total_ ropts then [grandtotal] else [])- ++ (if average_ ropts then [grandavg] else [])- )+ bigtable =+ case map (subreportAsTable ropts) subreports of+ [] -> Tabular.empty+ r:rs -> List.foldl' (concatTables tableInterSubreportBorder) r rs+ bigtablewithtotalsrow =+ if no_total_ ropts || length subreports == 1+ then bigtable+ else concatTables tableGrandTotalsTopBorder bigtable totalstable+ where+ -- Append the report's grand column totals at the bottom of the table.+ -- Note "row" is confusingly overloaded here; *Report rows, Table rows,+ -- and visually apparent table rows are all distinct.+ -- With multiple currencies, in some layout modes, the column totals (a single report row)+ -- occupy multiple lines, which currently we put into multiple table rows,+ -- for convenience I guess, borderless so they look like a single visual row.+ --+ -- multiBalanceRowAsText gets a matrix of each line of each column total rendered as text+ -- (actually as WideBuilders), in line-major-order:+ -- [+ -- [COL1LINE1, COL2LINE1]+ -- [COL1LINE2, COL2LINE2]+ -- ]+ coltotalslines = multiBalanceRowAsText ropts totalsrow+ totalstable = Table+ (Group NoLine $ map Header $ "Net:" : replicate (length coltotalslines - 1) "") -- row headers+ (Header []) -- column headers, concatTables will discard these+ coltotalslines -- cell values -- | Convert a named multi balance report to a table suitable for -- concatenating with others to make a compound balance report table.- subreportAsTable ropts singlesubreport (title, r, _) = t+ subreportAsTable ropts1 (title1, r, _) = tablewithtitle where- -- unless there's only one section, always show the subtotal row- ropts' | singlesubreport = ropts- | otherwise = ropts{ no_total_=False }- -- convert to table- Table lefthdrs tophdrs cells = balanceReportAsTable ropts' r- -- tweak the layout- t = Table (T.Group SingleLine [Header title, lefthdrs]) tophdrs ([]:cells)+ tablewithtitle = Table+ (Group tableSubreportTitleBottomBorder [Header title1, lefthdrs]) -- row headers+ tophdrs -- column headers+ ([]:cells) -- cell values+ where+ Table lefthdrs tophdrs cells = multiBalanceReportAsTable ropts1 r --- | Add the second table below the first, discarding its column headings.-concatTables (Table hLeft hTop dat) (Table hLeft' _ dat') =- Table (T.Group DoubleLine [hLeft, hLeft']) hTop (dat ++ dat')+ tableSubreportTitleBottomBorder = SingleLine+ tableInterSubreportBorder = DoubleLine+ tableGrandTotalsTopBorder = DoubleLine -- | Render a compound balance report as CSV. -- Subreports' CSV is concatenated, with the headings rows replaced by a -- subreport title row, and an overall title row, one headings row, and an -- optional overall totals row is added.-compoundBalanceReportAsCsv :: ReportOpts -> CompoundBalanceReport -> CSV-compoundBalanceReportAsCsv ropts (title, colspans, subreports, (coltotals, grandtotal, grandavg)) =- addtotals $- padRow title :- ("Account" :- map showDateSpanMonthAbbrev colspans- ++ (if row_total_ ropts then ["Total"] else [])- ++ (if average_ ropts then ["Average"] else [])- ) :- concatMap (subreportAsCsv ropts singlesubreport) subreports- where- singlesubreport = length subreports == 1- -- | Add a subreport title row and drop the heading row.- subreportAsCsv ropts singlesubreport (subreporttitle, multibalreport, _) =- padRow subreporttitle :- tail (multiBalanceReportAsCsv ropts' multibalreport)- where- -- unless there's only one section, always show the subtotal row- ropts' | singlesubreport = ropts- | otherwise = ropts{ no_total_=False }- padRow s = take numcols $ s : repeat ""- where- numcols- | null subreports = 1- | otherwise =- (3 +) $ -- account name & indent columns- (if row_total_ ropts then (1+) else id) $- (if average_ ropts then (1+) else id) $- maximum $ -- depends on non-null subreports- map (\(MultiBalanceReport (amtcolheadings, _, _)) -> length amtcolheadings) $ - map second3 subreports- addtotals- | no_total_ ropts || length subreports == 1 = id- | otherwise = (++ - ["Net:" :- map showMixedAmountOneLineWithoutPrice (- coltotals- ++ (if row_total_ ropts then [grandtotal] else [])- ++ (if average_ ropts then [grandavg] else [])- )- ])+compoundBalanceReportAsCsv :: ReportOpts -> CompoundPeriodicReport DisplayName MixedAmount -> CSV+compoundBalanceReportAsCsv ropts cbr =+ let spreadsheet =+ snd $ snd $+ compoundBalanceReportAsSpreadsheet+ machineFmt "Account" Nothing ropts cbr+ in Spr.rawTableContent $+ Spr.horizontalSpan (NonEmpty.head spreadsheet)+ (Spr.headerCell (cbrTitle cbr)) :+ NonEmpty.toList spreadsheet -- | Render a compound balance report as HTML.-compoundBalanceReportAsHtml :: ReportOpts -> CompoundBalanceReport -> Html ()+compoundBalanceReportAsHtml :: ReportOpts -> CompoundPeriodicReport DisplayName MixedAmount -> Html compoundBalanceReportAsHtml ropts cbr =+ let (title, (_fixed, cells)) =+ compoundBalanceReportAsSpreadsheet+ oneLineNoCostFmt "" (Just nbsp) ropts cbr+ colspanattr = colspan_ $ T.pack $ show $ length $ NonEmpty.head cells+ in do+ link_ [rel_ "stylesheet", href_ "hledger.css"]+ style_ $ stylesheet $+ tableStyle ++ [+ ("td:nth-child(1)", "white-space:nowrap"),+ ("tr:nth-child(odd) td", "background-color:#eee")+ ]+ table_ $ do+ tr_ $ th_ [colspanattr, style_ alignleft] $ h2_ $ toHtml title+ -- Do not use `styledTableHtml` here since that leads to nested `<table>`s.+ traverse_ formatRow $ fmap (map (fmap L.toHtml)) cells++-- | Render a compound balance report as Spreadsheet.+compoundBalanceReportAsSpreadsheet ::+ AmountFormat -> T.Text -> Maybe T.Text ->+ ReportOpts -> CompoundPeriodicReport DisplayName MixedAmount ->+ (T.Text, ((Int, Int), NonEmpty [Spr.Cell Spr.NumLines T.Text]))+compoundBalanceReportAsSpreadsheet fmt accountLabel maybeBlank ropts cbr = let- (title, colspans, subreports, (coltotals, grandtotal, grandavg)) = cbr- colspanattr = colspan_ $ TS.pack $ show $ - 1 + length colspans + (if row_total_ ropts then 1 else 0) + (if average_ ropts then 1 else 0)- leftattr = style_ "text-align:left"- blankrow = tr_ $ td_ [colspanattr] $ toHtmlRaw (" "::String)+ CompoundPeriodicReport title colspans subreports totalrow = cbr+ leadingHeaders =+ Spr.headerCell accountLabel :+ case layout_ ropts of+ LayoutTidy -> map Spr.headerCell tidyColumnLabels+ LayoutBare -> [Spr.headerCell "Commodity"]+ _ -> []+ dataHeaders =+ (guard (layout_ ropts /= LayoutTidy) >>) $+ map (Spr.headerCell . reportPeriodName (balanceaccum_ ropts) colspans)+ (if not (summary_only_ ropts) then colspans else []) +++ (guard (multiBalanceHasTotalsColumn ropts) >> [Spr.headerCell "Total"]) +++ (guard (average_ ropts) >> [Spr.headerCell "Average"])+ headerrow = leadingHeaders ++ dataHeaders - titlerows =- [tr_ $ th_ [colspanattr, leftattr] $ h2_ $ toHtml title]- ++ [thRow $- "" :- map showDateSpanMonthAbbrev colspans- ++ (if row_total_ ropts then ["Total"] else [])- ++ (if average_ ropts then ["Average"] else [])- ]+ blankrow =+ fmap (Spr.horizontalSpan headerrow . Spr.defaultCell) maybeBlank - thRow :: [String] -> Html ()- thRow = tr_ . mconcat . map (th_ . toHtml)- -- Make rows for a subreport: its title row, not the headings row, -- the data rows, any totals row, and a blank row for whitespace.- subreportrows :: (String, MultiBalanceReport, Bool) -> [Html ()]+ subreportrows ::+ (T.Text, MultiBalanceReport, Bool) -> [[Spr.Cell Spr.NumLines T.Text]] subreportrows (subreporttitle, mbr, _increasestotal) = let- (_,bodyrows,mtotalsrow) = multiBalanceReportHtmlRows ropts mbr- in- [tr_ $ th_ [colspanattr, leftattr] $ toHtml subreporttitle]- ++ bodyrows- ++ maybe [] (:[]) mtotalsrow- ++ [blankrow]+ (_, bodyrows, mtotalsrows) =+ multiBalanceReportAsSpreadsheetParts fmt ropts mbr - totalrows | no_total_ ropts || length subreports == 1 = []- | otherwise =- let defstyle = style_ "text-align:right"- in- [tr_ $ mconcat $- th_ [class_ "", style_ "text-align:left"] "Net:"- : [th_ [class_ "amount coltotal", defstyle] (toHtml $ showMixedAmountOneLineWithoutPrice a) | a <- coltotals]- ++ (if row_total_ ropts then [th_ [class_ "amount coltotal", defstyle] $ toHtml $ showMixedAmountOneLineWithoutPrice $ grandtotal] else [])- ++ (if average_ ropts then [th_ [class_ "amount colaverage", defstyle] $ toHtml $ showMixedAmountOneLineWithoutPrice $ grandavg] else [])- ]+ in+ Spr.horizontalSpan headerrow+ ((Spr.defaultCell subreporttitle){+ Spr.cellStyle = Spr.Body Spr.Total,+ Spr.cellClass = Spr.Class "account"+ }) :+ bodyrows +++ mtotalsrows +++ maybeToList blankrow +++ [] - in do- style_ (TS.unlines [""- ,"td { padding:0 0.5em; }"- ,"td:nth-child(1) { white-space:nowrap; }"- ,"tr:nth-child(even) td { background-color:#eee; }"- ])- link_ [rel_ "stylesheet", href_ "hledger.css"]- table_ $ mconcat $- titlerows- ++ [blankrow]- ++ concatMap subreportrows subreports- ++ totalrows+ totalrows =+ if no_total_ ropts || length subreports == 1 then []+ else+ multiBalanceRowAsCellBuilders fmt ropts colspans+ Total simpleDateSpanCell totalrow+ -- make a table of rendered lines of the report totals row+ & map (map (fmap wbToText))+ & Spr.addRowSpanHeader+ ((Spr.defaultCell "Net:") {Spr.cellClass = Spr.Class "account"})+ -- insert a headings column, with Net: on the first line only+ & addTotalBorders -- marking the first row for special styling + in (title,+ ((1,1),+ headerrow :| concatMap subreportrows subreports ++ totalrows))
+ Hledger/Cli/Conf.hs view
@@ -0,0 +1,293 @@+{-|+Read extra CLI arguments from a hledger config file.+-}++{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE NamedFieldPuns #-}+{-# LANGUAGE MultiWayIf #-}++module Hledger.Cli.Conf (+ Conf+ ,SectionName+ ,getConf+ ,getConf'+ ,nullconf+ ,confLookup+ ,activeConfFile+ ,activeLocalConfFile+ ,activeUserConfFile+ ,confFiles+ ,userConfFiles+ ,parseConf+)+where++import Control.Exception (handle)+import Control.Monad (void, forM)+import Control.Monad.Identity (Identity)+import Data.Functor ((<&>))+import Data.Map qualified as M+import Data.Maybe (catMaybes)+import Data.Text (Text)+import Data.Text qualified as T (pack)+import Safe (headMay, lastDef)+import System.Directory (getHomeDirectory, getXdgDirectory, XdgDirectory (XdgConfig), doesFileExist, getCurrentDirectory)+import System.FilePath ((</>), takeDirectory)+import Text.Megaparsec as M+import Text.Megaparsec.Char++import Hledger (error', strip, words', RawOpts, expandPath)+import Hledger.Read.Common+import Hledger.Utils.Parse+import Hledger.Utils.Debug+import Hledger.Data.RawOptions (collectopts)+++-- | A hledger config file.+data Conf = Conf {+ confFile :: FilePath+ -- ,confText :: String+ ,confFormat :: Int+ ,confSections :: [ConfSection]+} deriving (Eq,Show)++-- | One section in a hledger config file.+data ConfSection = ConfSection {+ csName :: SectionName+ ,csArgs :: [Arg]+} deriving (Eq,Show)++-- | The name of a config file section, with surrounding brackets and whitespace removed.+type SectionName = String++-- | A command line argument to be passed to CmdArgs.process.+-- It seems this should be a single command line argument (or flag or flag value).+-- If it contains spaces, those are treated as part of a single argument, as with CMD a "b c".+type Arg = String++nullconf = Conf {+ confFile = ""+ ,confFormat = 1+ ,confSections = []+}++-- | The --conf or --no-conf or default config file specified by command line options.+data ConfFileSpec =+ SomeConfFile FilePath -- ^ use config file specified with --conf+ | NoConfFile -- ^ don't use any config file (--no-conf)+ | AutoConfFile -- ^ use the config file found by directory search (default)+ deriving (Eq,Show)++-- Get the conf file specification from options,+-- considering the rightmost --conf or --no-conf option if any.+confFileSpecFromRawOpts :: RawOpts -> ConfFileSpec+confFileSpecFromRawOpts = lastDef AutoConfFile . collectopts cfsFromRawOpt+ where+ cfsFromRawOpt ("conf",f) = Just $ SomeConfFile f+ cfsFromRawOpt ("no-conf",_) = Just $ NoConfFile+ cfsFromRawOpt _ = Nothing++-- config reading++-- | Fetch all the arguments/options defined in a section with this name, if it exists.+-- This should be "general" for the unnamed first section, or a hledger command name.+confLookup :: SectionName -> Conf -> [Arg]+confLookup cmd Conf{confSections} =+ maybe [] (concatMap words') $ -- XXX PARTIAL+ M.lookup cmd $+ M.fromList [(csName,csArgs) | ConfSection{csName,csArgs} <- confSections]++-- | Try to read a hledger config from a config file specified by --conf,+-- or the first config file found in any of several default file paths.+-- If --no-conf was used, or if no file was specified or found, this returns a null Conf.+-- If a specified file, or the first file found, can not be read or parsed, this returns an error message.+-- Otherwise this returns the parsed Conf, and the file path.+getConf :: RawOpts -> IO (Either String (Conf, Maybe FilePath))+getConf rawopts = do+ -- As in Cli.hs, conf debug output always goes to stderr;+ -- that's ok as conf is a hledger cli feature for now.+ case confFileSpecFromRawOpts rawopts of+ NoConfFile -> return $ Right $ dbg1Msg "ignoring config files" (nullconf, Nothing)+ SomeConfFile f -> getCurrentDirectory >>= flip expandPath f >>= readConfFile . dbg1 "using specified config file"+ AutoConfFile -> do+ fs <- confFiles+ case fs of+ f:_ -> dbg8IO "found config files" fs >> dbg1IO "using nearest config file" f >> readConfFile f+ [] -> return $ Right $ dbg1Msg "no config file found" (nullconf, Nothing)++-- | Like getConf but throws an error on failure.+getConf' :: RawOpts -> IO (Conf, Maybe FilePath)+getConf' rawopts = getConf rawopts >>= either (error' . show) return++-- | Read this config file and parse its contents, or return an error message.+readConfFile :: FilePath -> IO (Either String (Conf, Maybe FilePath))+readConfFile f = handle (\(e::IOError) -> return $ Left $ show e) $ do+ -- avoid GHC 9.10.1's ugly stack trace when calling readFile on a nonexistent file+ exists <- doesFileExist f+ case exists of+ False -> return $ Left $ f <> " does not exist"+ True -> do+ ecs <- readFile f <&> parseConf f . T.pack+ case ecs of+ Left err -> return $ Left $ errorBundlePretty err -- customErrorBundlePretty err+ Right cs -> return $ Right (nullconf{+ confFile = f+ ,confFormat = 1+ ,confSections = cs+ },+ Just f+ )++-- -- | Like readConf, but throw an error on failure.+-- readConfFile' :: FilePath -> IO (Conf, Maybe FilePath)+-- readConfFile' f = readConfFile f >>= either (error' . show) return++-- | Get the highest precedence config file, based on the current directory.+activeConfFile :: IO (Maybe FilePath)+activeConfFile = headMay <$> confFiles++-- | Get the highest precedence local config file: +-- a config file in the current directory or above, that is not a user-wide config file.+activeLocalConfFile :: IO (Maybe FilePath)+activeLocalConfFile = do+ ufs <- userConfFiles+ mf <- headMay <$> confFiles+ return $ case mf of+ Just f | f `notElem` ufs -> Just f+ _ -> Nothing++-- | Get the highest precedence user-wide config file, based on the current directory.+-- (This may not be the active config file.)+activeUserConfFile :: IO (Maybe FilePath)+activeUserConfFile = headMay <$> userConfFiles++-- | Get the possibleConfFiles which exist, based on the current directory.+confFiles :: IO [FilePath]+confFiles = possibleConfFiles >>= existingFiles++-- | Get the possibleUserConfFiles which exist, based on the current directory.+userConfFiles :: IO [FilePath]+userConfFiles = possibleUserConfFiles >>= existingFiles++-- | Filter a list of paths to just the existing files.+existingFiles :: [FilePath] -> IO [FilePath]+existingFiles fs =+ fmap catMaybes $ forM fs $ \f -> do+ exists <- doesFileExist f+ return $ if exists then Just f else Nothing++-- | Get the possible paths for a hledger config file, highest precedence first:+-- hledger.conf in the current directory, +-- hledger.conf in any parent directory, +-- .hledger.conf in the home directory,+-- or hledger.conf in the XdgConfig directory.+possibleConfFiles :: IO [FilePath]+possibleConfFiles = do+ ds <- possibleConfDirs+ home <- getHomeDirectory+ return $ dbg8 "possible config file paths" $+ flip map ds $ \d -> d </> if d==home then ".hledger.conf" else "hledger.conf"++-- | Like possibleConfFiles, but consider only user-wide hledger config files:+-- .hledger.conf in the home directory,+-- or hledger.conf in the XdgConfig directory.+possibleUserConfFiles :: IO [FilePath]+possibleUserConfFiles = do+ home <- getHomeDirectory+ xdgc <- getXdgDirectory XdgConfig "hledger"+ let ds = [home,xdgc]+ return $ dbg8 "possible user config file paths" $+ flip map ds $ \d -> d </> if d==home then ".hledger.conf" else "hledger.conf"++-- | Get the directories where a hledger config file could be, highest precedence first:+-- the current directory, any parent directory, the home directory, or the XdgConfig directory.+possibleConfDirs :: IO [FilePath]+possibleConfDirs = do+ xdgc <- getXdgDirectory XdgConfig "hledger"+ home <- getHomeDirectory+ here <- getCurrentDirectory+ dirs <- getDirsUpToRoot here+ let dirs2 = if home `elem` dirs then dirs else dirs <> [home]+ let dirs3 = if xdgc `elem` dirs2 then dirs2 else dirs2 <> [xdgc]+ return $ dbg8 "searching config dirs" dirs3++-- | Get this directory and all of its parents up to /.+getDirsUpToRoot :: FilePath -> IO [FilePath]+getDirsUpToRoot dir = return $ go [] dir+ where+ go seen d = if+ | d `elem` seen || length seen >= 100 -> [] -- just in case+ | d=="/" -> [d]+ | otherwise -> d : go (d:seen) (takeDirectory d)++-- config file parsing++parseConf :: FilePath -> Text -> Either (ParseErrorBundle Text HledgerParseErrorData) [ConfSection]+parseConf = runParser confp++dp :: String -> TextParser m ()+dp = const $ return () -- no-op+-- dp = dbgparse 0 -- trace parse state at this --debug level++whitespacep, commentlinesp, restoflinep :: TextParser Identity ()+whitespacep = void $ {- dp "whitespacep" >> -} many spacenonewline+commentlinesp = void $ {- dp "commentlinesp" >> -} many (emptyorcommentlinep2 "#")+restoflinep = void $ {- dp "restoflinep" >> -} whitespacep >> emptyorcommentlinep2 "#"++confp :: TextParser Identity [ConfSection] -- a monadic TextParser to allow reusing other hledger parsers+confp = do+ dp "confp"+ commentlinesp+ genas <- many arglinep+ let s = ConfSection "general" genas+ ss <- many $ do+ (n, ma) <- sectionstartp+ as <- many arglinep+ return $ ConfSection n (maybe as (:as) ma)+ eof+ return $ s:ss++-- parse a section name and possibly arguments written on the same line+sectionstartp :: TextParser Identity (String, Maybe String)+sectionstartp = do+ dp "sectionstartp"+ char '['+ n <- fmap strip $ some $ noneOf "]#\n"+ char ']'+ -- dp "sectionstartp2"+ whitespacep+ -- dp "sectionstartp3"+ ma <- fmap (fmap strip) $ optional $ some $ noneOf "#\n"+ -- dp "sectionstartp4"+ restoflinep+ -- dp "sectionstartp5"+ commentlinesp+ -- dp "sectionstartp6"+ return (n, ma)++arglinep :: TextParser Identity String+arglinep = do+ dp "arglinep"+ notFollowedBy $ char '['+ -- dp "arglinep2"+ whitespacep+ -- dp "arglinep3"+ a <- some $ noneOf "#\n"+ -- dp "arglinep4"+ restoflinep <|> whitespacep -- whitespace / same-line comment, possibly with no newline+ commentlinesp+ return $ strip a+++-- initialiseAndParseJournal :: ErroringJournalParser IO ParsedJournal -> InputOpts+-- -> FilePath -> Text -> ExceptT String IO Journal+-- initialiseAndParseJournal parser iopts f txt =+-- prettyParseErrors $ runParserT (evalStateT parser initJournal) f txt+-- where+-- y = first3 . toGregorian $ _ioDay iopts+-- initJournal = nulljournal{jparsedefaultyear = Just y, jincludefilestack = [f]}+-- -- Flatten parse errors and final parse errors, and output each as a pretty String.+-- prettyParseErrors :: ExceptT FinalParseError IO (Either (ParseErrorBundle Text HledgerParseErrorData) a)+-- -> ExceptT String IO a+-- prettyParseErrors = withExceptT customErrorBundlePretty . liftEither+-- <=< withExceptT (finalErrorBundlePretty . attachSource f txt)
Hledger/Cli/DocFiles.hs view
@@ -1,4 +1,7 @@-{-# LANGUAGE TemplateHaskell, OverloadedStrings, PackageImports #-}+{-# LANGUAGE OverloadedStrings #-}+{-# LANGUAGE PackageImports #-}+{-# LANGUAGE ScopedTypeVariables #-}+{-# LANGUAGE TemplateHaskell #-} {-| Embedded documentation files in various formats, and helpers for viewing them.@@ -8,36 +11,59 @@ module Hledger.Cli.DocFiles ( Topic- ,docFiles- ,docTopics- ,lookupDocNroff- ,lookupDocTxt- ,lookupDocInfo ,printHelpForTopic ,runManForTopic ,runInfoForTopic ,runPagerForTopic+ ,runTldrForPage ) where -import Prelude ()-import "base-compat-batteries" Prelude.Compat+import Control.Exception import Data.ByteString (ByteString)-import qualified Data.ByteString.Char8 as BC+import Data.ByteString.Char8 qualified as BC+import Data.Maybe (fromMaybe) import Data.String+import System.Environment (setEnv) import System.IO import System.IO.Temp import System.Process -import Hledger.Utils (first3, second3, third3, embedFileRelative)+import Hledger.Utils (first3, second3, third3, embedFileRelative, error')+import Text.Printf (printf)+import System.Environment (lookupEnv)+import Hledger.Utils.Debug +-- The name of any hledger executable.+type Tool = String++-- Any heading in the hledger user manual (and perhaps later the hledger-ui/hledger-web manuals). type Topic = String --- | These are all the main hledger manuals, in man, txt, and info formats.--- Only files under the current package directory can be embedded,--- so most of these are symlinked here from the other package directories.-docFiles :: [(Topic, (ByteString, ByteString, ByteString))]-docFiles = [+-- Any name of a hledger tldr page (hledger, hledger-ui, hledger-print etc.)+type TldrPage = String++-- | All hledger-related pages from the tldr-pages project.+-- All are symlinked into the hledger package directory to allow embeddeding.+tldrs :: [(TldrPage, ByteString)]+tldrs = [+ ("hledger-accounts", $(embedFileRelative "embeddedfiles/hledger-accounts.md"))+ ,("hledger-add", $(embedFileRelative "embeddedfiles/hledger-add.md"))+ ,("hledger-aregister", $(embedFileRelative "embeddedfiles/hledger-aregister.md"))+ ,("hledger-balance", $(embedFileRelative "embeddedfiles/hledger-balance.md"))+ ,("hledger-balancesheet", $(embedFileRelative "embeddedfiles/hledger-balancesheet.md"))+ ,("hledger-import", $(embedFileRelative "embeddedfiles/hledger-import.md"))+ ,("hledger-incomestatement", $(embedFileRelative "embeddedfiles/hledger-incomestatement.md"))+ ,("hledger-print", $(embedFileRelative "embeddedfiles/hledger-print.md"))+ ,("hledger-ui", $(embedFileRelative "embeddedfiles/hledger-ui.md"))+ ,("hledger-web", $(embedFileRelative "embeddedfiles/hledger-web.md"))+ ,("hledger", $(embedFileRelative "embeddedfiles/hledger.md"))+ ]++-- | The main hledger manuals as source for man, info and as plain text.+-- All are symlinked into the hledger package directory to allow embeddeding.+manuals :: [(Tool, (ByteString, ByteString, ByteString))]+manuals = [ ("hledger", ($(embedFileRelative "embeddedfiles/hledger.1") ,$(embedFileRelative "embeddedfiles/hledger.txt")@@ -53,73 +79,94 @@ ,$(embedFileRelative "embeddedfiles/hledger-web.txt") ,$(embedFileRelative "embeddedfiles/hledger-web.info") ))- ,("hledger-api",- ($(embedFileRelative "embeddedfiles/hledger-api.1")- ,$(embedFileRelative "embeddedfiles/hledger-api.txt")- ,$(embedFileRelative "embeddedfiles/hledger-api.info")- ))- ,("journal",- ($(embedFileRelative "embeddedfiles/hledger_journal.5")- ,$(embedFileRelative "embeddedfiles/hledger_journal.txt")- ,$(embedFileRelative "embeddedfiles/hledger_journal.info")- ))- ,("csv",- ($(embedFileRelative "embeddedfiles/hledger_csv.5")- ,$(embedFileRelative "embeddedfiles/hledger_csv.txt")- ,$(embedFileRelative "embeddedfiles/hledger_csv.info")- ))- ,("timeclock",- ($(embedFileRelative "embeddedfiles/hledger_timeclock.5")- ,$(embedFileRelative "embeddedfiles/hledger_timeclock.txt")- ,$(embedFileRelative "embeddedfiles/hledger_timeclock.info")- ))- ,("timedot",- ($(embedFileRelative "embeddedfiles/hledger_timedot.5")- ,$(embedFileRelative "embeddedfiles/hledger_timedot.txt")- ,$(embedFileRelative "embeddedfiles/hledger_timedot.info")- )) ] -docTopics :: [Topic]-docTopics = map fst docFiles+-- | Get the manual as plain text for this tool, or a not found message.+manualTxt :: Tool -> ByteString+manualTxt name = maybe (fromString $ "No text manual found for tool: "++name) second3 $ lookup name manuals -lookupDocTxt :: Topic -> ByteString-lookupDocTxt name =- maybe (fromString $ "No text manual found for topic: "++name) second3 $ lookup name docFiles+-- | Get the manual as man source (nroff) for this tool, or a not found message.+manualMan :: Tool -> ByteString+manualMan name = maybe (fromString $ "No man page found for tool: "++name) first3 $ lookup name manuals -lookupDocNroff :: Topic -> ByteString-lookupDocNroff name =- maybe (fromString $ "No man page found for topic: "++name) first3 $ lookup name docFiles+-- | Get the manual as info source (texinfo) for this tool, or a not found message.+manualInfo :: Tool -> ByteString+manualInfo name = maybe (fromString $ "No info manual found for tool: "++name) third3 $ lookup name manuals -lookupDocInfo :: Topic -> ByteString-lookupDocInfo name =- maybe (fromString $ "No info manual found for topic: "++name) third3 $ lookup name docFiles+-- | Print plain text help for this tool.+-- Takes an optional topic argument for convenience but it is currently ignored.+printHelpForTopic :: Tool -> Maybe Topic -> IO ()+printHelpForTopic tool _mtopic = BC.putStr (manualTxt tool) -printHelpForTopic :: Topic -> IO ()-printHelpForTopic t =- BC.putStr (lookupDocTxt t)+-- | Display an info manual for this topic, opened at the given topic if provided,+-- using the "info" executable in $PATH.+-- Topic can be an exact heading or a heading prefix; info will favour an exact match.+runInfoForTopic :: Tool -> Maybe Topic -> IO ()+runInfoForTopic tool mtopic =+ withSystemTempFile ("hledger-"++tool++".info") $ \f h -> do+ BC.hPutStrLn h $ manualInfo tool+ hClose h+ callCommand $ dbg1 "info command" $+ "info -f " ++ f ++ maybe "" (printf " -n '%s'") mtopic -runPagerForTopic :: FilePath -> Topic -> IO ()-runPagerForTopic exe t = do- (Just inp, _, _, ph) <- createProcess (proc exe []){- std_in=CreatePipe- }- BC.hPutStrLn inp (lookupDocTxt t)- _ <- waitForProcess ph- return ()+-- less with any vertical whitespace squashed, case-insensitive searching, the $ regex metacharacter accessible as \$.+less = "less -s -i --use-backslash" -runManForTopic :: Topic -> IO ()-runManForTopic t =- withSystemTempFile ("hledger-"++t++".nroff") $ \f h -> do- BC.hPutStrLn h $ lookupDocNroff t+-- | Display plain text help for this tool, scrolled to the given topic if any, using the users $PAGER or "less".+-- When a topic is provided we always use less, ignoring $PAGER.+--+-- This is less robust than the newer Hledger.Utils.IO.runPager,+-- but that one doesn't yet support scrolling to a topic.+runPagerForTopic :: Tool -> Maybe Topic -> IO ()+runPagerForTopic tool mtopic = do+ withSystemTempFile ("hledger-"++tool++".txt") $ \f h -> do+ BC.hPutStrLn h $ manualTxt tool hClose h- -- the temp file path will presumably have a slash in it, so man should read it- callCommand $ "man " ++ f+ envpager <- fromMaybe less <$> lookupEnv "PAGER"+ let+ exactmatch = True+ (pager, searcharg) =+ case mtopic of+ Nothing -> (envpager, "")+ Just t -> (less, "-p'^( )?" ++ t ++ if exactmatch then "\\$'" else "")+ callCommand $ dbg1 "pager command" $ unwords [pager, searcharg, f] -runInfoForTopic :: Topic -> IO ()-runInfoForTopic t =- withSystemTempFile ("hledger-"++t++".info") $ \f h -> do- BC.hPutStrLn h $ lookupDocInfo t+-- | Display a man page for this tool, scrolled to the given topic if provided, using "man".+-- When a topic is provided we force man to use "less", ignoring $MANPAGER and $PAGER.+runManForTopic :: Tool -> Maybe Topic -> IO ()+runManForTopic tool mtopic =+ -- This temp file path should have a slash in it, man requires at least one.+ withSystemTempFile ("hledger-"++tool++".1") $ \f h -> do+ BC.hPutStrLn h $ manualMan tool hClose h- callCommand $ "info " ++ f+ let+ exactmatch = True+ pagerarg =+ case mtopic of+ Nothing -> ""+ Just t -> "-P \"" ++ less ++ " -p'^( )?" ++ t ++ (if exactmatch then "\\\\$" else "") ++ "'\""+ callCommand $ dbg1 "man command" $ unwords ["man", pagerarg, f] +-- | Get the named tldr page's source, if we know it.+tldr :: TldrPage -> Maybe ByteString+tldr name = lookup name tldrs++-- | Display one of the hledger tldr pages, using "tldr".+runTldrForPage :: TldrPage -> IO ()+runTldrForPage name =+ case tldr name of+ Nothing -> error' $ "sorry, there's no " <> name <> " tldr page yet"+ Just b -> (do+ withSystemTempFile (name++".md") $ \f h -> do+ BC.hPutStrLn h b+ hClose h+ -- tldr clients tend to auto-update their data, try to discourage that here+ -- tealdeer - doesn't auto-update by default+ -- tlrc - ?+ -- tldr-node-client - undocumented env var suggested in output+ setEnv "TLDR_AUTO_UPDATE_DISABLED" "1"+ callCommand $ dbg1 "tldr command" $ "tldr --render " <> f+ ) `catch` (\(_e::IOException) -> do+ hPutStrLn stderr $ "Warning: could not run tldr --render, using fallback viewer instead.\n"+ BC.putStrLn b+ )
− Hledger/Cli/Main.hs
@@ -1,264 +0,0 @@-{-|-hledger - a ledger-compatible accounting tool.-Copyright (c) 2007-2011 Simon Michael <simon@joyful.com>-Released under GPL version 3 or later.--hledger is a partial haskell clone of John Wiegley's "ledger". It-generates ledger-compatible register & balance reports from a plain text-journal, and demonstrates a functional implementation of ledger.-For more information, see http:\/\/hledger.org .--This module provides the main function for the hledger command-line-executable. It is exposed here so that it can be imported by eg benchmark-scripts.--You can use the command line:--> $ hledger --help--or ghci:--> $ ghci hledger-> > j <- readJournalFile def "examples/sample.journal"-> > register [] ["income","expenses"] j-> 2008/01/01 income income:salary $-1 $-1-> 2008/06/01 gift income:gifts $-1 $-2-> 2008/06/03 eat & shop expenses:food $1 $-1-> expenses:supplies $1 0-> > balance [Depth "1"] [] l-> $-1 assets-> $2 expenses-> $-2 income-> $1 liabilities-> > l <- myLedger--See "Hledger.Data.Ledger" for more examples.---}--{-# LANGUAGE QuasiQuotes #-}--module Hledger.Cli.Main where--import Data.Char (isDigit)-import Data.List-import Safe-import System.Console.CmdArgs.Explicit as C-import System.Environment-import System.Exit-import System.FilePath-import System.Process-import Text.Printf--import Hledger.Cli----- | The overall cmdargs mode describing hledger's command-line options and subcommands.-mainmode addons = defMode {- modeNames = [progname ++ " [CMD]"]- ,modeArgs = ([], Just $ argsFlag "[ARGS]")- ,modeHelp = unlines ["hledger's main command line interface. Runs builtin commands and other hledger executables. Type \"hledger\" to list available commands."]- ,modeGroupModes = Group {- -- subcommands in the unnamed group, shown first:- groupUnnamed = [- ]- -- subcommands in named groups:- ,groupNamed = [- ]- -- subcommands handled but not shown in the help:- ,groupHidden = map fst builtinCommands ++ map addonCommandMode addons- }- ,modeGroupFlags = Group {- -- flags in named groups:- groupNamed = [- ( "General input flags", inputflags)- ,("\nGeneral reporting flags", reportflags)- ,("\nGeneral help flags", helpflags)- ]- -- flags in the unnamed group, shown last:- ,groupUnnamed = []- -- flags handled but not shown in the help:- ,groupHidden =- [detailedversionflag]- -- ++ inputflags -- included here so they'll not raise a confusing error if present with no COMMAND- }- ,modeHelpSuffix = map (regexReplace "PROGNAME" progname) [- "Examples:"- ,"PROGNAME list commands"- ,"PROGNAME CMD [--] [OPTS] [ARGS] run a command (use -- with addon commands)"- ,"PROGNAME-CMD [OPTS] [ARGS] or run addon commands directly"- ,"PROGNAME -h show general usage"- ,"PROGNAME CMD -h show command usage"- ,"PROGNAME help [MANUAL] show any of the hledger manuals in various formats"- ]- }---- | Let's go!-main :: IO ()-main = do-- -- Choose and run the appropriate internal or external command based- -- on the raw command-line arguments, cmdarg's interpretation of- -- same, and hledger-* executables in the user's PATH. A somewhat- -- complex mishmash of cmdargs and custom processing, hence all the- -- debugging support and tests. See also Hledger.Cli.CliOptions and- -- command-line.test.-- -- some preliminary (imperfect) argument parsing to supplement cmdargs- args <- getArgs >>= expandArgsAt- let- args' = moveFlagsAfterCommand $ replaceNumericFlags args- isFlag = ("-" `isPrefixOf`)- isNonEmptyNonFlag s = not (isFlag s) && not (null s)- rawcmd = headDef "" $ takeWhile isNonEmptyNonFlag args'- isNullCommand = null rawcmd- (argsbeforecmd, argsaftercmd') = break (==rawcmd) args- argsaftercmd = drop 1 argsaftercmd'- dbgIO :: Show a => String -> a -> IO ()- dbgIO = ptraceAtIO 2-- dbgIO "running" prognameandversion- dbgIO "raw args" args- dbgIO "raw args rearranged for cmdargs" args'- dbgIO "raw command is probably" rawcmd- dbgIO "raw args before command" argsbeforecmd- dbgIO "raw args after command" argsaftercmd-- -- Search PATH for add-ons, excluding any that match built-in command names- addons' <- hledgerAddons- let addons = filter (not . (`elem` builtinCommandNames) . dropExtension) addons'-- -- parse arguments with cmdargs- opts <- argsToCliOpts args addons-- -- select an action and run it.- let- cmd = command_ opts -- the full matched internal or external command name, if any- isInternalCommand = cmd `elem` builtinCommandNames -- not (null cmd) && not (cmd `elem` addons)- isExternalCommand = not (null cmd) && cmd `elem` addons -- probably- isBadCommand = not (null rawcmd) && null cmd- hasVersion = ("--version" `elem`)- hasDetailedVersion = ("--version+" `elem`)- printUsage = putStr $ showModeUsage $ mainmode addons- badCommandError = error' ("command "++rawcmd++" is not recognized, run with no command to see a list") >> exitFailure- hasHelpFlag args = any (`elem` args) ["-h","--help"]- f `orShowHelp` mode- | hasHelpFlag args = putStr $ showModeUsage mode- | otherwise = f- dbgIO "processed opts" opts- dbgIO "command matched" cmd- dbgIO "isNullCommand" isNullCommand- dbgIO "isInternalCommand" isInternalCommand- dbgIO "isExternalCommand" isExternalCommand- dbgIO "isBadCommand" isBadCommand- d <- getCurrentDay- dbgIO "period from opts" (period_ $ reportopts_ opts)- dbgIO "interval from opts" (interval_ $ reportopts_ opts)- dbgIO "query from opts & args" (queryFromOpts d $ reportopts_ opts)- let- runHledgerCommand- -- high priority flags and situations. -h, then --help, then --info are highest priority.- | hasHelpFlag argsbeforecmd = dbgIO "" "-h before command, showing general usage" >> printUsage- | not (hasHelpFlag argsaftercmd) && (hasVersion argsbeforecmd || (hasVersion argsaftercmd && isInternalCommand))- = putStrLn prognameandversion- | not (hasHelpFlag argsaftercmd) && (hasDetailedVersion argsbeforecmd || (hasDetailedVersion argsaftercmd && isInternalCommand))- = putStrLn prognameanddetailedversion- -- \| (null externalcmd) && "binary-filename" `inRawOpts` rawopts = putStrLn $ binaryfilename progname- -- \| "--browse-args" `elem` args = System.Console.CmdArgs.Helper.execute "cmdargs-browser" mainmode' args >>= (putStr . show)- | isNullCommand = dbgIO "" "no command, showing commands list" >> printCommandsList addons- | isBadCommand = badCommandError-- -- builtin commands- | Just (cmdmode, cmdaction) <- findCommand cmd =- (case cmd of- "test" -> -- should not read the journal- cmdaction opts (error "journal-less command tried to use the journal")- "add" -> -- should create the journal if missing- (ensureJournalFileExists =<< (head <$> journalFilePathFromOpts opts)) >>- withJournalDo opts (cmdaction opts)- _ -> -- all other commands: read the journal or fail if missing- withJournalDo opts (cmdaction opts)- )- `orShowHelp` cmdmode-- -- addon commands- | isExternalCommand = do- let externalargs = argsbeforecmd ++ filter (not.(=="--")) argsaftercmd- let shellcmd = printf "%s-%s %s" progname cmd (unwords' externalargs) :: String- dbgIO "external command selected" cmd- dbgIO "external command arguments" (map quoteIfNeeded externalargs)- dbgIO "running shell command" shellcmd- system shellcmd >>= exitWith-- -- deprecated commands- -- cmd == "convert" = error' (modeHelp oldconvertmode) >> exitFailure-- -- shouldn't reach here- | otherwise = usageError ("could not understand the arguments "++show args) >> exitFailure-- runHledgerCommand---- | Parse hledger CLI options from these command line arguments and--- add-on command names, or raise any error.-argsToCliOpts :: [String] -> [String] -> IO CliOpts-argsToCliOpts args addons = do- let- args' = moveFlagsAfterCommand $ replaceNumericFlags args- cmdargsopts = either usageError id $ process (mainmode addons) args'- cmdargsopts' = decodeRawOpts cmdargsopts- rawOptsToCliOpts cmdargsopts'---- | A hacky workaround for cmdargs not accepting flags before the--- subcommand name: try to detect and move such flags after the--- command. This allows the user to put them in either position.--- The order of options is not preserved, but this should be ok.------ Since we're not parsing flags as precisely as cmdargs here, this is--- imperfect. We make a decent effort to:--- - move all no-argument help/input/report flags--- - move all required-argument help/input/report flags along with their values, space-separated or not--- - not confuse things further or cause misleading errors.-moveFlagsAfterCommand :: [String] -> [String]-moveFlagsAfterCommand args = moveArgs $ ensureDebugHasArg args- where- -- quickly! make sure --debug has a numeric argument, or this all goes to hell- ensureDebugHasArg as =- case break (=="--debug") as of- (bs,"--debug":c:cs) | null c || not (all isDigit c) -> bs++"--debug=1":c:cs- (bs,"--debug":[]) -> bs++"--debug=1":[]- _ -> as-- moveArgs args = insertFlagsAfterCommand $ moveArgs' (args, [])- where- -- -h ..., --version ...- moveArgs' ((f:a:as), flags) | isMovableNoArgFlag f = moveArgs' (a:as, flags ++ [f])- -- -f FILE ..., --alias ALIAS ...- moveArgs' ((f:v:a:as), flags) | isMovableReqArgFlag f, isValue v = moveArgs' (a:as, flags ++ [f,v])- -- -fFILE ..., --alias=ALIAS ...- moveArgs' ((fv:a:as), flags) | isMovableReqArgFlagAndValue fv = moveArgs' (a:as, flags ++ [fv])- -- -f(missing arg)- moveArgs' ((f:a:as), flags) | isMovableReqArgFlag f, not (isValue a) = moveArgs' (a:as, flags ++ [f])- -- anything else- moveArgs' (as, flags) = (as, flags)-- insertFlagsAfterCommand ([], flags) = flags- insertFlagsAfterCommand (command:args, flags) = [command] ++ flags ++ args--isMovableNoArgFlag a = "-" `isPrefixOf` a && dropWhile (=='-') a `elem` noargflagstomove--isMovableReqArgFlag a = "-" `isPrefixOf` a && dropWhile (=='-') a `elem` reqargflagstomove--isMovableReqArgFlagAndValue ('-':'-':a:as) = case break (== '=') (a:as) of (f:fs,_:_) -> (f:fs) `elem` reqargflagstomove- _ -> False-isMovableReqArgFlagAndValue ('-':shortflag:_:_) = [shortflag] `elem` reqargflagstomove-isMovableReqArgFlagAndValue _ = False--isValue "-" = True-isValue ('-':_) = False-isValue _ = True--flagstomove = inputflags ++ reportflags ++ helpflags-noargflagstomove = concatMap flagNames $ filter ((==FlagNone).flagInfo) flagstomove-reqargflagstomove = -- filter (/= "debug") $- concatMap flagNames $ filter ((==FlagReq ).flagInfo) flagstomove-
+ Hledger/Cli/Script.hs view
@@ -0,0 +1,56 @@+{-|+A convenient module to import in hledger scripts, +aiming to provide the most useful imports and reduce boilerplate.+|-}++{-# LANGUAGE CPP #-}+{-# LANGUAGE PackageImports #-}++module Hledger.Cli.Script +( module M+) +where++import Control.Applicative as M+import Control.Concurrent as M+import Control.Monad as M+import Data.Char as M+import Data.Either as M++import Data.Functor as M+#if MIN_VERSION_base(4,19,0)+ hiding (unzip)+#endif+-- import Data.Functor as M (Functor, fmap, (<$), ($>), (<$>), (<&>)) -- or without CPP ? redundant import warning++import Data.List as M+import Data.Maybe as M+import Data.Ord as M+-- import Data.String.QQ (s) -- https://github.com/audreyt/string-qq/pull/3+import Data.Time as M+import Text.Printf as M hiding (formatString)+import "text" Data.Text as M (Text, pack, unpack)+ -- can't re-export much of Data.Text & Data.Text.IO, they need to be qualified+import Safe as M hiding (at)+-- import System.Console.CmdArgs.Explicit qualified as M+import System.Directory as M+import System.Environment as M+import System.Exit as M+import System.FilePath as M+import System.IO as M+import System.IO.Error as M+import System.Process as M++-- import Hledger.Cli as M hiding (main)+import Hledger.Cli as M (argsToCliOpts)+import Hledger.Cli.CliOptions as M+import Hledger.Cli.Commands as M+import Hledger.Cli.DocFiles as M+import Hledger.Cli.Utils as M+import Hledger.Cli.Version as M+import Hledger.Cli.CompoundBalanceCommand as M++import Hledger as M+import System.Console.CmdArgs.Explicit as M++-- import Hledger.Cli as M (argsToCliOpts)
Hledger/Cli/Utils.hs view
@@ -1,5 +1,5 @@+{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE NoOverloadedStrings #-} -- prevent trouble if turned on in ghci {-| Utilities for top-level modules and ghci. See also Hledger.Read and@@ -9,244 +9,213 @@ module Hledger.Cli.Utils (+ unsupportedOutputFormatError,+ withJournal, withJournalDo,+ withPossibleJournal, writeOutput,+ writeOutputLazyText, journalTransform,- journalApplyValue,- journalAddForecast, journalReload, journalReloadIfChanged, journalFileIsNewer,- journalSpecifiedFileIsNewer,- fileModificationTime, openBrowserOn, writeFileWithBackup, writeFileWithBackupIfChanged,- readFileStrictly,- pivotByOpts,- anonymiseByOpts,+ journalSimilarTransaction,+ postingsOrTransactionsReportAsText,+ tests_Cli_Utils, ) where-import Control.Exception as C-import Control.Monad -import Data.Hashable (hash)+import Control.Monad.Except (ExceptT)+import Control.Monad.IO.Class (liftIO) import Data.List+import Data.List.NonEmpty qualified as NE (toList) import Data.Maybe-import qualified Data.Text as T-import qualified Data.Text.IO as T-import Data.Time (Day, addDays)-import Data.Word-import Numeric-import Safe (readMay)+import Data.Text qualified as T+import Data.Text.IO qualified as T+import Data.Text.Lazy qualified as TL+import Data.Text.Lazy.Builder qualified as TB+import Data.Text.Lazy.IO qualified as TL+import Data.Time (Day)+import Data.Time.Clock.POSIX (POSIXTime, utcTimeToPOSIXSeconds)+import Lens.Micro ((^.))+import Safe (readMay, headMay) import System.Console.CmdArgs-import System.Directory (getModificationTime, getDirectoryContents, copyFile)+import System.Directory (getModificationTime, getDirectoryContents, copyFile, doesFileExist) import System.Exit import System.FilePath ((</>), splitFileName, takeDirectory) import System.Info (os) import System.Process (readProcessWithExitCode)-import System.Time (ClockTime, getClockTime, diffClockTimes, TimeDiff(TimeDiff)) import Text.Printf import Text.Regex.TDFA ((=~)) -import System.Time (ClockTime(TOD))-import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)- import Hledger.Cli.CliOptions+import Hledger.Cli.Anon import Hledger.Data import Hledger.Read import Hledger.Reports import Hledger.Utils+import Control.Monad (when)+import Data.Functor ((<&>)) +-- | Standard error message for a bad output format specified with -O/-o.+unsupportedOutputFormatError :: String -> String+unsupportedOutputFormatError fmt = "Sorry, output format \""++fmt++"\" is unrecognised or not yet supported for this kind of report."+ -- | Parse the user's specified journal file(s) as a Journal, maybe apply some--- transformations according to options, and run a hledger command with it. +-- transformations according to options, and run a hledger command with it. -- Or, throw an error.-withJournalDo :: CliOpts -> (Journal -> IO a) -> IO a-withJournalDo opts cmd = do+withJournal :: CliOpts -> (Journal -> IO a) -> IO a+withJournal opts cmd = do -- We kludgily read the file before parsing to grab the full text, unless -- it's stdin, or it doesn't exist and we are adding. We read it strictly -- to let the add command work. journalpaths <- journalFilePathFromOpts opts- readJournalFiles (inputopts_ opts) journalpaths- >>= mapM (journalTransform opts)- >>= either error' cmd+ j <- runExceptT $ journalTransform opts <$> readJournalFiles (inputopts_ opts) (NE.toList journalpaths)+ either error' cmd j -- PARTIAL: --- | Apply some transformations to the journal if specified by options.--- These include:+{-# DEPRECATED withJournalDo "renamed, please use withJournal instead" #-}+withJournalDo = withJournal++-- | Like withJournal, but if the first journal file does not exist, provides an empty+-- journal with that file path set. This is useful for commands like add and import+-- that need to work with a potentially non-existent first journal file,+-- while still reading all specified files (for completions, etc).+withPossibleJournal :: CliOpts -> (Journal -> IO a) -> IO a+withPossibleJournal opts cmd = do+ journalpaths <- journalFilePathFromOptsNoDefault opts+ fs <- case journalpaths of+ Just paths -> return $ NE.toList paths+ Nothing -> (:[]) <$> defaultJournalPath+ j <- runExceptT $ journalTransform opts <$> readPossibleJournalFiles (inputopts_ opts) fs+ either error' cmd j -- PARTIAL:++-- | Apply some journal transformations, if enabled by options, that should happen late.+-- These happen after parsing, finalising the journal, strict checks, and .latest filtering/updating,+-- but before report calculation. They are, in processing order:+-- --pivot, --anonymise error message, --obfuscate. ----- - adding forecast transactions (--forecast)--- - converting amounts to market value (--value)--- - pivoting account names (--pivot)--- - anonymising (--anonymise).-journalTransform :: CliOpts -> Journal -> IO Journal-journalTransform opts@CliOpts{reportopts_=ropts} =- journalAddForecast opts- >=> journalApplyValue ropts- >=> return . pivotByOpts opts- >=> return . anonymiseByOpts opts+-- Why not do these in journalFinalise ?+-- That step is supposed to check the data's intrinsic correctness, regardless of view options;+-- whereas here we assume correctness and are just transforming the view (based only on InputOpts).+-- XXX But it's easy to forget to call this. Current callers include withJournal, journalReload, uiReload, withJournalCached.+journalTransform :: CliOpts -> Journal -> Journal+journalTransform opts =+ maybePivot opts+ <&> maybeWarnAboutAnon opts+ <&> maybeObfuscate opts --- | Apply the pivot transformation on a journal, if option is present.-pivotByOpts :: CliOpts -> Journal -> Journal-pivotByOpts opts =+-- | If the --pivot option is present, replace the journal's account names by specified other values.+maybePivot :: CliOpts -> Journal -> Journal+maybePivot opts = case maybestringopt "pivot" . rawopts_ $ opts of Just tag -> journalPivot $ T.pack tag Nothing -> id --- | Apply the anonymisation transformation on a journal, if option is present-anonymiseByOpts :: CliOpts -> Journal -> Journal-anonymiseByOpts opts =- case maybestringopt "anon" . rawopts_ $ opts of- Just _ -> anonymise- Nothing -> id---- | Apply the anonymisation transformation on a journal-anonymise :: Journal -> Journal-anonymise j- = let- pAnons p = p { paccount = T.intercalate (T.pack ":") . map anon . T.splitOn (T.pack ":") . paccount $ p- , pcomment = T.empty- , ptransaction = fmap tAnons . ptransaction $ p- , poriginal = pAnons <$> poriginal p- }- tAnons txn = txn { tpostings = map pAnons . tpostings $ txn- , tdescription = anon . tdescription $ txn- , tcomment = T.empty- }- in- j { jtxns = map tAnons . jtxns $ j }- where- anon = T.pack . flip showHex "" . (fromIntegral :: Int -> Word32) . hash---- TODO move journalApplyValue and friends to Hledger.Data.Journal ? They are here because they use ReportOpts---- | If -V/--value was requested, convert all journal amounts to their market value--- as of the report end date. Cf http://hledger.org/manual.html#market-value--- Since 2017/4 we do this early, before commands run, which affects all commands--- and seems to have the same effect as doing it last on the reported values.-journalApplyValue :: ReportOpts -> Journal -> IO Journal-journalApplyValue ropts j = do- today <- getCurrentDay- mspecifiedenddate <- specifiedEndDate ropts- let d = fromMaybe today mspecifiedenddate- convert | value_ ropts = overJournalAmounts (amountValue j d)- | otherwise = id- return $ convert j---- | Generate periodic transactions from all periodic transaction rules in the journal.--- These transactions are added to the in-memory Journal (but not the on-disk file).------ They start on or after the day following the latest normal transaction in the journal,--- or today if there are none.--- They end on or before the specified report end date, or 180 days from today if unspecified.----journalAddForecast :: CliOpts -> Journal -> IO Journal-journalAddForecast opts@CliOpts{inputopts_=iopts, reportopts_=ropts} j = do- today <- getCurrentDay-- -- "They start on or after the day following the latest normal transaction in the journal, or today if there are none."- let DateSpan _ mjournalend = dbg2 "journalspan" $ journalDateSpan False j -- ignore secondary dates- forecaststart = dbg2 "forecaststart" $ fromMaybe today mjournalend-- -- "They end on or before the specified report end date, or 180 days from today if unspecified."- mspecifiedend <- snd . dbg2 "specifieddates" <$> specifiedStartEndDates ropts- let forecastend = dbg2 "forecastend" $ fromMaybe (addDays 180 today) mspecifiedend-- let forecastspan = DateSpan (Just forecaststart) (Just forecastend)- forecasttxns =- [ txnTieKnot t | pt <- jperiodictxns j- , t <- runPeriodicTransaction pt forecastspan- , spanContainsDate forecastspan (tdate t)- ]- -- With --auto enabled, transaction modifiers are also applied to forecast txns- forecasttxns' = (if auto_ iopts then modifyTransactions (jtxnmodifiers j) else id) forecasttxns+-- #2133+-- | If the --anon flag is present, raise an informative error.+maybeWarnAboutAnon :: CliOpts -> Journal -> Journal+maybeWarnAboutAnon opts =+ if boolopt "anon" $ rawopts_ opts+ then error' $ unlines [+ "--anon does not give privacy, and perhaps should be avoided;"+ ,"please see https://github.com/simonmichael/hledger/issues/2133 ."+ ,"For now it has been renamed to --obfuscate (a hidden flag)."+ ]+ else id - return $- if forecast_ ropts - then journalBalanceTransactions' opts j{ jtxns = concat [jtxns j, forecasttxns'] }- else j- where - journalBalanceTransactions' opts j =- let assrt = not . ignore_assertions_ $ inputopts_ opts- in- either error' id $ journalBalanceTransactions assrt j+-- | If the --obfuscate flag is present, apply light obfuscation to the journal data.+maybeObfuscate :: CliOpts -> Journal -> Journal+maybeObfuscate opts =+ if anon_ . inputopts_ $ opts+ then anon+ else id -- | Write some output to stdout or to a file selected by --output-file. -- If the file exists it will be overwritten. writeOutput :: CliOpts -> String -> IO () writeOutput opts s = do f <- outputFileFromOpts opts- (if f == "-" then putStr else writeFile f) s- + (maybe putStr writeFile f) s++-- | Write some output, to a file specified by --output-file if any,+-- otherwise to stdout.+-- If writing to a file and the file exists, it will be overwritten.+-- If writing to stdout, a pager is used when appropriate and possible.+writeOutputLazyText :: CliOpts -> TL.Text -> IO ()+writeOutputLazyText opts s = do+ mf <- outputFileFromOpts opts+ maybe (runPager . TL.unpack) TL.writeFile mf s+ -- -- | Get a journal from the given string and options, or throw an error. -- readJournal :: CliOpts -> String -> IO Journal -- readJournal opts s = readJournal def Nothing s >>= either error' return --- | Re-read the journal file(s) specified by options, applying any--- transformations specified by options. Or return an error string.--- Reads the full journal, without filtering.-journalReload :: CliOpts -> IO (Either String Journal)-journalReload opts = do- journalpaths <- journalFilePathFromOpts opts- readJournalFiles (inputopts_ opts) journalpaths- >>= mapM (journalTransform opts)- -- | Re-read the option-specified journal file(s), but only if any of -- them has changed since last read. (If the file is standard input, -- this will either do nothing or give an error, not tested yet). -- Returns a journal or error message, and a flag indicating whether--- it was re-read or not. Like withJournalDo and journalReload, reads+-- it was re-read or not. Like withJournal and journalReload, reads -- the full journal, without filtering.-journalReloadIfChanged :: CliOpts -> Day -> Journal -> IO (Either String Journal, Bool)+journalReloadIfChanged :: CliOpts -> Day -> Journal -> ExceptT String IO (Journal, Bool) journalReloadIfChanged opts _d j = do- let maybeChangedFilename f = do newer <- journalSpecifiedFileIsNewer j f+ let maybeChangedFilename f = do newer <- journalFileIsNewer j f return $ if newer then Just f else Nothing- changedfiles <- catMaybes `fmap` mapM maybeChangedFilename (journalFilePaths j)- if not $ null changedfiles- then do- whenLoud $ printf "%s has changed, reloading\n" (head changedfiles)- ej <- journalReload opts- return (ej, True)- else- return (Right j, False)+ changedfiles <- liftIO $ catMaybes <$> mapM maybeChangedFilename (journalFilePaths j)+ case changedfiles of+ [] -> return (j, False)+ f:_ -> do+ -- XXX not sure why we use cmdarg's verbosity here, but keep it for now+ verbose <- liftIO isLoud+ when (verbose || debugLevel >= 6) . liftIO $ printf "%s has changed, reloading\n" f+ newj <- journalReload opts+ return (newj, True) --- | Has the journal's main data file changed since the journal was last--- read ?-journalFileIsNewer :: Journal -> IO Bool-journalFileIsNewer j@Journal{jlastreadtime=tread} = do- tmod <- fileModificationTime $ journalFilePath j- return $ diffClockTimes tmod tread > (TimeDiff 0 0 0 0 0 0 0)+-- | Re-read the journal file(s) specified by options, applying any+-- transformations specified by options. Or return an error string.+-- Reads the full journal, without filtering.+journalReload :: CliOpts -> ExceptT String IO Journal+journalReload opts = do+ journalpaths <- liftIO $ dbg6 "reloading files" <$> journalFilePathFromOpts opts+ journalTransform opts <$> readJournalFiles (inputopts_ opts) (NE.toList journalpaths) --- | Has the specified file (presumably one of journal's data files)--- changed since journal was last read ?-journalSpecifiedFileIsNewer :: Journal -> FilePath -> IO Bool-journalSpecifiedFileIsNewer Journal{jlastreadtime=tread} f = do- tmod <- fileModificationTime f- return $ diffClockTimes tmod tread > (TimeDiff 0 0 0 0 0 0 0)+-- | Has the specified file changed since the journal was last read ?+-- Typically this is one of the journal's journalFilePaths. These are+-- not always real files, so the file's existence is tested first;+-- for non-files the answer is always no.+journalFileIsNewer :: Journal -> FilePath -> IO Bool+journalFileIsNewer Journal{jlastreadtime=tread} f = do+ mtmod <- maybeFileModificationTime f+ return $+ case mtmod of+ Just tmod -> tmod > tread+ Nothing -> False --- | Get the last modified time of the specified file, or if it does not--- exist or there is some other error, the current time.-fileModificationTime :: FilePath -> IO ClockTime-fileModificationTime f- | null f = getClockTime- | otherwise = (do- utc <- getModificationTime f- let nom = utcTimeToPOSIXSeconds utc- let clo = TOD (read $ takeWhile (`elem` "0123456789") $ show nom) 0 -- XXX read- return clo- )- `C.catch` \(_::C.IOException) -> getClockTime+-- | Get the last modified time of the specified file, if it exists.+maybeFileModificationTime :: FilePath -> IO (Maybe POSIXTime)+maybeFileModificationTime f = do+ exists <- doesFileExist f+ if exists+ then do+ utc <- getModificationTime f+ return . Just $ utcTimeToPOSIXSeconds utc+ else+ return Nothing+ -- | Attempt to open a web browser on the given url, all platforms. openBrowserOn :: String -> IO ExitCode-openBrowserOn u = trybrowsers browsers u+openBrowserOn = trybrowsers browsers where- trybrowsers (b:bs) u = do- (e,_,_) <- readProcessWithExitCode b [u] ""+ trybrowsers (b:bs) u1 = do+ (e,_,_) <- readProcessWithExitCode b [u1] "" case e of ExitSuccess -> return ExitSuccess- ExitFailure _ -> trybrowsers bs u- trybrowsers [] u = do+ ExitFailure _ -> trybrowsers bs u1+ trybrowsers [] u1 = do putStrLn $ printf "Could not start a web browser (tried: %s)" $ intercalate ", " browsers- putStrLn $ printf "Please open your browser and visit %s" u+ putStrLn $ printf "Please open your browser and visit %s" u1 return $ ExitFailure 127 browsers | os=="darwin" = ["open"] | os=="mingw32" = ["c:/Program Files/Mozilla Firefox/firefox.exe"]@@ -261,6 +230,14 @@ -- overwrite it with this new text, or give an error, but only if the text -- is different from the current file contents, and return a flag -- indicating whether we did anything.+--+-- The given text should have unix line endings (\n); the existing+-- file content will be normalised to unix line endings before+-- comparing the two. If the file is overwritten, the new file will+-- have the current system's native line endings (\n on unix, \r\n on+-- windows). This could be different from the file's previous line+-- endings, if working with a DOS file on unix or vice-versa.+-- writeFileWithBackupIfChanged :: FilePath -> T.Text -> IO Bool writeFileWithBackupIfChanged f t = do s <- readFilePortably f@@ -272,15 +249,12 @@ writeFileWithBackup :: FilePath -> String -> IO () writeFileWithBackup f t = backUpFile f >> writeFile f t -readFileStrictly :: FilePath -> IO T.Text-readFileStrictly f = readFilePortably f >>= \s -> C.evaluate (T.length s) >> return s- -- | Back up this file with a (incrementing) numbered suffix, or give an error. backUpFile :: FilePath -> IO () backUpFile fp = do fs <- safeGetDirectoryContents $ takeDirectory $ fp let (d,f) = splitFileName fp- versions = catMaybes $ map (f `backupNumber`) fs+ versions = mapMaybe (f `backupNumber`) fs next = maximum (0:versions) + 1 f' = printf "%s.%d" f next copyFile fp (d </> f')@@ -295,3 +269,64 @@ backupNumber f g = case g =~ ("^" ++ f ++ "\\.([0-9]+)$") of (_::FilePath, _::FilePath, _::FilePath, [ext::FilePath]) -> readMay ext _ -> Nothing++-- Identify the closest recent match for this description in past transactions.+-- If the options specify a query, only matched transactions are considered.+journalSimilarTransaction :: CliOpts -> Journal -> T.Text -> Maybe Transaction+journalSimilarTransaction cliopts j desc =+ fmap fourth4 $ headMay $ journalTransactionsSimilarTo j desc q 0 1+ where+ q = queryFromFlags $ _rsReportOpts $ reportspec_ cliopts++-- | Render a 'PostingsReport' or 'AccountTransactionsReport' as Text,+-- determining the appropriate starting widths and increasing as necessary.+postingsOrTransactionsReportAsText+ :: Bool -> CliOpts -> (Int -> Int -> (a, [WideBuilder], [WideBuilder]) -> TB.Builder)+ -> (a -> MixedAmount) -> (a -> MixedAmount) -> [a] -> TB.Builder+postingsOrTransactionsReportAsText alignAll opts itemAsText itemamt itembal report =+ mconcat . snd $ mapAccumL renderItem (startWidth amt, startWidth bal) itemsWithAmounts+ where+ minWidth = 12+ chunkSize = 1000++ renderItem (amtWidth, balWidth) item@(_, amt1, bal1) = ((amtWidth', balWidth'), itemBuilder)+ where+ itemBuilder = itemAsText amtWidth' balWidth' item+ amtWidth' = if alignAll then amtWidth else maximumStrict $ amtWidth : map wbWidth amt1+ balWidth' = if alignAll then balWidth else maximumStrict $ balWidth : map wbWidth bal1++ startWidth f = maximum $ minWidth : map wbWidth (concatMap f startAlign)+ where+ startAlign = (if alignAll then id else take chunkSize) itemsWithAmounts++ itemsWithAmounts = map (\x -> (x, showAmt $ itemamt x, showAmt $ itembal x)) report+ showAmt = showMixedAmountLinesB oneLineNoCostFmt{displayColour=opts^.color__}+ amt = second3+ bal = third3++tests_Cli_Utils = testGroup "Utils" [++ -- testGroup "journalApplyValue" [+ -- -- Print the time required to convert one of the sample journals' amounts to value.+ -- -- Pretty clunky, but working.+ -- -- XXX sample.journal has no price records, but is always present.+ -- -- Change to eg examples/5000x1000x10.journal to make this useful.+ -- testCase "time" $ do+ -- ej <- io $ readJournalFile definputopts "examples/3000x1000x10.journal"+ -- case ej of+ -- Left e -> crash $ T.pack e+ -- Right j -> do+ -- (t,_) <- io $ timeItT $ do+ -- -- Enable -V, and ensure the valuation date is later than+ -- -- all prices for consistent timing.+ -- let ropts = defreportopts{+ -- value_=True,+ -- period_=PeriodTo $ fromGregorian 3000 01 01+ -- }+ -- j' <- journalApplyValue ropts j+ -- sum (journalAmounts j') `seq` return ()+ -- io $ printf "[%.3fs] " t+ -- ok+ -- ]++ ]
Hledger/Cli/Version.hs view
@@ -1,67 +1,269 @@-{-# LANGUAGE CPP, TemplateHaskell #-}+{-# LANGUAGE CPP #-} {- Version number-related utilities. See also the Makefile. -} module Hledger.Cli.Version (- progname,- version,- prognameandversion,- prognameanddetailedversion,- binaryfilename+ PackageVersionString,+ Version,+ nullversion,+ toVersion,+ showVersion,+ isReleaseVersion,+ HledgerVersionString,+ HledgerBinaryInfo(..),+ nullbinaryinfo,+ ProgramName,+ GitHash,+ ArchName,+ parseHledgerVersion,+ packageversion,+ packagemajorversion,+ versionStringWith, ) where++import GitHash (GitInfo, giHash, giCommitDate) -- giDirty import System.Info (os, arch)-import Text.Printf+import Data.List (intercalate)+import Data.List.NonEmpty (NonEmpty ((:|)), nonEmpty, toList)+import Data.List.Split (splitOn)+import Data.Maybe+import Text.Read (readMaybe) -import Hledger.Utils+import Hledger.Utils (ghcDebugSupportedInLib, splitAtElement, rstrip)+import Data.Time (Day)+import Text.Megaparsec+import Data.Void (Void)+import Text.Megaparsec.Char+import Text.Megaparsec.Char.Lexer qualified as L+import Hledger.Data.Dates (parsedate)+import Data.Bifunctor+import Data.List.NonEmpty qualified as NE --- package name and version from the cabal file-progname, version, prognameandversion, prognameanddetailedversion :: String-progname = "hledger"-#ifdef VERSION-version = VERSION-#else-version = "dev build"-#endif-prognameandversion = progname ++ " " ++ version-prognameanddetailedversion = printf "%s %s" progname version+-- | A Cabal/Hackage-compatible package version string: one or more dot-separated integers.+type PackageVersionString = String --- developer build version strings include PATCHLEVEL (number of--- patches since the last tag). If defined, it must be a number.-patchlevel :: String-#ifdef PATCHLEVEL-patchlevel = "." ++ show (PATCHLEVEL :: Int)+-- | The number parts parsed from a PackageVersionString.+type Version = NonEmpty Int++nullversion = NE.fromList [0]++showVersion :: Version -> String+showVersion = intercalate "." . map show . toList++-- | Parse a valid Cabal/Hackage-compatible package version.+toVersion :: PackageVersionString -> Maybe Version+toVersion s =+ let parts = map readMaybe $ splitOn "." s :: [Maybe Int]+ in+ if null parts || any isNothing parts+ then Nothing+ else nonEmpty $ catMaybes parts++isReleaseVersion :: Version -> Bool+isReleaseVersion v = NE.last v < 98 -- .99 and possibly .98 are dev++-- | A hledger version string, as shown by hledger --version.+-- This can vary; some examples:+--+-- * dev builds: hledger 1.42.99-g2288f5193-20250422, mac-aarch64+--+-- * release builds: hledger 1.42.1, mac-aarch64+--+-- * older versions: hledger 1.21+type HledgerVersionString = String++-- | The program name from a hledger version string: hledger, hledger-ui, hledger-web..+type ProgramName = String++-- | The operating system name from a hledger version string.+-- This the value of @System.Info.os@ modified for readability:+-- mac, windows, linux, linux-android, freebsd, netbsd, openbsd..+type OsName = String++-- | The machine architecture from a hledger version string.+-- This is the value of @System.Info.arch@, eg:+-- aarch64, alpha, arm, hppa, hppa1_1, i386, ia64, loongarch32, loongarch64, m68k,+-- mips, mipseb, mipsel, nios2, powerpc, powerpc64, powerpc64le, riscv32, riscv64,+-- rs6000, s390, s390x, sh4, sparc, sparc64, vax, x86_64..+type ArchName = String++-- | The git hash from a hledger version string, excluding the g prefix.+type GitHash = String++-- | The name and package version of a hledger binary,+-- and the build's git hash, the release date, and the binary's +-- intended operating machine and machine architecture, if we can detect these.+-- Also, a copy of the --version output from which it was parsed.+data HledgerBinaryInfo = HledgerBinaryInfo {+ hbinVersionOutput :: String+ , hbinProgramName :: ProgramName+ , hbinPackageVersion :: Version + , hbinPackageVersionStr :: String+ , hbinGitHash :: Maybe GitHash+ , hbinReleaseDate :: Maybe Day+ , hbinOs :: Maybe OsName+ , hbinArch :: Maybe ArchName+} deriving (Show, Eq)++nullbinaryinfo = HledgerBinaryInfo {+ hbinVersionOutput = ""+ , hbinProgramName = ""+ , hbinPackageVersion = nullversion+ , hbinPackageVersionStr = ""+ , hbinGitHash = Nothing+ , hbinReleaseDate = Nothing+ , hbinOs = Nothing+ , hbinArch = Nothing+}++type Parser = Parsec Void String++-- | Parse hledger's --version output.+--+-- >>> isRight $ parseHledgerVersion "hledger 1.21"+-- True+-- >>> isRight $ parseHledgerVersion "hledger 1.42.1, mac-aarch64"+-- True+-- >>> isRight $ parseHledgerVersion "hledger 1.42.99-g2288f5193-20250422, mac-aarch64"+-- True+--+parseHledgerVersion :: HledgerVersionString -> Either String HledgerBinaryInfo+parseHledgerVersion s = + case parse hledgerversionp "" s of+ Left err -> Left $ errorBundlePretty err+ Right v -> Right v{hbinVersionOutput=rstrip s}++-- Parser for hledger --version output: a program name beginning with "hledger" and a package version;+-- possibly followed by a git hash and release date;+-- possibly followed by the binary's intended operating system and architecture+-- (see HledgerVersionString and versionStringWith).+-- The hbinVersionOutput field is left blank here; parseHledgerVersion sets it.+hledgerversionp :: Parser HledgerBinaryInfo+hledgerversionp = do+ progName <- (<>) <$> string "hledger" <*> many (letterChar <|> char '-')+ some $ char ' '+ pkgversion <- packageversionp+ mgithash <- optional $ try $ string "-g" *> some hexDigitChar+ mreldate <- optional $ do+ string "-"+ datestr <- (:) <$> digitChar <*> some (digitChar <|> char '-')+ maybe (fail "invalid date") pure $ parsedate $ datestr+ -- Oh oh. hledger --version prints OS-ARCH, but it turns out OS can contain hyphens (eg linux-android).+ -- Based on the "common values" in System.Info docs, it seems ARCH typically does not contain hyphens;+ -- we'll assume that here, and split at the rightmost hyphen.+ mosarch <- optional $ do+ string ","+ some (char ' ')+ some (letterChar <|> digitChar <|> char '-' <|> char '_')+ let+ (march, mos) = case mosarch of+ Nothing -> (Nothing, Nothing)+ Just osarch -> bimap (Just . reverse) (Just . reverse) $ second (drop 1) $ break (== '-') $ reverse osarch+ many spaceChar+ eof+ return $ HledgerBinaryInfo+ { hbinVersionOutput = ""+ , hbinProgramName = progName+ , hbinPackageVersion = pkgversion+ , hbinPackageVersionStr = showVersion pkgversion+ , hbinGitHash = mgithash+ , hbinReleaseDate = mreldate+ , hbinOs = mos+ , hbinArch = march+ }++-- | Parser for Cabal package version numbers, one or more dot-separated integers. Eg "1.42.1".+packageversionp :: Parser Version+packageversionp = do+ firstNum <- L.decimal+ rest <- many (char '.' *> L.decimal)+ return $ firstNum :| rest++-- | The VERSION string defined with -D in this package's package.yaml/.cabal file +-- (by Shake setversion), if any. Normally a dotted number string with 1-3 components.+packageversion :: PackageVersionString+packageversion =+#ifdef VERSION+ VERSION #else-patchlevel = ""+ "" #endif --- the package version plus patchlevel if specified-buildversion :: String-buildversion = version ++ patchlevel+-- | Just the first 1-2 components of packageversion.+packagemajorversion :: PackageVersionString+packagemajorversion = intercalate "." $ take 2 $ splitAtElement '.' packageversion --- | Given a program name, return a precise platform-specific executable--- name suitable for naming downloadable binaries. Can raise an error if--- the version and patch level was not defined correctly at build time.-binaryfilename :: String -> String-binaryfilename progname = prettify $ splitAtElement '.' buildversion- where- prettify (major:minor:bugfix:patches:[]) =- printf "%s-%s.%s%s%s-%s-%s%s" progname major minor bugfix' patches' os' arch suffix- where- bugfix'- | bugfix `elem` ["0"{-,"98","99"-}] = ""- | otherwise = '.' : bugfix- patches'- | patches/="0" = '+' : patches- | otherwise = ""- (os',suffix)- | os == "darwin" = ("mac","" :: String)- | os == "mingw32" = ("windows",".exe")- | otherwise = (os,"")- prettify (major:minor:bugfix:[]) = prettify [major,minor,bugfix,"0"]- prettify (major:minor:[]) = prettify [major,minor,"0","0"]- prettify (major:[]) = prettify [major,"0","0","0"]- prettify [] = error' "VERSION is empty, please fix"- prettify _ = error' "VERSION has too many components, please fix"+-- | Given possible git state info from the build directory (or a git error, which is ignored),+-- and the debug build flag, executable name and package version for the package being built,+-- make the best version string we can. Here is the logic:+-- +-- * Program name, OS and architecture are always shown.+-- * The package version is always shown.+-- * If there is git info at build time, the latest commit hash and commit date are shown,+-- and (TODO, requires githash to use -uno for giDirty):+-- if the working copy has uncommitted changes a + sign is appended.+-- * (TODO, requires adding --match support to githash:+-- If there are tags matching THISPKG-[0-9]*, the latest one is used to calculate patch level+-- (number of commits since tag), and if non-zero, it and the branch name are shown.)+-- * If the debug build flag was enabled for the package being built, and for hledger-lib (both are needed),+-- "ghc-debug support" is shown.+--+-- Some example outputs:+--+-- * A homebrew binary, not built in git repo: hledger-ui 1.24, mac-aarch64+-- * A CI release build, built in git repo at release tag: hledger-ui 1.24.1-g455b35293-20211210, mac-x86_64+-- * (TODO) A dev build, built in git repo: hledger-ui 1.24.1+1-g4abd8ef10-20211210 (1.24-branch), mac-x86_64+--+-- This function requires git log to show the default (rfc2822-style) date format,+-- so that must not be overridden by a log.date git config variable.+--+-- The GitInfo if any, fetched by template haskell, is passed down from+-- a top-level module, reducing wasteful recompilation.+-- The status of the debug build flag is also passed down, since it is+-- specific to each hledger package.+--+-- This is used indirectly by at least hledger, hledger-ui, and hledger-web,+-- so output should be suitable for all of those.+--+versionStringWith :: Either String GitInfo -> Bool -> ProgramName -> PackageVersionString -> HledgerVersionString+versionStringWith egitinfo ghcDebugSupportedInThisPackage progname packagever =+ concat $+ [ progname , " " , version , ", " , os' , "-" , arch ]+ ++ [ " with ghc-debug support" | ghcDebugSupportedInThisPackage && ghcDebugSupportedInLib ]+ where+ os' | os == "darwin" = "mac"+ | os == "mingw32" = "windows"+ | otherwise = os+ version = case egitinfo of+ Left _err -> packagever+ Right gitinfo -> + case words $ giCommitDate gitinfo of+ -- git log's date format is normally --date=default ("similar to --date=rfc2822")+ _weekday:mon:day:_localtime:year:_offset:_ ->+ intercalate "-" $ [packagever, hash, date]+ -- ++ ["+" | giDirty gitinfo]+ -- XXX giDirty is wrong when repo shows untracked files by default, skip it for now+ where+ hash = 'g' : take 9 (giHash gitinfo) -- like git describe+ date = concat [year,mm,dd]+ where + mm = fromMaybe mon $ lookup mon $ [+ ("Jan","01")+ ,("Feb","02")+ ,("Mar","03")+ ,("Apr","04")+ ,("May","05")+ ,("Jun","06")+ ,("Jul","07")+ ,("Aug","08")+ ,("Sep","09")+ ,("Oct","10")+ ,("Nov","11")+ ,("Dec","12")+ ]+ dd = (if length day < 2 then ('0':) else id) day+ -- but could be overridden by a log.date config variable in repo or user git config+ _ -> packageversion
LICENSE view
@@ -1,7 +1,7 @@ GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -645,7 +645,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License- along with this program. If not, see <http://www.gnu.org/licenses/>.+ along with this program. If not, see <https://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. @@ -664,11 +664,11 @@ You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see-<http://www.gnu.org/licenses/>.+<https://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read-<http://www.gnu.org/philosophy/why-not-lgpl.html>.+<https://www.gnu.org/licenses/why-not-lgpl.html>.
README.md view
@@ -1,125 +1,9 @@-# hledger--## lightweight, portable, dependable accounting tools--hledger is a computer program for easily tracking money, time, or other commodities,-on unix, mac and windows (and web-capable mobile devices, to some extent).--It is first a command-line tool, but there are also curses-style and-web interfaces, and a Haskell library-(http://hackage.haskell.org/package/hledger-lib) for building your own-programs and scripts (hledger is written in Haskell). hledger was-inspired by and is largely compatible with Ledger. hledger is free-software available under the GNU General Public License v3+.--hledger aims to help both computer experts and regular folks-to gain clarity and control in their finances and time management,-but currently it is a bit more suited to techies.-I use it every day to:--- track spending and income-- see time reports by day/week/month/project-- get accurate numbers for client billing and tax filing-- track invoices--Though limited in features, hledger is lightweight, usable and reliable.-For some, it is a simpler, less distracting, more future-proof alternative to Quicken or GnuCash.--For more, see http://hledger.org.--## Support--### Backers-Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/hledger#backer)]--<a href="https://opencollective.com/hledger/backer/0/website" target="_blank"><img src="https://opencollective.com/hledger/backer/0/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/1/website" target="_blank"><img src="https://opencollective.com/hledger/backer/1/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/2/website" target="_blank"><img src="https://opencollective.com/hledger/backer/2/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/3/website" target="_blank"><img src="https://opencollective.com/hledger/backer/3/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/4/website" target="_blank"><img src="https://opencollective.com/hledger/backer/4/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/5/website" target="_blank"><img src="https://opencollective.com/hledger/backer/5/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/6/website" target="_blank"><img src="https://opencollective.com/hledger/backer/6/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/7/website" target="_blank"><img src="https://opencollective.com/hledger/backer/7/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/8/website" target="_blank"><img src="https://opencollective.com/hledger/backer/8/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/9/website" target="_blank"><img src="https://opencollective.com/hledger/backer/9/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/10/website" target="_blank"><img src="https://opencollective.com/hledger/backer/10/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/11/website" target="_blank"><img src="https://opencollective.com/hledger/backer/11/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/12/website" target="_blank"><img src="https://opencollective.com/hledger/backer/12/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/13/website" target="_blank"><img src="https://opencollective.com/hledger/backer/13/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/14/website" target="_blank"><img src="https://opencollective.com/hledger/backer/14/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/15/website" target="_blank"><img src="https://opencollective.com/hledger/backer/15/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/16/website" target="_blank"><img src="https://opencollective.com/hledger/backer/16/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/17/website" target="_blank"><img src="https://opencollective.com/hledger/backer/17/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/18/website" target="_blank"><img src="https://opencollective.com/hledger/backer/18/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/19/website" target="_blank"><img src="https://opencollective.com/hledger/backer/19/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/20/website" target="_blank"><img src="https://opencollective.com/hledger/backer/20/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/21/website" target="_blank"><img src="https://opencollective.com/hledger/backer/21/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/22/website" target="_blank"><img src="https://opencollective.com/hledger/backer/22/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/23/website" target="_blank"><img src="https://opencollective.com/hledger/backer/23/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/24/website" target="_blank"><img src="https://opencollective.com/hledger/backer/24/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/25/website" target="_blank"><img src="https://opencollective.com/hledger/backer/25/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/26/website" target="_blank"><img src="https://opencollective.com/hledger/backer/26/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/27/website" target="_blank"><img src="https://opencollective.com/hledger/backer/27/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/28/website" target="_blank"><img src="https://opencollective.com/hledger/backer/28/avatar.svg"></a>-<a href="https://opencollective.com/hledger/backer/29/website" target="_blank"><img src="https://opencollective.com/hledger/backer/29/avatar.svg"></a>--### Sponsors-Become a sponsor and get your logo on our README on Github with a link to your site. [[Become a sponsor](https://opencollective.com/hledger#sponsor)]--<a href="https://opencollective.com/hledger/sponsor/0/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/0/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/1/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/1/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/2/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/2/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/3/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/3/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/4/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/4/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/5/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/5/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/6/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/6/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/7/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/7/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/8/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/8/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/9/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/9/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/10/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/10/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/11/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/11/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/12/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/12/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/13/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/13/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/14/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/14/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/15/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/15/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/16/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/16/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/17/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/17/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/18/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/18/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/19/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/19/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/20/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/20/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/21/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/21/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/22/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/22/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/23/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/23/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/24/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/24/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/25/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/25/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/26/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/26/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/27/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/27/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/28/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/28/avatar.svg"></a>-<a href="https://opencollective.com/hledger/sponsor/29/website" target="_blank"><img src="https://opencollective.com/hledger/sponsor/29/avatar.svg"></a>--[](http://www.gnu.org/licenses/gpl.html)--[](#backers) -[](#sponsors)-[](https://github.com/simonmichael/hledger/issues?q=label:bounty)-[](http://bugs.hledger.org)--[](http://hackage.haskell.org/package/hledger)-[](http://stackage.org/nightly/package/hledger)-[](http://stackage.org/lts/package/hledger)-[](http://stackage.org/lts-7/package/hledger)-<!-- [](https://github.com/simonmichael/hledger/releases)---> <!-- [](https://github.com/simonmichael/hledger/releases)---> <!-- []()--->+# hledger -[](https://travis.hledger.org)-[](https://appveyor.hledger.org)-[](http://packdeps.haskellers.com/feed?needle=hledger-lib)-[](http://packdeps.haskellers.com/feed?needle=hledger)-[](http://packdeps.haskellers.com/feed?needle=hledger-ui)-[](http://packdeps.haskellers.com/feed?needle=hledger-web)-[](http://packdeps.haskellers.com/feed?needle=hledger-api)+The command-line interface for the hledger accounting system.+Its basic function is to read a plain text file describing+financial transactions and produce useful reports. +See also:+the [project README](https://hledger.org/README.html)+and [home page](https://hledger.org).
app/hledger-cli.hs view
@@ -1,6 +1,9 @@-#!/usr/bin/env runhaskell--- the hledger command-line executable; see Hledger/Cli/Main.hs+-- the hledger command-line executable; see Hledger/Cli.hs module Main (main) where-import Hledger.Cli.Main (main)+import Hledger.Cli qualified (main)++-- Have to write this explicitly for GHC 9.0.1a for some reason:+main :: IO ()+main = Hledger.Cli.main
bench/bench.hs view
@@ -4,12 +4,11 @@ import Criterion.Main (defaultMainWith, defaultConfig, bench, nfIO) -- import QuickBench (defaultMain)-import Data.Default import System.Directory (getCurrentDirectory) import System.Environment (getArgs, withArgs) import System.TimeIt (timeItT) import Text.Printf-import Hledger.Cli+import Hledger.Cli hiding (main) -- sample journal file to use for benchmarks inputfile = "bench/10000x1000x10.journal"@@ -34,7 +33,7 @@ benchWithTimeit = do getCurrentDirectory >>= printf "Benchmarking hledger in %s with timeit\n" let opts = defcliopts{output_file_=Just outputfile}- (t0,j) <- timeit ("read "++inputfile) $ either error id <$> readJournalFile def inputfile+ (t0,j) <- timeit ("read "++inputfile) $ readJournalFile' inputfile -- PARTIAL: (t1,_) <- timeit ("print") $ print' opts j (t2,_) <- timeit ("register") $ register opts j (t3,_) <- timeit ("balance") $ balance opts j@@ -50,9 +49,9 @@ benchWithCriterion = do getCurrentDirectory >>= printf "Benchmarking hledger in %s with criterion\n" let opts = defcliopts{output_file_=Just "/dev/null"}- j <- either error id <$> readJournalFile def inputfile+ j <- readJournalFile' inputfile -- PARTIAL: Criterion.Main.defaultMainWith defaultConfig $ [- bench ("read "++inputfile) $ nfIO $ (either error const <$> readJournalFile def inputfile),+ bench ("read "++inputfile) $ nfIO $ const <$> readJournalFile' inputfile, -- PARTIAL: bench ("print") $ nfIO $ print' opts j, bench ("register") $ nfIO $ register opts j, bench ("balance") $ nfIO $ balance opts j,
+ embeddedfiles/add.cast view
@@ -0,0 +1,524 @@+{"version": 2, "width": 80, "height": 25, "timestamp": 1678904454, "env": {"SHELL": "/opt/homebrew/bin/bash", "TERM": "xterm-256color"}, "title": "The easiest way to start a journal (add)"}+[0.255203, "o", "\u001b[?2004h~$ "]+[1.234397, "o", "h"]+[1.327242, "o", "l"]+[1.370235, "o", "e"]+[1.53249, "o", "d"]+[1.644623, "o", "g"]+[1.819847, "o", "e"]+[1.918665, "o", "r"]+[2.045801, "o", " "]+[2.542267, "o", "f"]+[2.64452, "o", "i"]+[2.738195, "o", "l"]+[2.791383, "o", "e"]+[2.874609, "o", "s"]+[3.26324, "o", "\r\n\u001b[?2004l\r"]+[3.428244, "o", "The hledger journa"]+[3.428272, "o", "l file \"/Users/simon/.hledger.journ"]+[3.42833, "o", "al\" was not found.\r\nPlease create it first, eg wi"]+[3.428339, "o", "th \"hledg"]+[3.428343, "o", "er a"]+[3.428347, "o", "dd\""]+[3.42835, "o", " or"]+[3.428353, "o", " a"]+[3.428356, "o", " t"]+[3.428377, "o", "ext"]+[3.42838, "o", " edito"]+[3.428508, "o", "r.\r\nOr, specify an existing journal file with -f or LEDGE"]+[3.428519, "o", "R_FILE.\r\n"]+[3.441928, "o", "\u001b[?2004h~$ "]+[4.143164, "o", "#"]+[4.300801, "o", " "]+[4.567329, "o", "N"]+[4.763292, "o", "o"]+[4.867708, "o", " "]+[5.065003, "o", "h"]+[5.123361, "o", "l"]+[5.18613, "o", "e"]+[5.327324, "o", "d"]+[5.418392, "o", "g"]+[5.552056, "o", "e"]+[5.627632, "o", "r"]+[5.735515, "o", " "]+[5.834046, "o", "d"]+[5.964766, "o", "a"]+[6.106152, "o", "t"]+[6.226028, "o", "a"]+[6.532517, "o", "."]+[6.678581, "o", " "]+[8.309635, "o", "G"]+[8.631756, "o", "o"]+[8.735402, "o", "a"]+[8.871778, "o", "l"]+[9.439375, "o", ":"]+[9.515163, "o", " "]+[9.997127, "o", "u"]+[10.078262, "o", "s"]+[10.121507, "o", "e"]+[10.251843, "o", " "]+[10.349225, "o", "t"]+[10.452566, "o", "h"]+[10.521314, "o", "e"]+[10.609218, "o", " "]+[10.683405, "o", "a"]+[10.764836, "o", "d"]+[10.900257, "o", "d"]+[11.012004, "o", " "]+[11.128565, "o", "c"]+[11.224034, "o", "o"]+[11.266054, "o", "m"]+[11.426288, "o", "m"]+[11.506869, "o", "a"]+[11.617359, "o", "n"]+[11.693657, "o", "d"]+[11.811191, "o", " "]+[11.930049, "o", "t"]+[12.014447, "o", "o"]+[12.08663, "o", " "]+[12.28556, "o", "s"]+[12.43082, "o", "t"]+[12.580679, "o", "a"]+[12.662909, "o", "r"]+[12.718242, "o", "t"]+[12.871033, "o", " "]+[12.963237, "o", "a"]+[13.064358, "o", " "]+[13.236245, "o", "j"]+[13.343545, "o", "o"]+[13.418653, "o", "u"]+[13.526455, "o", "r"]+[13.662285, "o", "n"]+[13.766545, "o", "a"]+[13.878083, "o", "l"]+[13.9981, "o", " "]+[14.162788, "o", "f"]+[14.28061, "o", "i"]+[14.364875, "o", "l"]+[14.477069, "o", "e"]+[16.816326, "o", "\r\n"]+[16.816471, "o", "\u001b[?2004l\r"]+[16.817073, "o", "\u001b[?2004h~$ "]+[17.363334, "o", "#"]+[17.870424, "o", " "]+[18.801564, "o", "a"]+[18.922632, "o", "n"]+[18.993035, "o", "d"]+[19.099526, "o", " "]+[19.215501, "o", "t"]+[19.293816, "o", "e"]+[19.388051, "o", "l"]+[19.545868, "o", "l"]+[19.598296, "o", " "]+[19.837054, "o", "h"]+[19.911172, "o", "l"]+[19.99106, "o", "e"]+[20.171846, "o", "d"]+[20.281177, "o", "g"]+[20.427339, "o", "e"]+[20.532727, "o", "r"]+[20.704936, "o", " "]+[20.826309, "o", "a"]+[20.945941, "o", "b"]+[21.069307, "o", "o"]+[21.143202, "o", "u"]+[21.247183, "o", "t"]+[21.356392, "o", " "]+[21.497804, "o", "m"]+[21.763716, "o", "y"]+[21.845479, "o", " "]+[21.936883, "o", "f"]+[22.06424, "o", "i"]+[22.145905, "o", "r"]+[22.287272, "o", "s"]+[22.388396, "o", "t"]+[22.528249, "o", " "]+[22.805059, "o", "a"]+[22.857191, "o", "c"]+[23.035561, "o", "c"]+[23.097684, "o", "o"]+[23.144705, "o", "u"]+[23.33486, "o", "n"]+[23.38399, "o", "t"]+[24.02125, "o", ":"]+[24.096632, "o", " "]+[25.64211, "o", "m"]+[25.875169, "o", "y"]+[25.960022, "o", " "]+[26.056582, "o", "w"]+[26.174807, "o", "a"]+[26.300508, "o", "l"]+[26.434609, "o", "l"]+[26.512283, "o", "e"]+[26.603068, "o", "t"]+[26.733512, "o", "."]+[28.063557, "o", "\r\n"]+[28.06375, "o", "\u001b[?2004l\r"]+[28.064135, "o", "\u001b[?2004h"]+[28.064168, "o", "~$ "]+[28.804492, "o", "h"]+[28.887535, "o", "l"]+[28.941199, "o", "e"]+[29.096535, "o", "d"]+[29.196855, "o", "g"]+[29.343033, "o", "e"]+[29.423874, "o", "r"]+[29.567085, "o", " "]+[29.754997, "o", "a"]+[29.84447, "o", "d"]+[29.964696, "o", "d"]+[30.821916, "o", "\r\n"]+[30.821956, "o", "\u001b[?2004l\r"]+[30.977925, "o", "Creating hledger journal file \"/Users/simon/.hledger.j"]+[30.97808, "o", "ournal\".\r\n"]+[30.979303, "o", "Add"]+[30.979315, "o", "ing tran"]+[30.979321, "o", "saction"]+[30.979324, "o", "s to "]+[30.979336, "o", "jou"]+[30.979391, "o", "rnal file /"]+[30.979397, "o", "Users/simon/.hledger.journal\r\nAny command line ar"]+[30.979401, "o", "gum"]+[30.979403, "o", "en"]+[30.979521, "o", "ts will be used as defaults.\r\nU"]+[30.979556, "o", "se tab key to complete, readline keys to edit, enter to accept defaults.\r\nAn opt"]+[30.979597, "o", "ional (CODE) may follow tra"]+[30.979629, "o", "nsaction dates.\r\nAn optional ; COMMENT"]+[30.979656, "o", " may follow descriptions or amounts.\r\nIf you"]+[30.979661, "o", " make "]+[30.979664, "o", "a "]+[30.979667, "o", "mis"]+[30.979674, "o", "ta"]+[30.979677, "o", "ke, en"]+[30.979733, "o", "te"]+[30.979739, "o", "r < at any prompt to go one step backward.\r\nTo end a"]+[30.979746, "o", " trans"]+[30.979763, "o", "action, enter "]+[30.979766, "o", ". w"]+[30.979769, "o", "he"]+[30.979772, "o", "n p"]+[30.979775, "o", "ro"]+[30.979778, "o", "mp"]+[30.979781, "o", "ted"]+[30.979783, "o", ".\r\n"]+[30.979789, "o", "To"]+[30.979792, "o", " quit"]+[30.979795, "o", ", "]+[30.979898, "o", "enter . at a date prompt or press control-d or control-c.\r\n"]+[30.981349, "o", "\u001b[?1h\u001b="]+[30.981828, "o", "\u001b[1;32mDate [2023-03-15]: \u001b[0m"]+[32.365693, "o", "E"]+[32.500444, "o", "N"]+[32.618772, "o", "T"]+[32.735942, "o", "E"]+[32.846347, "o", "R"]+[33.019661, "o", " "]+[33.327122, "o", "k"]+[33.448324, "o", "e"]+[33.604502, "o", "y"]+[33.684293, "o", " "]+[33.846854, "o", "t"]+[33.943511, "o", "o"]+[34.037209, "o", " "]+[34.184367, "o", "a"]+[34.218041, "o", "c"]+[34.66764, "o", "e"]+[35.057403, "o", "\b\u001b[K"]+[35.181887, "o", "c"]+[35.255623, "o", "e"]+[35.427566, "o", "p"]+[35.571436, "o", "t"]+[35.675992, "o", " "]+[35.818066, "o", "d"]+[36.014537, "o", "e"]+[36.124485, "o", "f"]+[36.220167, "o", "a"]+[36.292678, "o", "u"]+[36.363166, "o", "l"]+[36.64892, "o", "t"]+[36.954332, "o", "."]+[38.004952, "o", "\u001b[8D\u001b[K"]+[38.182813, "o", "\u001b[7D\u001b[K"]+[38.372388, "o", "\u001b[3D\u001b[K"]+[38.566491, "o", "\u001b[4D\u001b[K"]+[38.937339, "o", "\u001b[6D\u001b[K"]+[39.366089, "o", "\r\r\n"]+[39.366289, "o", "\u001b[?1l\u001b>"]+[39.370371, "o", "\u001b[?1h\u001b="]+[39.370686, "o", "\u001b[1;32mDescription: \u001b[0m"]+[40.438771, "o", "o"]+[40.510529, "o", "p"]+[40.624829, "o", "e"]+[40.790305, "o", "n"]+[40.965564, "o", "i"]+[41.043854, "o", "n"]+[41.153372, "o", "g"]+[41.232651, "o", " "]+[41.46274, "o", "b"]+[41.559769, "o", "a"]+[41.688099, "o", "l"]+[41.799534, "o", "a"]+[41.87038, "o", "n"]+[42.013444, "o", "c"]+[42.100814, "o", "e"]+[42.179245, "o", "s"]+[42.672007, "o", "\r\r\n"]+[42.672242, "o", "\u001b[?1l\u001b>"]+[42.672897, "o", "\u001b[?1h\u001b="]+[42.677624, "o", "\u001b[1;32mAccount 1: \u001b[0m"]+[44.247752, "o", "I"]+[44.451109, "o", "'"]+[44.648424, "o", "l"]+[44.796114, "o", "l"]+[44.887984, "o", " "]+[44.978643, "o", "c"]+[45.044853, "o", "a"]+[45.129135, "o", "l"]+[45.276748, "o", "l"]+[45.379586, "o", " "]+[45.545822, "o", "i"]+[45.670209, "o", "t"]+[45.763155, "o", " "]+[46.076756, "o", "c"]+[46.206959, "o", "a"]+[46.298797, "o", "s"]+[46.40413, "o", "h"]+[47.912169, "o", "\u001b[4D\u001b[K"]+[48.126171, "o", "\u001b[3D\u001b[K"]+[48.333167, "o", "\u001b[5D\u001b[K"]+[48.539866, "o", "\u001b[3D\u001b[K"]+[48.762142, "o", "\u001b[2D\u001b[K"]+[49.06622, "o", "c"]+[49.164572, "o", "a"]+[49.250997, "o", "s"]+[49.327952, "o", "h"]+[49.73888, "o", "\r\r\n"]+[49.739041, "o", "\u001b[?1l\u001b>"]+[49.739718, "o", "\u001b[?1h\u001b="]+[49.740062, "o", "\u001b[1;32mAmount 1: \u001b[0m"]+[50.952601, "o", "$"]+[51.407241, "o", "5"]+[51.608231, "o", "0"]+[51.926796, "o", "."]+[52.089745, "o", "2"]+[52.216239, "o", "5"]+[53.233036, "o", "\r\r\n"]+[53.23324, "o", "\u001b[?1l\u001b>"]+[53.235334, "o", "\u001b[?1h\u001b="]+[53.235626, "o", "\u001b[1;32mAccount 2: \u001b[0m"]+[55.593736, "o", "I"]+[55.778761, "o", "n"]+[55.846798, "o", " "]+[56.100551, "o", "D"]+[56.321018, "o", "o"]+[56.413207, "o", "u"]+[56.470998, "o", "b"]+[56.601466, "o", "l"]+[56.670964, "o", "e"]+[56.796657, "o", " "]+[56.955752, "o", "E"]+[57.171269, "o", "n"]+[57.289458, "o", "t"]+[57.339763, "o", "r"]+[57.500175, "o", "y"]+[57.573121, "o", " "]+[57.846171, "o", "B"]+[58.087773, "o", "o"]+[58.244044, "o", "o"]+[58.333501, "o", "k"]+[58.836289, "o", "k"]+[58.930351, "o", "e"]+[59.083618, "o", "e"]+[59.199624, "o", "p"]+[59.415746, "o", "i"]+[59.476424, "o", "n"]+[59.570074, "o", "g"]+[59.93668, "o", ","]+[60.017958, "o", " "]+[60.507438, "o", "w"]+[60.589713, "o", "e"]+[60.711635, "o", " "]+[60.911856, "o", "m"]+[61.105571, "o", "u"]+[61.158489, "o", "s"]+[61.250867, "o", "t"]+[61.321488, "o", " "]+[61.48602, "o", "s"]+[61.574183, "o", "a"]+[61.753348, "o", "y"]+[61.829632, "o", " "]+[62.100469, "o", "w"]+[62.279986, "o", "h"]+[62.393708, "o", "e"]+[62.529779, "o", "r"]+[62.626381, "o", "e"]+[62.79806, "o", " "]+[62.926809, "o", "t"]+[63.029974, "o", "h"]+[63.126396, "o", "e"]+[63.136837, "o", " "]+[63.336311, "o", "m"]+[63.457882, "o", "o"]+[63.565931, "o", "n"]+[63.71167, "o", "e"]+[63.941578, "o", "y"]+[64.005898, "o", " "]+[64.202506, "o", "c"]+[64.299594, "o", "o"]+[64.351714, "o", "m"]+[64.452243, "o", "e"]+[64.545918, "o", "s"]+[64.676844, "o", " "]+[64.800326, "o", "f"]+[64.968768, "o", "r"]+[65.000807, "o", "o"]+[65.075064, "o", "m"]+[65.335673, "o", "."]+[65.434415, "o", " \b"]+[65.754756, "o", "F"]+[66.021373, "o", "o"]+[66.105097, "o", "r"]+[66.20665, "o", " "]+[66.353568, "o", "o"]+[66.433295, "o", "p"]+[66.547727, "o", "e"]+[66.678949, "o", "n"]+[66.844279, "o", "i"]+[66.929605, "o", "n"]+[67.041925, "o", "g"]+[67.249947, "o", " "]+[67.912057, "o", "b"]+[68.023269, "o", "a"]+[68.128661, "o", "l"]+[68.254994, "o", "a"]+[68.33604, "o", "n"]+[68.457164, "o", "c"]+[68.527258, "o", "e"]+[68.612963, "o", "s"]+[68.904649, "o", ","]+[68.985425, "o", " "]+[69.977925, "o", "t"]+[70.136536, "o", "h"]+[70.219258, "o", "a"]+[70.31614, "o", "t"]+[70.485621, "o", "'"]+[70.617502, "o", "s"]+[70.83977, "o", " "]+[71.662638, "o", "\""]+[72.018456, "o", "e"]+[72.221028, "o", "q"]+[72.313577, "o", "u"]+[72.349719, "o", "i"]+[72.468137, "o", "t"]+[72.568905, "o", "y"]+[72.800114, "o", "\""]+[73.188821, "o", "."]+[77.548683, "o", "\u001b[8D\u001b[K"]+[77.799445, "o", "\u001b[3D\u001b[K"]+[77.832655, "o", "\u001b[5D\u001b[K"]+[77.866934, "o", "\u001b[10D\u001b[K"]+[77.901869, "o", "\u001b[8D\u001b[K"]+[77.9349, "o", "\u001b[4D\u001b[K"]+[77.97057, "o", "\r\u001b[A\u001b[74C\u001b[K\r\r\n\u001b[K\r\u001b[A\u001b[74C"]+[78.001574, "o", "\u001b[6D\u001b[K"]+[78.034116, "o", "\u001b[6D\u001b[K"]+[78.067545, "o", "\u001b[4D\u001b[K"]+[78.10191, "o", "\u001b[6D\u001b[K"]+[78.134988, "o", "\u001b[4D\u001b[K"]+[78.168896, "o", "\u001b[5D\u001b[K"]+[78.201546, "o", "\u001b[3D\u001b[K"]+[78.475379, "o", "\u001b[13D\u001b[K"]+[78.727091, "o", "\u001b[6D\u001b[K"]+[78.759581, "o", "\u001b[7D\u001b[K"]+[78.794906, "o", "\u001b[3D\u001b[K"]+[79.197513, "o", "e"]+[79.388333, "o", "q"]+[79.478797, "o", "u"]+[79.557333, "o", "i"]+[79.646162, "o", "t"]+[79.752036, "o", "y"]+[80.052548, "o", "\r\r\n"]+[80.052709, "o", "\u001b[?1l\u001b>"]+[80.053503, "o", "\u001b[?1h\u001b="]+[80.053779, "o", "\u001b[1;32mAmount 2 [$-50.25]: \u001b[0m"]+[81.514416, "o", "\r\r\n"]+[81.514624, "o", "\u001b[?1l\u001b>"]+[81.515346, "o", "\u001b[?1h\u001b="]+[81.515758, "o", "\u001b[1;32mAccount 3 (or . or enter to finish this transaction): \u001b[0m"]+[83.121045, "o", "\r\r\n"]+[83.121349, "o", "\u001b[?1l\u001b>"]+[83.124682, "o", "2023-03-15 opening balances\r\n cash $50.25\r\n equity $-50.25\r\n\r\n"]+[83.124741, "o", "\u001b[?1h\u001b="]+[83.125302, "o", "\u001b[1;32mSave this transaction to the journal ? [y]: \u001b[0m"]+[84.648814, "o", "\r\r\n"]+[84.649125, "o", "\u001b[?1l\u001b>"]+[84.650906, "o", "Saved"]+[84.650941, "o", ".\r\nStartin"]+[84.650952, "o", "g th"]+[84.650963, "o", "e "]+[84.650973, "o", "nex"]+[84.650983, "o", "t t"]+[84.650993, "o", "ran"]+[84.651004, "o", "sa"]+[84.651014, "o", "cti"]+[84.651025, "o", "on "]+[84.651035, "o", "(."]+[84.651045, "o", " or"]+[84.651055, "o", " ct"]+[84.651065, "o", "rl"]+[84.651075, "o", "-D/"]+[84.651086, "o", "ct"]+[84.651096, "o", "rl-"]+[84.651106, "o", "C t"]+[84.651116, "o", "o "]+[84.651126, "o", "qui"]+[84.651136, "o", "t)\r\n"]+[84.652027, "o", "\u001b[?1h\u001b="]+[84.652505, "o", "\u001b[1;32mDate [2023-03-15]: \u001b[0m"]+[86.062566, "o", "."]+[86.948614, "o", "\r\r\n"]+[86.94891, "o", "\u001b[?1l\u001b>"]+[86.961366, "o", "\u001b[?2004h"]+[86.961397, "o", "~$ "]+[90.08491, "o", "h"]+[90.169623, "o", "l"]+[90.259761, "o", "e"]+[90.393192, "o", "d"]+[90.48565, "o", "g"]+[90.643033, "o", "e"]+[90.731047, "o", "r"]+[90.845308, "o", " "]+[90.989267, "o", "f"]+[91.090677, "o", "i"]+[91.155866, "o", "l"]+[91.219015, "o", "e"]+[91.318928, "o", "s"]+[91.846494, "o", "\r\n"]+[91.846728, "o", "\u001b[?2004l\r"]+[91.89879, "o", "/Users/simon/.hledger.journal\r\n"]+[91.905659, "o", "\u001b[?2004h~$ "]+[93.218891, "o", "c"]+[93.397969, "o", "a"]+[93.545225, "o", "t"]+[93.677595, "o", " "]+[93.891204, "o", "."]+[94.181562, "o", "h"]+[94.223614, "o", "l"]+[94.309628, "o", "e"]+[94.451716, "o", "d"]+[94.549868, "o", "g"]+[94.684816, "o", "e"]+[94.792859, "o", "r"]+[94.855242, "o", "."]+[95.054234, "o", "j"]+[95.201191, "o", "o"]+[95.260721, "o", "u"]+[95.404053, "o", "r"]+[95.529899, "o", "n"]+[95.655928, "o", "a"]+[95.768796, "o", "l"]+[97.848002, "o", "\r\n\u001b[?2004l\r"]+[97.85161, "o", "; journal created 2023-03-15 by hledger\r\n\r\n2023-03-15 opening balances\r\n cash $50.25\r\n equity $-50.25\r\n"]+[100.830158, "o", "\u001b[?2004h"]+[100.830201, "o", "~$ "]+[105, "o", "\u001b[?2004l\r\r\n"]
+ embeddedfiles/balance.cast view
@@ -0,0 +1,100 @@+{"version": 2, "width": 80, "height": 25, "timestamp": 1678904454, "idle_time_limit": 0.5, "env": {"SHELL": "/opt/homebrew/bin/bash", "TERM": "xterm-256color"}, "title": "Show account balances and changes (balance)"}+[97.851861, "o", "\u001b[?2004h~$ "]+[108.4427, "o", "h"]+[108.511571, "o", "l"]+[108.563283, "o", "e"]+[108.730511, "o", "d"]+[108.803014, "o", "g"]+[108.958676, "o", "e"]+[109.045557, "o", "r"]+[109.179193, "o", " "]+[109.479806, "o", "b"]+[109.579409, "o", "a"]+[109.688887, "o", "l"]+[109.797373, "o", "a"]+[109.91028, "o", "n"]+[109.997384, "o", "c"]+[110.094392, "o", "e"]+[110.502797, "o", " "]+[110.689187, "o", " "]+[110.861258, "o", " "]+[110.983483, "o", "#"]+[111.339007, "o", " "]+[111.716216, "o", "s"]+[111.764379, "o", "h"]+[111.834664, "o", "o"]+[111.929608, "o", "w"]+[112.018977, "o", " "]+[112.127754, "o", "a"]+[112.222003, "o", "c"]+[112.376553, "o", "c"]+[112.447519, "o", "o"]+[112.508197, "o", "u"]+[112.718333, "o", "n"]+[112.776805, "o", "t"]+[112.882741, "o", " "]+[113.097111, "o", "b"]+[113.178418, "o", "a"]+[113.315295, "o", "l"]+[113.375822, "o", "a"]+[113.519044, "o", "n"]+[113.609534, "o", "c"]+[113.696372, "o", "e"]+[113.785515, "o", "s"]+[115.603503, "o", "\r\n"]+[115.603698, "o", "\u001b[?2004l\r"]+[115.658566, "o", " $50.25 cash\r\n \u001b[31m$-50.25\u001b[m equity\r\n--------------------\r\n 0 \r\n"]+[115.666234, "o", "\u001b[?2004h~$ "]+[117.006486, "o", "h"]+[117.097537, "o", "l"]+[117.154161, "o", "e"]+[117.331344, "o", "d"]+[117.4488, "o", "g"]+[117.596908, "o", "e"]+[117.690342, "o", "r"]+[117.799646, "o", " "]+[118.066348, "o", "b"]+[118.131542, "o", "a"]+[118.269237, "o", "l"]+[118.350699, "o", "a"]+[118.45648, "o", "n"]+[118.540488, "o", "c"]+[118.651362, "o", "e"]+[118.751114, "o", " "]+[119.039376, "o", "c"]+[119.146043, "o", "a"]+[119.258617, "o", "s"]+[119.41532, "o", "h"]+[119.7897, "o", " "]+[119.955405, "o", " "]+[120.142919, "o", " "]+[120.480195, "o", "#"]+[120.753113, "o", " "]+[120.904346, "o", "s"]+[121.013868, "o", "h"]+[121.06859, "o", "o"]+[121.151587, "o", "w"]+[121.241558, "o", " "]+[121.408393, "o", "j"]+[121.582123, "o", "u"]+[121.637329, "o", "s"]+[121.731132, "o", "t"]+[121.799539, "o", " "]+[121.972017, "o", "c"]+[122.064462, "o", "a"]+[122.157572, "o", "s"]+[122.355162, "o", "h"]+[122.459994, "o", " "]+[122.595849, "o", "a"]+[122.697417, "o", "c"]+[122.861577, "o", "c"]+[122.919021, "o", "o"]+[122.953757, "o", "u"]+[123.174305, "o", "n"]+[123.270113, "o", "t"]+[124.685978, "o", "\r\n"]+[124.686062, "o", "\u001b[?2004l\r"]+[124.827946, "o", " $50.25 cash\r\n--------------------\r\n $50.25 \r\n"]+[125, "o", "\u001b[?2004h"]+[125, "o", "~$ "]+[126, "o", "\u001b[?2004l\r\r\n"]
+ embeddedfiles/hledger-accounts.md view
@@ -0,0 +1,36 @@+# hledger accounts++> List account names.+> More information: <https://hledger.org/hledger.html#accounts>.++- Show all accounts used or declared in the default journal file:++`hledger accounts`++- Show accounts used by transactions:++`hledger accounts --used`++- Show accounts declared with account directives:++`hledger accounts --declared`++- Add new account directives, for accounts used but not declared, to the journal:++`hledger accounts --undeclared --directives >> {{2024-accounts.journal}}`++- Show accounts with `asset` in their name, and their declared/inferred types:++`hledger accounts asset --types`++- Show accounts of the `Asset` type:++`hledger accounts type:A`++- Show the first two levels of the accounts hierarchy:++`hledger accounts --tree --depth 2`++- Short form of the above:++`hledger acc -t -2`
+ embeddedfiles/hledger-add.md view
@@ -0,0 +1,24 @@+# hledger add++> Record new transactions with interactive prompting in the console.+> More information: <https://hledger.org/hledger.html#add>.++- Record new transactions, saving to the default journal file:++`hledger add`++- Add transactions to `2024.journal`, but also load `2023.journal` for completions:++`hledger add --file {{path/to/2024.journal}} --file {{path/to/2023.journal}}`++- Provide answers for the first four prompts:++`hledger add {{today}} '{{best buy}}' {{expenses:supplies}} '{{$20}}'`++- Show `add`'s options and documentation with `$PAGER`:++`hledger add --help`++- Show `add`'s documentation with `info` or `man` if available:++`hledger help add`
− embeddedfiles/hledger-api.1
@@ -1,143 +0,0 @@--.TH "hledger\-api" "1" "March 2019" "hledger\-api 1.14" "hledger User Manuals"----.SH NAME-.PP-hledger\-api \- web API server for the hledger accounting tool-.SH SYNOPSIS-.PP-\f[C]hledger\-api\ [OPTIONS]\f[]-.PD 0-.P-.PD-\f[C]hledger\ api\ \-\-\ [OPTIONS]\f[]-.SH DESCRIPTION-.PP-hledger is a cross\-platform program for tracking money, time, or any-other commodity, using double\-entry accounting and a simple, editable-file format.-hledger is inspired by and largely compatible with ledger(1).-.PP-hledger\-api is a simple web API server, intended to support-client\-side web apps operating on hledger data.-It comes with a series of simple client\-side app examples, which drive-its evolution.-.PP-Like hledger, it reads data from one or more files in hledger journal,-timeclock, timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-For more about this see hledger(1), hledger_journal(5) etc.-.PP-The server listens on IP address 127.0.0.1, accessible only to local-requests, by default.-You can change this with \f[C]\-\-host\f[], eg-\f[C]\-\-host\ 0.0.0.0\f[] to listen on all addresses.-Note there is no other access control, and hledger\-api allows file-browsing, so on shared machines you will certainly need to put it behind-an authenticating proxy to restrict access.-.PP-You can change the TCP port it listens on (default: 8001) with-\f[C]\-p\ PORT\f[].-.PP-API methods look like:-.IP-.nf-\f[C]-/api/v1/accountnames-/api/v1/transactions-/api/v1/prices-/api/v1/commodities-/api/v1/accounts-/api/v1/accounts/ACCTNAME-\f[]-.fi-.PP-See \f[C]/api/swagger.json\f[] for a full list in Swagger 2.0 format.-(Or you can run \f[C]hledger\-api\ \-\-swagger\f[] to print this in the-console.)-.PP-hledger\-api also serves files, from the current directory by default,-and the \f[C]/\f[] path will also show a directory listing.-This is convenient for serving client\-side web code, in addition to the-server\-side api.-.SH OPTIONS-.PP-Note: if invoking hledger\-api as a hledger subcommand, write-\f[C]\-\-\f[] before options as shown above.-.TP-.B \f[C]\-f\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or-\f[C]$HOME/.hledger.journal\f[])-.RS-.RE-.TP-.B \f[C]\-d\ \-\-static\-dir=DIR\f[]-serve files from a different directory (default: \f[C]\&.\f[])-.RS-.RE-.TP-.B \f[C]\-\-host=IPADDR\f[]-listen on this IP address (default: 127.0.0.1)-.RS-.RE-.TP-.B \f[C]\-p\ \-\-port=PORT\f[]-listen on this TCP port (default: 8001)-.RS-.RE-.TP-.B \f[C]\-\-swagger\f[]-print API docs in Swagger 2.0 format, and exit-.RS-.RE-.TP-.B \f[C]\-\-version\f[]-show version-.RS-.RE-.TP-.B \f[C]\-h\ \-\-help\f[]-show usage-.RS-.RE-.SH ENVIRONMENT-.PP-\f[B]LEDGER_FILE\f[] The journal file path when not specified with-\f[C]\-f\f[].-Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps-\f[C]C:/Users/USER/.hledger.journal\f[]).-.SH FILES-.PP-Reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-.SH BUGS-.PP-The need to precede options with \f[C]\-\-\f[] when invoked from hledger-is awkward.---.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)--.SH AUTHORS-Simon Michael <simon@joyful.com> and contributors--.SH COPYRIGHT--Copyright (C) 2007-2016 Simon Michael.-.br-Released under GNU GPL v3 or later.--.SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org
− embeddedfiles/hledger-api.info
@@ -1,86 +0,0 @@-This is hledger-api.info, produced by makeinfo version 6.5 from stdin.---File: hledger-api.info, Node: Top, Next: OPTIONS, Up: (dir)--hledger-api(1) hledger-api 1.14-*******************************--hledger-api is a simple web API server, intended to support client-side-web apps operating on hledger data. It comes with a series of simple-client-side app examples, which drive its evolution.-- Like hledger, it reads data from one or more files in hledger-journal, timeclock, timedot, or CSV format specified with '-f', or-'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps-'C:/Users/USER/.hledger.journal'). For more about this see hledger(1),-hledger_journal(5) etc.-- The server listens on IP address 127.0.0.1, accessible only to local-requests, by default. You can change this with '--host', eg '--host-0.0.0.0' to listen on all addresses. Note there is no other access-control, and hledger-api allows file browsing, so on shared machines you-will certainly need to put it behind an authenticating proxy to restrict-access.-- You can change the TCP port it listens on (default: 8001) with '-p-PORT'.-- API methods look like:--/api/v1/accountnames-/api/v1/transactions-/api/v1/prices-/api/v1/commodities-/api/v1/accounts-/api/v1/accounts/ACCTNAME-- See '/api/swagger.json' for a full list in Swagger 2.0 format. (Or-you can run 'hledger-api --swagger' to print this in the console.)-- hledger-api also serves files, from the current directory by default,-and the '/' path will also show a directory listing. This is convenient-for serving client-side web code, in addition to the server-side api.-* Menu:--* OPTIONS::---File: hledger-api.info, Node: OPTIONS, Prev: Top, Up: Top--1 OPTIONS-*********--Note: if invoking hledger-api as a hledger subcommand, write '--' before-options as shown above.--'-f --file=FILE'-- use a different input file. For stdin, use - (default:- '$LEDGER_FILE' or '$HOME/.hledger.journal')-'-d --static-dir=DIR'-- serve files from a different directory (default: '.')-'--host=IPADDR'-- listen on this IP address (default: 127.0.0.1)-'-p --port=PORT'-- listen on this TCP port (default: 8001)-'--swagger'-- print API docs in Swagger 2.0 format, and exit-'--version'-- show version-'-h --help'-- show usage---Tag Table:-Node: Top72-Node: OPTIONS1660-Ref: #options1745--End Tag Table
− embeddedfiles/hledger-api.txt
@@ -1,120 +0,0 @@--hledger-api(1) hledger User Manuals hledger-api(1)----NAME- hledger-api - web API server for the hledger accounting tool--SYNOPSIS- hledger-api [OPTIONS]- hledger api -- [OPTIONS]--DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any- other commodity, using double-entry accounting and a simple, editable- file format. hledger is inspired by and largely compatible with- ledger(1).-- hledger-api is a simple web API server, intended to support client-side- web apps operating on hledger data. It comes with a series of simple- client-side app examples, which drive its evolution.-- Like hledger, it reads data from one or more files in hledger journal,- timeclock, timedot, or CSV format specified with -f, or $LEDGER_FILE,- or $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal). For more about this see hledger(1),- hledger_journal(5) etc.-- The server listens on IP address 127.0.0.1, accessible only to local- requests, by default. You can change this with --host, eg- --host 0.0.0.0 to listen on all addresses. Note there is no other- access control, and hledger-api allows file browsing, so on shared- machines you will certainly need to put it behind an authenticating- proxy to restrict access.-- You can change the TCP port it listens on (default: 8001) with -p PORT.-- API methods look like:-- /api/v1/accountnames- /api/v1/transactions- /api/v1/prices- /api/v1/commodities- /api/v1/accounts- /api/v1/accounts/ACCTNAME-- See /api/swagger.json for a full list in Swagger 2.0 format. (Or you- can run hledger-api --swagger to print this in the console.)-- hledger-api also serves files, from the current directory by default,- and the / path will also show a directory listing. This is convenient- for serving client-side web code, in addition to the server-side api.--OPTIONS- Note: if invoking hledger-api as a hledger subcommand, write -- before- options as shown above.-- -f --file=FILE- use a different input file. For stdin, use - (default:- $LEDGER_FILE or $HOME/.hledger.journal)-- -d --static-dir=DIR- serve files from a different directory (default: .)-- --host=IPADDR- listen on this IP address (default: 127.0.0.1)-- -p --port=PORT- listen on this TCP port (default: 8001)-- --swagger- print API docs in Swagger 2.0 format, and exit-- --version- show version-- -h --help- show usage--ENVIRONMENT- LEDGER_FILE The journal file path when not specified with -f. Default:- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-- nal).--FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal).--BUGS- The need to precede options with -- when invoked from hledger is awk-- ward.----REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)---AUTHORS- Simon Michael <simon@joyful.com> and contributors---COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.---SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org----hledger-api 1.14 March 2019 hledger-api(1)
+ embeddedfiles/hledger-aregister.md view
@@ -0,0 +1,20 @@+# hledger aregister++> Show the transactions and running balances in one account, with each transaction on one line.+> More information: <https://hledger.org/hledger.html#aregister>.++- Show transactions and running balance in the `assets:bank:checking` account:++`hledger aregister assets:bank:checking`++- Show transactions and running balance in the first account named `*savings*`:++`hledger aregister savings`++- Show the checking account's cleared transactions, with a specified width:++`hledger aregister checking --cleared --width {{120}}`++- Show the checking register, including transactions from forecast rules:++`hledger aregister checking --forecast`
+ embeddedfiles/hledger-balance.md view
@@ -0,0 +1,37 @@+# hledger balance++> A flexible, general purpose "summing" report that shows accounts with some kind of numeric data.+> This can be balance changes per period, end balances, budget performance, unrealised capital gains, etc.+> More information: <https://hledger.org/hledger.html#balance>.++- Show the balance change in all accounts from all postings over all time:++`hledger balance`++- Show the balance change in accounts named `*expenses*`, as a tree, summarising the top two levels only:++`hledger balance {{expenses}} --tree --depth {{2}}`++- Show expenses each month, and their totals and averages, sorted by total; and their monthly budget goals:++`hledger balance {{expenses}} --monthly --row-total --average --sort-amount --budget`++- Similar to the above, shorter form, matching accounts by `Expense` type, as a two level tree without squashing boring accounts:++`hledger bal type:{{X}} -MTAS --budget -t -{{2}} --no-elide`++- Show end balances (including from postings before the start date), quarterly in 2024, in accounts named `*assets*` or `*liabilities*`:++`hledger balance --historical --period '{{quarterly in 2024}}' {{assets}} {{liabilities}}`++- Similar to the above, shorter form; also show zero balances, sort by total and summarise to three levels:++`hledger bal -HQ date:{{2024}} type:{{AL}} -ES -{{3}}`++- Show investment assets' market value in base currency at the end of each quarter:++`hledger bal -HVQ {{assets:investments}}`++- Show unrealised capital gains/losses from market price changes in each quarter, for non-cryptocurrency investment assets:++`hledger bal --gain -Q {{assets:investments}} not:{{cryptocurrency}}`
+ embeddedfiles/hledger-balancesheet.md view
@@ -0,0 +1,33 @@+# hledger balancesheet++> Show the end balances in asset and liability accounts.+> Amounts are shown with normal positive sign, as in conventional financial statements.+> More information: <https://hledger.org/hledger.html#balancesheet>.++- Show the current balances in `Asset` and `Liability` accounts, excluding zeros:++`hledger balancesheet`++- Show just the liquid assets (`Cash` account type):++`hledger balancesheet type:C`++- Include accounts with zero balances, and show the account hierarchy:++`hledger balancesheet --empty --tree`++- Show the balances at the end of each month:++`hledger balancesheet --monthly`++- Show the balances' market value in home currency at the end of each month:++`hledger balancesheet --monthly -V`++- Show quarterly balances, with just the top two levels of account hierarchy:++`hledger balancesheet --quarterly --tree --depth 2`++- Short form of the above, and generate HTML output in `bs.html`:++`hledger bs -Qt -2 -o bs.html`
+ embeddedfiles/hledger-import.md view
@@ -0,0 +1,28 @@+# hledger import++> Import new transactions from one or more data files to the main journal.+> More information: <https://hledger.org/hledger.html#import>.++- Import new transactions from `bank.csv`, using `bank.csv.rules` to convert:++`hledger import {{path/to/bank.csv}}`++- Show what would be imported from these two files, without doing anything:++`hledger import {{path/to/bank1.csv}} {{path/to/bank2.csv}} --dry-run`++- Import new transactions from all CSV files, using the same rules for all:++`hledger import --rules {{common.rules}} *.csv`++- Show conversion errors or results while editing `bank.csv.rules`:++`watchexec -- hledger -f {{path/to/bank.csv}} print`++- Mark `bank.csv`'s current data as seen, as if already imported:++`hledger import --catchup {{path/to/bank.csv}}`++- Mark `bank.csv` as all new, as if not yet imported:++`rm -f .latest.bank.csv`
+ embeddedfiles/hledger-incomestatement.md view
@@ -0,0 +1,21 @@+# hledger incomestatement++> Show revenue inflows and expense outflows during the report period.+> Amounts are shown with normal positive sign, as in conventional financial statements.+> More information: <https://hledger.org/hledger.html#incomestatement>.++- Show revenues and expenses (changes in `Revenue` and `Expense` accounts):++`hledger incomestatement`++- Show revenues and expenses each month:++`hledger incomestatement --monthly`++- Show monthly revenues/expenses/totals, largest first, summarised to 2 levels:++`hledger incomestatement --monthly --row-total --average --sort --depth 2`++- Short form of the above, and generate HTML output in `is.html`:++`hledger is -MTAS -2 -o is.html`
+ embeddedfiles/hledger-print.md view
@@ -0,0 +1,32 @@+# hledger print++> Show full journal entries, representing transactions.+> More information: <https://hledger.org/hledger.html#print>.++- Show all transactions in the default journal file:++`hledger print`++- Show transactions, with any implied amounts or costs made explicit:++`hledger print --explicit --infer-costs`++- Show transactions from two specified files, with amounts converted to cost:++`hledger print --file {{path/to/2023.journal}} --file {{path/to/2024.journal}} --cost`++- Show `$` transactions in `*food*` but not `*groceries*` accounts this month:++`hledger print cur:\\$ food not:groceries date:thismonth`++- Show transactions of amount 50 or more, with `whole foods` in their description:++`hledger print amt:'>50' desc:'whole foods'`++- Show cleared transactions, with `EUR` amounts rounded and with decimal commas:++`hledger print --cleared --commodity '1000, EUR' --round hard`++- Write transactions from `foo.journal` as a CSV file:++`hledger print --file {{path/to/foo.journal}} --output-file {{path/to/output_file.csv}}`
embeddedfiles/hledger-ui.1 view
@@ -1,520 +1,505 @@ -.TH "hledger\-ui" "1" "March 2019" "hledger\-ui 1.14" "hledger User Manuals"+.TH "HLEDGER\-UI" "1" "March 2026" "hledger-ui-1.52 " "hledger User Manuals" .SH NAME-.PP-hledger\-ui \- curses\-style interface for the hledger accounting tool+hledger\-ui \- terminal interface (TUI) for \f[CR]hledger\f[R], a+robust, friendly plain text accounting app. .SH SYNOPSIS-.PP-\f[C]hledger\-ui\ [OPTIONS]\ [QUERYARGS]\f[]+\f[CR]hledger\-ui [OPTS] [QUERYARGS]\f[R] .PD 0 .P .PD-\f[C]hledger\ ui\ \-\-\ [OPTIONS]\ [QUERYARGS]\f[]+or+.PD 0+.P+.PD+\f[CR]hledger ui [OPTS] [QUERYARGS]\f[R] .SH DESCRIPTION+This manual is for hledger\(aqs terminal interface, version 1.52.+See also the hledger manual for common concepts and file formats. .PP-hledger is a cross\-platform program for tracking money, time, or any-other commodity, using double\-entry accounting and a simple, editable-file format.-hledger is inspired by and largely compatible with ledger(1).+hledger is a robust, user\-friendly, cross\-platform set of programs for+tracking money, time, or any other commodity, using double\-entry+accounting and a simple, editable file format.+hledger is inspired by and largely compatible with ledger(1), and+largely interconvertible with beancount(1). .PP-hledger\-ui is hledger\[aq]s curses\-style interface, providing an-efficient full\-window text UI for viewing accounts and transactions,-and some limited data entry capability.-It is easier than hledger\[aq]s command\-line interface, and sometimes+hledger\-ui is hledger\(aqs terminal interface, providing an efficient+full\-window text UI for viewing accounts and transactions, and some+limited data entry capability.+It is easier than hledger\(aqs command\-line interface, and sometimes quicker and more convenient than the web interface. .PP-Note hledger\-ui has some different defaults (experimental):-.IP \[bu] 2-it generates rule\-based transactions and postings by default-(\-\-forecast and \-\-auto are always on).-.IP \[bu] 2-it hides transactions dated in the future by default (change this with-\-\-future or the F key).+Like hledger, it reads from (and appends to) a journal file specified by+the \f[CR]LEDGER_FILE\f[R] environment variable (defaulting to+\f[CR]$HOME/.hledger.journal\f[R]); or you can specify files with+\f[CR]\-f\f[R] options.+It can also read timeclock files, timedot files, or any CSV/SSV/TSV file+with a date field.+(See hledger(1) \-> Input for details.) .PP-Like hledger, it reads data from one or more files in hledger journal,-timeclock, timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-For more about this see hledger(1), hledger_journal(5) etc.+Unlike hledger, hledger\-ui hides all future\-dated transactions by+default.+They can be revealed, along with any rule\-generated periodic+transactions, by pressing the F key (or starting with \-\-forecast) to+enable \(dqforecast mode\(dq. .SH OPTIONS-.PP-Note: if invoking hledger\-ui as a hledger subcommand, write-\f[C]\-\-\f[] before options as shown above.-.PP-Any QUERYARGS are interpreted as a hledger search query which filters-the data.-.TP-.B \f[C]\-\-watch\f[]-watch for data and date changes and reload automatically-.RS-.RE-.TP-.B \f[C]\-\-theme=default|terminal|greenterm\f[]-use this custom display theme-.RS-.RE-.TP-.B \f[C]\-\-register=ACCTREGEX\f[]-start in the (first) matched account\[aq]s register screen-.RS-.RE-.TP-.B \f[C]\-\-change\f[]-show period balances (changes) at startup instead of historical balances-.RS-.RE-.TP-.B \f[C]\-F\ \-\-flat\f[]-show accounts as a list (default)-.RS-.RE-.TP-.B \f[C]\-T\ \-\-tree\f[]-show accounts as a tree-.RS-.RE-.TP-.B \f[C]\-\-future\f[]-show transactions dated later than today (normally hidden)-.RS-.RE-.PP-hledger input options:-.TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or-\f[C]$HOME/.hledger.journal\f[])-.RS-.RE-.TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)-.RS-.RE-.TP-.B \f[C]\-\-separator=CHAR\f[]-Field separator to expect when reading CSV (default: \[aq],\[aq])-.RS-.RE-.TP-.B \f[C]\-\-alias=OLD=NEW\f[]-rename accounts named OLD to NEW-.RS-.RE-.TP-.B \f[C]\-\-anon\f[]-anonymize accounts and payees-.RS-.RE-.TP-.B \f[C]\-\-pivot\ FIELDNAME\f[]-use some other field or tag for the account name-.RS-.RE-.TP-.B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions-.RS-.RE-.PP-hledger reporting options:-.TP-.B \f[C]\-b\ \-\-begin=DATE\f[]-include postings/txns on or after this date-.RS-.RE-.TP-.B \f[C]\-e\ \-\-end=DATE\f[]-include postings/txns before this date-.RS-.RE-.TP-.B \f[C]\-D\ \-\-daily\f[]-multiperiod/multicolumn report by day-.RS-.RE-.TP-.B \f[C]\-W\ \-\-weekly\f[]-multiperiod/multicolumn report by week-.RS-.RE-.TP-.B \f[C]\-M\ \-\-monthly\f[]-multiperiod/multicolumn report by month-.RS-.RE-.TP-.B \f[C]\-Q\ \-\-quarterly\f[]-multiperiod/multicolumn report by quarter-.RS-.RE-.TP-.B \f[C]\-Y\ \-\-yearly\f[]-multiperiod/multicolumn report by year-.RS-.RE-.TP-.B \f[C]\-p\ \-\-period=PERIODEXP\f[]-set start date, end date, and/or reporting interval all at once using-period expressions syntax (overrides the flags above)-.RS-.RE-.TP-.B \f[C]\-\-date2\f[]-match the secondary date instead (see command help for other effects)-.RS-.RE-.TP-.B \f[C]\-U\ \-\-unmarked\f[]-include only unmarked postings/txns (can combine with \-P or \-C)-.RS-.RE-.TP-.B \f[C]\-P\ \-\-pending\f[]-include only pending postings/txns-.RS-.RE-.TP-.B \f[C]\-C\ \-\-cleared\f[]-include only cleared postings/txns-.RS-.RE-.TP-.B \f[C]\-R\ \-\-real\f[]-include only non\-virtual postings-.RS-.RE-.TP-.B \f[C]\-NUM\ \-\-depth=NUM\f[]-hide/aggregate accounts or postings more than NUM levels deep-.RS-.RE-.TP-.B \f[C]\-E\ \-\-empty\f[]-show items with zero amount, normally hidden (and vice\-versa in-hledger\-ui/hledger\-web)-.RS-.RE-.TP-.B \f[C]\-B\ \-\-cost\f[]-convert amounts to their cost at transaction time (using the transaction-price, if any)-.RS-.RE-.TP-.B \f[C]\-V\ \-\-value\f[]-convert amounts to their market value on the report end date (using the-most recent applicable market price, if any)-.RS-.RE-.TP-.B \f[C]\-\-auto\f[]-apply automated posting rules to modify transactions.-.RS-.RE-.TP-.B \f[C]\-\-forecast\f[]-apply periodic transaction rules to generate future transactions, to 6-months from now or report end date.-.RS-.RE-.PP-When a reporting option appears more than once in the command line, the-last one takes precedence.+Any arguments are interpreted as a hledger query which filters the data.+hledger\-ui provides the following options:+.IP+.EX+Flags:+ \-w \-\-watch watch for data and date changes and reload+ automatically+ \-\-theme=THEME use this custom display theme (light,+ dark, terminal, greenterm)+ \-\-cash start in the cash accounts screen+ \-\-bs start in the balance sheet accounts screen+ \-\-is start in the income statement accounts screen+ \-\-all start in the all accounts screen+ \-\-register=ACCTREGEX start in the (first matched) account\(aqs register+ \-\-change show period balances (changes) at startup instead+ of historical balances+ \-l \-\-flat show accounts as a flat list (default)+ \-t \-\-tree show accounts as a tree+.EE .PP-Some reporting options can also be written as query arguments.+and also supports many of hledger\(aqs general options:+.IP+.EX+General input/data transformation flags:+ \-f \-\-file=[FMT:]FILE Read data from FILE, or from stdin if FILE is \-,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ \-\-rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ \-\-alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ \-\-auto generate extra postings by applying auto posting+ rules (\(dq=\(dq) to all transactions+ \-\-forecast[=PERIOD] Generate extra transactions from periodic rules+ (\(dq\(ti\(dq), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger\-ui, also make future\-dated transactions+ visible at startup.+ \-I \-\-ignore\-assertions don\(aqt check balance assertions by default+ \-\-txn\-balancing=... how to check that transactions are balanced:+ \(aqold\(aq: use global display precision+ \(aqexact\(aq: use transaction precision (default)+ \-\-infer\-costs infer conversion equity postings from costs+ \-\-infer\-equity infer costs from conversion equity postings+ \-\-infer\-market\-prices infer market prices from costs+ \-\-pivot=TAGNAME use a different field or tag as account names+ \-s \-\-strict do extra error checks (and override \-I)+ \-\-verbose\-tags add tags indicating generated/modified data++General output/reporting flags (supported by some commands):+ \-b \-\-begin=DATE include postings/transactions on/after this date+ \-e \-\-end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ \-D \-\-daily multiperiod report with 1 day interval+ \-W \-\-weekly multiperiod report with 1 week interval+ \-M \-\-monthly multiperiod report with 1 month interval+ \-Q \-\-quarterly multiperiod report with 1 quarter interval+ \-Y \-\-yearly multiperiod report with 1 year interval+ \-p \-\-period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ \-\-today=DATE override today\(aqs date (affects relative dates)+ \-\-date2 match/use secondary dates instead (deprecated)+ \-U \-\-unmarked include only unmarked postings/transactions+ \-P \-\-pending include only pending postings/transactions+ \-C \-\-cleared include only cleared postings/transactions+ (\-U/\-P/\-C can be combined)+ \-R \-\-real include only non\-virtual postings+ \-E \-\-empty Show zero items, which are normally hidden.+ In hledger\-ui & hledger\-web, do the opposite.+ \-\-depth=DEPTHEXP if a number (or \-NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ \-B \-\-cost show amounts converted to their cost/sale amount+ \-V \-\-market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to \-\-value=end.+ \-X \-\-exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to \-\-value=end,COMM.+ \-\-value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ \(aqthen\(aq: value on transaction dates+ \(aqend\(aq: value at period end(s)+ \(aqnow\(aq: value today+ YYYY\-MM\-DD: value on given date+ \-c \-\-commodity\-style=S Override a commodity\(aqs display style.+ Eg: \-c \(aq.\(aq or \-c \(aq1.000,00 EUR\(aq+ \-\-pretty[=YN] Use box\-drawing characters in text output? Can be+ \(aqy\(aq/\(aqyes\(aq or \(aqn\(aq/\(aqno\(aq.+ If YN is specified, the equals is required.++General help flags:+ \-h \-\-help show command line help+ \-\-tldr show command examples with tldr+ \-\-info show the manual with info+ \-\-man show the manual with man+ \-\-version show version information+ \-\-debug=[1\-9] show this much debug output (default: 1)+ \-\-pager=YN use a pager when needed ? y/yes (default) or n/no+ \-\-color=YNA \-\-colour use ANSI color ? y/yes, n/no, or auto (default)+.EE .PP-hledger help options:-.TP-.B \f[C]\-h\ \-\-help\f[]-show general usage (or after COMMAND, command usage)-.RS-.RE-.TP-.B \f[C]\-\-version\f[]-show version-.RS-.RE-.TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)-.RS-.RE+With hledger\-ui, the \f[CR]\-\-debug\f[R] option sends debug output to+a \f[CR]hledger\-ui.log\f[R] file in the current directory. .PP-A \@FILE argument will be expanded to the contents of FILE, which should-contain one command line option/argument per line.-(To prevent this, insert a \f[C]\-\-\f[] argument before.)+If you use the bash shell, you can auto\-complete flags by pressing TAB+in the command line.+If this is not working see Install > Shell completions.+.SH MOUSE+In most modern terminals, you can navigate through the screens with a+mouse or touchpad:+.IP \(bu 2+Use mouse wheel or trackpad to scroll up and down+.IP \(bu 2+Click on list items to go deeper+.IP \(bu 2+Click on the left margin (column 0) to go back. .SH KEYS+Keyboard gives more control. .PP-\f[C]?\f[] shows a help dialog listing all keys.+\f[CR]?\f[R] shows a help dialog listing all keys. (Some of these also appear in the quick help at the bottom of each-screen.) Press \f[C]?\f[] again (or \f[C]ESCAPE\f[], or \f[C]LEFT\f[])-to close it.+screen.)+Press \f[CR]?\f[R] again (or \f[CR]ESCAPE\f[R], or \f[CR]LEFT\f[R], or+\f[CR]q\f[R]) to close it. The following keys work on most screens: .PP-The cursor keys navigate: \f[C]right\f[] (or \f[C]enter\f[]) goes-deeper, \f[C]left\f[] returns to the previous screen,-\f[C]up\f[]/\f[C]down\f[]/\f[C]page\ up\f[]/\f[C]page\ down\f[]/\f[C]home\f[]/\f[C]end\f[]+The cursor keys navigate: \f[CR]RIGHT\f[R] or \f[CR]ENTER\f[R] goes+deeper, \f[CR]LEFT\f[R] returns to the previous screen,+\f[CR]UP\f[R]/\f[CR]DOWN\f[R]/\f[CR]PGUP\f[R]/\f[CR]PGDN\f[R]/\f[CR]HOME\f[R]/\f[CR]END\f[R] move up and down through lists.-Vi\-style (\f[C]h\f[]/\f[C]j\f[]/\f[C]k\f[]/\f[C]l\f[]) and Emacs\-style-(\f[C]CTRL\-p\f[]/\f[C]CTRL\-n\f[]/\f[C]CTRL\-f\f[]/\f[C]CTRL\-b\f[])+\f[CR]J\f[R]/\f[CR]K\f[R] jump down/up 10 items at a time.+Emacs\-style+(\f[CR]CTRL\-p\f[R]/\f[CR]CTRL\-n\f[R]/\f[CR]CTRL\-f\f[R]/\f[CR]CTRL\-b\f[R])+and VI\-style (\f[CR]k\f[R],\f[CR]j\f[R],\f[CR]l\f[R],\f[CR]h\f[R]) movement keys are also supported.-A tip: movement speed is limited by your keyboard repeat rate, to move-faster you may want to adjust it.-(If you\[aq]re on a mac, the Karabiner app is one way to do that.) .PP-With shift pressed, the cursor keys adjust the report period, limiting-the transactions to be shown (by default, all are shown).-\f[C]shift\-down/up\f[] steps downward and upward through these standard-report period durations: year, quarter, month, week, day.-Then, \f[C]shift\-left/right\f[] moves to the previous/next period.-\f[C]t\f[] sets the report period to today.-With the \f[C]\-\-watch\f[] option, when viewing a "current" period (the-current day, week, month, quarter, or year), the period will move-automatically to track the current date.-To set a non\-standard period, you can use \f[C]/\f[] and a-\f[C]date:\f[] query.+(Tip: movement speed is limited by your keyboard repeat rate, to move+faster you may want to adjust it.+On a mac, the Karabiner app is one way to do that.) .PP-\f[C]/\f[] lets you set a general filter query limiting the data shown,-using the same query terms as in hledger and hledger\-web.+\f[CR]/\f[R] lets you set a general filter query limiting the data+shown, using the same query terms as in hledger and hledger\-web. While editing the query, you can use CTRL\-a/e/d/k, BS, cursor keys;-press \f[C]ENTER\f[] to set it, or \f[C]ESCAPE\f[]to cancel.+press \f[CR]ENTER\f[R] to set it, or \f[CR]ESCAPE\f[R]to cancel. There are also keys for quickly adjusting some common filters like account depth and transaction status (see below).-\f[C]BACKSPACE\f[] or \f[C]DELETE\f[] removes all filters, showing all-transactions.+\f[CR]BACKSPACE\f[R] or \f[CR]DELETE\f[R] removes all filters, showing+all transactions. .PP-As mentioned above, hledger\-ui shows auto\-generated periodic-transactions, and hides future transactions (auto\-generated or not) by-default.-\f[C]F\f[] toggles showing and hiding these future transactions.-This is similar to using a query like \f[C]date:\-tomorrow\f[], but more-convenient.-(experimental)+As mentioned above, by default hledger\-ui hides future transactions \-+both ordinary transactions recorded in the journal, and periodic+transactions generated by rule.+\f[CR]F\f[R] toggles forecast mode, in which future/forecasted+transactions are shown. .PP-\f[C]ESCAPE\f[] removes all filters and jumps back to the top screen.-Or, it cancels a minibuffer edit or help dialog in progress.+Pressing \f[CR]SHIFT\-DOWN\f[R] narrows the report period, and pressing+\f[CR]SHIFT\-UP\f[R] expands it again.+When narrowed, the current report period is displayed in the header+line, pressing \f[CR]SHIFT\-LEFT\f[R] or \f[CR]SHIFT\-RIGHT\f[R] moves+to the previous or next period, and pressing \f[CR]T\f[R] sets the+period to \(dqtoday\(dq.+If you are using \f[CR]\-w/\-\-watch\f[R] and viewing a narrowed period+containing today, the view will follow any changes in system date+(moving to the period containing the new date).+(These keys work only with the standard Julian calendar+year/quarter/month/week/day periods; they are not affected by a custom+report interval specified at the command line.) .PP-\f[C]CTRL\-l\f[] redraws the screen and centers the selection if-possible (selections near the top won\[aq]t be centered, since we-don\[aq]t scroll above the top).+You can also specify a non\-standard period with \f[CR]/\f[R] and a+\f[CR]date:\f[R] query; in this case, the period is not movable with the+arrow keys. .PP-\f[C]g\f[] reloads from the data file(s) and updates the current screen-and any previous screens.+(Tip: arrow keys with Shift do not work out of the box in all terminal+software.+Eg in Apple\(aqs Terminal, the SHIFT\-DOWN and SHIFT\-UP keys must be+configured as follows: in Terminal\(aqs preferences, click Profiles,+select your current profile on the left, click Keyboard on the right,+click + and add this for SHIFT\-DOWN: \f[CR]\(rs033[1;2B\f[R], click ++and add this for SHIFT\-UP: \f[CR]\(rs033[1;2A\f[R].+\ In other terminals (Windows Terminal ?)+you might need to configure SHIFT\-RIGHT and SHIFT\-LEFT to emit+\f[CR]\(rs033[1;2C\f[R] and \f[CR]\(rs033[1;2D\f[R] respectively.)+.PP+\f[CR]ESCAPE\f[R] resets the UI state and jumps back to the top screen,+restoring the app\(aqs initial state at startup.+Or, it cancels minibuffer data entry or the help dialog.+.PP+\f[CR]CTRL\-l\f[R] redraws the screen and centers the selection if+possible (selections near the top won\(aqt be centered, since we+don\(aqt scroll above the top).+.PP+\f[CR]g\f[R] reloads from the data file(s) and updates the current+screen and any previous screens. (With large files, this could cause a noticeable pause.) .PP-\f[C]I\f[] toggles balance assertion checking.+\f[CR]I\f[R] toggles balance assertion checking. Disabling balance assertions temporarily can be useful for troubleshooting.+(If hledger\-ui was started with a \f[CR]\-\-pivot\f[R] option,+re\-enabling balance assertions with the \f[CR]I\f[R] key also reloads+the journal, like \f[CR]g\f[R].) .PP-\f[C]a\f[] runs command\-line hledger\[aq]s add command, and reloads the-updated file.+\f[CR]a\f[R] runs command\-line hledger\(aqs add command, and reloads+the updated file. This allows some basic data entry. .PP-\f[C]A\f[] is like \f[C]a\f[], but runs the hledger\-iadd tool, which-provides a curses\-style interface.-This key will be available if \f[C]hledger\-iadd\f[] is installed in-$PATH.+\f[CR]A\f[R] is like \f[CR]a\f[R], but runs the hledger\-iadd tool,+which provides a terminal interface.+This key will be available if \f[CR]hledger\-iadd\f[R] is installed in+$path. .PP-\f[C]E\f[] runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default-(\f[C]emacsclient\ \-a\ ""\ \-nw\f[]) on the journal file.+\f[CR]E\f[R] runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default+(\f[CR]emacsclient \-a \(dq\(dq \-nw\f[R]) on the journal file. With some editors (emacs, vi), the cursor will be positioned at the current transaction when invoked from the register and transaction screens, and at the error location (if possible) when invoked from the error screen. .PP-\f[C]q\f[] quits the application.-.PP-Additional screen\-specific keys are described below.-.SH SCREENS-.SS Accounts screen-.PP-This is normally the first screen displayed.-It lists accounts and their balances, like hledger\[aq]s balance-command.-By default, it shows all accounts and their latest ending balances-(including the balances of subaccounts).-if you specify a query on the command line, it shows just the matched-accounts and the balances from matched transactions.-.PP-Account names are shown as a flat list by default.-Press \f[C]T\f[] to toggle tree mode.-In flat mode, account balances are exclusive of subaccounts, except-where subaccounts are hidden by a depth limit (see below).-In tree mode, all account balances are inclusive of subaccounts.-.PP-To see less detail, press a number key, \f[C]1\f[] to \f[C]9\f[], to set-a depth limit.-Or use \f[C]\-\f[] to decrease and \f[C]+\f[]/\f[C]=\f[] to increase the-depth limit.-\f[C]0\f[] shows even less detail, collapsing all accounts to a single-total.-To remove the depth limit, set it higher than the maximum account depth,-or press \f[C]ESCAPE\f[].+\f[CR]B\f[R] toggles cost mode, showing amounts converted to their+cost\(aqs commodity (see hledger manual > Cost reporting. .PP-\f[C]H\f[] toggles between showing historical balances or period-balances.-Historical balances (the default) are ending balances at the end of the-report period, taking into account all transactions before that date-(filtered by the filter query if any), including transactions before the-start of the report period.-In other words, historical balances are what you would see on a bank-statement for that account (unless disturbed by a filter query).-Period balances ignore transactions before the report start date, so-they show the change in balance during the report period.-They are more useful eg when viewing a time log.+\f[CR]V\f[R] toggles value mode, showing amounts converted to their+market value (see hledger manual > Valuation flag).+More specifically,+.IP "1." 3+By default, the \f[CR]V\f[R] key toggles showing end value+(\f[CR]\-\-value=end\f[R]) on or off.+The valuation date will be the report end date if specified, otherwise+today.+.IP "2." 3+If you started hledger\-ui with some other valuation (such as+\f[CR]\-\-value=then,EUR\f[R]), the \f[CR]V\f[R] key toggles that off or+on. .PP-\f[C]U\f[] toggles filtering by unmarked status, including or excluding-unmarked postings in the balances.-Similarly, \f[C]P\f[] toggles pending postings, and \f[C]C\f[] toggles-cleared postings.-(By default, balances include all postings; if you activate one or two-status filters, only those postings are included; and if you activate-all three, the filter is removed.)+Cost/value tips: \- When showing end value, you can change the report+end date without restarting, by pressing \f[CR]/\f[R] and adding a query+like \f[CR]date:..YYYY\-MM\-DD\f[R].+\- Either cost mode, or value mode, can be active, but not both at once.+Cost mode takes precedence.+\- There\(aqs not yet any visual indicator that cost or value mode is+active, other than the amount values. .PP-\f[C]R\f[] toggles real mode, in which virtual postings are ignored.+\f[CR]q\f[R] quits the application. .PP-\f[C]Z\f[] toggles nonzero mode, in which only accounts with nonzero-balances are shown (hledger\-ui shows zero items by default, unlike-command\-line hledger).+Additional screen\-specific keys are described below.+.SH SCREENS+At startup, hledger\-ui shows a menu screen by default.+From here you can navigate to other screens using the cursor keys:+\f[CR]UP\f[R]/\f[CR]DOWN\f[R] to select, \f[CR]RIGHT\f[R] to move to the+selected screen, \f[CR]LEFT\f[R] to return to the previous screen.+Or you can use \f[CR]ESC\f[R] to return directly to the top menu screen. .PP-Press \f[C]right\f[] or \f[C]enter\f[] to view an account\[aq]s-transactions register.+You can also use a command line flag to specific a different startup+screen (\f[CR]\-\-cs\f[R], \f[CR]\-\-bs\f[R], \f[CR]\-\-is\f[R],+\f[CR]\-\-all\f[R], or \f[CR]\-\-register=ACCT\f[R]).+.SS Menu screen+This is the top\-most screen.+From here you can navigate to several screens listing accounts of+various types.+Note some of these may not show anything until you have configured+account types.+.SS Cash accounts screen+This screen shows \(dqcash\(dq (ie, liquid asset) accounts (like+\f[CR]hledger balancesheet type:c\f[R]).+It always shows balances (historical ending balances on the date shown+in the title line).+.SS Balance sheet accounts screen+This screen shows asset, liability and equity accounts (like+\f[CR]hledger balancesheetequity\f[R]).+It always shows balances.+.SS Income statement accounts screen+This screen shows revenue and expense accounts (like+\f[CR]hledger incomestatement\f[R]).+It always shows changes (balance changes in the period shown in the+title line).+.SS All accounts screen+This screen shows all accounts in your journal (unless filtered by a+query; like \f[CR]hledger balance\f[R]).+It shows balances by default; you can toggle showing changes with the+\f[CR]H\f[R] key. .SS Register screen-.PP-This screen shows the transactions affecting a particular account, like-a check register.-Each line represents one transaction and shows:-.IP \[bu] 2+This screen shows the transactions affecting a particular account.+Each line represents one transaction, and shows:+.IP \(bu 2 the other account(s) involved, in abbreviated form. (If there are both real and virtual postings, it shows only the accounts affected by real postings.)-.IP \[bu] 2-the overall change to the current account\[aq]s balance; positive for an+.IP \(bu 2+the overall change to the current account\(aqs balance; positive for an inflow to this account, negative for an outflow.-.IP \[bu] 2-the running historical total or period total for the current account,-after the transaction.-This can be toggled with \f[C]H\f[].-Similar to the accounts screen, the historical total is affected by-transactions (filtered by the filter query) before the report start-date, while the period total is not.-If the historical total is not disturbed by a filter query, it will be-the running historical balance you would see on a bank register for the-current account.+.IP \(bu 2+the running total after the transaction.+With the \f[CR]H\f[R] key you can toggle between+.RS 2+.IP \(bu 2+the period total, which is from just the transactions displayed+.IP \(bu 2+or the historical total, which includes any undisplayed transactions+before the start of the report period (and matching the filter query if+any).+This will be the running historical balance (what you would see on a+bank\(aqs website, eg) if not disturbed by a query.+.RE .PP-Transactions affecting this account\[aq]s subaccounts will be included-in the register if the accounts screen is in tree mode, or if it\[aq]s-in flat mode but this account has subaccounts which are not shown due to-a depth limit.+Note, this screen combines each transaction\(aqs in\-period postings to+a single line item, dated with the earliest in\-period transaction or+posting date (like hledger\(aqs \f[CR]aregister\f[R]).+So custom posting dates can cause the running balance to be temporarily+inaccurate.+(See hledger manual > aregister and posting dates.)+.PP+Transactions affecting this account\(aqs subaccounts will be included in+the register if the accounts screen is in tree mode, or if it\(aqs in+list mode but this account has subaccounts which are not shown due to a+depth limit. In other words, the register always shows the transactions contributing to the balance shown on the accounts screen.-.PD 0-.P-.PD-Tree mode/flat mode can be toggled with \f[C]T\f[] here also.+Tree mode/list mode can be toggled with \f[CR]t\f[R] here also. .PP-\f[C]U\f[] toggles filtering by unmarked status, showing or hiding+\f[CR]U\f[R] toggles filtering by unmarked status, showing or hiding unmarked transactions.-Similarly, \f[C]P\f[] toggles pending transactions, and \f[C]C\f[]+Similarly, \f[CR]P\f[R] toggles pending transactions, and \f[CR]C\f[R] toggles cleared transactions. (By default, transactions with all statuses are shown; if you activate one or two status filters, only those transactions are shown; and if you activate all three, the filter is removed.) .PP-\f[C]R\f[] toggles real mode, in which virtual postings are ignored.+\f[CR]R\f[R] toggles real mode, in which virtual postings are ignored. .PP-\f[C]Z\f[] toggles nonzero mode, in which only transactions posting a+\f[CR]z\f[R] toggles nonzero mode, in which only transactions posting a nonzero change are shown (hledger\-ui shows zero items by default, unlike command\-line hledger). .PP-Press \f[C]right\f[] (or \f[C]enter\f[]) to view the selected-transaction in detail.+Press \f[CR]RIGHT\f[R] to view the selected transaction in detail. .SS Transaction screen-.PP This screen shows a single transaction, as a general journal entry,-similar to hledger\[aq]s print command and journal format+similar to hledger\(aqs print command and journal format (hledger_journal(5)). .PP-The transaction\[aq]s date(s) and any cleared flag, transaction code,+The transaction\(aqs date(s) and any cleared flag, transaction code, description, comments, along with all of its account postings are shown. Simple transactions have two postings, but there can be more (or in certain cases, fewer). .PP-\f[C]up\f[] and \f[C]down\f[] will step through all transactions listed-in the previous account register screen.+\f[CR]UP\f[R] and \f[CR]DOWN\f[R] will step through all transactions+listed in the previous account register screen. In the title bar, the numbers in parentheses show your position within that account register. They will vary depending on which account register you came from (remember most transactions appear in multiple account registers).-The #N number preceding them is the transaction\[aq]s position within-the complete unfiltered journal, which is a more stable id (at least-until the next reload).-.SS Error screen+The #N number preceding them is the transaction\(aqs position within the+complete unfiltered journal, which is a more stable id (at least until+the next reload). .PP+On this screen (and the register screen), the \f[CR]E\f[R] key will open+your text editor with the cursor positioned at the current transaction+if possible.+.SS Error screen This screen will appear if there is a problem, such as a parse error, when you press g to reload. Once you have fixed the problem, press g again to reload and resume normal operation. (Or, you can press escape to cancel the reload attempt.)-.SH ENVIRONMENT+.SH WATCH MODE+One of hledger\-ui\(aqs best features is the auto\-reloading+\f[CR]\-w/\-\-watch\f[R] mode.+With this flag, it will update the display automatically whenever+changes are saved to the data files. .PP-\f[B]COLUMNS\f[] The screen width to use.-Default: the full terminal width.+This is very useful when reconciling.+A good workflow is to have your bank\(aqs 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:+.IP+.EX+$ hledger\-ui \-\-watch \-\-register checking \-C+.EE .PP-\f[B]LEDGER_FILE\f[] The journal file path when not specified with-\f[C]\-f\f[].-Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps-\f[C]C:/Users/USER/.hledger.journal\f[]).-.SH FILES+As you mark things cleared in the editor, you can see the effect+immediately without having to context switch.+This leaves more mental bandwidth for your accounting.+Of course you can still interact with hledger\-ui when needed, eg to+toggle cleared mode, or to explore the history.+.SS \-\-watch problems+\f[I]However.\f[R] There are limitations/unresolved bugs with+\f[CR]\-\-watch\f[R]:+.IP \(bu 2+It may not work at all for you, depending on platform or system+configuration.+On some unix systems, increasing fs.inotify.max_user_watches or+fs.file\-max parameters in /etc/sysctl.conf might help.+(#836)+.IP \(bu 2+It may not detect changes made from outside a virtual machine, ie by an+editor running on the host system.+.IP \(bu 2+It may not detect file changes on certain less common filesystems.+.IP \(bu 2+It may use increasing CPU and RAM over time, especially with large+files.+(This is probably not \-\-watch specific, you may be able to reproduce+it by pressing \f[CR]g\f[R] repeatedly.)+(#1825) .PP-Reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).+Tips/workarounds:+.IP \(bu 2+If \-\-watch won\(aqt work for you, press \f[CR]g\f[R] to reload data+manually instead.+.IP \(bu 2+If \-\-watch is leaking resources over time, quit and restart (or+suspend and resume) hledger\-ui when you\(aqre not using it.+.IP \(bu 2+When running hledger\-ui inside a VM, also make file changes inside the+VM.+.IP \(bu 2+When working with files mounted from another machine, make sure the+system clocks on both machines are roughly in agreement.+.SH ENVIRONMENT+\f[B]LEDGER_FILE\f[R] The main journal file to use when not specified+with \f[CR]\-f/\-\-file\f[R].+Default: \f[CR]$HOME/.hledger.journal\f[R]. .SH BUGS-.PP-The need to precede options with \f[C]\-\-\f[] when invoked from hledger-is awkward.+We welcome bug reports in the hledger issue tracker+(https://bugs.hledger.org), or on the hledger chat or mail list+(https://hledger.org/support). .PP-\f[C]\-f\-\f[] doesn\[aq]t work (hledger\-ui can\[aq]t read from stdin).+Some known issues: .PP-\f[C]\-V\f[] affects only the accounts screen.+\f[CR]\-f\-\f[R] doesn\(aqt work (hledger\-ui can\(aqt read from stdin). .PP-When you press \f[C]g\f[], the current and all previous screens are-regenerated, which may cause a noticeable pause with large files.-Also there is no visual indication that this is in progress.+\f[CR]\-\-watch\f[R] is not robust, especially with large files (see+WATCH MODE above). .PP-\f[C]\-\-watch\f[] is not yet fully robust.-It works well for normal usage, but many file changes in a short time-(eg saving the file thousands of times with an editor macro) can cause-problems at least on OSX.-Symptoms include: unresponsive UI, periodic resetting of the cursor-position, momentary display of parse errors, high CPU usage eventually-subsiding, and possibly a small but persistent build\-up of CPU usage-until the program is restarted.+If you press \f[CR]g\f[R] with large files, there could be a noticeable+pause with the UI unresponsive. -.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)- .SH AUTHORS-Simon Michael <simon@joyful.com> and contributors+Simon Michael <simon@joyful.com> and contributors.+.br+See http://hledger.org/CREDITS.html .SH COPYRIGHT+Copyright 2007-2023 Simon Michael and contributors. -Copyright (C) 2007-2016 Simon Michael.-.br+.SH LICENSE Released under GNU GPL v3 or later. .SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org+hledger(1), hledger\-ui(1), hledger\-web(1), ledger(1)
embeddedfiles/hledger-ui.info view
@@ -1,211 +1,212 @@-This is hledger-ui.info, produced by makeinfo version 6.5 from stdin.+This is hledger-ui.info, produced by makeinfo version 7.3 from stdin. +INFO-DIR-SECTION User Applications+START-INFO-DIR-ENTRY+* hledger-ui: (hledger-ui). Terminal UI for the hledger accounting tool.+END-INFO-DIR-ENTRY+ File: hledger-ui.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-ui(1) hledger-ui 1.14-*****************************+hledger-ui(1)+************* -hledger-ui is hledger's curses-style interface, providing an efficient+hledger-ui - terminal interface (TUI) for 'hledger', a robust, friendly+plain text accounting app.++ 'hledger-ui [OPTS] [QUERYARGS]'+or+'hledger ui [OPTS] [QUERYARGS]'++ This manual is for hledger's terminal interface, version 1.52. See+also the hledger manual for common concepts and file formats.++ hledger is a robust, user-friendly, cross-platform set of programs+for tracking money, time, or any other commodity, using double-entry+accounting and a simple, editable file format. hledger is inspired by+and largely compatible with ledger(1), and largely interconvertible with+beancount(1).++ hledger-ui is hledger's terminal interface, providing an efficient full-window text UI for viewing accounts and transactions, and some limited data entry capability. It is easier than hledger's command-line interface, and sometimes quicker and more convenient than the web interface. - Note hledger-ui has some different defaults (experimental):+ Like hledger, it reads from (and appends to) a journal file specified+by the 'LEDGER_FILE' environment variable (defaulting to+'$HOME/.hledger.journal'); or you can specify files with '-f' options.+It can also read timeclock files, timedot files, or any CSV/SSV/TSV file+with a date field. (See hledger(1) -> Input for details.) - * it generates rule-based transactions and postings by default- (-forecast and -auto are always on).- * it hides transactions dated in the future by default (change this- with -future or the F key).+ Unlike hledger, hledger-ui hides all future-dated transactions by+default. They can be revealed, along with any rule-generated periodic+transactions, by pressing the F key (or starting with -forecast) to+enable "forecast mode". - Like hledger, it reads data from one or more files in hledger-journal, timeclock, timedot, or CSV format specified with '-f', or-'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps-'C:/Users/USER/.hledger.journal'). For more about this see hledger(1),-hledger_journal(5) etc. * Menu: * OPTIONS::+* MOUSE:: * KEYS:: * SCREENS::+* WATCH MODE::+* ENVIRONMENT::+* BUGS:: -File: hledger-ui.info, Node: OPTIONS, Next: KEYS, Prev: Top, Up: Top+File: hledger-ui.info, Node: OPTIONS, Next: MOUSE, Prev: Top, Up: Top 1 OPTIONS ********* -Note: if invoking hledger-ui as a hledger subcommand, write '--' before-options as shown above.-- Any QUERYARGS are interpreted as a hledger search query which filters-the data.--'--watch'-- watch for data and date changes and reload automatically-'--theme=default|terminal|greenterm'-- use this custom display theme-'--register=ACCTREGEX'-- start in the (first) matched account's register screen-'--change'-- show period balances (changes) at startup instead of historical- balances-'-F --flat'-- show accounts as a list (default)-'-T --tree'-- show accounts as a tree-'--future'-- show transactions dated later than today (normally hidden)-- hledger input options:--'-f FILE --file=FILE'-- use a different input file. For stdin, use - (default:- '$LEDGER_FILE' or '$HOME/.hledger.journal')-'--rules-file=RULESFILE'-- Conversion rules file to use when reading CSV (default: FILE.rules)-'--separator=CHAR'-- Field separator to expect when reading CSV (default: ',')-'--alias=OLD=NEW'-- rename accounts named OLD to NEW-'--anon'-- anonymize accounts and payees-'--pivot FIELDNAME'-- use some other field or tag for the account name-'-I --ignore-assertions'-- ignore any failing balance assertions-- hledger reporting options:--'-b --begin=DATE'-- include postings/txns on or after this date-'-e --end=DATE'-- include postings/txns before this date-'-D --daily'-- multiperiod/multicolumn report by day-'-W --weekly'-- multiperiod/multicolumn report by week-'-M --monthly'-- multiperiod/multicolumn report by month-'-Q --quarterly'-- multiperiod/multicolumn report by quarter-'-Y --yearly'-- multiperiod/multicolumn report by year-'-p --period=PERIODEXP'-- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)-'--date2'-- match the secondary date instead (see command help for other- effects)-'-U --unmarked'-- include only unmarked postings/txns (can combine with -P or -C)-'-P --pending'-- include only pending postings/txns-'-C --cleared'-- include only cleared postings/txns-'-R --real'-- include only non-virtual postings-'-NUM --depth=NUM'-- hide/aggregate accounts or postings more than NUM levels deep-'-E --empty'-- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)-'-B --cost'-- convert amounts to their cost at transaction time (using the- transaction price, if any)-'-V --value'+Any arguments are interpreted as a hledger query which filters the data.+hledger-ui provides the following options: - convert amounts to their market value on the report end date (using- the most recent applicable market price, if any)-'--auto'+Flags:+ -w --watch watch for data and date changes and reload+ automatically+ --theme=THEME use this custom display theme (light,+ dark, terminal, greenterm)+ --cash start in the cash accounts screen+ --bs start in the balance sheet accounts screen+ --is start in the income statement accounts screen+ --all start in the all accounts screen+ --register=ACCTREGEX start in the (first matched) account's register+ --change show period balances (changes) at startup instead+ of historical balances+ -l --flat show accounts as a flat list (default)+ -t --tree show accounts as a tree - apply automated posting rules to modify transactions.-'--forecast'+ and also supports many of hledger's general options: - apply periodic transaction rules to generate future transactions,- to 6 months from now or report end date.+General input/data transformation flags:+ -f --file=[FMT:]FILE Read data from FILE, or from stdin if FILE is -,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ --rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ --alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ --auto generate extra postings by applying auto posting+ rules ("=") to all transactions+ --forecast[=PERIOD] Generate extra transactions from periodic rules+ ("~"), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger-ui, also make future-dated transactions+ visible at startup.+ -I --ignore-assertions don't check balance assertions by default+ --txn-balancing=... how to check that transactions are balanced:+ 'old': use global display precision+ 'exact': use transaction precision (default)+ --infer-costs infer conversion equity postings from costs+ --infer-equity infer costs from conversion equity postings+ --infer-market-prices infer market prices from costs+ --pivot=TAGNAME use a different field or tag as account names+ -s --strict do extra error checks (and override -I)+ --verbose-tags add tags indicating generated/modified data - When a reporting option appears more than once in the command line,-the last one takes precedence.+General output/reporting flags (supported by some commands):+ -b --begin=DATE include postings/transactions on/after this date+ -e --end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ -D --daily multiperiod report with 1 day interval+ -W --weekly multiperiod report with 1 week interval+ -M --monthly multiperiod report with 1 month interval+ -Q --quarterly multiperiod report with 1 quarter interval+ -Y --yearly multiperiod report with 1 year interval+ -p --period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ --today=DATE override today's date (affects relative dates)+ --date2 match/use secondary dates instead (deprecated)+ -U --unmarked include only unmarked postings/transactions+ -P --pending include only pending postings/transactions+ -C --cleared include only cleared postings/transactions+ (-U/-P/-C can be combined)+ -R --real include only non-virtual postings+ -E --empty Show zero items, which are normally hidden.+ In hledger-ui & hledger-web, do the opposite.+ --depth=DEPTHEXP if a number (or -NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ -B --cost show amounts converted to their cost/sale amount+ -V --market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to --value=end.+ -X --exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to --value=end,COMM.+ --value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ 'then': value on transaction dates+ 'end': value at period end(s)+ 'now': value today+ YYYY-MM-DD: value on given date+ -c --commodity-style=S Override a commodity's display style.+ Eg: -c '.' or -c '1.000,00 EUR'+ --pretty[=YN] Use box-drawing characters in text output? Can be+ 'y'/'yes' or 'n'/'no'.+ If YN is specified, the equals is required. - Some reporting options can also be written as query arguments.+General help flags:+ -h --help show command line help+ --tldr show command examples with tldr+ --info show the manual with info+ --man show the manual with man+ --version show version information+ --debug=[1-9] show this much debug output (default: 1)+ --pager=YN use a pager when needed ? y/yes (default) or n/no+ --color=YNA --colour use ANSI color ? y/yes, n/no, or auto (default) - hledger help options:+ With hledger-ui, the '--debug' option sends debug output to a+'hledger-ui.log' file in the current directory. -'-h --help'+ If you use the bash shell, you can auto-complete flags by pressing+TAB in the command line. If this is not working see Install > Shell+completions. - show general usage (or after COMMAND, command usage)-'--version'++File: hledger-ui.info, Node: MOUSE, Next: KEYS, Prev: OPTIONS, Up: Top - show version-'--debug[=N]'+2 MOUSE+******* - show debug output (levels 1-9, default: 1)+In most modern terminals, you can navigate through the screens with a+mouse or touchpad: - A @FILE argument will be expanded to the contents of FILE, which-should contain one command line option/argument per line. (To prevent-this, insert a '--' argument before.)+ * Use mouse wheel or trackpad to scroll up and down+ * Click on list items to go deeper+ * Click on the left margin (column 0) to go back. -File: hledger-ui.info, Node: KEYS, Next: SCREENS, Prev: OPTIONS, Up: Top+File: hledger-ui.info, Node: KEYS, Next: SCREENS, Prev: MOUSE, Up: Top -2 KEYS+3 KEYS ****** -'?' shows a help dialog listing all keys. (Some of these also appear in-the quick help at the bottom of each screen.) Press '?' again (or-'ESCAPE', or 'LEFT') to close it. The following keys work on most-screens:+Keyboard gives more control. - The cursor keys navigate: 'right' (or 'enter') goes deeper, 'left'-returns to the previous screen, 'up'/'down'/'page up'/'page-down'/'home'/'end' move up and down through lists. Vi-style-('h'/'j'/'k'/'l') and Emacs-style ('CTRL-p'/'CTRL-n'/'CTRL-f'/'CTRL-b')-movement keys are also supported. A tip: movement speed is limited by-your keyboard repeat rate, to move faster you may want to adjust it.-(If you're on a mac, the Karabiner app is one way to do that.)+ '?' shows a help dialog listing all keys. (Some of these also appear+in the quick help at the bottom of each screen.) Press '?' again (or+'ESCAPE', or 'LEFT', or 'q') to close it. The following keys work on+most screens: - With shift pressed, the cursor keys adjust the report period,-limiting the transactions to be shown (by default, all are shown).-'shift-down/up' steps downward and upward through these standard report-period durations: year, quarter, month, week, day. Then,-'shift-left/right' moves to the previous/next period. 't' sets the-report period to today. With the '--watch' option, when viewing a-"current" period (the current day, week, month, quarter, or year), the-period will move automatically to track the current date. To set a-non-standard period, you can use '/' and a 'date:' query.+ The cursor keys navigate: 'RIGHT' or 'ENTER' goes deeper, 'LEFT'+returns to the previous screen, 'UP'/'DOWN'/'PGUP'/'PGDN'/'HOME'/'END'+move up and down through lists. 'J'/'K' jump down/up 10 items at a+time. Emacs-style ('CTRL-p'/'CTRL-n'/'CTRL-f'/'CTRL-b') and VI-style+('k','j','l','h') movement keys are also supported. + (Tip: movement speed is limited by your keyboard repeat rate, to move+faster you may want to adjust it. On a mac, the Karabiner app is one+way to do that.)+ '/' lets you set a general filter query limiting the data shown, using the same query terms as in hledger and hledger-web. While editing the query, you can use CTRL-a/e/d/k, BS, cursor keys; press 'ENTER' to@@ -214,15 +215,38 @@ below). 'BACKSPACE' or 'DELETE' removes all filters, showing all transactions. - As mentioned above, hledger-ui shows auto-generated periodic-transactions, and hides future transactions (auto-generated or not) by-default. 'F' toggles showing and hiding these future transactions.-This is similar to using a query like 'date:-tomorrow', but more-convenient. (experimental)+ As mentioned above, by default hledger-ui hides future transactions -+both ordinary transactions recorded in the journal, and periodic+transactions generated by rule. 'F' toggles forecast mode, in which+future/forecasted transactions are shown. - 'ESCAPE' removes all filters and jumps back to the top screen. Or,-it cancels a minibuffer edit or help dialog in progress.+ Pressing 'SHIFT-DOWN' narrows the report period, and pressing+'SHIFT-UP' expands it again. When narrowed, the current report period+is displayed in the header line, pressing 'SHIFT-LEFT' or 'SHIFT-RIGHT'+moves to the previous or next period, and pressing 'T' sets the period+to "today". If you are using '-w/--watch' and viewing a narrowed period+containing today, the view will follow any changes in system date+(moving to the period containing the new date). (These keys work only+with the standard Julian calendar year/quarter/month/week/day periods;+they are not affected by a custom report interval specified at the+command line.) + You can also specify a non-standard period with '/' and a 'date:'+query; in this case, the period is not movable with the arrow keys.++ (Tip: arrow keys with Shift do not work out of the box in all+terminal software. Eg in Apple's Terminal, the SHIFT-DOWN and SHIFT-UP+keys must be configured as follows: in Terminal's preferences, click+Profiles, select your current profile on the left, click Keyboard on the+right, click + and add this for SHIFT-DOWN: '\033[1;2B', click + and add+this for SHIFT-UP: '\033[1;2A'. In other terminals (Windows Terminal ?)+you might need to configure SHIFT-RIGHT and SHIFT-LEFT to emit+'\033[1;2C' and '\033[1;2D' respectively.)++ 'ESCAPE' resets the UI state and jumps back to the top screen,+restoring the app's initial state at startup. Or, it cancels minibuffer+data entry or the help dialog.+ 'CTRL-l' redraws the screen and centers the selection if possible (selections near the top won't be centered, since we don't scroll above the top).@@ -232,14 +256,16 @@ pause.) 'I' toggles balance assertion checking. Disabling balance assertions-temporarily can be useful for troubleshooting.+temporarily can be useful for troubleshooting. (If hledger-ui was+started with a '--pivot' option, re-enabling balance assertions with the+'I' key also reloads the journal, like 'g'.) 'a' runs command-line hledger's add command, and reloads the updated file. This allows some basic data entry. 'A' is like 'a', but runs the hledger-iadd tool, which provides a-curses-style interface. This key will be available if 'hledger-iadd' is-installed in $PATH.+terminal interface. This key will be available if 'hledger-iadd' is+installed in $path. 'E' runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default ('emacsclient -a "" -nw') on the journal file. With some editors (emacs, vi), the@@ -247,80 +273,113 @@ the register and transaction screens, and at the error location (if possible) when invoked from the error screen. + 'B' toggles cost mode, showing amounts converted to their cost's+commodity (see hledger manual > Cost reporting.++ 'V' toggles value mode, showing amounts converted to their market+value (see hledger manual > Valuation flag). More specifically,++ 1. By default, the 'V' key toggles showing end value ('--value=end')+ on or off. The valuation date will be the report end date if+ specified, otherwise today.++ 2. If you started hledger-ui with some other valuation (such as+ '--value=then,EUR'), the 'V' key toggles that off or on.++ Cost/value tips: - When showing end value, you can change the report+end date without restarting, by pressing '/' and adding a query like+'date:..YYYY-MM-DD'. - Either cost mode, or value mode, can be active,+but not both at once. Cost mode takes precedence. - There's not yet+any visual indicator that cost or value mode is active, other than the+amount values.+ 'q' quits the application. Additional screen-specific keys are described below. -File: hledger-ui.info, Node: SCREENS, Prev: KEYS, Up: Top+File: hledger-ui.info, Node: SCREENS, Next: WATCH MODE, Prev: KEYS, Up: Top -3 SCREENS+4 SCREENS ********* +At startup, hledger-ui shows a menu screen by default. From here you+can navigate to other screens using the cursor keys: 'UP'/'DOWN' to+select, 'RIGHT' to move to the selected screen, 'LEFT' to return to the+previous screen. Or you can use 'ESC' to return directly to the top+menu screen.++ You can also use a command line flag to specific a different startup+screen ('--cs', '--bs', '--is', '--all', or '--register=ACCT').+ * Menu: -* Accounts screen::+* Menu screen::+* Cash accounts screen::+* Balance sheet accounts screen::+* Income statement accounts screen::+* All accounts screen:: * Register screen:: * Transaction screen:: * Error screen:: -File: hledger-ui.info, Node: Accounts screen, Next: Register screen, Up: SCREENS+File: hledger-ui.info, Node: Menu screen, Next: Cash accounts screen, Up: SCREENS -3.1 Accounts screen-===================+4.1 Menu screen+=============== -This is normally the first screen displayed. It lists accounts and-their balances, like hledger's balance command. By default, it shows-all accounts and their latest ending balances (including the balances of-subaccounts). if you specify a query on the command line, it shows just-the matched accounts and the balances from matched transactions.+This is the top-most screen. From here you can navigate to several+screens listing accounts of various types. Note some of these may not+show anything until you have configured account types. - Account names are shown as a flat list by default. Press 'T' to-toggle tree mode. In flat mode, account balances are exclusive of-subaccounts, except where subaccounts are hidden by a depth limit (see-below). In tree mode, all account balances are inclusive of-subaccounts.++File: hledger-ui.info, Node: Cash accounts screen, Next: Balance sheet accounts screen, Prev: Menu screen, Up: SCREENS - To see less detail, press a number key, '1' to '9', to set a depth-limit. Or use '-' to decrease and '+'/'=' to increase the depth limit.-'0' shows even less detail, collapsing all accounts to a single total.-To remove the depth limit, set it higher than the maximum account depth,-or press 'ESCAPE'.+4.2 Cash accounts screen+======================== - 'H' toggles between showing historical balances or period balances.-Historical balances (the default) are ending balances at the end of the-report period, taking into account all transactions before that date-(filtered by the filter query if any), including transactions before the-start of the report period. In other words, historical balances are-what you would see on a bank statement for that account (unless-disturbed by a filter query). Period balances ignore transactions-before the report start date, so they show the change in balance during-the report period. They are more useful eg when viewing a time log.+This screen shows "cash" (ie, liquid asset) accounts (like 'hledger+balancesheet type:c'). It always shows balances (historical ending+balances on the date shown in the title line). - 'U' toggles filtering by unmarked status, including or excluding-unmarked postings in the balances. Similarly, 'P' toggles pending-postings, and 'C' toggles cleared postings. (By default, balances-include all postings; if you activate one or two status filters, only-those postings are included; and if you activate all three, the filter-is removed.)++File: hledger-ui.info, Node: Balance sheet accounts screen, Next: Income statement accounts screen, Prev: Cash accounts screen, Up: SCREENS - 'R' toggles real mode, in which virtual postings are ignored.+4.3 Balance sheet accounts screen+================================= - 'Z' toggles nonzero mode, in which only accounts with nonzero-balances are shown (hledger-ui shows zero items by default, unlike-command-line hledger).+This screen shows asset, liability and equity accounts (like 'hledger+balancesheetequity'). It always shows balances. - Press 'right' or 'enter' to view an account's transactions register.++File: hledger-ui.info, Node: Income statement accounts screen, Next: All accounts screen, Prev: Balance sheet accounts screen, Up: SCREENS +4.4 Income statement accounts screen+====================================++This screen shows revenue and expense accounts (like 'hledger+incomestatement'). It always shows changes (balance changes in the+period shown in the title line).+ -File: hledger-ui.info, Node: Register screen, Next: Transaction screen, Prev: Accounts screen, Up: SCREENS+File: hledger-ui.info, Node: All accounts screen, Next: Register screen, Prev: Income statement accounts screen, Up: SCREENS -3.2 Register screen+4.5 All accounts screen+=======================++This screen shows all accounts in your journal (unless filtered by a+query; like 'hledger balance'). It shows balances by default; you can+toggle showing changes with the 'H' key.+++File: hledger-ui.info, Node: Register screen, Next: Transaction screen, Prev: All accounts screen, Up: SCREENS++4.6 Register screen =================== -This screen shows the transactions affecting a particular account, like-a check register. Each line represents one transaction and shows:+This screen shows the transactions affecting a particular account. Each+line represents one transaction, and shows: * the other account(s) involved, in abbreviated form. (If there are both real and virtual postings, it shows only the accounts affected@@ -329,20 +388,29 @@ * the overall change to the current account's balance; positive for an inflow to this account, negative for an outflow. - * the running historical total or period total for the current- account, after the transaction. This can be toggled with 'H'.- Similar to the accounts screen, the historical total is affected by- transactions (filtered by the filter query) before the report start- date, while the period total is not. If the historical total is- not disturbed by a filter query, it will be the running historical- balance you would see on a bank register for the current account.+ * the running total after the transaction. With the 'H' key you can+ toggle between + * the period total, which is from just the transactions+ displayed+ * or the historical total, which includes any undisplayed+ transactions before the start of the report period (and+ matching the filter query if any). This will be the running+ historical balance (what you would see on a bank's website,+ eg) if not disturbed by a query.++ Note, this screen combines each transaction's in-period postings to a+single line item, dated with the earliest in-period transaction or+posting date (like hledger's 'aregister'). So custom posting dates can+cause the running balance to be temporarily inaccurate. (See hledger+manual > aregister and posting dates.)+ Transactions affecting this account's subaccounts will be included in-the register if the accounts screen is in tree mode, or if it's in flat+the register if the accounts screen is in tree mode, or if it's in list mode but this account has subaccounts which are not shown due to a depth limit. In other words, the register always shows the transactions-contributing to the balance shown on the accounts screen.-Tree mode/flat mode can be toggled with 'T' here also.+contributing to the balance shown on the accounts screen. Tree+mode/list mode can be toggled with 't' here also. 'U' toggles filtering by unmarked status, showing or hiding unmarked transactions. Similarly, 'P' toggles pending transactions, and 'C'@@ -353,17 +421,16 @@ 'R' toggles real mode, in which virtual postings are ignored. - 'Z' toggles nonzero mode, in which only transactions posting a+ 'z' toggles nonzero mode, in which only transactions posting a nonzero change are shown (hledger-ui shows zero items by default, unlike command-line hledger). - Press 'right' (or 'enter') to view the selected transaction in-detail.+ Press 'RIGHT' to view the selected transaction in detail. File: hledger-ui.info, Node: Transaction screen, Next: Error screen, Prev: Register screen, Up: SCREENS -3.3 Transaction screen+4.7 Transaction screen ====================== This screen shows a single transaction, as a general journal entry,@@ -375,7 +442,7 @@ Simple transactions have two postings, but there can be more (or in certain cases, fewer). - 'up' and 'down' will step through all transactions listed in the+ 'UP' and 'DOWN' will step through all transactions listed in the previous account register screen. In the title bar, the numbers in parentheses show your position within that account register. They will vary depending on which account register you came from (remember most@@ -384,10 +451,14 @@ unfiltered journal, which is a more stable id (at least until the next reload). + On this screen (and the register screen), the 'E' key will open your+text editor with the cursor positioned at the current transaction if+possible.+ File: hledger-ui.info, Node: Error screen, Prev: Transaction screen, Up: SCREENS -3.4 Error screen+4.8 Error screen ================ This screen will appear if there is a problem, such as a parse error,@@ -396,21 +467,114 @@ to cancel the reload attempt.) +File: hledger-ui.info, Node: WATCH MODE, Next: ENVIRONMENT, Prev: SCREENS, Up: Top++5 WATCH MODE+************++One of hledger-ui's best features is the auto-reloading '-w/--watch'+mode. With this flag, it will update the display automatically whenever+changes are saved to the data files.++ 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:++$ hledger-ui --watch --register checking -C++ As you mark things cleared in the editor, you can see the effect+immediately without having to context switch. This leaves more mental+bandwidth for your accounting. Of course you can still interact with+hledger-ui when needed, eg to toggle cleared mode, or to explore the+history.++* Menu:++* --watch problems::+++File: hledger-ui.info, Node: --watch problems, Up: WATCH MODE++5.1 -watch problems+===================++_However._ There are limitations/unresolved bugs with '--watch':++ * It may not work at all for you, depending on platform or system+ configuration. On some unix systems, increasing+ fs.inotify.max_user_watches or fs.file-max parameters in+ /etc/sysctl.conf might help. (#836)+ * It may not detect changes made from outside a virtual machine, ie+ by an editor running on the host system.+ * It may not detect file changes on certain less common filesystems.+ * It may use increasing CPU and RAM over time, especially with large+ files. (This is probably not -watch specific, you may be able to+ reproduce it by pressing 'g' repeatedly.) (#1825)++ Tips/workarounds:++ * If -watch won't work for you, press 'g' to reload data manually+ instead.+ * If -watch is leaking resources over time, quit and restart (or+ suspend and resume) hledger-ui when you're not using it.+ * When running hledger-ui inside a VM, also make file changes inside+ the VM.+ * When working with files mounted from another machine, make sure the+ system clocks on both machines are roughly in agreement.+++File: hledger-ui.info, Node: ENVIRONMENT, Next: BUGS, Prev: WATCH MODE, Up: Top++6 ENVIRONMENT+*************++*LEDGER_FILE* The main journal file to use when not specified with+'-f/--file'. Default: '$HOME/.hledger.journal'.+++File: hledger-ui.info, Node: BUGS, Prev: ENVIRONMENT, Up: Top++7 BUGS+******++We welcome bug reports in the hledger issue tracker+(https://bugs.hledger.org), or on the hledger chat or mail list+(https://hledger.org/support).++ Some known issues:++ '-f-' doesn't work (hledger-ui can't read from stdin).++ '--watch' is not robust, especially with large files (see WATCH MODE+above).++ If you press 'g' with large files, there could be a noticeable pause+with the UI unresponsive.++ Tag Table:-Node: Top71-Node: OPTIONS1100-Ref: #options1197-Node: KEYS4616-Ref: #keys4711-Node: SCREENS7967-Ref: #screens8052-Node: Accounts screen8142-Ref: #accounts-screen8270-Node: Register screen10486-Ref: #register-screen10641-Node: Transaction screen12637-Ref: #transaction-screen12795-Node: Error screen13665-Ref: #error-screen13787+Node: Top221+Node: OPTIONS1867+Node: MOUSE8751+Node: KEYS9083+Node: SCREENS14267+Node: Menu screen15007+Node: Cash accounts screen15323+Node: Balance sheet accounts screen15684+Node: Income statement accounts screen16020+Node: All accounts screen16405+Node: Register screen16768+Node: Transaction screen19211+Node: Error screen20391+Node: WATCH MODE20757+Node: --watch problems21655+Node: ENVIRONMENT22902+Node: BUGS23135 End Tag Table+++Local Variables:+coding: utf-8+End:
+ embeddedfiles/hledger-ui.md view
@@ -0,0 +1,32 @@+# hledger-ui++> A terminal interface (TUI) for `hledger`, a robust, friendly plain text accounting app.+> More information: <https://hledger.org/hledger-ui.html>.++- Start in the main menu screen, reading from the default journal file:++`hledger-ui`++- Start with a different color theme:++`hledger-ui --theme {{terminal|greenterm|dark}}`++- Start in the balance sheet accounts screen, showing hierarchy down to level 3:++`hledger-ui --bs --tree --depth 3`++- Start in this account's screen, showing cleared transactions, and reload on change:++`hledger-ui --register {{assets:bank:checking}} --cleared --watch`++- Read two journal files, and show amounts as current value when known:++`hledger-ui --file {{path/to/2024.journal}} --file {{path/to/2024-prices.journal}} --value now`++- Show the manual in Info format, if possible:++`hledger-ui --info`++- Display help:++`hledger-ui --help`
embeddedfiles/hledger-ui.txt view
@@ -1,409 +1,450 @@ -hledger-ui(1) hledger User Manuals hledger-ui(1)--+HLEDGER-UI(1) hledger User Manuals HLEDGER-UI(1) NAME- hledger-ui - curses-style interface for the hledger accounting tool+ hledger-ui - terminal interface (TUI) for hledger, a robust, friendly plain+ text accounting app. SYNOPSIS- hledger-ui [OPTIONS] [QUERYARGS]- hledger ui -- [OPTIONS] [QUERYARGS]+ hledger-ui [OPTS] [QUERYARGS]+ or+ hledger ui [OPTS] [QUERYARGS] DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any- other commodity, using double-entry accounting and a simple, editable- file format. hledger is inspired by and largely compatible with- ledger(1).-- hledger-ui is hledger's curses-style interface, providing an efficient- full-window text UI for viewing accounts and transactions, and some- limited data entry capability. It is easier than hledger's com-- mand-line interface, and sometimes quicker and more convenient than the- web interface.+ This manual is for hledger's terminal interface, version 1.52. See also+ the hledger manual for common concepts and file formats. - Note hledger-ui has some different defaults (experimental):+ hledger is a robust, user-friendly, cross-platform set of programs for+ tracking money, time, or any other commodity, using double-entry accounting+ and a simple, editable file format. hledger is inspired by and largely+ compatible with ledger(1), and largely interconvertible with beancount(1). - o it generates rule-based transactions and postings by default (--fore-- cast and --auto are always on).+ hledger-ui is hledger's terminal interface, providing an efficient+ full-window text UI for viewing accounts and transactions, and some limited+ data entry capability. It is easier than hledger's command-line interface,+ and sometimes quicker and more convenient than the web interface. - o it hides transactions dated in the future by default (change this- with --future or the F key).+ Like hledger, it reads from (and appends to) a journal file specified by+ the LEDGER_FILE environment variable (defaulting to $HOME/.hledger.jour-+ nal); or you can specify files with -f options. It can also read timeclock+ files, timedot files, or any CSV/SSV/TSV file with a date field. (See+ hledger(1) -> Input for details.) - Like hledger, it reads data from one or more files in hledger journal,- timeclock, timedot, or CSV format specified with -f, or $LEDGER_FILE,- or $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal). For more about this see hledger(1),- hledger_journal(5) etc.+ Unlike hledger, hledger-ui hides all future-dated transactions by default.+ They can be revealed, along with any rule-generated periodic transactions,+ by pressing the F key (or starting with --forecast) to enable "forecast+ mode". OPTIONS- Note: if invoking hledger-ui as a hledger subcommand, write -- before- options as shown above.-- Any QUERYARGS are interpreted as a hledger search query which filters- the data.-- --watch- watch for data and date changes and reload automatically-- --theme=default|terminal|greenterm- use this custom display theme-- --register=ACCTREGEX- start in the (first) matched account's register screen-- --change- show period balances (changes) at startup instead of historical- balances-- -F --flat- show accounts as a list (default)+ Any arguments are interpreted as a hledger query which filters the data.+ hledger-ui provides the following options: - -T --tree- show accounts as a tree+ Flags:+ -w --watch watch for data and date changes and reload+ automatically+ --theme=THEME use this custom display theme (light,+ dark, terminal, greenterm)+ --cash start in the cash accounts screen+ --bs start in the balance sheet accounts screen+ --is start in the income statement accounts screen+ --all start in the all accounts screen+ --register=ACCTREGEX start in the (first matched) account's register+ --change show period balances (changes) at startup instead+ of historical balances+ -l --flat show accounts as a flat list (default)+ -t --tree show accounts as a tree - --future- show transactions dated later than today (normally hidden)+ and also supports many of hledger's general options: - hledger input options:+ General input/data transformation flags:+ -f --file=[FMT:]FILE Read data from FILE, or from stdin if FILE is -,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ --rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ --alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ --auto generate extra postings by applying auto posting+ rules ("=") to all transactions+ --forecast[=PERIOD] Generate extra transactions from periodic rules+ ("~"), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger-ui, also make future-dated transactions+ visible at startup.+ -I --ignore-assertions don't check balance assertions by default+ --txn-balancing=... how to check that transactions are balanced:+ 'old': use global display precision+ 'exact': use transaction precision (default)+ --infer-costs infer conversion equity postings from costs+ --infer-equity infer costs from conversion equity postings+ --infer-market-prices infer market prices from costs+ --pivot=TAGNAME use a different field or tag as account names+ -s --strict do extra error checks (and override -I)+ --verbose-tags add tags indicating generated/modified data - -f FILE --file=FILE- use a different input file. For stdin, use - (default:- $LEDGER_FILE or $HOME/.hledger.journal)+ General output/reporting flags (supported by some commands):+ -b --begin=DATE include postings/transactions on/after this date+ -e --end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ -D --daily multiperiod report with 1 day interval+ -W --weekly multiperiod report with 1 week interval+ -M --monthly multiperiod report with 1 month interval+ -Q --quarterly multiperiod report with 1 quarter interval+ -Y --yearly multiperiod report with 1 year interval+ -p --period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ --today=DATE override today's date (affects relative dates)+ --date2 match/use secondary dates instead (deprecated)+ -U --unmarked include only unmarked postings/transactions+ -P --pending include only pending postings/transactions+ -C --cleared include only cleared postings/transactions+ (-U/-P/-C can be combined)+ -R --real include only non-virtual postings+ -E --empty Show zero items, which are normally hidden.+ In hledger-ui & hledger-web, do the opposite.+ --depth=DEPTHEXP if a number (or -NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ -B --cost show amounts converted to their cost/sale amount+ -V --market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to --value=end.+ -X --exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to --value=end,COMM.+ --value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ 'then': value on transaction dates+ 'end': value at period end(s)+ 'now': value today+ YYYY-MM-DD: value on given date+ -c --commodity-style=S Override a commodity's display style.+ Eg: -c '.' or -c '1.000,00 EUR'+ --pretty[=YN] Use box-drawing characters in text output? Can be+ 'y'/'yes' or 'n'/'no'.+ If YN is specified, the equals is required. - --rules-file=RULESFILE- Conversion rules file to use when reading CSV (default:- FILE.rules)+ General help flags:+ -h --help show command line help+ --tldr show command examples with tldr+ --info show the manual with info+ --man show the manual with man+ --version show version information+ --debug=[1-9] show this much debug output (default: 1)+ --pager=YN use a pager when needed ? y/yes (default) or n/no+ --color=YNA --colour use ANSI color ? y/yes, n/no, or auto (default) - --separator=CHAR- Field separator to expect when reading CSV (default: ',')+ With hledger-ui, the --debug option sends debug output to a hledger-ui.log+ file in the current directory. - --alias=OLD=NEW- rename accounts named OLD to NEW+ If you use the bash shell, you can auto-complete flags by pressing TAB in+ the command line. If this is not working see Install > Shell completions. - --anon anonymize accounts and payees+MOUSE+ In most modern terminals, you can navigate through the screens with a mouse+ or touchpad: - --pivot FIELDNAME- use some other field or tag for the account name+ * Use mouse wheel or trackpad to scroll up and down - -I --ignore-assertions- ignore any failing balance assertions+ * Click on list items to go deeper - hledger reporting options:+ * Click on the left margin (column 0) to go back. - -b --begin=DATE- include postings/txns on or after this date+KEYS+ Keyboard gives more control. - -e --end=DATE- include postings/txns before this date+ ? shows a help dialog listing all keys. (Some of these also appear in the+ quick help at the bottom of each screen.) Press ? again (or ESCAPE, or+ LEFT, or q) to close it. The following keys work on most screens: - -D --daily- multiperiod/multicolumn report by day+ The cursor keys navigate: RIGHT or ENTER goes deeper, LEFT returns to the+ previous screen, UP/DOWN/PGUP/PGDN/HOME/END move up and down through lists.+ J/K jump down/up 10 items at a time. Emacs-style+ (CTRL-p/CTRL-n/CTRL-f/CTRL-b) and VI-style (k,j,l,h) movement keys are also+ supported. - -W --weekly- multiperiod/multicolumn report by week+ (Tip: movement speed is limited by your keyboard repeat rate, to move+ faster you may want to adjust it. On a mac, the Karabiner app is one way+ to do that.) - -M --monthly- multiperiod/multicolumn report by month+ / lets you set a general filter query limiting the data shown, using the+ same query terms as in hledger and hledger-web. While editing the query,+ you can use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set it, or ES-+ CAPEto cancel. There are also keys for quickly adjusting some common fil-+ ters like account depth and transaction status (see below). BACKSPACE or+ DELETE removes all filters, showing all transactions. - -Q --quarterly- multiperiod/multicolumn report by quarter+ As mentioned above, by default hledger-ui hides future transactions - both+ ordinary transactions recorded in the journal, and periodic transactions+ generated by rule. F toggles forecast mode, in which future/forecasted+ transactions are shown. - -Y --yearly- multiperiod/multicolumn report by year+ Pressing SHIFT-DOWN narrows the report period, and pressing SHIFT-UP ex-+ pands it again. When narrowed, the current report period is displayed in+ the header line, pressing SHIFT-LEFT or SHIFT-RIGHT moves to the previous+ or next period, and pressing T sets the period to "today". If you are us-+ ing -w/--watch and viewing a narrowed period containing today, the view+ will follow any changes in system date (moving to the period containing the+ new date). (These keys work only with the standard Julian calendar+ year/quarter/month/week/day periods; they are not affected by a custom re-+ port interval specified at the command line.) - -p --period=PERIODEXP- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)+ You can also specify a non-standard period with / and a date: query; in+ this case, the period is not movable with the arrow keys. - --date2- match the secondary date instead (see command help for other- effects)+ (Tip: arrow keys with Shift do not work out of the box in all terminal+ software. Eg in Apple's Terminal, the SHIFT-DOWN and SHIFT-UP keys must be+ configured as follows: in Terminal's preferences, click Profiles, select+ your current profile on the left, click Keyboard on the right, click + and+ add this for SHIFT-DOWN: \033[1;2B, click + and add this for SHIFT-UP:+ \033[1;2A. In other terminals (Windows Terminal ?) you might need to+ configure SHIFT-RIGHT and SHIFT-LEFT to emit \033[1;2C and \033[1;2D re-+ spectively.) - -U --unmarked- include only unmarked postings/txns (can combine with -P or -C)+ ESCAPE resets the UI state and jumps back to the top screen, restoring the+ app's initial state at startup. Or, it cancels minibuffer data entry or+ the help dialog. - -P --pending- include only pending postings/txns+ CTRL-l redraws the screen and centers the selection if possible (selections+ near the top won't be centered, since we don't scroll above the top). - -C --cleared- include only cleared postings/txns+ g reloads from the data file(s) and updates the current screen and any pre-+ vious screens. (With large files, this could cause a noticeable pause.) - -R --real- include only non-virtual postings+ I toggles balance assertion checking. Disabling balance assertions tem-+ porarily can be useful for troubleshooting. (If hledger-ui was started+ with a --pivot option, re-enabling balance assertions with the I key also+ reloads the journal, like g.) - -NUM --depth=NUM- hide/aggregate accounts or postings more than NUM levels deep+ a runs command-line hledger's add command, and reloads the updated file.+ This allows some basic data entry. - -E --empty- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)+ A is like a, but runs the hledger-iadd tool, which provides a terminal in-+ terface. This key will be available if hledger-iadd is installed in $path. - -B --cost- convert amounts to their cost at transaction time (using the- transaction price, if any)+ E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emacsclient -a "" -nw)+ on the journal file. With some editors (emacs, vi), the cursor will be po-+ sitioned at the current transaction when invoked from the register and+ transaction screens, and at the error location (if possible) when invoked+ from the error screen. - -V --value- convert amounts to their market value on the report end date- (using the most recent applicable market price, if any)+ B toggles cost mode, showing amounts converted to their cost's commodity+ (see hledger manual > Cost reporting. - --auto apply automated posting rules to modify transactions.+ V toggles value mode, showing amounts converted to their market value (see+ hledger manual > Valuation flag). More specifically, - --forecast- apply periodic transaction rules to generate future transac-- tions, to 6 months from now or report end date.+ 1. By default, the V key toggles showing end value (--value=end) on or off.+ The valuation date will be the report end date if specified, otherwise+ today. - When a reporting option appears more than once in the command line, the- last one takes precedence.+ 2. If you started hledger-ui with some other valuation (such as+ --value=then,EUR), the V key toggles that off or on. - Some reporting options can also be written as query arguments.+ Cost/value tips: - When showing end value, you can change the report end+ date without restarting, by pressing / and adding a query like+ date:..YYYY-MM-DD. - Either cost mode, or value mode, can be active, but+ not both at once. Cost mode takes precedence. - There's not yet any vi-+ sual indicator that cost or value mode is active, other than the amount+ values. - hledger help options:+ q quits the application. - -h --help- show general usage (or after COMMAND, command usage)+ Additional screen-specific keys are described below. - --version- show version+SCREENS+ At startup, hledger-ui shows a menu screen by default. From here you can+ navigate to other screens using the cursor keys: UP/DOWN to select, RIGHT+ to move to the selected screen, LEFT to return to the previous screen. Or+ you can use ESC to return directly to the top menu screen. - --debug[=N]- show debug output (levels 1-9, default: 1)+ You can also use a command line flag to specific a different startup screen+ (--cs, --bs, --is, --all, or --register=ACCT). - A @FILE argument will be expanded to the contents of FILE, which should- contain one command line option/argument per line. (To prevent this,- insert a -- argument before.)+ Menu screen+ This is the top-most screen. From here you can navigate to several screens+ listing accounts of various types. Note some of these may not show any-+ thing until you have configured account types. -KEYS- ? shows a help dialog listing all keys. (Some of these also appear in- the quick help at the bottom of each screen.) Press ? again (or ESCAPE,- or LEFT) to close it. The following keys work on most screens:+ Cash accounts screen+ This screen shows "cash" (ie, liquid asset) accounts (like hledger bal-+ ancesheet type:c). It always shows balances (historical ending balances on+ the date shown in the title line). - The cursor keys navigate: right (or enter) goes deeper, left returns to- the previous screen, up/down/page up/page down/home/end move up and- down through lists. Vi-style (h/j/k/l) and Emacs-style- (CTRL-p/CTRL-n/CTRL-f/CTRL-b) movement keys are also supported. A tip:- movement speed is limited by your keyboard repeat rate, to move faster- you may want to adjust it. (If you're on a mac, the Karabiner app is- one way to do that.)+ Balance sheet accounts screen+ This screen shows asset, liability and equity accounts (like hledger bal-+ ancesheetequity). It always shows balances. - With shift pressed, the cursor keys adjust the report period, limiting- the transactions to be shown (by default, all are shown).- shift-down/up steps downward and upward through these standard report- period durations: year, quarter, month, week, day. Then,- shift-left/right moves to the previous/next period. t sets the report- period to today. With the --watch option, when viewing a "current"- period (the current day, week, month, quarter, or year), the period- will move automatically to track the current date. To set a non-stan-- dard period, you can use / and a date: query.+ Income statement accounts screen+ This screen shows revenue and expense accounts (like hledger incomestate-+ ment). It always shows changes (balance changes in the period shown in the+ title line). - / lets you set a general filter query limiting the data shown, using- the same query terms as in hledger and hledger-web. While editing the- query, you can use CTRL-a/e/d/k, BS, cursor keys; press ENTER to set- it, or ESCAPEto cancel. There are also keys for quickly adjusting some- common filters like account depth and transaction status (see below).- BACKSPACE or DELETE removes all filters, showing all transactions.+ All accounts screen+ This screen shows all accounts in your journal (unless filtered by a query;+ like hledger balance). It shows balances by default; you can toggle show-+ ing changes with the H key. - As mentioned above, hledger-ui shows auto-generated periodic transac-- tions, and hides future transactions (auto-generated or not) by- default. F toggles showing and hiding these future transactions. This- is similar to using a query like date:-tomorrow, but more convenient.- (experimental)+ Register screen+ This screen shows the transactions affecting a particular account. Each+ line represents one transaction, and shows: - ESCAPE removes all filters and jumps back to the top screen. Or, it- cancels a minibuffer edit or help dialog in progress.+ * the other account(s) involved, in abbreviated form. (If there are both+ real and virtual postings, it shows only the accounts affected by real+ postings.) - CTRL-l redraws the screen and centers the selection if possible (selec-- tions near the top won't be centered, since we don't scroll above the- top).+ * the overall change to the current account's balance; positive for an in-+ flow to this account, negative for an outflow. - g reloads from the data file(s) and updates the current screen and any- previous screens. (With large files, this could cause a noticeable- pause.)+ * the running total after the transaction. With the H key you can toggle+ between - I toggles balance assertion checking. Disabling balance assertions- temporarily can be useful for troubleshooting.+ * the period total, which is from just the transactions displayed - a runs command-line hledger's add command, and reloads the updated- file. This allows some basic data entry.+ * or the historical total, which includes any undisplayed transactions+ before the start of the report period (and matching the filter query if+ any). This will be the running historical balance (what you would see+ on a bank's website, eg) if not disturbed by a query. - A is like a, but runs the hledger-iadd tool, which provides a- curses-style interface. This key will be available if hledger-iadd is- installed in $PATH.+ Note, this screen combines each transaction's in-period postings to a sin-+ gle line item, dated with the earliest in-period transaction or posting+ date (like hledger's aregister). So custom posting dates can cause the+ running balance to be temporarily inaccurate. (See hledger manual > areg-+ ister and posting dates.) - E runs $HLEDGER_UI_EDITOR, or $EDITOR, or a default (emac-- sclient -a "" -nw) on the journal file. With some editors (emacs, vi),- the cursor will be positioned at the current transaction when invoked- from the register and transaction screens, and at the error location- (if possible) when invoked from the error screen.+ Transactions affecting this account's subaccounts will be included in the+ register if the accounts screen is in tree mode, or if it's in list mode+ but this account has subaccounts which are not shown due to a depth limit.+ In other words, the register always shows the transactions contributing to+ the balance shown on the accounts screen. Tree mode/list mode can be tog-+ gled with t here also. - q quits the application.+ U toggles filtering by unmarked status, showing or hiding unmarked transac-+ tions. Similarly, P toggles pending transactions, and C toggles cleared+ transactions. (By default, transactions with all statuses are shown; if+ you activate one or two status filters, only those transactions are shown;+ and if you activate all three, the filter is removed.) - Additional screen-specific keys are described below.+ R toggles real mode, in which virtual postings are ignored. -SCREENS- Accounts screen- This is normally the first screen displayed. It lists accounts and- their balances, like hledger's balance command. By default, it shows- all accounts and their latest ending balances (including the balances- of subaccounts). if you specify a query on the command line, it shows- just the matched accounts and the balances from matched transactions.+ z toggles nonzero mode, in which only transactions posting a nonzero change+ are shown (hledger-ui shows zero items by default, unlike command-line+ hledger). - Account names are shown as a flat list by default. Press T to toggle- tree mode. In flat mode, account balances are exclusive of subac-- counts, except where subaccounts are hidden by a depth limit (see- below). In tree mode, all account balances are inclusive of subac-- counts.+ Press RIGHT to view the selected transaction in detail. - To see less detail, press a number key, 1 to 9, to set a depth limit.- Or use - to decrease and +/= to increase the depth limit. 0 shows even- less detail, collapsing all accounts to a single total. To remove the- depth limit, set it higher than the maximum account depth, or press- ESCAPE.+ Transaction screen+ This screen shows a single transaction, as a general journal entry, similar+ to hledger's print command and journal format (hledger_journal(5)). - H toggles between showing historical balances or period balances. His-- torical balances (the default) are ending balances at the end of the- report period, taking into account all transactions before that date- (filtered by the filter query if any), including transactions before- the start of the report period. In other words, historical balances- are what you would see on a bank statement for that account (unless- disturbed by a filter query). Period balances ignore transactions- before the report start date, so they show the change in balance during- the report period. They are more useful eg when viewing a time log.+ The transaction's date(s) and any cleared flag, transaction code, descrip-+ tion, comments, along with all of its account postings are shown. Simple+ transactions have two postings, but there can be more (or in certain cases,+ fewer). - U toggles filtering by unmarked status, including or excluding unmarked- postings in the balances. Similarly, P toggles pending postings, and C- toggles cleared postings. (By default, balances include all postings;- if you activate one or two status filters, only those postings are- included; and if you activate all three, the filter is removed.)+ UP and DOWN will step through all transactions listed in the previous ac-+ count register screen. In the title bar, the numbers in parentheses show+ your position within that account register. They will vary depending on+ which account register you came from (remember most transactions appear in+ multiple account registers). The #N number preceding them is the transac-+ tion's position within the complete unfiltered journal, which is a more+ stable id (at least until the next reload). - R toggles real mode, in which virtual postings are ignored.+ On this screen (and the register screen), the E key will open your text ed-+ itor with the cursor positioned at the current transaction if possible. - Z toggles nonzero mode, in which only accounts with nonzero balances- are shown (hledger-ui shows zero items by default, unlike command-line- hledger).+ Error screen+ This screen will appear if there is a problem, such as a parse error, when+ you press g to reload. Once you have fixed the problem, press g again to+ reload and resume normal operation. (Or, you can press escape to cancel+ the reload attempt.) - Press right or enter to view an account's transactions register.+WATCH MODE+ One of hledger-ui's best features is the auto-reloading -w/--watch mode.+ With this flag, it will update the display automatically whenever changes+ are saved to the data files. - Register screen- This screen shows the transactions affecting a particular account, like- a check register. Each line represents one transaction and shows:+ 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: - o the other account(s) involved, in abbreviated form. (If there are- both real and virtual postings, it shows only the accounts affected- by real postings.)+ $ hledger-ui --watch --register checking -C - o the overall change to the current account's balance; positive for an- inflow to this account, negative for an outflow.+ As you mark things cleared in the editor, you can see the effect immedi-+ ately without having to context switch. This leaves more mental bandwidth+ for your accounting. Of course you can still interact with hledger-ui when+ needed, eg to toggle cleared mode, or to explore the history. - o the running historical total or period total for the current account,- after the transaction. This can be toggled with H. Similar to the- accounts screen, the historical total is affected by transactions- (filtered by the filter query) before the report start date, while- the period total is not. If the historical total is not disturbed by- a filter query, it will be the running historical balance you would- see on a bank register for the current account.+ --watch problems+ However. There are limitations/unresolved bugs with --watch: - Transactions affecting this account's subaccounts will be included in- the register if the accounts screen is in tree mode, or if it's in flat- mode but this account has subaccounts which are not shown due to a- depth limit. In other words, the register always shows the transac-- tions contributing to the balance shown on the accounts screen.- Tree mode/flat mode can be toggled with T here also.+ * It may not work at all for you, depending on platform or system configu-+ ration. On some unix systems, increasing fs.inotify.max_user_watches or+ fs.file-max parameters in /etc/sysctl.conf might help. (#836) - U toggles filtering by unmarked status, showing or hiding unmarked- transactions. Similarly, P toggles pending transactions, and C toggles- cleared transactions. (By default, transactions with all statuses are- shown; if you activate one or two status filters, only those transac-- tions are shown; and if you activate all three, the filter is removed.)+ * It may not detect changes made from outside a virtual machine, ie by an+ editor running on the host system. - R toggles real mode, in which virtual postings are ignored.+ * It may not detect file changes on certain less common filesystems. - Z toggles nonzero mode, in which only transactions posting a nonzero- change are shown (hledger-ui shows zero items by default, unlike com-- mand-line hledger).+ * It may use increasing CPU and RAM over time, especially with large files.+ (This is probably not --watch specific, you may be able to reproduce it+ by pressing g repeatedly.) (#1825) - Press right (or enter) to view the selected transaction in detail.+ Tips/workarounds: - Transaction screen- This screen shows a single transaction, as a general journal entry,- similar to hledger's print command and journal format (hledger_jour-- nal(5)).+ * If --watch won't work for you, press g to reload data manually instead. - The transaction's date(s) and any cleared flag, transaction code,- description, comments, along with all of its account postings are- shown. Simple transactions have two postings, but there can be more- (or in certain cases, fewer).+ * If --watch is leaking resources over time, quit and restart (or suspend+ and resume) hledger-ui when you're not using it. - up and down will step through all transactions listed in the previous- account register screen. In the title bar, the numbers in parentheses- show your position within that account register. They will vary- depending on which account register you came from (remember most trans-- actions appear in multiple account registers). The #N number preceding- them is the transaction's position within the complete unfiltered jour-- nal, which is a more stable id (at least until the next reload).+ * When running hledger-ui inside a VM, also make file changes inside the+ VM. - Error screen- This screen will appear if there is a problem, such as a parse error,- when you press g to reload. Once you have fixed the problem, press g- again to reload and resume normal operation. (Or, you can press escape- to cancel the reload attempt.)+ * When working with files mounted from another machine, make sure the sys-+ tem clocks on both machines are roughly in agreement. ENVIRONMENT- COLUMNS The screen width to use. Default: the full terminal width.-- LEDGER_FILE The journal file path when not specified with -f. Default:- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-- nal).--FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal).+ LEDGER_FILE The main journal file to use when not specified with -f/--file.+ Default: $HOME/.hledger.journal. BUGS- The need to precede options with -- when invoked from hledger is awk-- ward.+ We welcome bug reports in the hledger issue tracker+ (https://bugs.hledger.org), or on the hledger chat or mail list+ (https://hledger.org/support). - -f- doesn't work (hledger-ui can't read from stdin).+ Some known issues: - -V affects only the accounts screen.+ -f- doesn't work (hledger-ui can't read from stdin). - When you press g, the current and all previous screens are regenerated,- which may cause a noticeable pause with large files. Also there is no- visual indication that this is in progress.+ --watch is not robust, especially with large files (see WATCH MODE above). - --watch is not yet fully robust. It works well for normal usage, but- many file changes in a short time (eg saving the file thousands of- times with an editor macro) can cause problems at least on OSX. Symp-- toms include: unresponsive UI, periodic resetting of the cursor posi-- tion, momentary display of parse errors, high CPU usage eventually sub-- siding, and possibly a small but persistent build-up of CPU usage until- the program is restarted.+ If you press g with large files, there could be a noticeable pause with the+ UI unresponsive. -REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)-- AUTHORS- Simon Michael <simon@joyful.com> and contributors+ Simon Michael <simon@joyful.com> and contributors.+ See http://hledger.org/CREDITS.html COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.+ Copyright 2007-2023 Simon Michael and contributors. -SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org+LICENSE+ Released under GNU GPL v3 or later. +SEE ALSO+ hledger(1), hledger-ui(1), hledger-web(1), ledger(1) -hledger-ui 1.14 March 2019 hledger-ui(1)+hledger-ui-1.52 March 2026 HLEDGER-UI(1)
embeddedfiles/hledger-web.1 view
@@ -1,329 +1,259 @@ -.TH "hledger\-web" "1" "March 2019" "hledger\-web 1.14" "hledger User Manuals"+.TH "HLEDGER\-WEB" "1" "March 2026" "hledger-web-1.52 " "hledger User Manuals" .SH NAME-.PP-hledger\-web \- web interface for the hledger accounting tool+hledger\-web \- web interface and API for \f[CR]hledger\f[R], a robust,+friendly plain text accounting app. .SH SYNOPSIS-.PP-\f[C]hledger\-web\ [OPTIONS]\f[]+\f[CR]hledger\-web [OPTS] [QUERY]\f[R] .PD 0 .P .PD-\f[C]hledger\ web\ \-\-\ [OPTIONS]\f[]+or+.PD 0+.P+.PD+\f[CR]hledger web [OPTS] [QUERY]\f[R] .SH DESCRIPTION+This manual is for hledger\(aqs web interface, version 1.52.+See also the hledger manual for common concepts and file formats. .PP-hledger is a cross\-platform program for tracking money, time, or any-other commodity, using double\-entry accounting and a simple, editable-file format.-hledger is inspired by and largely compatible with ledger(1).+hledger is a robust, user\-friendly, cross\-platform set of programs for+tracking money, time, or any other commodity, using double\-entry+accounting and a simple, editable file format.+hledger is inspired by and largely compatible with ledger(1), and+largely interconvertible with beancount(1). .PP-hledger\-web is hledger\[aq]s web interface.-It starts a simple web application for browsing and adding transactions,-and optionally opens it in a web browser window if possible.+hledger\-web is a simple web application for browsing and adding+transactions. It provides a more user\-friendly UI than the hledger CLI or hledger\-ui-interface, showing more at once (accounts, the current account register,+TUI, showing more at once (accounts, the current account register, balance charts) and allowing history\-aware data entry, interactive searching, and bookmarking. .PP-hledger\-web also lets you share a ledger with multiple users, or even+hledger\-web also lets you share a journal with multiple users, or even the public web. There is no access control, so if you need that you should put it behind a suitable web proxy. As a small protection against data loss when running an unprotected-instance, it writes a numbered backup of the main journal file (only ?)-on every edit.-.PP-Like hledger, it reads data from one or more files in hledger journal,-timeclock, timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-For more about this see hledger(1), hledger_journal(5) etc.-.SH OPTIONS-.PP-Command\-line options and arguments may be used to set an initial filter-on the data.-These filter options are not shown in the web UI, but it will be applied-in addition to any search query entered there.+instance, it writes a numbered backup of the main journal file (only) on+every edit. .PP-Note: if invoking hledger\-web as a hledger subcommand, write-\f[C]\-\-\f[] before options, as shown in the synopsis above.-.TP-.B \f[C]\-\-serve\f[]-serve and log requests, don\[aq]t browse or auto\-exit-.RS-.RE-.TP-.B \f[C]\-\-host=IPADDR\f[]-listen on this IP address (default: 127.0.0.1)-.RS-.RE-.TP-.B \f[C]\-\-port=PORT\f[]-listen on this TCP port (default: 5000)-.RS-.RE-.TP-.B \f[C]\-\-base\-url=URL\f[]-set the base url (default: http://IPADDR:PORT).-You would change this when sharing over the network, or integrating-within a larger website.-.RS-.RE-.TP-.B \f[C]\-\-file\-url=URL\f[]-set the static files url (default: BASEURL/static).-hledger\-web normally serves static files itself, but if you wanted to-serve them from another server for efficiency, you would set the url-with this.-.RS-.RE-.TP-.B \f[C]\-\-capabilities=CAP[,CAP..]\f[]-enable the view, add, and/or manage capabilities (default: view,add)-.RS-.RE-.TP-.B \f[C]\-\-capabilities\-header=HTTPHEADER\f[]-read capabilities to enable from a HTTP header, like-X\-Sandstorm\-Permissions (default: disabled)-.RS-.RE+Like hledger, it reads from (and appends to) a journal file specified by+the \f[CR]LEDGER_FILE\f[R] environment variable (defaulting to+\f[CR]$HOME/.hledger.journal\f[R]); or you can specify files with+\f[CR]\-f\f[R] options.+It can also read timeclock files, timedot files, or any CSV/SSV/TSV file+with a date field.+(See hledger(1) \-> Input for details.) .PP-hledger input options:-.TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or-\f[C]$HOME/.hledger.journal\f[])-.RS-.RE-.TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)-.RS-.RE-.TP-.B \f[C]\-\-separator=CHAR\f[]-Field separator to expect when reading CSV (default: \[aq],\[aq])-.RS-.RE-.TP-.B \f[C]\-\-alias=OLD=NEW\f[]-rename accounts named OLD to NEW-.RS-.RE-.TP-.B \f[C]\-\-anon\f[]-anonymize accounts and payees-.RS-.RE-.TP-.B \f[C]\-\-pivot\ FIELDNAME\f[]-use some other field or tag for the account name-.RS-.RE-.TP-.B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions-.RS-.RE+hledger\-web can be run in three modes:+.IP \(bu 2+\f[CR]\-\-serve\-browse\f[R] mode (the default): the app serves the web+UI and JSON API, and opens your default web browser to show the app if+possible, and exits automatically after two minutes of inactivity (with+no requests received and no open browser windows viewing it).+.IP \(bu 2+\f[CR]\-\-serve\f[R]: the app just serves the web UI and JSON API.+.IP \(bu 2+\f[CR]\-\-serve\-api\f[R]: the app just serves the JSON API. .PP-hledger reporting options:-.TP-.B \f[C]\-b\ \-\-begin=DATE\f[]-include postings/txns on or after this date-.RS-.RE-.TP-.B \f[C]\-e\ \-\-end=DATE\f[]-include postings/txns before this date-.RS-.RE-.TP-.B \f[C]\-D\ \-\-daily\f[]-multiperiod/multicolumn report by day-.RS-.RE-.TP-.B \f[C]\-W\ \-\-weekly\f[]-multiperiod/multicolumn report by week-.RS-.RE-.TP-.B \f[C]\-M\ \-\-monthly\f[]-multiperiod/multicolumn report by month-.RS-.RE-.TP-.B \f[C]\-Q\ \-\-quarterly\f[]-multiperiod/multicolumn report by quarter-.RS-.RE-.TP-.B \f[C]\-Y\ \-\-yearly\f[]-multiperiod/multicolumn report by year-.RS-.RE-.TP-.B \f[C]\-p\ \-\-period=PERIODEXP\f[]-set start date, end date, and/or reporting interval all at once using-period expressions syntax (overrides the flags above)-.RS-.RE-.TP-.B \f[C]\-\-date2\f[]-match the secondary date instead (see command help for other effects)-.RS-.RE-.TP-.B \f[C]\-U\ \-\-unmarked\f[]-include only unmarked postings/txns (can combine with \-P or \-C)-.RS-.RE-.TP-.B \f[C]\-P\ \-\-pending\f[]-include only pending postings/txns-.RS-.RE-.TP-.B \f[C]\-C\ \-\-cleared\f[]-include only cleared postings/txns-.RS-.RE-.TP-.B \f[C]\-R\ \-\-real\f[]-include only non\-virtual postings-.RS-.RE-.TP-.B \f[C]\-NUM\ \-\-depth=NUM\f[]-hide/aggregate accounts or postings more than NUM levels deep-.RS-.RE-.TP-.B \f[C]\-E\ \-\-empty\f[]-show items with zero amount, normally hidden (and vice\-versa in-hledger\-ui/hledger\-web)-.RS-.RE-.TP-.B \f[C]\-B\ \-\-cost\f[]-convert amounts to their cost at transaction time (using the transaction-price, if any)-.RS-.RE-.TP-.B \f[C]\-V\ \-\-value\f[]-convert amounts to their market value on the report end date (using the-most recent applicable market price, if any)-.RS-.RE-.TP-.B \f[C]\-\-auto\f[]-apply automated posting rules to modify transactions.-.RS-.RE-.TP-.B \f[C]\-\-forecast\f[]-apply periodic transaction rules to generate future transactions, to 6-months from now or report end date.-.RS-.RE+In all cases hledger\-web runs as a foreground process, logging requests+to stdout.+.SH OPTIONS+hledger\-web provides the following options:+.IP+.EX+Flags:+ \-\-serve \-\-server serve and log requests, don\(aqt browse or auto\-exit+ \-\-serve\-api like \-\-serve, but serve only the JSON web API,+ not the web UI+ \-\-allow=view|add|edit set the user\(aqs access level for changing data+ (default: \(gaadd\(ga). It also accepts \(gasandstorm\(ga for+ use on that platform (reads permissions from the+ \(gaX\-Sandstorm\-Permissions\(ga request header).+ \-\-cors=ORIGIN allow cross\-origin requests from the specified+ origin; setting ORIGIN to \(dq*\(dq allows requests from+ any origin+ \-\-host=IPADDR listen on this IP address (default: 127.0.0.1)+ \-\-port=PORT listen on this TCP port (default: 5000)+ \-\-socket=SOCKET listen on the given unix socket instead of an IP+ address and port (unix only; implies \-\-serve)+ \-\-base\-url=BASEURL set the base url (default: http://IPADDR:PORT)+ \-\-test run hledger\-web\(aqs tests and exit. hspec test+ runner args may follow a \-\-, eg: hledger\-web \-\-test+ \-\-help+.EE .PP-When a reporting option appears more than once in the command line, the-last one takes precedence.+By default hledger\-web listens only on IP address \f[CR]127.0.0.1\f[R],+which be accessed only from the local machine. .PP-Some reporting options can also be written as query arguments.+To allow access from elsewhere, use \f[CR]\-\-host\f[R] to specify an+externally accessible address configured on this machine, The special+address \f[CR]0.0.0.0\f[R] causes it to listen on all of this+machine\(aqs addresses. .PP-hledger help options:-.TP-.B \f[C]\-h\ \-\-help\f[]-show general usage (or after COMMAND, command usage)-.RS-.RE-.TP-.B \f[C]\-\-version\f[]-show version-.RS-.RE-.TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)-.RS-.RE+Similarly, you can use \f[CR]\-\-port\f[R] to listen on a TCP port other+than 5000.+This is useful if you want to run multiple hledger\-web instances on a+machine. .PP-A \@FILE argument will be expanded to the contents of FILE, which should-contain one command line option/argument per line.-(To prevent this, insert a \f[C]\-\-\f[] argument before.)+When \f[CR]\-\-socket\f[R] is used, hledger\-web creates and+communicates via a socket file instead of a TCP port.+This can be more secure, respects unix file permissions, and makes+certain use cases easier, such as running per\-user instances behind an+nginx reverse proxy.+(Eg:+\f[CR]proxy_pass http://unix:/tmp/hledger/${remote_user}.socket;\f[R].) .PP-By default, hledger\-web starts the web app in "transient mode" and also-opens it in your default web browser if possible.-In this mode the web app will keep running for as long as you have it-open in a browser window, and will exit after two minutes of inactivity-(no requests and no browser windows viewing it).-With \f[C]\-\-serve\f[], it just runs the web app without exiting, and-logs requests to the console.+You can use \f[CR]\-\-base\-url\f[R] to change the protocol, hostname,+port and path that appear in hledger\-web\(aqs hyperlinks.+This is useful eg when integrating hledger\-web within a larger website.+The default is \f[CR]http://HOST:PORT/\f[R] using the server\(aqs+configured host address and TCP port (or \f[CR]http://HOST\f[R] if PORT+is 80).+Note this affects url generation but not route parsing. .PP-By default the server listens on IP address 127.0.0.1, accessible only-to local requests.-You can use \f[C]\-\-host\f[] to change this, eg-\f[C]\-\-host\ 0.0.0.0\f[] to listen on all configured addresses.+hledger\-web also supports many of hledger\(aqs general options:+.IP+.EX+General input/data transformation flags:+ \-f \-\-file=[FMT:]FILE Read data from FILE, or from stdin if FILE is \-,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ \-\-rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ \-\-alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ \-\-auto generate extra postings by applying auto posting+ rules (\(dq=\(dq) to all transactions+ \-\-forecast[=PERIOD] Generate extra transactions from periodic rules+ (\(dq\(ti\(dq), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger\-ui, also make future\-dated transactions+ visible at startup.+ \-I \-\-ignore\-assertions don\(aqt check balance assertions by default+ \-\-txn\-balancing=... how to check that transactions are balanced:+ \(aqold\(aq: use global display precision+ \(aqexact\(aq: use transaction precision (default)+ \-\-infer\-costs infer conversion equity postings from costs+ \-\-infer\-equity infer costs from conversion equity postings+ \-\-infer\-market\-prices infer market prices from costs+ \-\-pivot=TAGNAME use a different field or tag as account names+ \-s \-\-strict do extra error checks (and override \-I)+ \-\-verbose\-tags add tags indicating generated/modified data++General output/reporting flags (supported by some commands):+ \-b \-\-begin=DATE include postings/transactions on/after this date+ \-e \-\-end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ \-D \-\-daily multiperiod report with 1 day interval+ \-W \-\-weekly multiperiod report with 1 week interval+ \-M \-\-monthly multiperiod report with 1 month interval+ \-Q \-\-quarterly multiperiod report with 1 quarter interval+ \-Y \-\-yearly multiperiod report with 1 year interval+ \-p \-\-period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ \-\-today=DATE override today\(aqs date (affects relative dates)+ \-\-date2 match/use secondary dates instead (deprecated)+ \-U \-\-unmarked include only unmarked postings/transactions+ \-P \-\-pending include only pending postings/transactions+ \-C \-\-cleared include only cleared postings/transactions+ (\-U/\-P/\-C can be combined)+ \-R \-\-real include only non\-virtual postings+ \-E \-\-empty Show zero items, which are normally hidden.+ In hledger\-ui & hledger\-web, do the opposite.+ \-\-depth=DEPTHEXP if a number (or \-NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ \-B \-\-cost show amounts converted to their cost/sale amount+ \-V \-\-market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to \-\-value=end.+ \-X \-\-exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to \-\-value=end,COMM.+ \-\-value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ \(aqthen\(aq: value on transaction dates+ \(aqend\(aq: value at period end(s)+ \(aqnow\(aq: value today+ YYYY\-MM\-DD: value on given date+ \-c \-\-commodity\-style=S Override a commodity\(aqs display style.+ Eg: \-c \(aq.\(aq or \-c \(aq1.000,00 EUR\(aq+ \-\-pretty[=YN] Use box\-drawing characters in text output? Can be+ \(aqy\(aq/\(aqyes\(aq or \(aqn\(aq/\(aqno\(aq.+ If YN is specified, the equals is required.++General help flags:+ \-h \-\-help show command line help+ \-\-tldr show command examples with tldr+ \-\-info show the manual with info+ \-\-man show the manual with man+ \-\-version show version information+ \-\-debug=[1\-9] show this much debug output (default: 1)+ \-\-pager=YN use a pager when needed ? y/yes (default) or n/no+ \-\-color=YNA \-\-colour use ANSI color ? y/yes, n/no, or auto (default)+.EE .PP-Similarly, use \f[C]\-\-port\f[] to set a TCP port other than 5000, eg-if you are running multiple hledger\-web instances.+hledger\-web shows accounts with zero balances by default (like+\f[CR]hledger\-ui\f[R], and unlike \f[CR]hledger\f[R]).+Using the \f[CR]\-E/\-\-empty\f[R] flag will reverse this behaviour.+If you see accounts which appear to have a zero balance, but cannot be+hidden with \f[CR]\-E\f[R], it\(aqs because they have a mixed\-cost+balance, which looks like zero when costs are hidden.+(hledger\-web does not show costs.) .PP-You can use \f[C]\-\-base\-url\f[] to change the protocol, hostname,-port and path that appear in hyperlinks, useful eg for integrating-hledger\-web within a larger website.-The default is \f[C]http://HOST:PORT/\f[] using the server\[aq]s-configured host address and TCP port (or \f[C]http://HOST\f[] if PORT is-80).+Reporting options and/or query arguments can be used to set an initial+query, which although not shown in the UI, will restrict the data shown+(in addition to any search query entered in the UI). .PP-With \f[C]\-\-file\-url\f[] you can set a different base url for static-files, eg for better caching or cookie\-less serving on high performance-websites.+If you use the bash shell, you can auto\-complete flags by pressing TAB+in the command line.+If this is not working see Install > Shell completions. .SH PERMISSIONS-.PP By default, hledger\-web allows anyone who can reach it to view the journal and to add new transactions, but not to change existing data. .PP-You can restrict who can reach it by-.IP \[bu] 2-setting the IP address it listens on (see \f[C]\-\-host\f[] above).-By default it listens on 127.0.0.1, accessible to all users on the local-machine.-.IP \[bu] 2-putting it behind an authenticating proxy, using eg apache or nginx-.IP \[bu] 2-custom firewall rules+You can restrict who can reach it, by+.IP \(bu 2+setting the IP address it listens on (see \f[CR]\-\-host\f[R] above).+By default it listens on 127.0.0.1, accessible to users on the local+machine only.+.IP \(bu 2+putting it behind an authenticating proxy, such as caddy or apache+.IP \(bu 2+putting it behind a firewall .PP-You can restrict what the users who reach it can do, by-.IP \[bu] 2-using the \f[C]\-\-capabilities=CAP[,CAP..]\f[] flag when you start it,-enabling one or more of the following capabilities.-The default value is \f[C]view,add\f[]:-.RS 2-.IP \[bu] 2-\f[C]view\f[] \- allows viewing the journal file and all included files-.IP \[bu] 2-\f[C]add\f[] \- allows adding new transactions to the main journal file-.IP \[bu] 2-\f[C]manage\f[] \- allows editing, uploading or downloading the main or-included files-.RE-.IP \[bu] 2-using the \f[C]\-\-capabilities\-header=HTTPHEADER\f[] flag to specify a-HTTP header from which it will read capabilities to enable.-hledger\-web on Sandstorm uses the X\-Sandstorm\-Permissions header to-integrate with Sandstorm\[aq]s permissions.-This is disabled by default.-.SH EDITING, UPLOADING, DOWNLOADING+And you can restrict what the users reaching it can do, by specifying+the \f[CR]\-\-allow=ACCESSLEVEL\f[R] option at startup.+ACCESSLEVEL is one of:+.IP \(bu 2+\f[CR]view\f[R] \- allows viewing the journal file(s)+.IP \(bu 2+\f[CR]add\f[R] \- also allows adding new transactions to the main+journal file+.IP \(bu 2+\f[CR]edit\f[R] \- also allows editing, uploading or downloading the+journal file(s)+.IP \(bu 2+\f[CR]sandstorm\f[R] \- (for the hledger\-web Sandstorm app:) allows+whichever of \f[CR]view\f[R], \f[CR]add\f[R], or \f[CR]edit\f[R] are+specified in the \f[CR]X\-Sandstorm\-Permissions\f[R] HTTP header .PP-If you enable the \f[C]manage\f[] capability mentioned above, you\[aq]ll-see a new "spanner" button to the right of the search form.+The default access level is \f[CR]add\f[R].+.SH EDITING, UPLOADING, DOWNLOADING+If you enable the \f[CR]manage\f[R] capability mentioned above,+you\(aqll see a new \(dqspanner\(dq button to the right of the search+form. Clicking this will let you edit, upload, or download the journal file or any files it includes. .PP@@ -332,80 +262,261 @@ .PP Normally whenever a file is changed in this way, hledger\-web saves a numbered backup (assuming file permissions allow it, the disk is not-full, etc.) hledger\-web is not aware of version control systems,-currently; if you use one, you\[aq]ll have to arrange to commit the-changes yourself (eg with a cron job or a file watcher like entr).+full, etc.)+hledger\-web is not aware of version control systems, currently; if you+use one, you\(aqll have to arrange to commit the changes yourself (eg+with a cron job or a file watcher like entr). .PP Changes which would leave the journal file(s) unparseable or non\-valid (eg with failing balance assertions) are prevented. (Probably. This needs re\-testing.) .SH RELOADING-.PP hledger\-web detects changes made to the files by other means (eg if you edit it directly, outside of hledger\-web), and it will show the new data when you reload the page or navigate to a new page. If a change makes a file unparseable, hledger\-web will display an error message until the file has been fixed.+.PP+(Note: if you are viewing files mounted from another machine, make sure+that both machine clocks are roughly in step.) .SH JSON API+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 \f[CR]\-\-serve\-api\f[R]+flag.+Eg:+.IP+.EX+$ hledger\-web \-f examples/sample.journal \-\-serve\-api+\&...+.EE .PP-In addition to the web UI, hledger\-web provides some JSON API routes.-These are similar to the API provided by the hledger\-api tool, but it-may be convenient to have them in hledger\-web also.+You can get JSON data from these routes: .IP-.nf-\f[C]+.EX+/version /accountnames /transactions /prices /commodities /accounts-/accounttransactions/#AccountName-\f[]-.fi-.SH ENVIRONMENT+/accounttransactions/ACCOUNTNAME+.EE .PP-\f[B]LEDGER_FILE\f[] The journal file path when not specified with-\f[C]\-f\f[].-Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps-\f[C]C:/Users/USER/.hledger.journal\f[]).-.SH FILES+Eg, all account names in the journal (similar to the accounts command).+(hledger\-web\(aqs JSON does not include newlines, here we use python to+prettify it):+.IP+.EX+$ curl \-s http://127.0.0.1:5000/accountnames | python \-m json.tool+[+ \(dqassets\(dq,+ \(dqassets:bank\(dq,+ \(dqassets:bank:checking\(dq,+ \(dqassets:bank:saving\(dq,+ \(dqassets:cash\(dq,+ \(dqexpenses\(dq,+ \(dqexpenses:food\(dq,+ \(dqexpenses:supplies\(dq,+ \(dqincome\(dq,+ \(dqincome:gifts\(dq,+ \(dqincome:salary\(dq,+ \(dqliabilities\(dq,+ \(dqliabilities:debts\(dq+]+.EE .PP-Reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-.SH BUGS+Or all transactions:+.IP+.EX+$ curl \-s http://127.0.0.1:5000/transactions | python \-m json.tool+[+ {+ \(dqtcode\(dq: \(dq\(dq,+ \(dqtcomment\(dq: \(dq\(dq,+ \(dqtdate\(dq: \(dq2008\-01\-01\(dq,+ \(dqtdate2\(dq: null,+ \(dqtdescription\(dq: \(dqincome\(dq,+ \(dqtindex\(dq: 1,+ \(dqtpostings\(dq: [+ {+ \(dqpaccount\(dq: \(dqassets:bank:checking\(dq,+ \(dqpamount\(dq: [+ {+ \(dqacommodity\(dq: \(dq$\(dq,+ \(dqaismultiplier\(dq: false,+ \(dqaprice\(dq: null,+\&...+.EE .PP-The need to precede options with \f[C]\-\-\f[] when invoked from hledger-is awkward.+Most of the JSON corresponds to hledger\(aqs data types; for details of+what the fields mean, see the Hledger.Data.Json haddock docs and click+on the various data types, eg Transaction.+And for a higher level understanding, see the journal docs.+There is also a basic OpenAPI specification. .PP-\f[C]\-f\-\f[] doesn\[aq]t work (hledger\-web can\[aq]t read from-stdin).+In some cases there is outer JSON corresponding to a \(dqReport\(dq+type.+To understand that, go to the Hledger.Web.Handler.MiscR haddock and look+at the source for the appropriate handler to see what it returns.+Eg for \f[CR]/accounttransactions\f[R] it\(aqs getAccounttransactionsR,+returning a \(dq\f[CR]accountTransactionsReport ...\f[R]\(dq.+Looking up the haddock for that we can see that /accounttransactions+returns an AccountTransactionsReport, which consists of a report title+and a list of AccountTransactionsReportItem (etc). .PP-Query arguments and some hledger options are ignored.+You can add a new transaction to the journal with a PUT request to+\f[CR]/add\f[R], if hledger\-web was started with the \f[CR]add\f[R]+capability (enabled by default).+The payload must be the full, exact JSON representation of a hledger+transaction (partial data won\(aqt do).+You can get sample JSON from hledger\-web\(aqs \f[CR]/transactions\f[R]+or \f[CR]/accounttransactions\f[R], or you can export it with+hledger\-lib, eg like so:+.IP+.EX+\&.../hledger$ stack ghci hledger\-lib+>>> writeJsonFile \(dqtxn.json\(dq (head $ jtxns samplejournal)+>>> :q+.EE .PP-Does not work in text\-mode browsers.+Here\(aqs how it looks as of hledger\-1.17 (remember, this JSON+corresponds to hledger\(aqs Transaction and related data types):+.IP+.EX+{+ \(dqtcomment\(dq: \(dq\(dq,+ \(dqtpostings\(dq: [+ {+ \(dqpbalanceassertion\(dq: \f[B]null\f[R],+ \(dqpstatus\(dq: \(dqUnmarked\(dq,+ \(dqpamount\(dq: [+ {+ \(dqaprice\(dq: \f[B]null\f[R],+ \(dqacommodity\(dq: \(dq$\(dq,+ \(dqaquantity\(dq: {+ \(dqfloatingPoint\(dq: 1,+ \(dqdecimalPlaces\(dq: 10,+ \(dqdecimalMantissa\(dq: 10000000000+ },+ \(dqaismultiplier\(dq: \f[B]false\f[R],+ \(dqastyle\(dq: {+ \(dqascommodityside\(dq: \(dqL\(dq,+ \(dqasdigitgroups\(dq: \f[B]null\f[R],+ \(dqascommodityspaced\(dq: \f[B]false\f[R],+ \(dqasprecision\(dq: 2,+ \(dqasdecimalpoint\(dq: \(dq.\(dq+ }+ }+ ],+ \(dqptransaction_\(dq: \(dq1\(dq,+ \(dqpaccount\(dq: \(dqassets:bank:checking\(dq,+ \(dqpdate\(dq: \f[B]null\f[R],+ \(dqptype\(dq: \(dqRegularPosting\(dq,+ \(dqpcomment\(dq: \(dq\(dq,+ \(dqpdate2\(dq: \f[B]null\f[R],+ \(dqptags\(dq: [],+ \(dqporiginal\(dq: \f[B]null\f[R]+ },+ {+ \(dqpbalanceassertion\(dq: \f[B]null\f[R],+ \(dqpstatus\(dq: \(dqUnmarked\(dq,+ \(dqpamount\(dq: [+ {+ \(dqaprice\(dq: \f[B]null\f[R],+ \(dqacommodity\(dq: \(dq$\(dq,+ \(dqaquantity\(dq: {+ \(dqfloatingPoint\(dq: \-1,+ \(dqdecimalPlaces\(dq: 10,+ \(dqdecimalMantissa\(dq: \-10000000000+ },+ \(dqaismultiplier\(dq: \f[B]false\f[R],+ \(dqastyle\(dq: {+ \(dqascommodityside\(dq: \(dqL\(dq,+ \(dqasdigitgroups\(dq: \f[B]null\f[R],+ \(dqascommodityspaced\(dq: \f[B]false\f[R],+ \(dqasprecision\(dq: 2,+ \(dqasdecimalpoint\(dq: \(dq.\(dq+ }+ }+ ],+ \(dqptransaction_\(dq: \(dq1\(dq,+ \(dqpaccount\(dq: \(dqincome:salary\(dq,+ \(dqpdate\(dq: \f[B]null\f[R],+ \(dqptype\(dq: \(dqRegularPosting\(dq,+ \(dqpcomment\(dq: \(dq\(dq,+ \(dqpdate2\(dq: \f[B]null\f[R],+ \(dqptags\(dq: [],+ \(dqporiginal\(dq: \f[B]null\f[R]+ }+ ],+ \(dqttags\(dq: [],+ \(dqtsourcepos\(dq: {+ \(dqtag\(dq: \(dqJournalSourcePos\(dq,+ \(dqcontents\(dq: [+ \(dq\(dq,+ [+ 1,+ 1+ ]+ ]+ },+ \(dqtdate\(dq: \(dq2008\-01\-01\(dq,+ \(dqtcode\(dq: \(dq\(dq,+ \(dqtindex\(dq: 1,+ \(dqtprecedingcomment\(dq: \(dq\(dq,+ \(dqtdate2\(dq: \f[B]null\f[R],+ \(dqtdescription\(dq: \(dqincome\(dq,+ \(dqtstatus\(dq: \(dqUnmarked\(dq+}+.EE .PP-Does not work well on small screens.+And here\(aqs how to test adding it with curl.+This should add a new entry to your journal:+.IP+.EX+$ curl http://127.0.0.1:5000/add \-X PUT \-H \(aqContent\-Type: application/json\(aq \-\-data\-binary \(attxn.json+.EE+.SH DEBUG OUTPUT+.SS Debug output+You can add \f[CR]\-\-debug[=N]\f[R] to the command line to log debug+output.+N ranges from 1 (least output, the default) to 9 (maximum output).+Typically you would start with 1 and increase until you are seeing+enough.+Debug output goes to stderr, interleaved with the requests logged on+stdout.+To capture debug output in a log file instead, you can usually redirect+stderr, eg:+.PD 0+.P+.PD+\f[CR]hledger\-web \-\-debug=3 2>hledger\-web.log\f[R].+.SH ENVIRONMENT+\f[B]LEDGER_FILE\f[R] The main journal file to use when not specified+with \f[CR]\-f/\-\-file\f[R].+Default: \f[CR]$HOME/.hledger.journal\f[R].+.SH BUGS+We welcome bug reports in the hledger issue tracker+(https://bugs.hledger.org), or on the hledger chat or mail list+(https://hledger.org/support).+.PP+Some known issues:+.PP+Does not work well on small screens, or in text\-mode browsers. -.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)- .SH AUTHORS-Simon Michael <simon@joyful.com> and contributors+Simon Michael <simon@joyful.com> and contributors.+.br+See http://hledger.org/CREDITS.html .SH COPYRIGHT+Copyright 2007-2023 Simon Michael and contributors. -Copyright (C) 2007-2016 Simon Michael.-.br+.SH LICENSE Released under GNU GPL v3 or later. .SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org+hledger(1), hledger\-ui(1), hledger\-web(1), ledger(1)
embeddedfiles/hledger-web.info view
@@ -1,30 +1,64 @@-This is hledger-web.info, produced by makeinfo version 6.5 from stdin.+This is hledger-web.info, produced by makeinfo version 7.3 from stdin. +INFO-DIR-SECTION User Applications+START-INFO-DIR-ENTRY+* hledger-web: (hledger-web). Web UI/API for the hledger accounting tool.+END-INFO-DIR-ENTRY+ File: hledger-web.info, Node: Top, Next: OPTIONS, Up: (dir) -hledger-web(1) hledger-web 1.14-*******************************+hledger-web(1)+************** -hledger-web is hledger's web interface. It starts a simple web-application for browsing and adding transactions, and optionally opens-it in a web browser window if possible. It provides a more-user-friendly UI than the hledger CLI or hledger-ui interface, showing-more at once (accounts, the current account register, balance charts)-and allowing history-aware data entry, interactive searching, and-bookmarking.+hledger-web - web interface and API for 'hledger', a robust, friendly+plain text accounting app. - hledger-web also lets you share a ledger with multiple users, or even-the public web. There is no access control, so if you need that you-should put it behind a suitable web proxy. As a small protection+ 'hledger-web [OPTS] [QUERY]'+or+'hledger web [OPTS] [QUERY]'++ This manual is for hledger's web interface, version 1.52. See also+the hledger manual for common concepts and file formats.++ hledger is a robust, user-friendly, cross-platform set of programs+for tracking money, time, or any other commodity, using double-entry+accounting and a simple, editable file format. hledger is inspired by+and largely compatible with ledger(1), and largely interconvertible with+beancount(1).++ hledger-web is a simple web application for browsing and adding+transactions. It provides a more user-friendly UI than the hledger CLI+or hledger-ui TUI, showing more at once (accounts, the current account+register, balance charts) and allowing history-aware data entry,+interactive searching, and bookmarking.++ hledger-web also lets you share a journal with multiple users, or+even the public web. There is no access control, so if you need that+you should put it behind a suitable web proxy. As a small protection against data loss when running an unprotected instance, it writes a-numbered backup of the main journal file (only ?) on every edit.+numbered backup of the main journal file (only) on every edit. - Like hledger, it reads data from one or more files in hledger-journal, timeclock, timedot, or CSV format specified with '-f', or-'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps-'C:/Users/USER/.hledger.journal'). For more about this see hledger(1),-hledger_journal(5) etc.+ Like hledger, it reads from (and appends to) a journal file specified+by the 'LEDGER_FILE' environment variable (defaulting to+'$HOME/.hledger.journal'); or you can specify files with '-f' options.+It can also read timeclock files, timedot files, or any CSV/SSV/TSV file+with a date field. (See hledger(1) -> Input for details.)++ hledger-web can be run in three modes:++ * '--serve-browse' mode (the default): the app serves the web UI and+ JSON API, and opens your default web browser to show the app if+ possible, and exits automatically after two minutes of inactivity+ (with no requests received and no open browser windows viewing it).++ * '--serve': the app just serves the web UI and JSON API.++ * '--serve-api': the app just serves the JSON API.++ In all cases hledger-web runs as a foreground process, logging+requests to stdout.+ * Menu: * OPTIONS::@@ -32,6 +66,9 @@ * EDITING UPLOADING DOWNLOADING:: * RELOADING:: * JSON API::+* DEBUG OUTPUT::+* ENVIRONMENT::+* BUGS:: File: hledger-web.info, Node: OPTIONS, Next: PERMISSIONS, Prev: Top, Up: Top@@ -39,177 +76,152 @@ 1 OPTIONS ********* -Command-line options and arguments may be used to set an initial filter-on the data. These filter options are not shown in the web UI, but it-will be applied in addition to any search query entered there.-- Note: if invoking hledger-web as a hledger subcommand, write '--'-before options, as shown in the synopsis above.--'--serve'-- serve and log requests, don't browse or auto-exit-'--host=IPADDR'-- listen on this IP address (default: 127.0.0.1)-'--port=PORT'-- listen on this TCP port (default: 5000)-'--base-url=URL'-- set the base url (default: http://IPADDR:PORT). You would change- this when sharing over the network, or integrating within a larger- website.-'--file-url=URL'-- set the static files url (default: BASEURL/static). hledger-web- normally serves static files itself, but if you wanted to serve- them from another server for efficiency, you would set the url with- this.-'--capabilities=CAP[,CAP..]'-- enable the view, add, and/or manage capabilities (default:- view,add)-'--capabilities-header=HTTPHEADER'-- read capabilities to enable from a HTTP header, like- X-Sandstorm-Permissions (default: disabled)-- hledger input options:--'-f FILE --file=FILE'-- use a different input file. For stdin, use - (default:- '$LEDGER_FILE' or '$HOME/.hledger.journal')-'--rules-file=RULESFILE'-- Conversion rules file to use when reading CSV (default: FILE.rules)-'--separator=CHAR'-- Field separator to expect when reading CSV (default: ',')-'--alias=OLD=NEW'-- rename accounts named OLD to NEW-'--anon'-- anonymize accounts and payees-'--pivot FIELDNAME'-- use some other field or tag for the account name-'-I --ignore-assertions'-- ignore any failing balance assertions-- hledger reporting options:--'-b --begin=DATE'-- include postings/txns on or after this date-'-e --end=DATE'-- include postings/txns before this date-'-D --daily'-- multiperiod/multicolumn report by day-'-W --weekly'-- multiperiod/multicolumn report by week-'-M --monthly'-- multiperiod/multicolumn report by month-'-Q --quarterly'-- multiperiod/multicolumn report by quarter-'-Y --yearly'-- multiperiod/multicolumn report by year-'-p --period=PERIODEXP'-- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)-'--date2'-- match the secondary date instead (see command help for other- effects)-'-U --unmarked'-- include only unmarked postings/txns (can combine with -P or -C)-'-P --pending'-- include only pending postings/txns-'-C --cleared'-- include only cleared postings/txns-'-R --real'-- include only non-virtual postings-'-NUM --depth=NUM'-- hide/aggregate accounts or postings more than NUM levels deep-'-E --empty'-- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)-'-B --cost'-- convert amounts to their cost at transaction time (using the- transaction price, if any)-'-V --value'-- convert amounts to their market value on the report end date (using- the most recent applicable market price, if any)-'--auto'-- apply automated posting rules to modify transactions.-'--forecast'-- apply periodic transaction rules to generate future transactions,- to 6 months from now or report end date.+hledger-web provides the following options: - When a reporting option appears more than once in the command line,-the last one takes precedence.+Flags:+ --serve --server serve and log requests, don't browse or auto-exit+ --serve-api like --serve, but serve only the JSON web API,+ not the web UI+ --allow=view|add|edit set the user's access level for changing data+ (default: `add`). It also accepts `sandstorm` for+ use on that platform (reads permissions from the+ `X-Sandstorm-Permissions` request header).+ --cors=ORIGIN allow cross-origin requests from the specified+ origin; setting ORIGIN to "*" allows requests from+ any origin+ --host=IPADDR listen on this IP address (default: 127.0.0.1)+ --port=PORT listen on this TCP port (default: 5000)+ --socket=SOCKET listen on the given unix socket instead of an IP+ address and port (unix only; implies --serve)+ --base-url=BASEURL set the base url (default: http://IPADDR:PORT)+ --test run hledger-web's tests and exit. hspec test+ runner args may follow a --, eg: hledger-web --test+ --help - Some reporting options can also be written as query arguments.+ By default hledger-web listens only on IP address '127.0.0.1', which+be accessed only from the local machine. - hledger help options:+ To allow access from elsewhere, use '--host' to specify an externally+accessible address configured on this machine, The special address+'0.0.0.0' causes it to listen on all of this machine's addresses. -'-h --help'+ Similarly, you can use '--port' to listen on a TCP port other than+5000. This is useful if you want to run multiple hledger-web instances+on a machine. - show general usage (or after COMMAND, command usage)-'--version'+ When '--socket' is used, hledger-web creates and communicates via a+socket file instead of a TCP port. This can be more secure, respects+unix file permissions, and makes certain use cases easier, such as+running per-user instances behind an nginx reverse proxy. (Eg:+'proxy_pass http://unix:/tmp/hledger/${remote_user}.socket;'.) - show version-'--debug[=N]'+ You can use '--base-url' to change the protocol, hostname, port and+path that appear in hledger-web's hyperlinks. This is useful eg when+integrating hledger-web within a larger website. The default is+'http://HOST:PORT/' using the server's configured host address and TCP+port (or 'http://HOST' if PORT is 80). Note this affects url generation+but not route parsing. - show debug output (levels 1-9, default: 1)+ hledger-web also supports many of hledger's general options: - A @FILE argument will be expanded to the contents of FILE, which-should contain one command line option/argument per line. (To prevent-this, insert a '--' argument before.)+General input/data transformation flags:+ -f --file=[FMT:]FILE Read data from FILE, or from stdin if FILE is -,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ --rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ --alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ --auto generate extra postings by applying auto posting+ rules ("=") to all transactions+ --forecast[=PERIOD] Generate extra transactions from periodic rules+ ("~"), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger-ui, also make future-dated transactions+ visible at startup.+ -I --ignore-assertions don't check balance assertions by default+ --txn-balancing=... how to check that transactions are balanced:+ 'old': use global display precision+ 'exact': use transaction precision (default)+ --infer-costs infer conversion equity postings from costs+ --infer-equity infer costs from conversion equity postings+ --infer-market-prices infer market prices from costs+ --pivot=TAGNAME use a different field or tag as account names+ -s --strict do extra error checks (and override -I)+ --verbose-tags add tags indicating generated/modified data - By default, hledger-web starts the web app in "transient mode" and-also opens it in your default web browser if possible. In this mode the-web app will keep running for as long as you have it open in a browser-window, and will exit after two minutes of inactivity (no requests and-no browser windows viewing it). With '--serve', it just runs the web-app without exiting, and logs requests to the console.+General output/reporting flags (supported by some commands):+ -b --begin=DATE include postings/transactions on/after this date+ -e --end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ -D --daily multiperiod report with 1 day interval+ -W --weekly multiperiod report with 1 week interval+ -M --monthly multiperiod report with 1 month interval+ -Q --quarterly multiperiod report with 1 quarter interval+ -Y --yearly multiperiod report with 1 year interval+ -p --period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ --today=DATE override today's date (affects relative dates)+ --date2 match/use secondary dates instead (deprecated)+ -U --unmarked include only unmarked postings/transactions+ -P --pending include only pending postings/transactions+ -C --cleared include only cleared postings/transactions+ (-U/-P/-C can be combined)+ -R --real include only non-virtual postings+ -E --empty Show zero items, which are normally hidden.+ In hledger-ui & hledger-web, do the opposite.+ --depth=DEPTHEXP if a number (or -NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ -B --cost show amounts converted to their cost/sale amount+ -V --market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to --value=end.+ -X --exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to --value=end,COMM.+ --value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ 'then': value on transaction dates+ 'end': value at period end(s)+ 'now': value today+ YYYY-MM-DD: value on given date+ -c --commodity-style=S Override a commodity's display style.+ Eg: -c '.' or -c '1.000,00 EUR'+ --pretty[=YN] Use box-drawing characters in text output? Can be+ 'y'/'yes' or 'n'/'no'.+ If YN is specified, the equals is required. - By default the server listens on IP address 127.0.0.1, accessible-only to local requests. You can use '--host' to change this, eg '--host-0.0.0.0' to listen on all configured addresses.+General help flags:+ -h --help show command line help+ --tldr show command examples with tldr+ --info show the manual with info+ --man show the manual with man+ --version show version information+ --debug=[1-9] show this much debug output (default: 1)+ --pager=YN use a pager when needed ? y/yes (default) or n/no+ --color=YNA --colour use ANSI color ? y/yes, n/no, or auto (default) - Similarly, use '--port' to set a TCP port other than 5000, eg if you-are running multiple hledger-web instances.+ hledger-web shows accounts with zero balances by default (like+'hledger-ui', and unlike 'hledger'). Using the '-E/--empty' flag will+reverse this behaviour. If you see accounts which appear to have a zero+balance, but cannot be hidden with '-E', it's because they have a+mixed-cost balance, which looks like zero when costs are hidden.+(hledger-web does not show costs.) - You can use '--base-url' to change the protocol, hostname, port and-path that appear in hyperlinks, useful eg for integrating hledger-web-within a larger website. The default is 'http://HOST:PORT/' using the-server's configured host address and TCP port (or 'http://HOST' if PORT-is 80).+ Reporting options and/or query arguments can be used to set an+initial query, which although not shown in the UI, will restrict the+data shown (in addition to any search query entered in the UI). - With '--file-url' you can set a different base url for static files,-eg for better caching or cookie-less serving on high performance-websites.+ If you use the bash shell, you can auto-complete flags by pressing+TAB in the command line. If this is not working see Install > Shell+completions. File: hledger-web.info, Node: PERMISSIONS, Next: EDITING UPLOADING DOWNLOADING, Prev: OPTIONS, Up: Top@@ -220,30 +232,27 @@ By default, hledger-web allows anyone who can reach it to view the journal and to add new transactions, but not to change existing data. - You can restrict who can reach it by+ You can restrict who can reach it, by * setting the IP address it listens on (see '--host' above). By- default it listens on 127.0.0.1, accessible to all users on the- local machine.- * putting it behind an authenticating proxy, using eg apache or nginx- * custom firewall rules+ default it listens on 127.0.0.1, accessible to users on the local+ machine only.+ * putting it behind an authenticating proxy, such as caddy or apache+ * putting it behind a firewall - You can restrict what the users who reach it can do, by+ And you can restrict what the users reaching it can do, by specifying+the '--allow=ACCESSLEVEL' option at startup. ACCESSLEVEL is one of: - * using the '--capabilities=CAP[,CAP..]' flag when you start it,- enabling one or more of the following capabilities. The default- value is 'view,add':- * 'view' - allows viewing the journal file and all included- files- * 'add' - allows adding new transactions to the main journal- file- * 'manage' - allows editing, uploading or downloading the main- or included files+ * 'view' - allows viewing the journal file(s)+ * 'add' - also allows adding new transactions to the main journal+ file+ * 'edit' - also allows editing, uploading or downloading the journal+ file(s)+ * 'sandstorm' - (for the hledger-web Sandstorm app:) allows whichever+ of 'view', 'add', or 'edit' are specified in the+ 'X-Sandstorm-Permissions' HTTP header - * using the '--capabilities-header=HTTPHEADER' flag to specify a HTTP- header from which it will read capabilities to enable. hledger-web- on Sandstorm uses the X-Sandstorm-Permissions header to integrate- with Sandstorm's permissions. This is disabled by default.+ The default access level is 'add'. File: hledger-web.info, Node: EDITING UPLOADING DOWNLOADING, Next: RELOADING, Prev: PERMISSIONS, Up: Top@@ -281,35 +290,257 @@ file unparseable, hledger-web will display an error message until the file has been fixed. + (Note: if you are viewing files mounted from another machine, make+sure that both machine clocks are roughly in step.)+ -File: hledger-web.info, Node: JSON API, Prev: RELOADING, Up: Top+File: hledger-web.info, Node: JSON API, Next: DEBUG OUTPUT, Prev: RELOADING, Up: Top 5 JSON API ********** -In addition to the web UI, hledger-web provides some JSON API routes.-These are similar to the API provided by the hledger-api tool, but it-may be convenient to have them in hledger-web also.+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: +$ hledger-web -f examples/sample.journal --serve-api+...++ You can get JSON data from these routes:++/version /accountnames /transactions /prices /commodities /accounts-/accounttransactions/#AccountName+/accounttransactions/ACCOUNTNAME + Eg, all account names in the journal (similar to the accounts+command). (hledger-web's JSON does not include newlines, here we use+python to prettify it):++$ curl -s http://127.0.0.1:5000/accountnames | python -m json.tool+[+ "assets",+ "assets:bank",+ "assets:bank:checking",+ "assets:bank:saving",+ "assets:cash",+ "expenses",+ "expenses:food",+ "expenses:supplies",+ "income",+ "income:gifts",+ "income:salary",+ "liabilities",+ "liabilities:debts"+]++ Or all transactions:++$ curl -s http://127.0.0.1:5000/transactions | python -m json.tool+[+ {+ "tcode": "",+ "tcomment": "",+ "tdate": "2008-01-01",+ "tdate2": null,+ "tdescription": "income",+ "tindex": 1,+ "tpostings": [+ {+ "paccount": "assets:bank:checking",+ "pamount": [+ {+ "acommodity": "$",+ "aismultiplier": false,+ "aprice": null,+...++ Most of the JSON corresponds to hledger's data types; for details of+what the fields mean, see the Hledger.Data.Json haddock docs and click+on the various data types, eg Transaction. And for a higher level+understanding, see the journal docs. There is also a basic OpenAPI+specification.++ In some cases there is outer JSON corresponding to a "Report" type.+To understand that, go to the Hledger.Web.Handler.MiscR haddock and look+at the source for the appropriate handler to see what it returns. Eg+for '/accounttransactions' it's getAccounttransactionsR, returning a+"'accountTransactionsReport ...'". Looking up the haddock for that we+can see that /accounttransactions returns an AccountTransactionsReport,+which consists of a report title and a list of+AccountTransactionsReportItem (etc).++ You can add a new transaction to the journal with a PUT request to+'/add', if hledger-web was started with the 'add' capability (enabled by+default). The payload must be the full, exact JSON representation of a+hledger transaction (partial data won't do). You can get sample JSON+from hledger-web's '/transactions' or '/accounttransactions', or you can+export it with hledger-lib, eg like so:++.../hledger$ stack ghci hledger-lib+>>> writeJsonFile "txn.json" (head $ jtxns samplejournal)+>>> :q++ Here's how it looks as of hledger-1.17 (remember, this JSON+corresponds to hledger's Transaction and related data types):++{+ "tcomment": "",+ "tpostings": [+ {+ "pbalanceassertion": null,+ "pstatus": "Unmarked",+ "pamount": [+ {+ "aprice": null,+ "acommodity": "$",+ "aquantity": {+ "floatingPoint": 1,+ "decimalPlaces": 10,+ "decimalMantissa": 10000000000+ },+ "aismultiplier": false,+ "astyle": {+ "ascommodityside": "L",+ "asdigitgroups": null,+ "ascommodityspaced": false,+ "asprecision": 2,+ "asdecimalpoint": "."+ }+ }+ ],+ "ptransaction_": "1",+ "paccount": "assets:bank:checking",+ "pdate": null,+ "ptype": "RegularPosting",+ "pcomment": "",+ "pdate2": null,+ "ptags": [],+ "poriginal": null+ },+ {+ "pbalanceassertion": null,+ "pstatus": "Unmarked",+ "pamount": [+ {+ "aprice": null,+ "acommodity": "$",+ "aquantity": {+ "floatingPoint": -1,+ "decimalPlaces": 10,+ "decimalMantissa": -10000000000+ },+ "aismultiplier": false,+ "astyle": {+ "ascommodityside": "L",+ "asdigitgroups": null,+ "ascommodityspaced": false,+ "asprecision": 2,+ "asdecimalpoint": "."+ }+ }+ ],+ "ptransaction_": "1",+ "paccount": "income:salary",+ "pdate": null,+ "ptype": "RegularPosting",+ "pcomment": "",+ "pdate2": null,+ "ptags": [],+ "poriginal": null+ }+ ],+ "ttags": [],+ "tsourcepos": {+ "tag": "JournalSourcePos",+ "contents": [+ "",+ [+ 1,+ 1+ ]+ ]+ },+ "tdate": "2008-01-01",+ "tcode": "",+ "tindex": 1,+ "tprecedingcomment": "",+ "tdate2": null,+ "tdescription": "income",+ "tstatus": "Unmarked"+}++ And here's how to test adding it with curl. This should add a new+entry to your journal:++$ curl http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.json+ +File: hledger-web.info, Node: DEBUG OUTPUT, Next: ENVIRONMENT, Prev: JSON API, Up: Top++6 DEBUG OUTPUT+**************++* Menu:++* Debug output::+++File: hledger-web.info, Node: Debug output, Up: DEBUG OUTPUT++6.1 Debug output+================++You can add '--debug[=N]' to the command line to log debug output. N+ranges from 1 (least output, the default) to 9 (maximum output).+Typically you would start with 1 and increase until you are seeing+enough. Debug output goes to stderr, interleaved with the requests+logged on stdout. To capture debug output in a log file instead, you+can usually redirect stderr, eg:+'hledger-web --debug=3 2>hledger-web.log'.+++File: hledger-web.info, Node: ENVIRONMENT, Next: BUGS, Prev: DEBUG OUTPUT, Up: Top++7 ENVIRONMENT+*************++*LEDGER_FILE* The main journal file to use when not specified with+'-f/--file'. Default: '$HOME/.hledger.journal'.+++File: hledger-web.info, Node: BUGS, Prev: ENVIRONMENT, Up: Top++8 BUGS+******++We welcome bug reports in the hledger issue tracker+(https://bugs.hledger.org), or on the hledger chat or mail list+(https://hledger.org/support).++ Some known issues:++ Does not work well on small screens, or in text-mode browsers.++ Tag Table:-Node: Top72-Node: OPTIONS1354-Ref: #options1459-Node: PERMISSIONS6549-Ref: #permissions6688-Node: EDITING UPLOADING DOWNLOADING7900-Ref: #editing-uploading-downloading8081-Node: RELOADING8915-Ref: #reloading9049-Node: JSON API9359-Ref: #json-api9453+Node: Top223+Node: OPTIONS2575+Node: PERMISSIONS11473+Node: EDITING UPLOADING DOWNLOADING12623+Node: RELOADING13638+Node: JSON API14205+Node: DEBUG OUTPUT19854+Node: Debug output20006+Node: ENVIRONMENT20524+Node: BUGS20760 End Tag Table+++Local Variables:+coding: utf-8+End:
+ embeddedfiles/hledger-web.md view
@@ -0,0 +1,32 @@+# hledger-web++> A web interface and API for `hledger`, a robust, friendly plain text accounting app.+> More information: <https://hledger.org/hledger-web.html>.++- Start the web app, and a browser if possible, for local viewing and adding only:++`hledger-web`++- As above but with a specified file, and allow editing of existing data:++`hledger-web --file {{path/to/file.journal}} --allow edit`++- Start just the web app, and accept incoming connections to the specified host and port:++`hledger-web --serve --host {{my.host.name}} --port 8000`++- Start just the web app's JSON API, and allow only read access:++`hledger-web --serve-api --host {{my.host.name}} --allow view`++- Show amounts converted to current market value in your base currency when known:++`hledger-web --value now --infer-market-prices`++- Show the manual in Info format if possible:++`hledger-web --info`++- Display help:++`hledger-web --help`
embeddedfiles/hledger-web.txt view
@@ -1,322 +1,473 @@ -hledger-web(1) hledger User Manuals hledger-web(1)--+HLEDGER-WEB(1) hledger User Manuals HLEDGER-WEB(1) NAME- hledger-web - web interface for the hledger accounting tool+ hledger-web - web interface and API for hledger, a robust, friendly plain+ text accounting app. SYNOPSIS- hledger-web [OPTIONS]- hledger web -- [OPTIONS]+ hledger-web [OPTS] [QUERY]+ or+ hledger web [OPTS] [QUERY] DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any- other commodity, using double-entry accounting and a simple, editable- file format. hledger is inspired by and largely compatible with- ledger(1).-- hledger-web is hledger's web interface. It starts a simple web appli-- cation for browsing and adding transactions, and optionally opens it in- a web browser window if possible. It provides a more user-friendly UI- than the hledger CLI or hledger-ui interface, showing more at once- (accounts, the current account register, balance charts) and allowing- history-aware data entry, interactive searching, and bookmarking.-- hledger-web also lets you share a ledger with multiple users, or even- the public web. There is no access control, so if you need that you- should put it behind a suitable web proxy. As a small protection- against data loss when running an unprotected instance, it writes a- numbered backup of the main journal file (only ?) on every edit.-- Like hledger, it reads data from one or more files in hledger journal,- timeclock, timedot, or CSV format specified with -f, or $LEDGER_FILE,- or $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal). For more about this see hledger(1),- hledger_journal(5) etc.--OPTIONS- Command-line options and arguments may be used to set an initial filter- on the data. These filter options are not shown in the web UI, but it- will be applied in addition to any search query entered there.-- Note: if invoking hledger-web as a hledger subcommand, write -- before- options, as shown in the synopsis above.-- --serve- serve and log requests, don't browse or auto-exit-- --host=IPADDR- listen on this IP address (default: 127.0.0.1)-- --port=PORT- listen on this TCP port (default: 5000)-- --base-url=URL- set the base url (default: http://IPADDR:PORT). You would- change this when sharing over the network, or integrating within- a larger website.-- --file-url=URL- set the static files url (default: BASEURL/static). hledger-web- normally serves static files itself, but if you wanted to serve- them from another server for efficiency, you would set the url- with this.-- --capabilities=CAP[,CAP..]- enable the view, add, and/or manage capabilities (default:- view,add)-- --capabilities-header=HTTPHEADER- read capabilities to enable from a HTTP header, like X-Sand-- storm-Permissions (default: disabled)-- hledger input options:+ This manual is for hledger's web interface, version 1.52. See also the+ hledger manual for common concepts and file formats. - -f FILE --file=FILE- use a different input file. For stdin, use - (default:- $LEDGER_FILE or $HOME/.hledger.journal)+ hledger is a robust, user-friendly, cross-platform set of programs for+ tracking money, time, or any other commodity, using double-entry accounting+ and a simple, editable file format. hledger is inspired by and largely+ compatible with ledger(1), and largely interconvertible with beancount(1). - --rules-file=RULESFILE- Conversion rules file to use when reading CSV (default:- FILE.rules)+ hledger-web is a simple web application for browsing and adding transac-+ tions. It provides a more user-friendly UI than the hledger CLI or+ hledger-ui TUI, showing more at once (accounts, the current account regis-+ ter, balance charts) and allowing history-aware data entry, interactive+ searching, and bookmarking. - --separator=CHAR- Field separator to expect when reading CSV (default: ',')+ hledger-web also lets you share a journal with multiple users, or even the+ public web. There is no access control, so if you need that you should put+ it behind a suitable web proxy. As a small protection against data loss+ when running an unprotected instance, it writes a numbered backup of the+ main journal file (only) on every edit. - --alias=OLD=NEW- rename accounts named OLD to NEW+ Like hledger, it reads from (and appends to) a journal file specified by+ the LEDGER_FILE environment variable (defaulting to $HOME/.hledger.jour-+ nal); or you can specify files with -f options. It can also read timeclock+ files, timedot files, or any CSV/SSV/TSV file with a date field. (See+ hledger(1) -> Input for details.) - --anon anonymize accounts and payees+ hledger-web can be run in three modes: - --pivot FIELDNAME- use some other field or tag for the account name+ * --serve-browse mode (the default): the app serves the web UI and JSON+ API, and opens your default web browser to show the app if possible, and+ exits automatically after two minutes of inactivity (with no requests re-+ ceived and no open browser windows viewing it). - -I --ignore-assertions- ignore any failing balance assertions+ * --serve: the app just serves the web UI and JSON API. - hledger reporting options:+ * --serve-api: the app just serves the JSON API. - -b --begin=DATE- include postings/txns on or after this date+ In all cases hledger-web runs as a foreground process, logging requests to+ stdout. - -e --end=DATE- include postings/txns before this date+OPTIONS+ hledger-web provides the following options: - -D --daily- multiperiod/multicolumn report by day+ Flags:+ --serve --server serve and log requests, don't browse or auto-exit+ --serve-api like --serve, but serve only the JSON web API,+ not the web UI+ --allow=view|add|edit set the user's access level for changing data+ (default: `add`). It also accepts `sandstorm` for+ use on that platform (reads permissions from the+ `X-Sandstorm-Permissions` request header).+ --cors=ORIGIN allow cross-origin requests from the specified+ origin; setting ORIGIN to "*" allows requests from+ any origin+ --host=IPADDR listen on this IP address (default: 127.0.0.1)+ --port=PORT listen on this TCP port (default: 5000)+ --socket=SOCKET listen on the given unix socket instead of an IP+ address and port (unix only; implies --serve)+ --base-url=BASEURL set the base url (default: http://IPADDR:PORT)+ --test run hledger-web's tests and exit. hspec test+ runner args may follow a --, eg: hledger-web --test+ --help - -W --weekly- multiperiod/multicolumn report by week+ By default hledger-web listens only on IP address 127.0.0.1, which be ac-+ cessed only from the local machine. - -M --monthly- multiperiod/multicolumn report by month+ To allow access from elsewhere, use --host to specify an externally acces-+ sible address configured on this machine, The special address 0.0.0.0+ causes it to listen on all of this machine's addresses. - -Q --quarterly- multiperiod/multicolumn report by quarter+ Similarly, you can use --port to listen on a TCP port other than 5000.+ This is useful if you want to run multiple hledger-web instances on a ma-+ chine. - -Y --yearly- multiperiod/multicolumn report by year+ When --socket is used, hledger-web creates and communicates via a socket+ file instead of a TCP port. This can be more secure, respects unix file+ permissions, and makes certain use cases easier, such as running per-user+ instances behind an nginx reverse proxy. (Eg: proxy_pass+ http://unix:/tmp/hledger/${remote_user}.socket;.) - -p --period=PERIODEXP- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)+ You can use --base-url to change the protocol, hostname, port and path that+ appear in hledger-web's hyperlinks. This is useful eg when integrating+ hledger-web within a larger website. The default is http://HOST:PORT/ us-+ ing the server's configured host address and TCP port (or http://HOST if+ PORT is 80). Note this affects url generation but not route parsing. - --date2- match the secondary date instead (see command help for other- effects)+ hledger-web also supports many of hledger's general options: - -U --unmarked- include only unmarked postings/txns (can combine with -P or -C)+ General input/data transformation flags:+ -f --file=[FMT:]FILE Read data from FILE, or from stdin if FILE is -,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ --rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ --alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ --auto generate extra postings by applying auto posting+ rules ("=") to all transactions+ --forecast[=PERIOD] Generate extra transactions from periodic rules+ ("~"), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger-ui, also make future-dated transactions+ visible at startup.+ -I --ignore-assertions don't check balance assertions by default+ --txn-balancing=... how to check that transactions are balanced:+ 'old': use global display precision+ 'exact': use transaction precision (default)+ --infer-costs infer conversion equity postings from costs+ --infer-equity infer costs from conversion equity postings+ --infer-market-prices infer market prices from costs+ --pivot=TAGNAME use a different field or tag as account names+ -s --strict do extra error checks (and override -I)+ --verbose-tags add tags indicating generated/modified data - -P --pending- include only pending postings/txns+ General output/reporting flags (supported by some commands):+ -b --begin=DATE include postings/transactions on/after this date+ -e --end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ -D --daily multiperiod report with 1 day interval+ -W --weekly multiperiod report with 1 week interval+ -M --monthly multiperiod report with 1 month interval+ -Q --quarterly multiperiod report with 1 quarter interval+ -Y --yearly multiperiod report with 1 year interval+ -p --period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ --today=DATE override today's date (affects relative dates)+ --date2 match/use secondary dates instead (deprecated)+ -U --unmarked include only unmarked postings/transactions+ -P --pending include only pending postings/transactions+ -C --cleared include only cleared postings/transactions+ (-U/-P/-C can be combined)+ -R --real include only non-virtual postings+ -E --empty Show zero items, which are normally hidden.+ In hledger-ui & hledger-web, do the opposite.+ --depth=DEPTHEXP if a number (or -NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ -B --cost show amounts converted to their cost/sale amount+ -V --market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to --value=end.+ -X --exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to --value=end,COMM.+ --value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ 'then': value on transaction dates+ 'end': value at period end(s)+ 'now': value today+ YYYY-MM-DD: value on given date+ -c --commodity-style=S Override a commodity's display style.+ Eg: -c '.' or -c '1.000,00 EUR'+ --pretty[=YN] Use box-drawing characters in text output? Can be+ 'y'/'yes' or 'n'/'no'.+ If YN is specified, the equals is required. - -C --cleared- include only cleared postings/txns+ General help flags:+ -h --help show command line help+ --tldr show command examples with tldr+ --info show the manual with info+ --man show the manual with man+ --version show version information+ --debug=[1-9] show this much debug output (default: 1)+ --pager=YN use a pager when needed ? y/yes (default) or n/no+ --color=YNA --colour use ANSI color ? y/yes, n/no, or auto (default) - -R --real- include only non-virtual postings+ hledger-web shows accounts with zero balances by default (like hledger-ui,+ and unlike hledger). Using the -E/--empty flag will reverse this behav-+ iour. If you see accounts which appear to have a zero balance, but cannot+ be hidden with -E, it's because they have a mixed-cost balance, which looks+ like zero when costs are hidden. (hledger-web does not show costs.) - -NUM --depth=NUM- hide/aggregate accounts or postings more than NUM levels deep+ Reporting options and/or query arguments can be used to set an initial+ query, which although not shown in the UI, will restrict the data shown (in+ addition to any search query entered in the UI). - -E --empty- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)+ If you use the bash shell, you can auto-complete flags by pressing TAB in+ the command line. If this is not working see Install > Shell completions. - -B --cost- convert amounts to their cost at transaction time (using the- transaction price, if any)+PERMISSIONS+ By default, hledger-web allows anyone who can reach it to view the journal+ and to add new transactions, but not to change existing data. - -V --value- convert amounts to their market value on the report end date- (using the most recent applicable market price, if any)+ You can restrict who can reach it, by - --auto apply automated posting rules to modify transactions.+ * setting the IP address it listens on (see --host above). By default it+ listens on 127.0.0.1, accessible to users on the local machine only. - --forecast- apply periodic transaction rules to generate future transac-- tions, to 6 months from now or report end date.+ * putting it behind an authenticating proxy, such as caddy or apache - When a reporting option appears more than once in the command line, the- last one takes precedence.+ * putting it behind a firewall - Some reporting options can also be written as query arguments.+ And you can restrict what the users reaching it can do, by specifying the+ --allow=ACCESSLEVEL option at startup. ACCESSLEVEL is one of: - hledger help options:+ * view - allows viewing the journal file(s) - -h --help- show general usage (or after COMMAND, command usage)+ * add - also allows adding new transactions to the main journal file - --version- show version+ * edit - also allows editing, uploading or downloading the journal file(s) - --debug[=N]- show debug output (levels 1-9, default: 1)+ * sandstorm - (for the hledger-web Sandstorm app:) allows whichever of+ view, add, or edit are specified in the X-Sandstorm-Permissions HTTP+ header - A @FILE argument will be expanded to the contents of FILE, which should- contain one command line option/argument per line. (To prevent this,- insert a -- argument before.)+ The default access level is add. - By default, hledger-web starts the web app in "transient mode" and also- opens it in your default web browser if possible. In this mode the web- app will keep running for as long as you have it open in a browser win-- dow, and will exit after two minutes of inactivity (no requests and no- browser windows viewing it). With --serve, it just runs the web app- without exiting, and logs requests to the console.+EDITING, UPLOADING, DOWNLOADING+ If you enable the manage capability mentioned above, you'll see a new+ "spanner" button to the right of the search form. Clicking this will let+ you edit, upload, or download the journal file or any files it includes. - By default the server listens on IP address 127.0.0.1, accessible only- to local requests. You can use --host to change this, eg- --host 0.0.0.0 to listen on all configured addresses.+ Note, unlike any other hledger command, in this mode you (or any visitor)+ can alter or wipe the data files. - Similarly, use --port to set a TCP port other than 5000, eg if you are- running multiple hledger-web instances.+ Normally whenever a file is changed in this way, hledger-web saves a num-+ bered backup (assuming file permissions allow it, the disk is not full,+ etc.) hledger-web is not aware of version control systems, currently; if+ you use one, you'll have to arrange to commit the changes yourself (eg with+ a cron job or a file watcher like entr). - You can use --base-url to change the protocol, hostname, port and path- that appear in hyperlinks, useful eg for integrating hledger-web within- a larger website. The default is http://HOST:PORT/ using the server's- configured host address and TCP port (or http://HOST if PORT is 80).+ Changes which would leave the journal file(s) unparseable or non-valid (eg+ with failing balance assertions) are prevented. (Probably. This needs+ re-testing.) - With --file-url you can set a different base url for static files, eg- for better caching or cookie-less serving on high performance websites.+RELOADING+ hledger-web detects changes made to the files by other means (eg if you+ edit it directly, outside of hledger-web), and it will show the new data+ when you reload the page or navigate to a new page. If a change makes a+ file unparseable, hledger-web will display an error message until the file+ has been fixed. -PERMISSIONS- By default, hledger-web allows anyone who can reach it to view the- journal and to add new transactions, but not to change existing data.+ (Note: if you are viewing files mounted from another machine, make sure+ that both machine clocks are roughly in step.) - You can restrict who can reach it by+JSON API+ 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: - o setting the IP address it listens on (see --host above). By default- it listens on 127.0.0.1, accessible to all users on the local- machine.+ $ hledger-web -f examples/sample.journal --serve-api+ ... - o putting it behind an authenticating proxy, using eg apache or nginx+ You can get JSON data from these routes: - o custom firewall rules+ /version+ /accountnames+ /transactions+ /prices+ /commodities+ /accounts+ /accounttransactions/ACCOUNTNAME - You can restrict what the users who reach it can do, by+ Eg, all account names in the journal (similar to the accounts command).+ (hledger-web's JSON does not include newlines, here we use python to pret-+ tify it): - o using the --capabilities=CAP[,CAP..] flag when you start it, enabling- one or more of the following capabilities. The default value is- view,add:+ $ curl -s http://127.0.0.1:5000/accountnames | python -m json.tool+ [+ "assets",+ "assets:bank",+ "assets:bank:checking",+ "assets:bank:saving",+ "assets:cash",+ "expenses",+ "expenses:food",+ "expenses:supplies",+ "income",+ "income:gifts",+ "income:salary",+ "liabilities",+ "liabilities:debts"+ ] - o view - allows viewing the journal file and all included files+ Or all transactions: - o add - allows adding new transactions to the main journal file+ $ curl -s http://127.0.0.1:5000/transactions | python -m json.tool+ [+ {+ "tcode": "",+ "tcomment": "",+ "tdate": "2008-01-01",+ "tdate2": null,+ "tdescription": "income",+ "tindex": 1,+ "tpostings": [+ {+ "paccount": "assets:bank:checking",+ "pamount": [+ {+ "acommodity": "$",+ "aismultiplier": false,+ "aprice": null,+ ... - o manage - allows editing, uploading or downloading the main or- included files+ Most of the JSON corresponds to hledger's data types; for details of what+ the fields mean, see the Hledger.Data.Json haddock docs and click on the+ various data types, eg Transaction. And for a higher level understanding,+ see the journal docs. There is also a basic OpenAPI specification. - o using the --capabilities-header=HTTPHEADER flag to specify a HTTP- header from which it will read capabilities to enable. hledger-web- on Sandstorm uses the X-Sandstorm-Permissions header to integrate- with Sandstorm's permissions. This is disabled by default.+ In some cases there is outer JSON corresponding to a "Report" type. To un-+ derstand that, go to the Hledger.Web.Handler.MiscR haddock and look at the+ source for the appropriate handler to see what it returns. Eg for /ac-+ counttransactions it's getAccounttransactionsR, returning a "accountTrans-+ actionsReport ...". Looking up the haddock for that we can see that /ac-+ counttransactions returns an AccountTransactionsReport, which consists of a+ report title and a list of AccountTransactionsReportItem (etc). -EDITING, UPLOADING, DOWNLOADING- If you enable the manage capability mentioned above, you'll see a new- "spanner" button to the right of the search form. Clicking this will- let you edit, upload, or download the journal file or any files it- includes.+ You can add a new transaction to the journal with a PUT request to /add, if+ hledger-web was started with the add capability (enabled by default). The+ payload must be the full, exact JSON representation of a hledger transac-+ tion (partial data won't do). You can get sample JSON from hledger-web's+ /transactions or /accounttransactions, or you can export it with+ hledger-lib, eg like so: - Note, unlike any other hledger command, in this mode you (or any visi-- tor) can alter or wipe the data files.+ .../hledger$ stack ghci hledger-lib+ >>> writeJsonFile "txn.json" (head $ jtxns samplejournal)+ >>> :q - Normally whenever a file is changed in this way, hledger-web saves a- numbered backup (assuming file permissions allow it, the disk is not- full, etc.) hledger-web is not aware of version control systems, cur-- rently; if you use one, you'll have to arrange to commit the changes- yourself (eg with a cron job or a file watcher like entr).+ Here's how it looks as of hledger-1.17 (remember, this JSON corresponds to+ hledger's Transaction and related data types): - Changes which would leave the journal file(s) unparseable or non-valid- (eg with failing balance assertions) are prevented. (Probably. This- needs re-testing.)+ {+ "tcomment": "",+ "tpostings": [+ {+ "pbalanceassertion": null,+ "pstatus": "Unmarked",+ "pamount": [+ {+ "aprice": null,+ "acommodity": "$",+ "aquantity": {+ "floatingPoint": 1,+ "decimalPlaces": 10,+ "decimalMantissa": 10000000000+ },+ "aismultiplier": false,+ "astyle": {+ "ascommodityside": "L",+ "asdigitgroups": null,+ "ascommodityspaced": false,+ "asprecision": 2,+ "asdecimalpoint": "."+ }+ }+ ],+ "ptransaction_": "1",+ "paccount": "assets:bank:checking",+ "pdate": null,+ "ptype": "RegularPosting",+ "pcomment": "",+ "pdate2": null,+ "ptags": [],+ "poriginal": null+ },+ {+ "pbalanceassertion": null,+ "pstatus": "Unmarked",+ "pamount": [+ {+ "aprice": null,+ "acommodity": "$",+ "aquantity": {+ "floatingPoint": -1,+ "decimalPlaces": 10,+ "decimalMantissa": -10000000000+ },+ "aismultiplier": false,+ "astyle": {+ "ascommodityside": "L",+ "asdigitgroups": null,+ "ascommodityspaced": false,+ "asprecision": 2,+ "asdecimalpoint": "."+ }+ }+ ],+ "ptransaction_": "1",+ "paccount": "income:salary",+ "pdate": null,+ "ptype": "RegularPosting",+ "pcomment": "",+ "pdate2": null,+ "ptags": [],+ "poriginal": null+ }+ ],+ "ttags": [],+ "tsourcepos": {+ "tag": "JournalSourcePos",+ "contents": [+ "",+ [+ 1,+ 1+ ]+ ]+ },+ "tdate": "2008-01-01",+ "tcode": "",+ "tindex": 1,+ "tprecedingcomment": "",+ "tdate2": null,+ "tdescription": "income",+ "tstatus": "Unmarked"+ } -RELOADING- hledger-web detects changes made to the files by other means (eg if you- edit it directly, outside of hledger-web), and it will show the new- data when you reload the page or navigate to a new page. If a change- makes a file unparseable, hledger-web will display an error message- until the file has been fixed.+ And here's how to test adding it with curl. This should add a new entry to+ your journal: -JSON API- In addition to the web UI, hledger-web provides some JSON API routes.- These are similar to the API provided by the hledger-api tool, but it- may be convenient to have them in hledger-web also.+ $ curl http://127.0.0.1:5000/add -X PUT -H 'Content-Type: application/json' --data-binary @txn.json - /accountnames- /transactions- /prices- /commodities- /accounts- /accounttransactions/#AccountName+DEBUG OUTPUT+ Debug output+ You can add --debug[=N] to the command line to log debug output. N ranges+ from 1 (least output, the default) to 9 (maximum output). Typically you+ would start with 1 and increase until you are seeing enough. Debug output+ goes to stderr, interleaved with the requests logged on stdout. To capture+ debug output in a log file instead, you can usually redirect stderr, eg:+ hledger-web --debug=3 2>hledger-web.log. ENVIRONMENT- LEDGER_FILE The journal file path when not specified with -f. Default:- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-- nal).--FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal).+ LEDGER_FILE The main journal file to use when not specified with -f/--file.+ Default: $HOME/.hledger.journal. BUGS- The need to precede options with -- when invoked from hledger is awk-- ward.-- -f- doesn't work (hledger-web can't read from stdin).-- Query arguments and some hledger options are ignored.+ We welcome bug reports in the hledger issue tracker+ (https://bugs.hledger.org), or on the hledger chat or mail list+ (https://hledger.org/support). - Does not work in text-mode browsers.+ Some known issues: - Does not work well on small screens.+ Does not work well on small screens, or in text-mode browsers. -REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)-- AUTHORS- Simon Michael <simon@joyful.com> and contributors+ Simon Michael <simon@joyful.com> and contributors.+ See http://hledger.org/CREDITS.html COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.+ Copyright 2007-2023 Simon Michael and contributors. -SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org+LICENSE+ Released under GNU GPL v3 or later. +SEE ALSO+ hledger(1), hledger-ui(1), hledger-web(1), ledger(1) -hledger-web 1.14 March 2019 hledger-web(1)+hledger-web-1.52 March 2026 HLEDGER-WEB(1)
embeddedfiles/hledger.1 view
@@ -1,3275 +1,13775 @@ .\"t -.TH "hledger" "1" "March 2019" "hledger 1.14" "hledger User Manuals"----.SH NAME-.PP-hledger \- a command\-line accounting tool-.SH SYNOPSIS-.PP-\f[C]hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [ARGS]\f[]-.PD 0-.P-.PD-\f[C]hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [ARGS]\f[]-.PD 0-.P-.PD-\f[C]hledger\f[]-.SH DESCRIPTION-.PP-hledger is a cross\-platform program for tracking money, time, or any-other commodity, using double\-entry accounting and a simple, editable-file format.-hledger is inspired by and largely compatible with ledger(1).-.PD 0-.P-.PD-Tested on unix, mac, windows, hledger aims to be a reliable, practical-tool for daily use.-.PP-This is hledger's command\-line interface (there are also curses and web-interfaces).-Its basic function is to read a plain text file describing financial-transactions (in accounting terms, a general journal) and print useful-reports on standard output, or export them as CSV.-hledger can also read some other file formats such as CSV files,-translating them to journal format.-Additionally, hledger lists other hledger\-* executables found in the-user's $PATH and can invoke them as subcommands.-.PP-hledger reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-If using \f[C]$LEDGER_FILE\f[], note this must be a real environment-variable, not a shell variable.-You can specify standard input with \f[C]\-f\-\f[].-.PP-Transactions are dated movements of money between two (or more) named-accounts, and are recorded with journal entries like this:-.IP-.nf-\f[C]-2015/10/16\ bought\ food-\ expenses:food\ \ \ \ \ \ \ \ \ \ $10-\ assets:cash-\f[]-.fi-.PP-For more about this format, see hledger_journal(5).-.PP-Most users use a text editor to edit the journal, usually with an editor-mode such as ledger\-mode for added convenience.-hledger's interactive add command is another way to record new-transactions.-hledger never changes existing transactions.-.PP-To get started, you can either save some entries like the above in-\f[C]~/.hledger.journal\f[], or run \f[C]hledger\ add\f[] and follow the-prompts.-Then try some commands like \f[C]hledger\ print\f[] or-\f[C]hledger\ balance\f[].-Run \f[C]hledger\f[] with no arguments for a list of commands.-.SH EXAMPLES-.PP-Two simple transactions in hledger journal format:-.IP-.nf-\f[C]-2015/9/30\ gift\ received-\ \ assets:cash\ \ \ $20-\ \ income:gifts--2015/10/16\ farmers\ market-\ \ expenses:food\ \ \ \ $10-\ \ assets:cash-\f[]-.fi-.PP-Some basic reports:-.IP-.nf-\f[C]-$\ hledger\ print-2015/09/30\ gift\ received-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ $20-\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ $\-20--2015/10/16\ farmers\ market-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ $10-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ $\-10-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ accounts\ \-\-tree-assets-\ \ cash-expenses-\ \ food-income-\ \ gifts-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ balance-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ assets:cash-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ expenses:food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-20\ \ income:gifts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ register\ cash-2015/09/30\ gift\ received\ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ $20-2015/10/16\ farmers\ market\ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ \ \ $10-\f[]-.fi-.PP-More commands:-.IP-.nf-\f[C]-$\ hledger\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ available\ commands-$\ hledger\ add\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ add\ more\ transactions\ to\ the\ journal\ file-$\ hledger\ balance\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ all\ accounts\ with\ aggregated\ balances-$\ hledger\ balance\ \-\-help\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ detailed\ help\ for\ balance\ command-$\ hledger\ balance\ \-\-depth\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ only\ top\-level\ accounts-$\ hledger\ register\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ account\ postings,\ with\ running\ total-$\ hledger\ reg\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ postings\ to/from\ income\ accounts-$\ hledger\ reg\ \[aq]assets:some\ bank:checking\[aq]\ #\ show\ postings\ to/from\ this\ checking\ account-$\ hledger\ print\ desc:shop\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ transactions\ with\ shop\ in\ the\ description-$\ hledger\ activity\ \-W\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ transaction\ counts\ per\ week\ as\ a\ bar\ chart-\f[]-.fi-.SH OPTIONS-.SS General options-.PP-To see general usage help, including general options which are supported-by most hledger commands, run \f[C]hledger\ \-h\f[].-.PP-General help options:-.TP-.B \f[C]\-h\ \-\-help\f[]-show general usage (or after COMMAND, command usage)-.RS-.RE-.TP-.B \f[C]\-\-version\f[]-show version-.RS-.RE-.TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)-.RS-.RE-.PP-General input options:-.TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or-\f[C]$HOME/.hledger.journal\f[])-.RS-.RE-.TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)-.RS-.RE-.TP-.B \f[C]\-\-separator=CHAR\f[]-Field separator to expect when reading CSV (default: \[aq],\[aq])-.RS-.RE-.TP-.B \f[C]\-\-alias=OLD=NEW\f[]-rename accounts named OLD to NEW-.RS-.RE-.TP-.B \f[C]\-\-anon\f[]-anonymize accounts and payees-.RS-.RE-.TP-.B \f[C]\-\-pivot\ FIELDNAME\f[]-use some other field or tag for the account name-.RS-.RE-.TP-.B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions-.RS-.RE-.PP-General reporting options:-.TP-.B \f[C]\-b\ \-\-begin=DATE\f[]-include postings/txns on or after this date-.RS-.RE-.TP-.B \f[C]\-e\ \-\-end=DATE\f[]-include postings/txns before this date-.RS-.RE-.TP-.B \f[C]\-D\ \-\-daily\f[]-multiperiod/multicolumn report by day-.RS-.RE-.TP-.B \f[C]\-W\ \-\-weekly\f[]-multiperiod/multicolumn report by week-.RS-.RE-.TP-.B \f[C]\-M\ \-\-monthly\f[]-multiperiod/multicolumn report by month-.RS-.RE-.TP-.B \f[C]\-Q\ \-\-quarterly\f[]-multiperiod/multicolumn report by quarter-.RS-.RE-.TP-.B \f[C]\-Y\ \-\-yearly\f[]-multiperiod/multicolumn report by year-.RS-.RE-.TP-.B \f[C]\-p\ \-\-period=PERIODEXP\f[]-set start date, end date, and/or reporting interval all at once using-period expressions syntax (overrides the flags above)-.RS-.RE-.TP-.B \f[C]\-\-date2\f[]-match the secondary date instead (see command help for other effects)-.RS-.RE-.TP-.B \f[C]\-U\ \-\-unmarked\f[]-include only unmarked postings/txns (can combine with \-P or \-C)-.RS-.RE-.TP-.B \f[C]\-P\ \-\-pending\f[]-include only pending postings/txns-.RS-.RE-.TP-.B \f[C]\-C\ \-\-cleared\f[]-include only cleared postings/txns-.RS-.RE-.TP-.B \f[C]\-R\ \-\-real\f[]-include only non\-virtual postings-.RS-.RE-.TP-.B \f[C]\-NUM\ \-\-depth=NUM\f[]-hide/aggregate accounts or postings more than NUM levels deep-.RS-.RE-.TP-.B \f[C]\-E\ \-\-empty\f[]-show items with zero amount, normally hidden (and vice\-versa in-hledger\-ui/hledger\-web)-.RS-.RE-.TP-.B \f[C]\-B\ \-\-cost\f[]-convert amounts to their cost at transaction time (using the transaction-price, if any)-.RS-.RE-.TP-.B \f[C]\-V\ \-\-value\f[]-convert amounts to their market value on the report end date (using the-most recent applicable market price, if any)-.RS-.RE-.TP-.B \f[C]\-\-auto\f[]-apply automated posting rules to modify transactions.-.RS-.RE-.TP-.B \f[C]\-\-forecast\f[]-apply periodic transaction rules to generate future transactions, to 6-months from now or report end date.-.RS-.RE-.PP-When a reporting option appears more than once in the command line, the-last one takes precedence.-.PP-Some reporting options can also be written as query arguments.-.SS Command options-.PP-To see options for a particular command, including command\-specific-options, run: \f[C]hledger\ COMMAND\ \-h\f[].-.PP-Command\-specific options must be written after the command name, eg:-\f[C]hledger\ print\ \-x\f[].-.PP-Additionally, if the command is an addon, you may need to put its-options after a double\-hyphen, eg:-\f[C]hledger\ ui\ \-\-\ \-\-watch\f[].-Or, you can run the addon executable directly:-\f[C]hledger\-ui\ \-\-watch\f[].-.SS Command arguments-.PP-Most hledger commands accept arguments after the command name, which are-often a query, filtering the data in some way.-.SS Argument files-.PP-You can save a set of command line options/arguments in a file, one per-line, and then reuse them by writing \f[C]\@FILENAME\f[] in a command-line.-To prevent this expansion of \f[C]\@\f[]\-arguments, precede them with a-\f[C]\-\-\f[] argument.-For more, see Save frequently used options.-.SS Special characters in arguments and queries-.PP-In shell command lines, option and argument values which contain-"problematic" characters, ie spaces, and also characters significant to-your shell such as \f[C]<\f[], \f[C]>\f[], \f[C](\f[], \f[C])\f[],-\f[C]|\f[] and \f[C]$\f[], should be escaped by enclosing them in quotes-or by writing backslashes before the characters.-Eg:-.PP-\f[C]hledger\ register\ \-p\ \[aq]last\ year\[aq]\ "accounts\ receivable\ (receivable|payable)"\ amt:\\>100\f[].-.SS More escaping-.PP-Characters significant both to the shell and in regular expressions may-need one extra level of escaping.-These include parentheses, the pipe symbol and the dollar sign.-Eg, to match the dollar symbol, bash users should do:-.PP-\f[C]hledger\ balance\ cur:\[aq]\\$\[aq]\f[]-.PP-or:-.PP-\f[C]hledger\ balance\ cur:\\\\$\f[]-.SS Even more escaping-.PP-When hledger runs an addon executable (eg you type \f[C]hledger\ ui\f[],-hledger runs \f[C]hledger\-ui\f[]), it de\-escapes command\-line options-and arguments once, so you might need to \f[I]triple\f[]\-escape.-Eg in bash, running the ui command and matching the dollar sign,-it\[aq]s:-.PP-\f[C]hledger\ ui\ cur:\[aq]\\\\$\[aq]\f[]-.PP-or:-.PP-\f[C]hledger\ ui\ cur:\\\\\\\\$\f[]-.PP-If you asked why \f[I]four\f[] slashes above, this may help:-.PP-.TS-tab(@);-l l.-T{-unescaped:-T}@T{-\f[C]$\f[]-T}-T{-escaped:-T}@T{-\f[C]\\$\f[]-T}-T{-double\-escaped:-T}@T{-\f[C]\\\\$\f[]-T}-T{-triple\-escaped:-T}@T{-\f[C]\\\\\\\\$\f[]-T}-.TE-.PP-(The number of backslashes in fish shell is left as an exercise for the-reader.)-.PP-You can always avoid the extra escaping for addons by running the addon-directly:-.PP-\f[C]hledger\-ui\ cur:\\\\$\f[]-.SS Less escaping-.PP-Inside an argument file, or in the search field of hledger\-ui or-hledger\-web, or at a GHCI prompt, you need one less level of escaping-than at the command line.-And backslashes may work better than quotes.-Eg:-.PP-\f[C]ghci>\ :main\ balance\ cur:\\$\f[]-.SS Command line tips-.PP-If in doubt, keep things simple:-.IP \[bu] 2-write options after the command (\f[C]hledger\ CMD\ \-OPTIONS\ ARGS\f[])-.IP \[bu] 2-run add\-on executables directly (\f[C]hledger\-ui\ \-OPTIONS\ ARGS\f[])-.IP \[bu] 2-enclose problematic args in single quotes-.IP \[bu] 2-if needed, also add a backslash to escape regexp metacharacters-.PP-To find out exactly how a command line is being parsed, add-\f[C]\-\-debug=2\f[] to troubleshoot.-.SS Unicode characters-.PP-hledger is expected to handle unicode (non\-ascii) characters, but this-requires a well\-configured environment.-.PP-To handle unicode characters in the command line or input data, a system-locale that can decode them must be configured (POSIX\[aq]s default-\f[C]C\f[] locale will not work).-Eg in bash, you could do:-.IP-.nf-\f[C]-export\ LANG=en_US.UTF\-8-\f[]-.fi-.PP-See Troubleshooting for more about this.-.PP-Unicode characters should appear correctly in hledger\[aq]s output.-For the hledger and hledger\-ui tools, this requires that-.IP \[bu] 2-your terminal supports unicode-.IP \[bu] 2-the terminal\[aq]s font includes the required unicode glyphs-.IP \[bu] 2-the terminal is configured to display "wide" characters as double width-(otherwise report alignment will be off)-.SS Input files-.PP-hledger reads transactions from a data file (and the add command writes-to it).-By default this file is \f[C]$HOME/.hledger.journal\f[] (or on Windows,-something like \f[C]C:/Users/USER/.hledger.journal\f[]).-You can override this with the \f[C]$LEDGER_FILE\f[] environment-variable:-.IP-.nf-\f[C]-$\ setenv\ LEDGER_FILE\ ~/finance/2016.journal-$\ hledger\ stats-\f[]-.fi-.PP-or with the \f[C]\-f/\-\-file\f[] option:-.IP-.nf-\f[C]-$\ hledger\ \-f\ /some/file\ stats-\f[]-.fi-.PP-The file name \f[C]\-\f[] (hyphen) means standard input:-.IP-.nf-\f[C]-$\ cat\ some.journal\ |\ hledger\ \-f\--\f[]-.fi-.PP-Usually the data file is in hledger\[aq]s journal format, but it can-also be one of several other formats, listed below.-hledger detects the format automatically based on the file extension, or-if that is not recognised, by trying each built\-in "reader" in turn:-.PP-.TS-tab(@);-lw(10.3n) lw(33.5n) lw(26.2n).-T{-Reader:-T}@T{-Reads:-T}@T{-Used for file extensions:-T}-_-T{-\f[C]journal\f[]-T}@T{-hledger\[aq]s journal format, also some Ledger journals-T}@T{-\f[C]\&.journal\f[] \f[C]\&.j\f[] \f[C]\&.hledger\f[] \f[C]\&.ledger\f[]-T}-T{-\f[C]timeclock\f[]-T}@T{-timeclock files (precise time logging)-T}@T{-\f[C]\&.timeclock\f[]-T}-T{-\f[C]timedot\f[]-T}@T{-timedot files (approximate time logging)-T}@T{-\f[C]\&.timedot\f[]-T}-T{-\f[C]csv\f[]-T}@T{-comma\-separated values (data interchange)-T}@T{-\f[C]\&.csv\f[]-T}-.TE-.PP-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:-.IP-.nf-\f[C]-$\ hledger\ \-f\ csv:/some/csv\-file.dat\ stats-$\ echo\ \[aq]i\ 2009/13/1\ 08:00:00\[aq]\ |\ hledger\ print\ \-ftimeclock:\--\f[]-.fi-.PP-You can also specify multiple \f[C]\-f\f[] options, to read multiple-files as one big journal.-There are some limitations with this:-.IP \[bu] 2-directives in one file will not affect the other files-.IP \[bu] 2-balance assertions will not see any account balances from previous files-.PP-If you need those, either use the include directive, or concatenate the-files, eg: \f[C]cat\ a.journal\ b.journal\ |\ hledger\ \-f\-\ CMD\f[].-.SS Smart dates-.PP-hledger\[aq]s user interfaces accept a flexible "smart date" syntax-(unlike dates in the journal file).-Smart dates allow some english words, can be relative to today\[aq]s-date, and can have less\-significant date parts omitted (defaulting to-1).-.PP-Examples:-.PP-.TS-tab(@);-l l.-T{-\f[C]2004/10/1\f[], \f[C]2004\-01\-01\f[], \f[C]2004.9.1\f[]-T}@T{-exact date, several separators allowed.-Year is 4+ digits, month is 1\-12, day is 1\-31-T}-T{-\f[C]2004\f[]-T}@T{-start of year-T}-T{-\f[C]2004/10\f[]-T}@T{-start of month-T}-T{-\f[C]10/1\f[]-T}@T{-month and day in current year-T}-T{-\f[C]21\f[]-T}@T{-day in current month-T}-T{-\f[C]october,\ oct\f[]-T}@T{-start of month in current year-T}-T{-\f[C]yesterday,\ today,\ tomorrow\f[]-T}@T{-\-1, 0, 1 days from today-T}-T{-\f[C]last/this/next\ day/week/month/quarter/year\f[]-T}@T{-\-1, 0, 1 periods from the current period-T}-T{-\f[C]20181201\f[]-T}@T{-8 digit YYYYMMDD with valid year month and day-T}-T{-\f[C]201812\f[]-T}@T{-6 digit YYYYMM with valid year and month-T}-.TE-.PP-Counterexamples \- malformed digit sequences might give surprising-results:-.PP-.TS-tab(@);-l l.-T{-\f[C]201813\f[]-T}@T{-6 digits with an invalid month is parsed as start of 6\-digit year-T}-T{-\f[C]20181301\f[]-T}@T{-8 digits with an invalid month is parsed as start of 8\-digit year-T}-T{-\f[C]20181232\f[]-T}@T{-8 digits with an invalid day gives an error-T}-T{-\f[C]201801012\f[]-T}@T{-9+ digits beginning with a valid YYYYMMDD gives an error-T}-.TE-.SS Report start & end date-.PP-Most hledger reports show the full span of time represented by the-journal data, by default.-So, the effective report start and end dates will be the earliest and-latest transaction or posting dates found in the journal.-.PP-Often you will want to see a shorter time span, such as the current-month.-You can specify a start and/or end date using \f[C]\-b/\-\-begin\f[],-\f[C]\-e/\-\-end\f[], \f[C]\-p/\-\-period\f[] or a \f[C]date:\f[] query-(described below).-All of these accept the smart date syntax.-One important thing to be aware of when specifying end dates: as in-Ledger, end dates are exclusive, so you need to write the date-\f[I]after\f[] the last day you want to include.-.PP-Examples:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-b\ 2016/3/17\f[]-T}@T{-begin on St.-Patrick\[aq]s day 2016-T}-T{-\f[C]\-e\ 12/1\f[]-T}@T{-end at the start of december 1st of the current year (11/30 will be the-last date included)-T}-T{-\f[C]\-b\ thismonth\f[]-T}@T{-all transactions on or after the 1st of the current month-T}-T{-\f[C]\-p\ thismonth\f[]-T}@T{-all transactions in the current month-T}-T{-\f[C]date:2016/3/17\-\f[]-T}@T{-the above written as queries instead-T}-T{-\f[C]date:\-12/1\f[]-T}@T{-T}-T{-\f[C]date:thismonth\-\f[]-T}@T{-T}-T{-\f[C]date:thismonth\f[]-T}@T{-T}-.TE-.SS Report intervals-.PP-A report interval can be specified so that commands like register,-balance and activity will divide their reports into multiple subperiods.-The basic intervals can be selected with one of \f[C]\-D/\-\-daily\f[],-\f[C]\-W/\-\-weekly\f[], \f[C]\-M/\-\-monthly\f[],-\f[C]\-Q/\-\-quarterly\f[], or \f[C]\-Y/\-\-yearly\f[].-More complex intervals may be specified with a period expression.-Report intervals can not be specified with a query, currently.-.SS Period expressions-.PP-The \f[C]\-p/\-\-period\f[] option accepts period expressions, a-shorthand way of expressing a start date, end date, and/or report-interval all at once.-.PP-Here\[aq]s a basic period expression specifying the first quarter of-2009.-Note, hledger always treats start dates as inclusive and end dates as-exclusive:-.PP-\f[C]\-p\ "from\ 2009/1/1\ to\ 2009/4/1"\f[]-.PP-Keywords like "from" and "to" are optional, and so are the spaces, as-long as you don\[aq]t run two dates together.-"to" can also be written as "\-".-These are equivalent to the above:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "2009/1/1\ 2009/4/1"\f[]-T}-T{-\f[C]\-p2009/1/1to2009/4/1\f[]-T}-T{-\f[C]\-p2009/1/1\-2009/4/1\f[]-T}-.TE-.PP-Dates are smart dates, so if the current year is 2009, the above can-also be written as:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "1/1\ 4/1"\f[]-T}-T{-\f[C]\-p\ "january\-apr"\f[]-T}-T{-\f[C]\-p\ "this\ year\ to\ 4/1"\f[]-T}-.TE-.PP-If you specify only one date, the missing start or end date will be the-earliest or latest transaction in your journal:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-p\ "from\ 2009/1/1"\f[]-T}@T{-everything after january 1, 2009-T}-T{-\f[C]\-p\ "from\ 2009/1"\f[]-T}@T{-the same-T}-T{-\f[C]\-p\ "from\ 2009"\f[]-T}@T{-the same-T}-T{-\f[C]\-p\ "to\ 2009"\f[]-T}@T{-everything before january 1, 2009-T}-.TE-.PP-A single date with no "from" or "to" defines both the start and end date-like so:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-p\ "2009"\f[]-T}@T{-the year 2009; equivalent to "2009/1/1 to 2010/1/1"-T}-T{-\f[C]\-p\ "2009/1"\f[]-T}@T{-the month of jan; equivalent to "2009/1/1 to 2009/2/1"-T}-T{-\f[C]\-p\ "2009/1/1"\f[]-T}@T{-just that day; equivalent to "2009/1/1 to 2009/1/2"-T}-.TE-.PP-The argument of \f[C]\-p\f[] can also begin with, or be, a report-interval expression.-The basic report intervals are \f[C]daily\f[], \f[C]weekly\f[],-\f[C]monthly\f[], \f[C]quarterly\f[], or \f[C]yearly\f[], which have the-same effect as the \f[C]\-D\f[],\f[C]\-W\f[],\f[C]\-M\f[],\f[C]\-Q\f[],-or \f[C]\-Y\f[] flags.-Between report interval and start/end dates (if any), the word-\f[C]in\f[] is optional.-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[]-T}-T{-\f[C]\-p\ "monthly\ in\ 2008"\f[]-T}-T{-\f[C]\-p\ "quarterly"\f[]-T}-.TE-.PP-Note that \f[C]weekly\f[], \f[C]monthly\f[], \f[C]quarterly\f[] and-\f[C]yearly\f[] intervals will always start on the first day on week,-month, quarter or year accordingly, and will end on the last day of same-period, even if associated period expression specifies different-explicit start and end date.-.PP-For example:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[] \-\- starts on-2008/12/29, closest preceeding Monday-T}-T{-\f[C]\-p\ "monthly\ in\ 2008/11/25"\f[] \-\- starts on 2018/11/01-T}-T{-\f[C]\-p\ "quarterly\ from\ 2009\-05\-05\ to\ 2009\-06\-01"\f[] \--starts on 2009/04/01, ends on 2009/06/30, which are first and last days-of Q2 2009-T}-T{-\f[C]\-p\ "yearly\ from\ 2009\-12\-29"\f[] \- starts on 2009/01/01,-first day of 2009-T}-.TE-.PP-The following more complex report intervals are also supported:-\f[C]biweekly\f[], \f[C]bimonthly\f[],-\f[C]every\ day|week|month|quarter|year\f[],-\f[C]every\ N\ days|weeks|months|quarters|years\f[].-.PP-All of these will start on the first day of the requested period and end-on the last one, as described above.-.PP-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "bimonthly\ from\ 2008"\f[] \-\- periods will have boundaries-on 2008/01/01, 2008/03/01, ...-T}-T{-\f[C]\-p\ "every\ 2\ weeks"\f[] \-\- starts on closest preceeding Monday-T}-T{-\f[C]\-p\ "every\ 5\ month\ from\ 2009/03"\f[] \-\- periods will have-boundaries on 2009/03/01, 2009/08/01, ...-T}-.TE-.PP-If you want intervals that start on arbitrary day of your choosing and-span a week, month or year, you need to use any of the following:-.PP-\f[C]every\ Nth\ day\ of\ week\f[], \f[C]every\ <weekday>\f[],-\f[C]every\ Nth\ day\ [of\ month]\f[],-\f[C]every\ Nth\ weekday\ [of\ month]\f[],-\f[C]every\ MM/DD\ [of\ year]\f[], \f[C]every\ Nth\ MMM\ [of\ year]\f[],-\f[C]every\ MMM\ Nth\ [of\ year]\f[].-.PP-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "every\ 2nd\ day\ of\ week"\f[] \-\- periods will go from Tue-to Tue-T}-T{-\f[C]\-p\ "every\ Tue"\f[] \-\- same-T}-T{-\f[C]\-p\ "every\ 15th\ day"\f[] \-\- period boundaries will be on 15th-of each month-T}-T{-\f[C]\-p\ "every\ 2nd\ Monday"\f[] \-\- period boundaries will be on-second Monday of each month-T}-T{-\f[C]\-p\ "every\ 11/05"\f[] \-\- yearly periods with boundaries on 5th-of Nov-T}-T{-\f[C]\-p\ "every\ 5th\ Nov"\f[] \-\- same-T}-T{-\f[C]\-p\ "every\ Nov\ 5th"\f[] \-\- same-T}-.TE-.PP-Show historical balances at end of 15th each month (N is exclusive end-date):-.PP-\f[C]hledger\ balance\ \-H\ \-p\ "every\ 16th\ day"\f[]-.PP-Group postings from start of wednesday to end of next tuesday (N is-start date and exclusive end date):-.PP-\f[C]hledger\ register\ checking\ \-p\ "every\ 3rd\ day\ of\ week"\f[]-.SS Depth limiting-.PP-With the \f[C]\-\-depth\ N\f[] option (short form: \f[C]\-N\f[]),-commands like account, balance and register will show only the uppermost-accounts in the account tree, down to level N.-Use this when you want a summary with less detail.-This flag has the same effect as a \f[C]depth:\f[] query argument (so-\f[C]\-2\f[], \f[C]\-\-depth=2\f[] or \f[C]depth:2\f[] are basically-equivalent).-.SS Pivoting-.PP-Normally hledger sums amounts, and organizes them in a hierarchy, based-on account name.-The \f[C]\-\-pivot\ FIELD\f[] option causes it to sum and organize-hierarchy based on the value of some other field instead.-FIELD can be: \f[C]code\f[], \f[C]description\f[], \f[C]payee\f[],-\f[C]note\f[], or the full name (case insensitive) of any tag.-As with account names, values containing \f[C]colon:separated:parts\f[]-will be displayed hierarchically in reports.-.PP-\f[C]\-\-pivot\f[] is a general option affecting all reports; you can-think of hledger transforming the journal before any other processing,-replacing every posting\[aq]s account name with the value of the-specified field on that posting, inheriting it from the transaction or-using a blank value if it\[aq]s not present.-.PP-An example:-.IP-.nf-\f[C]-2016/02/16\ Member\ Fee\ Payment-\ \ \ \ assets:bank\ account\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR-\ \ \ \ income:member\ fees\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ ;\ member:\ John\ Doe-\f[]-.fi-.PP-Normal balance report showing account names:-.IP-.nf-\f[C]-$\ hledger\ balance-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR\ \ assets:bank\ account-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ income:member\ fees-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-Pivoted balance report, using member: tag values instead:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-pivot\ member-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-One way to show only amounts with a member: value (using a query,-described below):-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-pivot\ member\ tag:member=.-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR-\f[]-.fi-.PP-Another way (the acct: query matches against the pivoted "account-name"):-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-pivot\ member\ acct:.-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR-\f[]-.fi-.SS Cost-.PP-The \f[C]\-B/\-\-cost\f[] flag converts amounts to their cost at-transaction time, if they have a transaction price specified.-.SS Market value-.PP-The \f[C]\-V/\-\-value\f[] flag converts reported amounts to their-current market value.-.PD 0-.P-.PD-Specifically, when there is a market price (P directive) for the-amount\[aq]s commodity, dated on or before today\[aq]s date (or the-report end date if specified), the amount will be converted to the-price\[aq]s commodity.-.PP-When there are multiple applicable P directives, \-V chooses the most-recent one, or in case of equal dates, the last\-parsed one.-.PP-For example:-.IP-.nf-\f[C]-#\ one\ euro\ is\ worth\ this\ many\ dollars\ from\ nov\ 1-P\ 2016/11/01\ €\ $1.10--#\ purchase\ some\ euros\ on\ nov\ 3-2016/11/3-\ \ \ \ assets:euros\ \ \ \ \ \ \ \ €100-\ \ \ \ assets:checking--#\ the\ euro\ is\ worth\ fewer\ dollars\ by\ dec\ 21-P\ 2016/12/21\ €\ $1.03-\f[]-.fi-.PP-How many euros do I have ?-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ \-N\ euros-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros-\f[]-.fi-.PP-What are they worth at end of nov 3 ?-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ \-N\ euros\ \-V\ \-e\ 2016/11/4-\ \ \ \ \ \ \ \ \ \ \ \ \ $110.00\ \ assets:euros-\f[]-.fi-.PP-What are they worth after 2016/12/21 ?-(no report end date specified, defaults to today)-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ \-N\ euros\ \-V-\ \ \ \ \ \ \ \ \ \ \ \ \ $103.00\ \ assets:euros-\f[]-.fi-.PP-Currently, hledger\[aq]s \-V only uses market prices recorded with P-directives, not transaction prices (unlike Ledger).-.PP-Currently, \-V has a limitation in multicolumn balance reports: it uses-the market prices on the report end date for all columns.-(Instead of the prices on each column\[aq]s end date.)-.SS Combining \-B and \-V-.PP-Using \-B/\-\-cost and \-V/\-\-value together is currently allowed, but-the results are probably not meaningful.-Let us know if you find a use for this.-.SS Output destination-.PP-Some commands (print, register, stats, the balance commands) can write-their output to a destination other than the console.-This is controlled by the \f[C]\-o/\-\-output\-file\f[] option.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-o\ \-\ \ \ \ \ #\ write\ to\ stdout\ (the\ default)-$\ hledger\ balance\ \-o\ FILE\ \ #\ write\ to\ FILE-\f[]-.fi-.SS Output format-.PP-Some commands can write their output in other formats.-Eg print and register can output CSV, and the balance commands can-output CSV or HTML.-This is controlled by the \f[C]\-O/\-\-output\-format\f[] option, or by-specifying a \f[C]\&.csv\f[] or \f[C]\&.html\f[] file extension with-\f[C]\-o/\-\-output\-file\f[].-.IP-.nf-\f[C]-$\ hledger\ balance\ \-O\ csv\ \ \ \ \ \ \ #\ write\ CSV\ to\ stdout-$\ hledger\ balance\ \-o\ FILE.csv\ \ #\ write\ CSV\ to\ FILE.csv-\f[]-.fi-.SS Regular expressions-.PP-hledger uses regular expressions in a number of places:-.IP \[bu] 2-query terms, on the command line and in the hledger\-web search form:-\f[C]REGEX\f[], \f[C]desc:REGEX\f[], \f[C]cur:REGEX\f[],-\f[C]tag:...=REGEX\f[]-.IP \[bu] 2-CSV rules conditional blocks: \f[C]if\ REGEX\ ...\f[]-.IP \[bu] 2-account alias directives and options:-\f[C]alias\ /REGEX/\ =\ REPLACEMENT\f[],-\f[C]\-\-alias\ /REGEX/=REPLACEMENT\f[]-.PP-hledger\[aq]s regular expressions come from the regex\-tdfa library.-In general they:-.IP \[bu] 2-are case insensitive-.IP \[bu] 2-are infix matching (do not need to match the entire thing being matched)-.IP \[bu] 2-are POSIX extended regular expressions-.IP \[bu] 2-also support GNU word boundaries (\\<, \\>, \\b, \\B)-.IP \[bu] 2-and parenthesised capturing groups and numeric backreferences in-replacement strings-.IP \[bu] 2-do not support mode modifiers like (?s)-.PP-Some things to note:-.IP \[bu] 2-In the \f[C]alias\f[] directive and \f[C]\-\-alias\f[] option, regular-expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[]).-Elsewhere in hledger, these are not required.-.IP \[bu] 2-In queries, to match a regular expression metacharacter like \f[C]$\f[]-as a literal character, prepend a backslash.-Eg to search for amounts with the dollar sign in hledger\-web, write-\f[C]cur:\\$\f[].-.IP \[bu] 2-On the command line, some metacharacters like \f[C]$\f[] have a special-meaning to the shell and so must be escaped at least once more.-See Special characters.-.SH QUERIES-.PP-One of hledger\[aq]s strengths is being able to quickly report on-precise subsets of your data.-Most commands accept an optional query expression, written as arguments-after the command name, to filter the data by date, account name or-other criteria.-The syntax is similar to a web search: one or more space\-separated-search terms, quotes to enclose whitespace, prefixes to match specific-fields, a not: prefix to negate the match.-.PP-We do not yet support arbitrary boolean combinations of search terms;-instead most commands show transactions/postings/accounts which match-(or negatively match):-.IP \[bu] 2-any of the description terms AND-.IP \[bu] 2-any of the account terms AND-.IP \[bu] 2-any of the status terms AND-.IP \[bu] 2-all the other terms.-.PP-The print command instead shows transactions which:-.IP \[bu] 2-match any of the description terms AND-.IP \[bu] 2-have any postings matching any of the positive account terms AND-.IP \[bu] 2-have no postings matching any of the negative account terms AND-.IP \[bu] 2-match all the other terms.-.PP-The following kinds of search terms can be used.-Remember these can also be prefixed with \f[B]\f[BC]not:\f[B]\f[], eg to-exclude a particular subaccount.-.TP-.B \f[B]\f[BC]REGEX\f[B], \f[BC]acct:REGEX\f[B]\f[]-match account names by this regular expression.-(With no prefix, \f[C]acct:\f[] is assumed.)-.RS-.RE-same as above-.RS-.RE-.TP-.B \f[B]\f[BC]amt:N,\ amt:<N,\ amt:<=N,\ amt:>N,\ amt:>=N\f[B]\f[]-match postings with a single\-commodity amount that is equal to, less-than, or greater than N.-(Multi\-commodity amounts are not tested, and will always match.) The-comparison has two modes: if N is preceded by a + or \- sign (or is 0),-the two signed numbers are compared.-Otherwise, the absolute magnitudes are compared, ignoring sign.-.RS-.RE-.TP-.B \f[B]\f[BC]code:REGEX\f[B]\f[]-match by transaction code (eg check number)-.RS-.RE-.TP-.B \f[B]\f[BC]cur:REGEX\f[B]\f[]-match postings or transactions including any amounts whose-currency/commodity symbol is fully matched by REGEX.-(For a partial match, use \f[C]\&.*REGEX.*\f[]).-Note, to match characters which are regex\-significant, like the dollar-sign (\f[C]$\f[]), you need to prepend \f[C]\\\f[].-And when using the command line you need to add one more level of-quoting to hide it from the shell, so eg do:-\f[C]hledger\ print\ cur:\[aq]\\$\[aq]\f[] or-\f[C]hledger\ print\ cur:\\\\$\f[].-.RS-.RE-.TP-.B \f[B]\f[BC]desc:REGEX\f[B]\f[]-match transaction descriptions.-.RS-.RE-.TP-.B \f[B]\f[BC]date:PERIODEXPR\f[B]\f[]-match dates within the specified period.-PERIODEXPR is a period expression (with no report interval).-Examples: \f[C]date:2016\f[], \f[C]date:thismonth\f[],-\f[C]date:2000/2/1\-2/15\f[], \f[C]date:lastweek\-\f[].-If the \f[C]\-\-date2\f[] command line flag is present, this matches-secondary dates instead.-.RS-.RE-.TP-.B \f[B]\f[BC]date2:PERIODEXPR\f[B]\f[]-match secondary dates within the specified period.-.RS-.RE-.TP-.B \f[B]\f[BC]depth:N\f[B]\f[]-match (or display, depending on command) accounts at or above this depth-.RS-.RE-.TP-.B \f[B]\f[BC]note:REGEX\f[B]\f[]-match transaction notes (part of description right of \f[C]|\f[], or-whole description when there\[aq]s no \f[C]|\f[])-.RS-.RE-.TP-.B \f[B]\f[BC]payee:REGEX\f[B]\f[]-match transaction payee/payer names (part of description left of-\f[C]|\f[], or whole description when there\[aq]s no \f[C]|\f[])-.RS-.RE-.TP-.B \f[B]\f[BC]real:,\ real:0\f[B]\f[]-match real or virtual postings respectively-.RS-.RE-.TP-.B \f[B]\f[BC]status:,\ status:!,\ status:*\f[B]\f[]-match unmarked, pending, or cleared transactions respectively-.RS-.RE-.TP-.B \f[B]\f[BC]tag:REGEX[=REGEX]\f[B]\f[]-match by tag name, and optionally also by tag value.-Note a tag: query is considered to match a transaction if it matches any-of the postings.-Also remember that postings inherit the tags of their parent-transaction.-.RS-.RE-.PP-The following special search term is used automatically in hledger\-web,-only:-.TP-.B \f[B]\f[BC]inacct:ACCTNAME\f[B]\f[]-tells hledger\-web to show the transaction register for this account.-Can be filtered further with \f[C]acct\f[] etc.-.RS-.RE-.PP-Some of these can also be expressed as command\-line options (eg-\f[C]depth:2\f[] is equivalent to \f[C]\-\-depth\ 2\f[]).-Generally you can mix options and query arguments, and the resulting-query will be their intersection (perhaps excluding the-\f[C]\-p/\-\-period\f[] option).-.SH COMMANDS-.PP-hledger provides a number of subcommands; \f[C]hledger\f[] with no-arguments shows a list.-.PP-If you install additional \f[C]hledger\-*\f[] packages, or if you put-programs or scripts named \f[C]hledger\-NAME\f[] in your PATH, these-will also be listed as subcommands.-.PP-Run a subcommand by writing its name as first argument (eg-\f[C]hledger\ incomestatement\f[]).-You can also write one of the standard short aliases displayed in-parentheses in the command list (\f[C]hledger\ b\f[]), or any any-unambiguous prefix of a command name (\f[C]hledger\ inc\f[]).-.PP-Here are all the builtin commands in alphabetical order.-See also \f[C]hledger\f[] for a more organised command list, and-\f[C]hledger\ CMD\ \-h\f[] for detailed command help.-.SS accounts-.PP-accounts, a-.PD 0-.P-.PD-Show account names.-.PP-This command lists account names, either declared with account-directives (\-\-declared), posted to (\-\-used), or both (the default).-With query arguments, only matched account names and account names-referenced by matched postings are shown.-It shows a flat list by default.-With \f[C]\-\-tree\f[], it uses indentation to show the account-hierarchy.-In flat mode you can add \f[C]\-\-drop\ N\f[] to omit the first few-account name components.-Account names can be depth\-clipped with \f[C]depth:N\f[] or-\f[C]\-\-depth\ N\f[] or \f[C]\-N\f[].-.PP-Examples:-.IP-.nf-\f[C]-$\ hledger\ accounts-assets:bank:checking-assets:bank:saving-assets:cash-expenses:food-expenses:supplies-income:gifts-income:salary-liabilities:debts-\f[]-.fi-.SS activity-.PP-activity-.PD 0-.P-.PD-Show an ascii barchart of posting counts per interval.-.PP-The activity command displays an ascii histogram showing transaction-counts by day, week, month or other reporting interval (by day is the-default).-With query arguments, it counts only matched transactions.-.PP-Examples:-.IP-.nf-\f[C]-$\ hledger\ activity\ \-\-quarterly-2008\-01\-01\ **-2008\-04\-01\ *******-2008\-07\-01\ -2008\-10\-01\ **-\f[]-.fi-.SS add-.PP-add-.PD 0-.P-.PD-Prompt for transactions and add them to the journal.-.PP-Many hledger users edit their journals directly with a text editor, or-generate them from CSV.-For more interactive data entry, there is the \f[C]add\f[] command,-which prompts interactively on the console for new transactions, and-appends them to the journal file (if there are multiple-\f[C]\-f\ FILE\f[] options, the first file is used.) Existing-transactions are not changed.-This is the only hledger command that writes to the journal file.-.PP-To use it, just run \f[C]hledger\ add\f[] and follow the prompts.-You can add as many transactions as you like; when you are finished,-enter \f[C]\&.\f[] or press control\-d or control\-c to exit.-.PP-Features:-.IP \[bu] 2-add tries to provide useful defaults, using the most similar (by-description) recent transaction (filtered by the query, if any) as a-template.-.IP \[bu] 2-You can also set the initial defaults with command line arguments.-.IP \[bu] 2-Readline\-style edit keys can be used during data entry.-.IP \[bu] 2-The tab key will auto\-complete whenever possible \- accounts,-descriptions, dates (\f[C]yesterday\f[], \f[C]today\f[],-\f[C]tomorrow\f[]).-If the input area is empty, it will insert the default value.-.IP \[bu] 2-If the journal defines a default commodity, it will be added to any bare-numbers entered.-.IP \[bu] 2-A parenthesised transaction code may be entered following a date.-.IP \[bu] 2-Comments and tags may be entered following a description or amount.-.IP \[bu] 2-If you make a mistake, enter \f[C]<\f[] at any prompt to restart the-transaction.-.IP \[bu] 2-Input prompts are displayed in a different colour when the terminal-supports it.-.PP-Example (see the tutorial for a detailed explanation):-.IP-.nf-\f[C]-$\ hledger\ add-Adding\ transactions\ to\ journal\ file\ /src/hledger/examples/sample.journal-Any\ command\ line\ arguments\ will\ be\ used\ as\ defaults.-Use\ tab\ key\ to\ complete,\ readline\ keys\ to\ edit,\ enter\ to\ accept\ defaults.-An\ optional\ (CODE)\ may\ follow\ transaction\ dates.-An\ optional\ ;\ COMMENT\ may\ follow\ descriptions\ or\ amounts.-If\ you\ make\ a\ mistake,\ enter\ <\ at\ any\ prompt\ to\ restart\ the\ transaction.-To\ end\ a\ transaction,\ enter\ .\ when\ prompted.-To\ quit,\ enter\ .\ at\ a\ date\ prompt\ or\ press\ control\-d\ or\ control\-c.-Date\ [2015/05/22]:\ -Description:\ supermarket-Account\ 1:\ expenses:food-Amount\ \ 1:\ $10-Account\ 2:\ assets:checking-Amount\ \ 2\ [$\-10.0]:\ -Account\ 3\ (or\ .\ or\ enter\ to\ finish\ this\ transaction):\ .-2015/05/22\ supermarket-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ $10-\ \ \ \ assets:checking\ \ \ \ \ \ \ \ $\-10.0--Save\ this\ transaction\ to\ the\ journal\ ?\ [y]:\ -Saved.-Starting\ the\ next\ transaction\ (.\ or\ ctrl\-D/ctrl\-C\ to\ quit)-Date\ [2015/05/22]:\ <CTRL\-D>\ $-\f[]-.fi-.SS balance-.PP-balance, bal, b-.PD 0-.P-.PD-Show accounts and their balances.-.PP-The balance command is hledger\[aq]s most versatile command.-Note, despite the name, it is not always used for showing real\-world-account balances; the more accounting\-aware balancesheet and-incomestatement may be more convenient for that.-.PP-By default, it displays all accounts, and each account\[aq]s change in-balance during the entire period of the journal.-Balance changes are calculated by adding up the postings in each-account.-You can limit the postings matched, by a query, to see fewer accounts,-changes over a different time period, changes from only cleared-transactions, etc.-.PP-If you include an account\[aq]s complete history of postings in the-report, the balance change is equivalent to the account\[aq]s current-ending balance.-For a real\-world account, typically you won\[aq]t have all transactions-in the journal; instead you\[aq]ll have all transactions after a certain-date, and an "opening balances" transaction setting the correct starting-balance on that date.-Then the balance command will show real\-world account balances.-In some cases the \-H/\-\-historical flag is used to ensure this (more-below).-.PP-The balance command can produce several styles of report:-.SS Classic balance report-.PP-This is the original balance report, as found in Ledger.-It usually looks like this:-.IP-.nf-\f[C]-$\ hledger\ balance-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ gifts-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ salary-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-By default, accounts are displayed hierarchically, with subaccounts-indented below their parent.-At each level of the tree, accounts are sorted by account code if any,-then by account name.-Or with \f[C]\-S/\-\-sort\-amount\f[], by their balance amount.-.PP-"Boring" accounts, which contain a single interesting subaccount and no-balance of their own, are elided into the following line for more-compact output.-(Eg above, the "liabilities" account.) Use \f[C]\-\-no\-elide\f[] to-prevent this.-.PP-Account balances are "inclusive" \- they include the balances of any-subaccounts.-.PP-Accounts which have zero balance (and no non\-zero subaccounts) are-omitted.-Use \f[C]\-E/\-\-empty\f[] to show them.-.PP-A final total is displayed by default; use \f[C]\-N/\-\-no\-total\f[] to-suppress it, eg:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-\-no\-total-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies-\f[]-.fi-.SS Customising the classic balance report-.PP-You can customise the layout of classic balance reports with-\f[C]\-\-format\ FMT\f[]:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-format\ "%20(account)\ %12(total)"-\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ \ \ \ \ \ \ bank:saving\ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cash\ \ \ \ \ \ \ \ \ \ $\-2-\ \ \ \ \ \ \ \ \ \ \ \ expenses\ \ \ \ \ \ \ \ \ \ \ $2-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ food\ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ \ \ \ \ \ \ \ supplies\ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ income\ \ \ \ \ \ \ \ \ \ $\-2-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ gifts\ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ salary\ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ $1-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-The FMT format string (plus a newline) specifies the formatting applied-to each account/balance pair.-It may contain any suitable text, with data fields interpolated like so:-.PP-\f[C]%[MIN][.MAX](FIELDNAME)\f[]-.IP \[bu] 2-MIN pads with spaces to at least this width (optional)-.IP \[bu] 2-MAX truncates at this width (optional)-.IP \[bu] 2-FIELDNAME must be enclosed in parentheses, and can be one of:-.RS 2-.IP \[bu] 2-\f[C]depth_spacer\f[] \- a number of spaces equal to the account\[aq]s-depth, or if MIN is specified, MIN * depth spaces.-.IP \[bu] 2-\f[C]account\f[] \- the account\[aq]s name-.IP \[bu] 2-\f[C]total\f[] \- the account\[aq]s balance/posted total, right-justified-.RE-.PP-Also, FMT can begin with an optional prefix to control how-multi\-commodity amounts are rendered:-.IP \[bu] 2-\f[C]%_\f[] \- render on multiple lines, bottom\-aligned (the default)-.IP \[bu] 2-\f[C]%^\f[] \- render on multiple lines, top\-aligned-.IP \[bu] 2-\f[C]%,\f[] \- render on one line, comma\-separated-.PP-There are some quirks.-Eg in one\-line mode, \f[C]%(depth_spacer)\f[] has no effect, instead-\f[C]%(account)\f[] has indentation built in.- Experimentation may be needed to get pleasing results.-.PP-Some example formats:-.IP \[bu] 2-\f[C]%(total)\f[] \- the account\[aq]s total-.IP \[bu] 2-\f[C]%\-20.20(account)\f[] \- the account\[aq]s name, left justified,-padded to 20 characters and clipped at 20 characters-.IP \[bu] 2-\f[C]%,%\-50(account)\ \ %25(total)\f[] \- account name padded to 50-characters, total padded to 20 characters, with multiple commodities-rendered on one line-.IP \[bu] 2-\f[C]%20(total)\ \ %2(depth_spacer)%\-(account)\f[] \- the default-format for the single\-column balance report-.SS Colour support-.PP-The balance command shows negative amounts in red, if:-.IP \[bu] 2-the \f[C]TERM\f[] environment variable is not set to \f[C]dumb\f[]-.IP \[bu] 2-the output is not being redirected or piped anywhere-.SS Flat mode-.PP-To see a flat list instead of the default hierarchical display, use-\f[C]\-\-flat\f[].-In this mode, accounts (unless depth\-clipped) show their full names and-"exclusive" balance, excluding any subaccount balances.-In this mode, you can also use \f[C]\-\-drop\ N\f[] to omit the first-few account name components.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-N\ \-\-flat\ \-\-drop\ 1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ supplies-\f[]-.fi-.SS Depth limited balance reports-.PP-With \f[C]\-\-depth\ N\f[] or \f[C]depth:N\f[] or just \f[C]\-N\f[],-balance reports show accounts only to the specified numeric depth.-This is very useful to summarise a complex set of accounts and get an-overview.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-N\ \-1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities-\f[]-.fi-.PP-Flat\-mode balance reports, which normally show exclusive balances, show-inclusive balances at the depth limit.-.SS Multicolumn balance report-.PP-Multicolumn or tabular balance reports are a very useful hledger-feature, and usually the preferred style.-They share many of the above features, but they show the report as a-table, with columns representing time periods.-This mode is activated by providing a reporting interval.-.PP-There are three types of multicolumn balance report, showing different-information:-.IP "1." 3-By default: each column shows the sum of postings in that period, ie the-account\[aq]s change of balance in that period.-This is useful eg for a monthly income statement:-.RS 4-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-quarterly\ income\ expenses\ \-E-Balance\ changes\ in\ 2008:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008q1\ \ 2008q2\ \ 2008q3\ \ 2008q4\ -===================++=================================-\ expenses:food\ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ expenses:supplies\ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ income:gifts\ \ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ income:salary\ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\f[]-.fi-.RE-.IP "2." 3-With \f[C]\-\-cumulative\f[]: each column shows the ending balance for-that period, accumulating the changes across periods, starting from 0 at-the report start date:-.RS 4-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-quarterly\ income\ expenses\ \-E\ \-\-cumulative-Ending\ balances\ (cumulative)\ in\ 2008:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008/03/31\ \ 2008/06/30\ \ 2008/09/30\ \ 2008/12/31\ -===================++=================================================-\ expenses:food\ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ expenses:supplies\ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ income:gifts\ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ -\ income:salary\ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ -\f[]-.fi-.RE-.IP "3." 3-With \f[C]\-\-historical/\-H\f[]: each column shows the actual-historical ending balance for that period, accumulating the changes-across periods, starting from the actual balance at the report start-date.-This is useful eg for a multi\-period balance sheet, and when you are-showing only the data after a certain start date:-.RS 4-.IP-.nf-\f[C]-$\ hledger\ balance\ ^assets\ ^liabilities\ \-\-quarterly\ \-\-historical\ \-\-begin\ 2008/4/1-Ending\ balances\ (historical)\ in\ 2008/04/01\-2008/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008/06/30\ \ 2008/09/30\ \ 2008/12/31\ -======================++=====================================-\ assets:bank:checking\ ||\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ 0\ -\ assets:bank:saving\ \ \ ||\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ assets:cash\ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-2\ \ \ \ \ \ \ \ \ $\-2\ \ \ \ \ \ \ \ \ $\-2\ -\ liabilities:debts\ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ -\f[]-.fi-.RE-.PP-Multicolumn balance reports display accounts in flat mode by default; to-see the hierarchy, use \f[C]\-\-tree\f[].-.PP-With a reporting interval (like \f[C]\-\-quarterly\f[] above), the-report start/end dates will be adjusted if necessary so that they-encompass the displayed report periods.-This is so that the first and last periods will be "full" and comparable-to the others.-.PP-The \f[C]\-E/\-\-empty\f[] flag does two things in multicolumn balance-reports: first, the report will show all columns within the specified-report period (without \-E, leading and trailing columns with all zeroes-are not shown).-Second, all accounts which existed at the report start date will be-considered, not just the ones with activity during the report period-(use \-E to include low\-activity accounts which would otherwise would-be omitted).-.PP-The \f[C]\-T/\-\-row\-total\f[] flag adds an additional column showing-the total for each row.-.PP-The \f[C]\-A/\-\-average\f[] flag adds a column showing the average-value in each row.-.PP-Here\[aq]s an example of all three:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-Q\ income\ expenses\ \-\-tree\ \-ETA-Balance\ changes\ in\ 2008:--\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008q1\ \ 2008q2\ \ 2008q3\ \ 2008q4\ \ \ \ Total\ \ Average\ -============++===================================================-\ expenses\ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $2\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $2\ \ \ \ \ \ \ $1\ -\ \ \ food\ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ 0\ -\ \ \ supplies\ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ 0\ -\ income\ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-2\ \ \ \ \ \ $\-1\ -\ \ \ gifts\ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ 0\ -\ \ \ salary\ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ 0\ -\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ 0\ --#\ Average\ is\ rounded\ to\ the\ dollar\ here\ since\ all\ journal\ amounts\ are-\f[]-.fi-.PP-Limitations:-.PP-In multicolumn reports the \f[C]\-V/\-\-value\f[] flag uses the market-price on the report end date, for all columns (not the price on each-column\[aq]s end date).-.PP-Eliding of boring parent accounts in tree mode, as in the classic-balance report, is not yet supported in multicolumn reports.-.SS Budget report-.PP-With \f[C]\-\-budget\f[], extra columns are displayed showing budget-goals for each account and period, if any.-Budget goals are defined by periodic transactions.-This is very useful for comparing planned and actual income, expenses,-time usage, etc.-\-\-budget is most often combined with a report interval.-.PP-For example, you can take average monthly expenses in the common expense-categories to construct a minimal monthly budget:-.IP-.nf-\f[C]-;;\ Budget-~\ monthly-\ \ income\ \ $2000-\ \ expenses:food\ \ \ \ $400-\ \ expenses:bus\ \ \ \ \ $50-\ \ expenses:movies\ \ $30-\ \ assets:bank:checking--;;\ Two\ months\ worth\ of\ expenses-2017\-11\-01-\ \ income\ \ $1950-\ \ expenses:food\ \ \ \ $396-\ \ expenses:bus\ \ \ \ \ $49-\ \ expenses:movies\ \ $30-\ \ expenses:supplies\ \ $20-\ \ assets:bank:checking--2017\-12\-01-\ \ income\ \ $2100-\ \ expenses:food\ \ \ \ $412-\ \ expenses:bus\ \ \ \ \ $53-\ \ expenses:gifts\ \ \ $100-\ \ assets:bank:checking-\f[]-.fi-.PP-You can now see a monthly budget report:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-M\ \-\-budget-Budget\ performance\ in\ 2017/11/01\-2017/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ -======================++====================================================-\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ \ $565\ [\ 118%\ of\ \ \ $480]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ \ $53\ [\ 106%\ of\ \ \ \ $50]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $412\ [\ 103%\ of\ \ \ $400]\ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ \ \ 0\ [\ \ \ 0%\ of\ \ \ \ $30]\ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $2100\ [\ 105%\ of\ \ $2000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-Note this is different from a normal balance report in several ways:-.IP \[bu] 2-Only accounts with budget goals during the report period are shown, by-default.-.IP \[bu] 2-In each column, in square brackets after the actual amount, budgeted-amounts are shown, along with the percentage of budget used.-.IP \[bu] 2-All parent accounts are always shown, even in flat mode.-Eg assets, assets:bank, and expenses above.-.IP \[bu] 2-Amounts always include all subaccounts, budgeted or unbudgeted, even in-flat mode.-.PP-This means that the numbers displayed will not always add up! Eg above,-the \f[C]expenses\f[] actual amount includes the gifts and supplies-transactions, but the \f[C]expenses:gifts\f[] and-\f[C]expenses:supplies\f[] accounts are not shown, as they have no-budget amounts declared.-.PP-This can be confusing.-When you need to make things clearer, use the \f[C]\-E/\-\-empty\f[]-flag, which will reveal all accounts including unbudgeted ones, giving-the full picture.-Eg:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-M\ \-\-budget\ \-\-empty-Budget\ performance\ in\ 2017/11/01\-2017/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ -======================++====================================================-\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ \ $565\ [\ 118%\ of\ \ \ $480]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ \ $53\ [\ 106%\ of\ \ \ \ $50]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $412\ [\ 103%\ of\ \ \ $400]\ -\ expenses:gifts\ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ \ \ 0\ [\ \ \ 0%\ of\ \ \ \ $30]\ -\ expenses:supplies\ \ \ \ ||\ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $2100\ [\ 105%\ of\ \ $2000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-You can roll over unspent budgets to next period with-\f[C]\-\-cumulative\f[]:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-M\ \-\-budget\ \-\-cumulative-Budget\ performance\ in\ 2017/11/01\-2017/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ -======================++====================================================-\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ $1060\ [\ 110%\ of\ \ \ $960]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ $102\ [\ 102%\ of\ \ \ $100]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $808\ [\ 101%\ of\ \ \ $800]\ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ $30\ [\ \ 50%\ of\ \ \ \ $60]\ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $4050\ [\ 101%\ of\ \ $4000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-For more examples, see Budgeting and Forecasting.-.SS Nested budgets-.PP-You can add budgets to any account in your account hierarchy.-If you have budgets on both parent account and some of its children,-then budget(s) of the child account(s) would be added to the budget of-their parent, much like account balances behave.-.PP-In the most simple case this means that once you add a budget to any-account, all its parents would have budget as well.-.PP-To illustrate this, consider the following budget:-.IP-.nf-\f[C]-~\ monthly\ from\ 2019/01-\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ $1,000.00-\ \ \ \ expenses:personal:electronics\ \ \ \ $100.00-\ \ \ \ liabilities-\f[]-.fi-.PP-With this, monthly budget for electronics is defined to be $100 and-budget for personal expenses is an additional $1000, which implicity-means that budget for both \f[C]expenses:personal\f[] and-\f[C]expenses\f[] is $1100.-.PP-Transactions in \f[C]expenses:personal:electronics\f[] will be counted-both towards its $100 budget and $1100 of \f[C]expenses:personal\f[] ,-and transactions in any other subaccount of \f[C]expenses:personal\f[]-would be counted towards only towards the budget of-\f[C]expenses:personal\f[].-.PP-For example, let\[aq]s consider these transactions:-.IP-.nf-\f[C]-~\ monthly\ from\ 2019/01-\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ $1,000.00-\ \ \ \ expenses:personal:electronics\ \ \ \ $100.00-\ \ \ \ liabilities--2019/01/01\ Google\ home\ hub-\ \ \ \ expenses:personal:electronics\ \ \ \ \ \ \ \ \ \ $90.00-\ \ \ \ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-90.00--2019/01/02\ Phone\ screen\ protector-\ \ \ \ expenses:personal:electronics:upgrades\ \ \ \ \ \ \ \ \ \ $10.00-\ \ \ \ liabilities--2019/01/02\ Weekly\ train\ ticket-\ \ \ \ expenses:personal:train\ tickets\ \ \ \ \ \ \ $153.00-\ \ \ \ liabilities--2019/01/03\ Flowers-\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ $30.00-\ \ \ \ liabilities-\f[]-.fi-.PP-As you can see, we have transactions in-\f[C]expenses:personal:electronics:upgrades\f[] and-\f[C]expenses:personal:train\ tickets\f[], and since both of these-accounts are without explicitly defined budget, these transactions would-be counted towards budgets of \f[C]expenses:personal:electronics\f[] and-\f[C]expenses:personal\f[] accordingly:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-budget\ \-M-Budget\ performance\ in\ 2019/01:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Jan\ -===============================++===============================-\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal:electronics\ ||\ \ $100.00\ [\ 100%\ of\ \ \ $100.00]\ -\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-283.00\ [\ \ 26%\ of\ $\-1100.00]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-And with \f[C]\-\-empty\f[], we can get a better picture of budget-allocation and consumption:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-budget\ \-M\ \-\-empty-Budget\ performance\ in\ 2019/01:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Jan\ -========================================++===============================-\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal:electronics\ \ \ \ \ \ \ \ \ \ ||\ \ $100.00\ [\ 100%\ of\ \ \ $100.00]\ -\ expenses:personal:electronics:upgrades\ ||\ \ \ $10.00\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ expenses:personal:train\ tickets\ \ \ \ \ \ \ \ ||\ \ $153.00\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-283.00\ [\ \ 26%\ of\ $\-1100.00]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.SS Output format-.PP-The balance command supports output destination and output format-selection.-.SS balancesheet-.PP-balancesheet, bs-.PD 0-.P-.PD-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date).-It assumes that these accounts are under a top\-level \f[C]asset\f[] or-\f[C]liability\f[] account (case insensitive, plural forms also-allowed).-.PP-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ balancesheet-Balance\ Sheet--Assets:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--Liabilities:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-With a reporting interval, multiple columns will be shown, one for each-report period.-As with multicolumn balance reports, you can alter the report mode with-\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].-Normally balancesheet shows historical ending balances, which is what-you need for a balance sheet; note this means it ignores report begin-dates.-.PP-This command also supports output destination and output format-selection.-.SS balancesheetequity-.PP-balancesheetequity, bse-.PD 0-.P-.PD-Just like balancesheet, but also reports Equity (which it assumes is-under a top\-level \f[C]equity\f[] account).-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ balancesheetequity-Balance\ Sheet\ With\ Equity--Assets:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-3\ \ \ \ cash-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2--Liabilities:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1--Equity:-\ \ \ \ \ \ \ \ \ \ $1\ \ equity:owner-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ $1--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.SS cashflow-.PP-cashflow, cf-.PD 0-.P-.PD-This command displays a simple cashflow statement, showing changes in-"cash" accounts.-It assumes that these accounts are under a top\-level \f[C]asset\f[]-account (case insensitive, plural forms also allowed) and do not contain-\f[C]receivable\f[] or \f[C]A/R\f[] in their name.-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ cashflow-Cashflow\ Statement--Cash\ flows:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1-\f[]-.fi-.PP-With a reporting interval, multiple columns will be shown, one for each-report period.-Normally cashflow shows changes in assets per period, though as with-multicolumn balance reports you can alter the report mode with-\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].-.PP-This command also supports output destination and output format-selection.-.SS check\-dates-.PP-check\-dates-.PD 0-.P-.PD-Check that transactions are sorted by increasing date.-With \-\-date2, checks secondary dates instead.-With \-\-strict, dates must also be unique.-With a query, only matched transactions\[aq] dates are checked.-Reads the default journal file, or another specified with \-f.-.SS check\-dupes-.PP-check\-dupes-.PD 0-.P-.PD-Reports account names having the same leaf but different prefixes.-In other words, two or more leaves that are categorized differently.-Reads the default journal file, or another specified as an argument.-.PP-An example: http://stefanorodighiero.net/software/hledger\-dupes.html-.SS close-.PP-close, equity-.PD 0-.P-.PD-Prints a "closing balances" transaction and an "opening balances"-transaction that bring account balances to and from zero, respectively.-Useful for bringing asset/liability balances forward into a new journal-file, or for closing out revenues/expenses to retained earnings at the-end of a period.-.PP-The closing transaction transfers balances to "equity:closing balances".-The opening transaction transfers balances from "equity:opening-balances".-You can chose to print just one of the transactions by using the-\f[C]\-\-opening\f[] or \f[C]\-\-closing\f[] flag.-.PP-If you split your journal files by time (eg yearly), you will typically-run this command at the end of the year, and save the closing-transaction as last entry of the old file, and the opening transaction-as the first entry of the new file.-This makes the files self contained, so that correct balances are-reported no matter which of them are loaded.-Ie, if you load just one file, the balances are initialised correctly;-or if you load several files, the redundant closing/opening transactions-cancel each other out.-(They will show up in print or register reports; you can exclude them-with a query like-\f[C]not:desc:\[aq](opening|closing)\ balances\[aq]\f[].)-.PP-If you\[aq]re running a business, you might also use this command to-"close the books" at the end of an accounting period, transferring-income statement account balances to retained earnings.-(You may want to change the equity account name to something like-"equity:retained earnings".)-.PP-By default, the closing transaction is dated yesterday, the balances are-calculated as of end of yesterday, and the opening transaction is dated-today.-To close on some other date, use:-\f[C]hledger\ close\ \-e\ OPENINGDATE\f[].-Eg, to close/open on the 2018/2019 boundary, use \f[C]\-e\ 2019\f[].-You can also use \-p or \f[C]date:PERIOD\f[] (any starting date is-ignored).-.PP-Both transactions will include balance assertions for the-closed/reopened accounts.-You probably shouldn\[aq]t use status or realness filters (like \-C or-\-R or \f[C]status:\f[]) with this command, or the generated balance-assertions will depend on these flags.-Likewise, if you run this command with \-\-auto, the balance assertions-will probably always require \-\-auto.-.PP-Examples:-.PP-Carrying asset/liability balances into a new file for 2019, all from-command line:-.PP-\f[I]Warning: we use \f[CI]>>\f[I] here to append; be careful not to-type a single \f[CI]>\f[I] which would wipe your journal!\f[]-.IP-.nf-\f[C]-$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-opening\ >>2019.journal-$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-closing\ >>2018.journal-\f[]-.fi-.PP-Now:-.IP-.nf-\f[C]-$\ 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-\f[]-.fi-.PP-Transactions spanning the closing date can complicate matters, breaking-balance assertions:-.IP-.nf-\f[C]-2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5-\ \ \ \ assets:bank:checking\ \ \-5\ \ ;\ [2019/1/2]-\f[]-.fi-.PP-Here\[aq]s one way to resolve that:-.IP-.nf-\f[C]-;\ in\ 2018.journal:-2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5-\ \ \ \ liabilities:pending--;\ in\ 2019.journal:-2019/1/2\ clearance\ of\ last\ year\[aq]s\ pending\ transactions-\ \ \ \ liabilities:pending\ \ \ \ 5\ =\ 0-\ \ \ \ assets:checking-\f[]-.fi-.SS files-.PP-files-.PD 0-.P-.PD-List all files included in the journal.-With a REGEX argument, only file names matching the regular expression-(case sensitive) are shown.-.SS help-.PP-help-.PD 0-.P-.PD-Show any of the hledger manuals.-.PP-The \f[C]help\f[] command displays any of the main hledger manuals, in-one of several ways.-Run it with no argument to list the manuals, or provide a full or-partial manual name to select one.-.PP-hledger manuals are available in several formats.-hledger help will use the first of these display methods that it finds:-info, man, $PAGER, less, stdout (or when non\-interactive, just stdout).-You can force a particular viewer with the \f[C]\-\-info\f[],-\f[C]\-\-man\f[], \f[C]\-\-pager\f[], \f[C]\-\-cat\f[] flags.-.PP-Examples:-.IP-.nf-\f[C]-$\ hledger\ help-Please\ choose\ a\ manual\ by\ typing\ "hledger\ help\ MANUAL"\ (a\ substring\ is\ ok).-Manuals:\ hledger\ hledger\-ui\ hledger\-web\ hledger\-api\ journal\ csv\ timeclock\ timedot-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ help\ h\ \-\-man--hledger(1)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger\ User\ Manuals\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger(1)--NAME-\ \ \ \ \ \ \ hledger\ \-\ a\ command\-line\ accounting\ tool--SYNOPSIS-\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [ARGS]-\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [ARGS]-\ \ \ \ \ \ \ hledger--DESCRIPTION-\ \ \ \ \ \ \ hledger\ \ is\ \ a\ \ cross\-platform\ \ program\ \ for\ tracking\ money,\ time,\ or\ any-\&...-\f[]-.fi-.SS import-.PP-import-.PD 0-.P-.PD-Read new transactions added to each FILE since last run, and add them to-the main journal file.-Or with \-\-dry\-run, just print the transactions that would be added.-.PP-The input files are specified as arguments \- no need to write \-f-before each one.-So eg to add new transactions from all CSV files to the main journal,-it\[aq]s just: \f[C]hledger\ import\ *.csv\f[]-.PP-New transactions are detected in the same way as print \-\-new: by-assuming transactions are always added to the input files in increasing-date order, and by saving \f[C]\&.latest.FILE\f[] state files.-.PP-The \-\-dry\-run output is in journal format, so you can filter it, eg-to see only uncategorised transactions:-.IP-.nf-\f[C]-$\ hledger\ import\ \-\-dry\ ...\ |\ hledger\ \-f\-\ print\ unknown\ \-\-ignore\-assertions-\f[]-.fi-.SS incomestatement-.PP-incomestatement, is-.PD 0-.P-.PD-This command displays a simple income statement, showing revenues and-expenses during a period.-It assumes that these accounts are under a top\-level \f[C]revenue\f[]-or \f[C]income\f[] or \f[C]expense\f[] account (case insensitive, plural-forms also allowed).-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-.PP-This command displays a simple income statement.-It currently assumes that you have top\-level accounts named-\f[C]income\f[] (or \f[C]revenue\f[]) and \f[C]expense\f[] (plural forms-also allowed.)-.IP-.nf-\f[C]-$\ hledger\ incomestatement-Income\ Statement--Revenues:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ gifts-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ salary-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2--Expenses:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-With a reporting interval, multiple columns will be shown, one for each-report period.-Normally incomestatement shows revenues/expenses per period, though as-with multicolumn balance reports you can alter the report mode with-\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].-.PP-This command also supports output destination and output format-selection.-.SS prices-.PP-prices-.PD 0-.P-.PD-Print market price directives from the journal.-With \-\-costs, also print synthetic market prices based on transaction-prices.-With \-\-inverted\-costs, also print inverse prices based on transaction-prices.-Prices (and postings providing prices) can be filtered by a query.-.SS print-.PP-print, txns, p-.PD 0-.P-.PD-Show transaction journal entries, sorted by date.-.PP-The print command displays full journal entries (transactions) from the-journal file in date order, tidily formatted.-With \-\-date2, transactions are sorted by secondary date instead.-.PP-print\[aq]s output is always a valid hledger journal.-.PD 0-.P-.PD-It preserves all transaction information, but it does not preserve-directives or inter\-transaction comments-.IP-.nf-\f[C]-$\ hledger\ print-2008/01/01\ income-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--2008/06/01\ gift-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--2008/06/02\ save-\ \ \ \ assets:bank:saving\ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1--2008/06/03\ *\ eat\ &\ shop-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ expenses:supplies\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2--2008/12/31\ *\ pay\ off-\ \ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1-\f[]-.fi-.PP-Normally, the journal entry\[aq]s explicit or implicit amount style is-preserved.-Ie when an amount is omitted in the journal, it will be omitted in the-output.-You can use the \f[C]\-x\f[]/\f[C]\-\-explicit\f[] flag to make all-amounts explicit, which can be useful for troubleshooting or for making-your journal more readable and robust against data entry errors.-Note, \f[C]\-x\f[] will cause postings with a multi\-commodity amount-(these can arise when a multi\-commodity transaction has an implicit-amount) will be split into multiple single\-commodity postings, for-valid journal output.-.PP-With \f[C]\-B\f[]/\f[C]\-\-cost\f[], amounts with transaction prices are-converted to cost using that price.-This can be used for troubleshooting.-.PP-With \f[C]\-m\f[]/\f[C]\-\-match\f[] and a STR argument, print will show-at most one transaction: the one one whose description is most similar-to STR, and is most recent.-STR should contain at least two characters.-If there is no similar\-enough match, no transaction will be shown.-.PP-With \f[C]\-\-new\f[], for each FILE being read, hledger reads (and-writes) a special state file (\f[C]\&.latest.FILE\f[] in the same-directory), containing the latest transaction date(s) that were seen-last time FILE was read.-When this file is found, only transactions 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:-.IP-.nf-\f[C]-$\ hledger\ \-f\ bank1.csv\ print\ \-\-new-#\ shows\ transactions\ added\ since\ last\ print\ \-\-new\ on\ this\ file-\f[]-.fi-.PP-This assumes that transactions added to FILE always have same or-increasing dates, and that transactions on the same day do not get-reordered.-See also the import command.-.PP-This command also supports output destination and output format-selection.-Here\[aq]s an example of print\[aq]s CSV output:-.IP-.nf-\f[C]-$\ hledger\ print\ \-Ocsv-"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting\-status","posting\-comment"-"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""-"1","2008/01/01","","","","income","","income:salary","\-1","$","1","","",""-"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""-"2","2008/06/01","","","","gift","","income:gifts","\-1","$","1","","",""-"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""-"3","2008/06/02","","","","save","","assets:bank:checking","\-1","$","1","","",""-"4","2008/06/03","","*","","eat\ &\ shop","","expenses:food","1","$","","1","",""-"4","2008/06/03","","*","","eat\ &\ shop","","expenses:supplies","1","$","","1","",""-"4","2008/06/03","","*","","eat\ &\ shop","","assets:cash","\-2","$","2","","",""-"5","2008/12/31","","*","","pay\ off","","liabilities:debts","1","$","","1","",""-"5","2008/12/31","","*","","pay\ off","","assets:bank:checking","\-1","$","1","","",""-\f[]-.fi-.IP \[bu] 2-There is one CSV record per posting, with the parent transaction\[aq]s-fields repeated.-.IP \[bu] 2-The "txnidx" (transaction index) field shows which postings belong to-the same transaction.-(This number might change if transactions are reordered within the file,-files are parsed/included in a different order, etc.)-.IP \[bu] 2-The amount is separated into "commodity" (the symbol) and "amount"-(numeric quantity) fields.-.IP \[bu] 2-The numeric amount is repeated in either the "credit" or "debit" column,-for convenience.-(Those names are not accurate in the accounting sense; it just puts-negative amounts under credit and zero or greater amounts under debit.)-.SS print\-unique-.PP-print\-unique-.PD 0-.P-.PD-Print transactions which do not reuse an already\-seen description.-.PP-Example:-.IP-.nf-\f[C]-$\ cat\ unique.journal-1/1\ test-\ (acct:one)\ \ 1-2/2\ test-\ (acct:two)\ \ 2-$\ LEDGER_FILE=unique.journal\ hledger\ print\-unique-(\-f\ option\ not\ supported)-2015/01/01\ test-\ \ \ \ (acct:one)\ \ \ \ \ \ \ \ \ \ \ \ \ 1-\f[]-.fi-.SS register-.PP-register, reg, r-.PD 0-.P-.PD-Show postings and their running total.-.PP-The register command displays postings in date order, one per line, and-their running total.-This is typically used with a query selecting a particular account, to-see that account\[aq]s activity:-.IP-.nf-\f[C]-$\ hledger\ register\ checking-2008/01/01\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $1-2008/06/01\ gift\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $2-2008/06/02\ save\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ $1-2008/12/31\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-With \-\-date2, it shows and sorts by secondary date instead.-.PP-The \f[C]\-\-historical\f[]/\f[C]\-H\f[] flag adds the balance from any-undisplayed prior postings to the running total.-This is useful when you want to see only recent activity, with a-historically accurate running balance:-.IP-.nf-\f[C]-$\ hledger\ register\ checking\ \-b\ 2008/6\ \-\-historical-2008/06/01\ gift\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $2-2008/06/02\ save\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ $1-2008/12/31\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-The \f[C]\-\-depth\f[] option limits the amount of sub\-account detail-displayed.-.PP-The \f[C]\-\-average\f[]/\f[C]\-A\f[] flag shows the running average-posting amount instead of the running total (so, the final number-displayed is the average for the whole report period).-This flag implies \f[C]\-\-empty\f[] (see below).-It is affected by \f[C]\-\-historical\f[].-It works best when showing just one account and one commodity.-.PP-The \f[C]\-\-related\f[]/\f[C]\-r\f[] flag shows the \f[I]other\f[]-postings in the transactions of the postings which would normally be-shown.-.PP-The \f[C]\-\-invert\f[] flag negates all amounts.-For example, it can be used on an income account where amounts are-normally displayed as negative numbers.-It\[aq]s also useful to show postings on the checking account together-with the related account:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-related\ \-\-invert\ assets:checking-\f[]-.fi-.PP-With a reporting interval, register shows summary postings, one per-interval, aggregating the postings to each account:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-monthly\ income-2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1-2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-2-\f[]-.fi-.PP-Periods with no activity, and summary postings with a zero amount, are-not shown by default; use the \f[C]\-\-empty\f[]/\f[C]\-E\f[] flag to-see them:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-monthly\ income\ \-E-2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1-2008/02\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/03\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/04\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/05\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-2-2008/07\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/08\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/09\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/10\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/11\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/12\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-\f[]-.fi-.PP-Often, you\[aq]ll want to see just one line per interval.-The \f[C]\-\-depth\f[] option helps with this, causing subaccounts to be-aggregated:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-monthly\ assets\ \-\-depth\ 1h-2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $1-2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0-2008/12\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1-\f[]-.fi-.PP-Note when using report intervals, if you specify start/end dates these-will be adjusted outward if necessary to contain a whole number of-intervals.-This ensures that the first and last intervals are full length and-comparable to the others in the report.-.SS Custom register output-.PP-register uses the full terminal width by default, except on windows.-You can override this by setting the \f[C]COLUMNS\f[] environment-variable (not a bash shell variable) or by using the-\f[C]\-\-width\f[]/\f[C]\-w\f[] option.-.PP-The description and account columns normally share the space equally-(about half of (width \- 40) each).-You can adjust this by adding a description width as part of-\-\-width\[aq]s argument, comma\-separated: \f[C]\-\-width\ W,D\f[] .-Here\[aq]s a diagram (won\[aq]t display correctly in \-\-help):-.IP-.nf-\f[C]-<\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\ width\ (W)\ \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->-date\ (10)\ \ description\ (D)\ \ \ \ \ \ \ account\ (W\-41\-D)\ \ \ \ \ amount\ (12)\ \ \ balance\ (12)-DDDDDDDDDD\ dddddddddddddddddddd\ \ aaaaaaaaaaaaaaaaaaa\ \ AAAAAAAAAAAA\ \ AAAAAAAAAAAA-\f[]-.fi-.PP-and some examples:-.IP-.nf-\f[C]-$\ hledger\ reg\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ use\ terminal\ width\ (or\ 80\ on\ windows)-$\ hledger\ reg\ \-w\ 100\ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ use\ width\ 100-$\ COLUMNS=100\ hledger\ reg\ \ \ \ \ \ \ \ \ #\ set\ with\ one\-time\ environment\ variable-$\ export\ COLUMNS=100;\ hledger\ reg\ #\ set\ till\ session\ end\ (or\ window\ resize)-$\ hledger\ reg\ \-w\ 100,40\ \ \ \ \ \ \ \ \ \ \ #\ set\ overall\ width\ 100,\ description\ width\ 40-$\ hledger\ reg\ \-w\ $COLUMNS,40\ \ \ \ \ \ #\ use\ terminal\ width,\ &\ description\ width\ 40-\f[]-.fi-.PP-This command also supports output destination and output format-selection.-.SS register\-match-.PP-register\-match-.PD 0-.P-.PD-Print the one posting whose transaction description is closest to DESC,-in the style of the register command.-If there are multiple equally good matches, it shows the most recent.-Query options (options, not arguments) can be used to restrict the-search space.-Helps ledger\-autosync detect already\-seen transactions when importing.-.SS rewrite-.PP-rewrite-.PD 0-.P-.PD-Print all transactions, rewriting the postings of matched transactions.-For now the only rewrite available is adding new postings, like print-\-\-auto.-.PP-This is a start at a generic rewriter of transaction entries.-It reads the default journal and prints the transactions, like print,-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\[aq]s first posting amount.-.PP-Examples:-.IP-.nf-\f[C]-hledger\-rewrite.hs\ ^income\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\ \ ;\ income\ tax\[aq]\ \-\-add\-posting\ \[aq](reserve:gifts)\ \ $100\[aq]-hledger\-rewrite.hs\ expenses:gifts\ \-\-add\-posting\ \[aq](reserve:gifts)\ \ *\-1"\[aq]-hledger\-rewrite.hs\ \-f\ rewrites.hledger-\f[]-.fi-.PP-rewrites.hledger may consist of entries like:-.IP-.nf-\f[C]-=\ ^income\ amt:<0\ date:2017-\ \ (liabilities:tax)\ \ *0.33\ \ ;\ tax\ on\ income-\ \ (reserve:grocery)\ \ *0.25\ \ ;\ reserve\ 25%\ for\ grocery-\ \ (reserve:)\ \ *0.25\ \ ;\ reserve\ 25%\ for\ grocery-\f[]-.fi-.PP-Note the single quotes to protect the dollar sign from bash, and the two-spaces between account and amount.-.PP-More:-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ [QUERY]\ \ \ \ \ \ \ \ \-\-add\-posting\ "ACCT\ \ AMTEXPR"\ ...-$\ hledger\ rewrite\ \-\-\ ^income\ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]-$\ hledger\ rewrite\ \-\-\ expenses:gifts\ \-\-add\-posting\ \[aq](budget:gifts)\ \ *\-1"\[aq]-$\ hledger\ rewrite\ \-\-\ ^income\ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq](budget:foreign\ currency)\ \ *0.25\ JPY;\ diversify\[aq]-\f[]-.fi-.PP-Argument for \f[C]\-\-add\-posting\f[] option is a usual posting of-transaction with an exception for amount specification.-More precisely, you can use \f[C]\[aq]*\[aq]\f[] (star symbol) before-the amount to indicate that that this is a factor for an amount of-original matched posting.-If the amount includes a commodity name, the new posting amount will be-in the new commodity; otherwise, it will be in the matched posting-amount\[aq]s commodity.-.SS Re\-write rules in a file-.PP-During the run this tool will execute so called "Automated Transactions"-found in any journal it process.-I.e instead of specifying this operations in command line you can put-them in a journal file.-.IP-.nf-\f[C]-$\ rewrite\-rules.journal-\f[]-.fi-.PP-Make contents look like this:-.IP-.nf-\f[C]-=\ ^income-\ \ \ \ (liabilities:tax)\ \ *.33--=\ expenses:gifts-\ \ \ \ budget:gifts\ \ *\-1-\ \ \ \ assets:budget\ \ *1-\f[]-.fi-.PP-Note that \f[C]\[aq]=\[aq]\f[] (equality symbol) that is used instead of-date in transactions you usually write.-It indicates the query by which you want to match the posting to add new-ones.-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ \-f\ input.journal\ \-f\ rewrite\-rules.journal\ >\ rewritten\-tidy\-output.journal-\f[]-.fi-.PP-This is something similar to the commands pipeline:-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ \-f\ input.journal\ \[aq]^income\[aq]\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]\ \\-\ \ |\ hledger\ rewrite\ \-\-\ \-f\ \-\ expenses:gifts\ \ \ \ \ \ \-\-add\-posting\ \[aq]budget:gifts\ \ *\-1\[aq]\ \ \ \ \ \ \ \\-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq]assets:budget\ \ *1\[aq]\ \ \ \ \ \ \ \\-\ \ >\ rewritten\-tidy\-output.journal-\f[]-.fi-.PP-It is important to understand that relative order of such entries in-journal is important.-You can re\-use result of previously added postings.-.SS Diff output format-.PP-To use this tool for batch modification of your journal files you may-find useful output in form of unified diff.-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ \-\-diff\ \-f\ examples/sample.journal\ \[aq]^income\[aq]\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]-\f[]-.fi-.PP-Output might look like:-.IP-.nf-\f[C]-\-\-\-\ /tmp/examples/sample.journal-+++\ /tmp/examples/sample.journal-\@\@\ \-18,3\ +18,4\ \@\@-\ 2008/01/01\ income-\-\ \ \ \ assets:bank:checking\ \ $1-+\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ income:salary-+\ \ \ \ (liabilities:tax)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\@\@\ \-22,3\ +23,4\ \@\@-\ 2008/06/01\ gift-\-\ \ \ \ assets:bank:checking\ \ $1-+\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ income:gifts-+\ \ \ \ (liabilities:tax)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-If you\[aq]ll pass this through \f[C]patch\f[] tool you\[aq]ll get-transactions containing the posting that matches your query be updated.-Note that multiple files might be update according to list of input-files specified via \f[C]\-\-file\f[] options and \f[C]include\f[]-directives inside of these files.-.PP-Be careful.-Whole transaction being re\-formatted in a style of output from-\f[C]hledger\ print\f[].-.PP-See also:-.PP-https://github.com/simonmichael/hledger/issues/99-.SS rewrite vs. print \-\-auto-.PP-This command predates print \-\-auto, and currently does much the same-thing, but with these differences:-.IP \[bu] 2-with multiple files, rewrite lets rules in any file affect all other-files.-print \-\-auto uses standard directive scoping; rules affect only child-files.-.IP \[bu] 2-rewrite\[aq]s query limits which transactions can be rewritten; all are-printed.-print \-\-auto\[aq]s query limits which transactions are printed.-.IP \[bu] 2-rewrite applies rules specified on command line or in the journal.-print \-\-auto applies rules specified in the journal.-.SS roi-.PP-roi-.PD 0-.P-.PD-Shows the time\-weighted (TWR) and money\-weighted (IRR) rate of return-on your investments.-.PP-This command assumes that you have account(s) that hold nothing but your-investments and whenever you record current appraisal/valuation of these-investments you offset unrealized profit and loss into account(s) that,-again, hold nothing but unrealized profit and loss.-.PP-Any transactions affecting balance of investment account(s) and not-originating from unrealized profit and loss account(s) are assumed to be-your investments or withdrawals.-.PP-At a minimum, you need to supply a query (which could be just an account-name) to select your investments with \f[C]\-\-inv\f[], and another-query to identify your profit and loss transactions with-\f[C]\-\-pnl\f[].-.PP-It will compute and display the internalized rate of return (IRR) and-time\-weighted rate of return (TWR) for your investments for the time-period requested.-Both rates of return are annualized before display, regardless of the-length of reporting interval.-.SS stats-.PP-stats-.PD 0-.P-.PD-Show some journal statistics.-.PP-The stats command displays summary information for the whole journal, or-a matched part of it.-With a reporting interval, it shows a report for each report period.-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ stats-Main\ journal\ file\ \ \ \ \ \ \ \ :\ /src/hledger/examples/sample.journal-Included\ journal\ files\ \ \ :\ -Transactions\ span\ \ \ \ \ \ \ \ :\ 2008\-01\-01\ to\ 2009\-01\-01\ (366\ days)-Last\ transaction\ \ \ \ \ \ \ \ \ :\ 2008\-12\-31\ (2333\ days\ ago)-Transactions\ \ \ \ \ \ \ \ \ \ \ \ \ :\ 5\ (0.0\ per\ day)-Transactions\ last\ 30\ days:\ 0\ (0.0\ per\ day)-Transactions\ last\ 7\ days\ :\ 0\ (0.0\ per\ day)-Payees/descriptions\ \ \ \ \ \ :\ 5-Accounts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ 8\ (depth\ 3)-Commodities\ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ 1\ ($)-\f[]-.fi-.PP-This command also supports output destination and output format-selection.-.SS tags-.PP-tags-.PD 0-.P-.PD-List all the tag names used in the journal.-With a TAGREGEX argument, only tag names matching the regular expression-(case insensitive) are shown.-With QUERY arguments, only transactions matching the query are-considered.-.SS test-.PP-test-.PD 0-.P-.PD-Run built\-in unit tests.-.PP-This command runs the unit tests built in to hledger\-lib and hledger,-printing test names and results on stdout.-If any test fails, the exit code will be non\-zero.-.PP-Test names include a group prefix.-If a (exact, case sensitive) group prefix, or a full test name is-provided as the first argument, only that group or test is run.-.PP-If a numeric second argument is provided, it will set the randomness-seed, for repeatable results from tests using randomness (currently none-of them).-.PP-This is mainly used by developers, but it\[aq]s nice to be able to-sanity\-check your installed hledger executable at any time.-All tests are expected to pass \- if you ever see otherwise, something-has gone wrong, please report a bug!-.SH ADD\-ON COMMANDS-.PP-hledger also searches for external add\-on commands, and will include-these in the commands list.-These are programs or scripts in your PATH whose name starts with-\f[C]hledger\-\f[] and ends with a recognised file extension (currently:-no extension, \f[C]bat\f[],\f[C]com\f[],\f[C]exe\f[],-\f[C]hs\f[],\f[C]lhs\f[],\f[C]pl\f[],\f[C]py\f[],\f[C]rb\f[],\f[C]rkt\f[],\f[C]sh\f[]).-.PP-Add\-ons can be invoked like any hledger command, but there are a few-things to be aware of.-Eg if the \f[C]hledger\-web\f[] add\-on is installed,-.IP \[bu] 2-\f[C]hledger\ \-h\ web\f[] shows hledger\[aq]s help, while-\f[C]hledger\ web\ \-h\f[] shows hledger\-web\[aq]s help.-.IP \[bu] 2-Flags specific to the add\-on must have a preceding \f[C]\-\-\f[] to-hide them from hledger.-So \f[C]hledger\ web\ \-\-serve\ \-\-port\ 9000\f[] will be rejected;-you must use \f[C]hledger\ web\ \-\-\ \-\-serve\ \-\-port\ 9000\f[].-.IP \[bu] 2-You can always run add\-ons directly if preferred:-\f[C]hledger\-web\ \-\-serve\ \-\-port\ 9000\f[].-.PP-Add\-ons are a relatively easy way to add local features or experiment-with new ideas.-They can be written in any language, but haskell scripts have a big-advantage: they can use the same hledger (and haskell) library functions-that built\-in commands do, for command\-line options, journal parsing,-reporting, etc.-.PP-Here are some hledger add\-ons available:-.SS Official add\-ons-.PP-These are maintained and released along with hledger.-.SS api-.PP-hledger\-api serves hledger data as a JSON web API.-.SS ui-.PP-hledger\-ui provides an efficient curses\-style interface.-.SS web-.PP-hledger\-web provides a simple web interface.-.SS Third party add\-ons-.PP-These are maintained separately, and usually updated shortly after a-hledger release.-.SS diff-.PP-hledger\-diff shows differences in an account\[aq]s transactions between-one journal file and another.-.SS iadd-.PP-hledger\-iadd is a curses\-style, more interactive replacement for the-add command.-.SS interest-.PP-hledger\-interest generates interest transactions for an account-according to various schemes.-.SS irr-.PP-hledger\-irr calculates the internal rate of return of an investment-account, but it\[aq]s superseded now by the built\-in roi command.-.SS Experimental add\-ons-.PP-These are available in source form in the hledger repo\[aq]s bin/-directory; installing them is pretty easy.-They may be less mature and documented than built\-in commands.-Reading and tweaking these is a good way to start making your own!-.SS autosync-.PP-hledger\-autosync is a symbolic link for easily running-ledger\-autosync, if installed.-ledger\-autosync does deduplicating conversion of OFX data and some CSV-formats, and can also download the data if your bank offers OFX Direct-Connect.-.SS chart-.PP-hledger\-chart.hs is an old pie chart generator, in need of some love.-.SS check-.PP-hledger\-check.hs checks more powerful account balance assertions.-.SH ENVIRONMENT-.PP-\f[B]COLUMNS\f[] The screen width used by the register command.-Default: the full terminal width.-.PP-\f[B]LEDGER_FILE\f[] The journal file path when not specified with-\f[C]\-f\f[].-Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps-\f[C]C:/Users/USER/.hledger.journal\f[]).-.SH FILES-.PP-Reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-.SH BUGS-.PP-The need to precede addon command options with \f[C]\-\-\f[] when-invoked from hledger is awkward.-.PP-When input data contains non\-ascii characters, a suitable system locale-must be configured (or there will be an unhelpful error).-Eg on POSIX, set LANG to something other than C.-.PP-In a Microsoft Windows CMD window, non\-ascii characters and colours are-not supported.-.PP-In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger-add.-.PP-Not all of Ledger\[aq]s journal file syntax is supported.-See file format differences.-.PP-On large data files, hledger is slower and uses more memory than Ledger.-.SH TROUBLESHOOTING-.PP-Here are some issues you might encounter when you run hledger (and-remember you can also seek help from the IRC channel, mail list or bug-tracker):-.PP-\f[B]Successfully installed, but "No command \[aq]hledger\[aq]-found"\f[]-.PD 0-.P-.PD-stack and cabal install binaries into a special directory, which should-be added to your PATH environment variable.-Eg on unix\-like systems, that is ~/.local/bin and ~/.cabal/bin-respectively.-.PP-\f[B]I set a custom LEDGER_FILE, but hledger is still using the default-file\f[]-.PD 0-.P-.PD-\f[C]LEDGER_FILE\f[] should be a real environment variable, not just a-shell variable.-The command \f[C]env\ |\ grep\ LEDGER_FILE\f[] should show it.-You may need to use \f[C]export\f[].-Here\[aq]s an explanation.-.PP-\f[B]"Illegal byte sequence" or "Invalid or incomplete multibyte or wide-character" errors\f[]-.PD 0-.P-.PD-In order to handle non\-ascii letters and symbols (like £), hledger-needs an appropriate locale.-This is usually configured system\-wide; you can also configure it-temporarily.-The locale may need to be one that supports UTF\-8, if you built hledger-with GHC < 7.2 (or possibly always, I\[aq]m not sure yet).-.PP-Here\[aq]s an example of setting the locale temporarily, on ubuntu-gnu/linux:-.IP-.nf-\f[C]-$\ file\ my.journal-my.journal:\ UTF\-8\ Unicode\ text\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ <\-\ the\ file\ is\ UTF8\-encoded-$\ locale\ \-a-C-en_US.utf8\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ <\-\ a\ UTF8\-aware\ locale\ is\ available-POSIX-$\ LANG=en_US.utf8\ hledger\ \-f\ my.journal\ print\ \ \ #\ <\-\ use\ it\ for\ this\ command-\f[]-.fi-.PP-Here\[aq]s one way to set it permanently, there are probably better-ways:-.IP-.nf-\f[C]-$\ echo\ "export\ LANG=en_US.UTF\-8"\ >>~/.bash_profile-$\ bash\ \-\-login-\f[]-.fi-.PP-If we preferred to use eg \f[C]fr_FR.utf8\f[], we might have to install-that first:-.IP-.nf-\f[C]-$\ apt\-get\ install\ language\-pack\-fr-$\ locale\ \-a-C-en_US.utf8-fr_BE.utf8-fr_CA.utf8-fr_CH.utf8-fr_FR.utf8-fr_LU.utf8-POSIX-$\ LANG=fr_FR.utf8\ hledger\ \-f\ my.journal\ print-\f[]-.fi-.PP-Note some platforms allow variant locale spellings, but not all (ubuntu-accepts \f[C]fr_FR.UTF8\f[], mac osx requires exactly-\f[C]fr_FR.UTF\-8\f[]).---.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)--.SH AUTHORS-Simon Michael <simon@joyful.com> and contributors--.SH COPYRIGHT--Copyright (C) 2007-2016 Simon Michael.-.br-Released under GNU GPL v3 or later.--.SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org+.TH "HLEDGER" "1" "March 2026" "hledger-1.52 " "hledger User Manuals"++++.SH NAME+hledger \- a robust, friendly plain text accounting app (command line+version).+.SH SYNOPSIS+\f[CR]hledger\f[R]+.PD 0+.P+.PD+or+.PD 0+.P+.PD+\f[CR]hledger COMMAND [OPTS] [ARGS]\f[R]+.PD 0+.P+.PD+.SH DESCRIPTION+hledger is a robust, user\-friendly, cross\-platform set of programs for+tracking money, time, or any other commodity, using double\-entry+accounting and a simple, editable file format.+hledger is inspired by and largely compatible with ledger(1), and+largely interconvertible with beancount(1).+.PP+This manual is for hledger\(aqs command line interface, version 1.52.+It also describes the common options, file formats and concepts used by+all hledger programs.+It might accidentally teach you some bookkeeping/accounting as well!+You don\(aqt need to know everything in here to use hledger+productively, but when you have a question about functionality, this doc+should answer it.+It is detailed, so do skip ahead or skim when needed.+You can read it on hledger.org, or as an info manual or man page on your+system.+You can also open a built\-in copy, at a point of interest, by running+.PD 0+.P+.PD+\f[CR]hledger \-\-man [CMD]\f[R], \f[CR]hledger \-\-info [CMD]\f[R] or+\f[CR]hledger help [TOPIC]\f[R].+.PP+(And for shorter help, try \f[CR]hledger \-\-tldr [CMD]\f[R].)+.PP+The main function of the hledger CLI is to read plain text files+describing financial transactions, crunch the numbers, and print a+useful report on the terminal (or save it as HTML, CSV, JSON or SQL).+Many reports are available, as subcommands.+hledger will also detect other \f[CR]hledger\-*\f[R] executables as+extra subcommands.+.PP+hledger usually reads from (and appends to) a journal file specified by+the \f[CR]LEDGER_FILE\f[R] environment variable (defaulting to+\f[CR]$HOME/.hledger.journal\f[R]); or you can specify files with+\f[CR]\-f\f[R] options.+It can also read timeclock files, timedot files, or any CSV/SSV/TSV file+with a date field.+.PP+Here is a small journal file describing one transaction:+.IP+.EX+2015\-10\-16 bought food+ expenses:food $10+ assets:cash+.EE+.PP+Transactions are dated movements of money (etc.)+between two or more \f[I]accounts\f[R]: bank accounts, your wallet,+revenue/expense categories, people, etc.+You can choose any account names you wish, using \f[CR]:\f[R] to+indicate subaccounts.+There must be at least two spaces between account name and amount.+Positive amounts are inflow to that account (\f[I]debit\f[R]), negatives+are outflow from it (\f[I]credit\f[R]).+(Some reports show revenue, liability and equity account balances as+negative numbers as a result; this is normal.)+.PP+hledger\(cqs add command can help you add transactions, or you can+install other data entry UIs like hledger\-web or hledger\-iadd.+For more extensive/efficient changes, use a text editor: Emacs ++ledger\-mode, VIM + vim\-ledger, or VS Code + hledger\-vscode are some+good choices (see https://hledger.org/editors.html).+.PP+To get started, run \f[CR]hledger add\f[R] and follow the prompts, or+save some entries like the above in \f[CR]$HOME/.hledger.journal\f[R],+then try commands like:+.IP+.EX+$ hledger print \-x+$ hledger aregister assets+$ hledger balance+$ hledger balancesheet+$ hledger incomestatement+.EE+.PP+Run \f[CR]hledger\f[R] to list the commands.+See also the \(dqStarting a journal file\(dq and \(dqSetting opening+balances\(dq sections in PART 5: COMMON TASKS.+.SH PART 1: USER INTERFACE+.SH Input+hledger reads one or more data files, each time you run it.+You can specify a file with \f[CR]\-f\f[R], like so+.IP+.EX+$ hledger \-f FILE [\-f FILE2 ...] print+.EE+.PP+Files are most often in hledger\(aqs journal format, with the+\f[CR].journal\f[R] file extension (\f[CR].hledger\f[R] or \f[CR].j\f[R]+also work); these files describe transactions, like an accounting+general journal.+.PP+When no file is specified, hledger looks for \f[CR].hledger.journal\f[R]+in your home directory.+.PP+But most people prefer to keep financial files in a dedicated folder,+perhaps with version control.+Also, starting a new journal file each year is common (it\(aqs not+required, but helps keep things fast and organised).+So we usually configure a different journal file, by setting the+\f[CR]LEDGER_FILE\f[R] environment variable, to something like+\f[CR]\(ti/finance/2023.journal\f[R].+For more about how to do that on your system, see Common tasks > Setting+LEDGER_FILE.+.SS Text encoding+hledger expects non\-ascii input to be decodable with the system+locale\(aqs text encoding.+(For CSV/SSV/TSV files, this can be overridden by the+\f[CR]encoding\f[R] CSV rule.)+.PP+So, trying to read non\-ascii files which have the wrong text encoding,+or when no system locale is configured, will fail.+To fix this, configure your system locale appropriately, and/or convert+the files to your system\(aqs text encoding (using \f[CR]iconv\f[R] on+unix, or powershell or notepad on Windows).+See Install: Text encoding for more tips.+.PP+hledger\(aqs output will use the system locale\(aqs encoding.+.PP+hledger\(aqs docs and example files mostly use UTF\-8 encoding.+.SS Data formats+Usually the data file is in hledger\(aqs journal format, but it can be+in any of the supported file formats, which currently are:+.PP+.TS+tab(@);+lw(13.5n) lw(33.0n) lw(23.5n).+T{+Reader:+T}@T{+Reads:+T}@T{+Automatically used for files with extensions:+T}+_+T{+\f[CR]journal\f[R]+T}@T{+hledger journal files and some Ledger journals, for transactions+T}@T{+\f[CR].journal\f[R] \f[CR].j\f[R] \f[CR].hledger\f[R] \f[CR].ledger\f[R]+T}+T{+\f[CR]timeclock\f[R]+T}@T{+timeclock files, for precise time logging+T}@T{+\f[CR].timeclock\f[R]+T}+T{+\f[CR]timedot\f[R]+T}@T{+timedot files, for approximate time logging+T}@T{+\f[CR].timedot\f[R]+T}+T{+\f[CR]csv\f[R]+T}@T{+Comma\- or other delimiter\-separated values, for data import+T}@T{+\f[CR].csv\f[R]+T}+T{+\f[CR]ssv\f[R]+T}@T{+Semicolon separated values+T}@T{+\f[CR].ssv\f[R]+T}+T{+\f[CR]tsv\f[R]+T}@T{+Tab separated values+T}@T{+\f[CR].tsv\f[R]+T}+T{+\f[CR]rules\f[R]+T}@T{+CSV/SSV/TSV/other separated values, alternate way+T}@T{+\f[CR].rules\f[R]+T}+.TE+.PP+These formats are described in more detail below.+.PP+hledger detects the format automatically based on the file extensions+shown above.+If it can\(aqt recognise the file extension, it assumes+\f[CR]journal\f[R] format.+So for non\-journal files, it\(aqs important to use a recognised file+extension, so as to either read successfully or to show relevant error+messages.+.PP+You can also force a specific reader/format by prefixing the file path+with the format and a colon.+Eg, to read a .dat file containing tab separated values:+.IP+.EX+$ hledger \-f tsv:/some/file.dat stats+.EE+.SS Standard input+The file name \f[CR]\-\f[R] means standard input:+.IP+.EX+$ cat FILE | hledger \-f\- print+.EE+.PP+If reading non\-journal data in this way, you\(aqll need to write the+format as a prefix, like \f[CR]timeclock:\f[R] here:+.IP+.EX+$ echo \(aqi 2009/13/1 08:00:00\(aq | hledger print \-f timeclock:\-+.EE+.SS Multiple files+You can specify multiple \f[CR]\-f\f[R] options, to read multiple files+as one big journal.+When doing this, note that certain features (described below) will be+affected:+.IP \(bu 2+Balance assertions will not see the effect of transactions in previous+files.+(Usually this doesn\(aqt matter as each file will set the corresponding+opening balances.)+.IP \(bu 2+Some directives will not affect previous or subsequent files.+.PP+If needed, you can work around these by using a single parent file which+includes the others, or concatenating the files into one, eg:+\f[CR]cat a.journal b.journal | hledger \-f\- CMD\f[R].+.SS Strict mode+hledger checks input files for valid data.+By default, the most important errors are detected, while still+accepting easy journal files without a lot of declarations:+.IP \(bu 2+Are the input files parseable, with valid syntax ?+.IP \(bu 2+Are all transactions balanced ?+.IP \(bu 2+Do all balance assertions pass ?+.PP+With the \f[CR]\-s\f[R]/\f[CR]\-\-strict\f[R] flag, additional checks+are performed:+.IP \(bu 2+Are all accounts posted to, declared with an \f[CR]account\f[R]+directive ?+(Account error checking)+.IP \(bu 2+Are all commodities declared with a \f[CR]commodity\f[R] directive ?+(Commodity error checking)+.IP \(bu 2+Are all commodity conversions declared explicitly ?+.PP+You can use the check command to run individual checks \- the ones+listed above and some more.+.SH Commands+hledger provides various subcommands for getting things done.+Most of these commands do not change the journal file; they just read it+and output a report.+A few commands assist with adding data and file management.+Some often\-used commands are \f[CR]add\f[R], \f[CR]print\f[R],+\f[CR]register\f[R], \f[CR]balancesheet\f[R] and+\f[CR]incomestatement\f[R].+.PP+To show a summary of commands, run \f[CR]hledger\f[R] with no arguments.+You can see the same commands summary at the start of PART 4: COMMANDS+below.+.PP+To use a particular command, run+\f[CR]hledger CMD [CMDOPTS] [CMDARGS]\f[R],+.IP \(bu 2+CMD is the full command name, or its standard abbreviation shown in the+commands list, or any unambiguous prefix of the name.+.IP \(bu 2+CMDOPTS are command\-specific options, if any.+Command\-specific options must be written after the command name.+Eg: \f[CR]hledger print \-x\f[R].+.IP \(bu 2+CMDARGS are additional arguments to the command, if any.+Most hledger commands accept arguments representing a query, to limit+the data in some way.+Eg: \f[CR]hledger reg assets:checking\f[R].+.PP+To list a command\(aqs options, arguments, and documentation in the+terminal, run \f[CR]hledger CMD \-h\f[R].+Eg: \f[CR]hledger bal \-h\f[R].+.SS Add\-on commands+In addition to the built\-in commands, you can install \f[I]add\-on+commands\f[R], which will also appear in hledger\(aqs commands list.+Some of these can be installed as separate packages; others can be found+in hledger\(aqs bin/ directory, documented at+https://hledger.org/scripts.html.+.PP+Add\-on commands are programs or scripts in your shell\(aqs PATH, whose+name starts with \(dqhledger\-\(dq and ends with no extension or a+recognised extension (\(dq.bat\(dq, \(dq.com\(dq, \(dq.exe\(dq,+\(dq.hs\(dq, \(dq.js\(dq, \(dq.lhs\(dq, \(dq.lua\(dq, \(dq.php\(dq,+\(dq.pl\(dq, \(dq.py\(dq, \(dq.rb\(dq, \(dq.rkt\(dq, or \(dq.sh\(dq),+and (on unix and mac) which has executable permission for the current+user.+.PP+You can run add\-on commands directly: \f[CR]hledger\-ui \-\-watch\f[R].+.PP+Or you can run them with hledger, like built\-in commands:+\f[CR]hledger ui \-\-watch\f[R].+In this case hledger\(aqs config file will be used, so you can set+custom options for the addon there.+(Before hledger 1.50, an \f[CR]\-\-\f[R] argument was needed before+addon options, but not any more.)+.SH Options+Run \f[CR]hledger \-h\f[R] to see general command line help.+Options can be written either before or after the command name.+These options are specific to the \f[CR]hledger\f[R] CLI:+.IP+.EX+Flags:+ \-\-conf=CONFFILE Use extra options defined in this config file. If+ not specified, searches upward and in XDG config+ dir for hledger.conf (or .hledger.conf in $HOME).+ \-n \-\-no\-conf ignore any config file+.EE+.PP+And the following general options are common to most hledger commands:+.IP+.EX+General input/data transformation flags:+ \-f \-\-file=[FMT:]FILE Read data from FILE, or from stdin if FILE is \-,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ \-\-rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ \-\-alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ \-\-auto generate extra postings by applying auto posting+ rules (\(dq=\(dq) to all transactions+ \-\-forecast[=PERIOD] Generate extra transactions from periodic rules+ (\(dq\(ti\(dq), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger\-ui, also make future\-dated transactions+ visible at startup.+ \-I \-\-ignore\-assertions don\(aqt check balance assertions by default+ \-\-txn\-balancing=... how to check that transactions are balanced:+ \(aqold\(aq: use global display precision+ \(aqexact\(aq: use transaction precision (default)+ \-\-infer\-costs infer conversion equity postings from costs+ \-\-infer\-equity infer costs from conversion equity postings+ \-\-infer\-market\-prices infer market prices from costs+ \-\-pivot=TAGNAME use a different field or tag as account names+ \-s \-\-strict do extra error checks (and override \-I)+ \-\-verbose\-tags add tags indicating generated/modified data++General output/reporting flags (supported by some commands):+ \-b \-\-begin=DATE include postings/transactions on/after this date+ \-e \-\-end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ \-D \-\-daily multiperiod report with 1 day interval+ \-W \-\-weekly multiperiod report with 1 week interval+ \-M \-\-monthly multiperiod report with 1 month interval+ \-Q \-\-quarterly multiperiod report with 1 quarter interval+ \-Y \-\-yearly multiperiod report with 1 year interval+ \-p \-\-period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ \-\-today=DATE override today\(aqs date (affects relative dates)+ \-\-date2 match/use secondary dates instead (deprecated)+ \-U \-\-unmarked include only unmarked postings/transactions+ \-P \-\-pending include only pending postings/transactions+ \-C \-\-cleared include only cleared postings/transactions+ (\-U/\-P/\-C can be combined)+ \-R \-\-real include only non\-virtual postings+ \-E \-\-empty Show zero items, which are normally hidden.+ In hledger\-ui & hledger\-web, do the opposite.+ \-\-depth=DEPTHEXP if a number (or \-NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ \-B \-\-cost show amounts converted to their cost/sale amount+ \-V \-\-market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to \-\-value=end.+ \-X \-\-exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to \-\-value=end,COMM.+ \-\-value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ \(aqthen\(aq: value on transaction dates+ \(aqend\(aq: value at period end(s)+ \(aqnow\(aq: value today+ YYYY\-MM\-DD: value on given date+ \-c \-\-commodity\-style=S Override a commodity\(aqs display style.+ Eg: \-c \(aq.\(aq or \-c \(aq1.000,00 EUR\(aq+ \-\-pretty[=YN] Use box\-drawing characters in text output? Can be+ \(aqy\(aq/\(aqyes\(aq or \(aqn\(aq/\(aqno\(aq.+ If YN is specified, the equals is required.++General help flags:+ \-h \-\-help show command line help+ \-\-tldr show command examples with tldr+ \-\-info show the manual with info+ \-\-man show the manual with man+ \-\-version show version information+ \-\-debug=[1\-9] show this much debug output (default: 1)+ \-\-pager=YN use a pager when needed ? y/yes (default) or n/no+ \-\-color=YNA \-\-colour use ANSI color ? y/yes, n/no, or auto (default)+.EE+.PP+Usually hledger accepts any unambiguous flag prefix, eg you can write+\f[CR]\-\-tl\f[R] instead of \f[CR]\-\-tldr\f[R] or \f[CR]\-\-dry\f[R]+instead of \f[CR]\-\-dry\-run\f[R].+.PP+You can combine short flags which don\(aqt take arguments, eg you can+write \f[CR]\-MAST\f[R] instead of \f[CR]\-M \-A \-S \-T\f[R].+Flags requiring an argument can\(aqt be combined in this way+(\f[CR]\-If FILE\f[R] won\(aqt work).+.PP+If the same option appears more than once in a command line, usually the+last (right\-most) wins.+Similarly, if mutually exclusive flags are used together, the+right\-most wins.+(When flags are mutually exclusive, they\(aqll usually have a group+prefix in \-\-help.)+.PP+With most commands, arguments are interpreted as a hledger query which+filter the data.+Some queries can be expressed either with options or with arguments.+.PP+Below are more tips for using the command line interface \- feel free to+skip these until you need them.+.SS Special characters+In commands you type at the command line, certain characters have+special meaning and sometimes need to be \(dqescaped\(dq or+\(dqquoted\(dq, by prefixing backslashes or enclosing in quotes.+.PP+If you are able to minimise the use of special characters in your data,+you won\(aqt have to deal with this as much.+For example, you could use hyphen \f[CR]\-\f[R] or underscore+\f[CR]_\f[R] instead of spaces in account names, and you could use the+\f[CR]USD\f[R] currency code instead of the \f[CR]$\f[R] currency symbol+in amounts.+.PP+But if you prefer to use spaced account names and \f[CR]$\f[R], it\(aqs+fine.+Just be aware of this topic so you can check this doc when needed.+(These examples are mostly tested on unix; some details might need to be+adapted if you\(aqre on Windows.)+.SS Escaping shell special characters+These are some characters which may have special meaning to your shell+(the program which interprets command lines):+.IP \(bu 2+SPACE, \f[CR]<\f[R], \f[CR]>\f[R], \f[CR](\f[R], \f[CR])\f[R],+\f[CR]|\f[R], \f[CR]\(rs\f[R], \f[CR]%\f[R]+.IP \(bu 2+\f[CR]$\f[R] if followed by a word character+.PP+So for example, to match an account name containing spaces, like+\(dqcredit card\(dq, don\(aqt write:+.IP+.EX+$ hledger register credit card+.EE+.PP+Instead, enclose the name in single quotes:+.IP+.EX+$ hledger register \(aqcredit card\(aq+.EE+.PP+On unix or in Windows powershell, if you use double quotes your shell+will silently treat \f[CR]$\f[R] as variable interpolation.+So you should probably avoid double quotes, unless you want that+behaviour, eg in a script:+.IP+.EX+$ hledger register \(dqassets:$SOMEACCT\(dq+.EE+.PP+But in an older Windows CMD.EXE window, you must use double quotes:+.IP+.EX+C:\(rsUsers\(rsMe> hledger register \(dqcredit card\(dq+.EE+.PP+On unix or in Windows powershell, as an alternative to quotes you can+write a backslash before each special character:+.IP+.EX+$ hledger register credit\(rs card+.EE+.PP+Finally, since hledger\(aqs query arguments are regular expressions+(described below), you could also fill that gap with \f[CR].\f[R] which+matches any character:+.IP+.EX+$ hledger register credit.card+.EE+.SS Escaping regular expression special characters+Some characters also have special meaning in regular expressions, which+hledger\(aqs arguments often are.+Those include:+.IP \(bu 2+\f[CR].\f[R], \f[CR]\(ha\f[R], \f[CR]$\f[R], \f[CR][\f[R], \f[CR]]\f[R],+\f[CR](\f[R], \f[CR])\f[R], \f[CR]|\f[R], \f[CR]\(rs\f[R]+.PP+To escape one of these, write \f[CR]\(rs\f[R] before it.+But note this is in addition to the shell escaping above.+So for characters which are special to both shell and regular+expressions, like \f[CR]\(rs\f[R] and \f[CR]$\f[R], you will sometimes+need two levels of escaping.+.PP+For example, a balance report that uses a \f[CR]cur:\f[R] query+restricting it to just the $ currency, should be written like this:+.IP+.EX+$ hledger balance cur:\(rs\(rs$+.EE+.PP+Explanation:+.IP "1." 3+Add a backslash \f[CR]\(rs\f[R] before the dollar sign \f[CR]$\f[R] to+protect it from regular expressions (so it will be matched literally+with no special meaning).+.IP "2." 3+Add another backslash before that backslash, to protect it from the+shell (so the shell won\(aqt consume it).+.IP "3." 3+\f[CR]$\f[R] doesn\(aqt need to be protected from the shell in this+case, because it\(aqs not followed by a word character; but it would be+harmless to do so.+.PP+But here\(aqs another way to write that, which tends to be easier: add+backslashes to escape from regular expressions, then enclose with quotes+to escape from the shell:+.IP+.EX+$ hledger balance cur:\(aq\(rs$\(aq+.EE+.SS Escaping in other situations+hledger options and arguments are sometimes used in places other than+the command line, where the escaping/quoting rules are different.+For example, backslash\-quoting may not be available.+Here\(aqs a quick reference:+.PP+.TS+tab(@);+lw(17.5n) lw(52.5n).+T{+In unix shell+T}@T{+Use single quotes and/or backslash (or double quotes for variable+interpolation)+T}+T{+In Windows \f[CR]powershell\f[R]+T}@T{+Use single quotes (or double quotes for variable interpolation)+T}+T{+In Windows \f[CR]cmd\f[R]+T}@T{+Use double quotes+T}+T{+In hledger\-ui\(aqs filter prompt+T}@T{+Use single or double quotes+T}+T{+In hledger\-web\(aqs search form+T}@T{+Use single or double quotes+T}+T{+In an argument file+T}@T{+Don\(aqt use spaces, don\(aqt shell\-escape, do regex\-escape, write one+argument/option per line+T}+T{+In a config file+T}@T{+Use single or double quotes, and enclose the whole argument+(\f[CR]\(aqdesc:a b\(aq\f[R] not \f[CR]desc:\(aqa b\(aq\f[R])+T}+T{+In \f[CR]ghci\f[R] (the Haskell REPL)+T}@T{+Use double quotes, and enclose the whole argument+T}+.TE+.SS Unicode characters+hledger is expected to handle non\-ascii characters correctly:+.IP \(bu 2+they should be parsed correctly in input files and on the command line,+by all hledger tools (add, iadd, hledger\-web\(aqs search/add/edit+forms, etc.)+.IP \(bu 2+they should be displayed correctly by all hledger tools, and on\-screen+alignment should be preserved.+.PP+This requires a well\-configured environment.+Here are some tips:+.IP \(bu 2+A system locale must be configured, which can decode the characters+being used.+This is essential \- see Text encoding and Install: Text encoding.+.IP \(bu 2+Your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..)+must support unicode.+On Windows, you may need to use Windows Terminal.+.IP \(bu 2+The terminal must be using a font which includes the required unicode+glyphs.+.IP \(bu 2+The terminal should be configured to display wide characters as double+width (for report alignment).+.IP \(bu 2+On Windows, for best results you should run hledger in the same kind of+environment in which it was built.+Eg hledger built in the standard CMD.EXE environment (like the binaries+on our download page) might show display problems when run in a cygwin+or msys terminal, and vice versa.+(See eg #961).+.SS Regular expressions+A regular expression (regexp) is a small piece of text where certain+characters (like \f[CR].\f[R], \f[CR]\(ha\f[R], \f[CR]$\f[R],+\f[CR]+\f[R], \f[CR]*\f[R], \f[CR]()\f[R], \f[CR]|\f[R], \f[CR][]\f[R],+\f[CR]\(rs\f[R]) have special meanings, forming a tiny language for+matching text precisely \- very useful in hledger and elsewhere.+To learn all about them, visit regular\-expressions.info.+.PP+hledger supports regexps whenever you are entering a pattern to match+something, eg in query arguments, account aliases, CSV if rules,+hledger\-web\(aqs search form, hledger\-ui\(aqs \f[CR]/\f[R] search,+etc.+You may need to wrap them in quotes, especially at the command line (see+Special characters above).+Here are some examples:+.PP+Account name queries (quoted for command line use):+.IP+.EX+Regular expression: Matches:+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+bank assets:bank, assets:bank:savings, expenses:art:banksy, ...+:bank assets:bank:savings, expenses:art:banksy+:bank: assets:bank:savings+\(aq\(habank\(aq none of those ( \(ha matches beginning of text )+\(aqbank$\(aq assets:bank ( $ matches end of text )+\(aqbig \(rs$ bank\(aq big $ bank ( \(rs disables following character\(aqs special meaning )+\(aq\(rsbbank\(rsb\(aq assets:bank, assets:bank:savings ( \(rsb matches word boundaries )+\(aq(sav|check)ing\(aq saving or checking ( (|) matches either alternative )+\(aqsaving|checking\(aq saving or checking ( outer parentheses are not needed )+\(aqsavings?\(aq saving or savings ( ? matches 0 or 1 of the preceding thing )+\(aqmy +bank\(aq my bank, my bank, ... ( + matches 1 or more of the preceding thing )+\(aqmy *bank\(aq mybank, my bank, my bank, ... ( * matches 0 or more of the preceding thing )+\(aqb.nk\(aq bank, bonk, b nk, ... ( . matches any character )+.EE+.PP+Some other queries:+.IP+.EX+desc:\(aqamazon|amzn|audible\(aq Amazon transactions+cur:EUR amounts with commodity symbol containing EUR+cur:\(aq\(rs$\(aq amounts with commodity symbol containing $+cur:\(aq\(ha\(rs$$\(aq only $ amounts, not eg AU$ or CA$+cur:....? amounts with 4\-or\-more\-character symbols+tag:.=202[1\-3] things with any tag whose value contains 2021, 2022 or 2023+.EE+.PP+Account name aliases: accept \f[CR].\f[R] instead of \f[CR]:\f[R] as+account separator:+.IP+.EX+alias /\(rs./=: replaces all periods in account names with colons+.EE+.PP+Show multiple top\-level accounts combined as one:+.IP+.EX+\-\-alias=\(aq/\(ha[\(ha:]+/=combined\(aq ( [\(ha:] matches any character other than : )+.EE+.PP+Show accounts with the second\-level part removed:+.IP+.EX+\-\-alias \(aq/\(ha([\(ha:]+):[\(ha:]+/ = \(rs1\(aq+ match a top\-level account and a second\-level account+ and replace those with just the top\-level account+ ( \(rs1 in the replacement text means \(dqwhatever was matched+ by the first parenthesised part of the regexp\(dq+.EE+.PP+CSV rules: match CSV records containing dining\-related MCC codes:+.IP+.EX+if \(rs?MCC581[124]+.EE+.PP+Match CSV records with a specific amount around the end/start of month:+.IP+.EX+if %amount \(rsb3\(rs.99+& %date (29|30|31|01|02|03)$+.EE+.SS hledger\(aqs regular expressions+hledger\(aqs regular expressions come from the regex\-tdfa library.+If they\(aqre not doing what you expect, it\(aqs important to know+exactly what they support:+.IP "1." 3+they are case insensitive+.IP "2." 3+they are infix matching (they do not need to match the entire thing+being matched)+.IP "3." 3+they are POSIX ERE (extended regular expressions)+.IP "4." 3+they also support GNU word boundaries (\f[CR]\(rsb\f[R],+\f[CR]\(rsB\f[R], \f[CR]\(rs<\f[R], \f[CR]\(rs>\f[R])+.IP "5." 3+backreferences are supported when doing text replacement in account+aliases or CSV rules, where backreferences can be used in the+replacement string to reference capturing groups in the search regexp.+Otherwise, if you write \f[CR]\(rs1\f[R], it will match the digit+\f[CR]1\f[R].+.IP "6." 3+they do not support lazy quantifiers (\f[CR]*?\f[R]), mode modifiers+(\f[CR](?s)\f[R]), character classes (\f[CR]\(rsw\f[R],+\f[CR]\(rsd\f[R]), or anything else not mentioned above.+.IP "7." 3+they may not (I\(aqm guessing not) properly support right\-to\-left or+bidirectional text.+.PP+Some things to note:+.IP \(bu 2+In the \f[CR]alias\f[R] directive and \f[CR]\-\-alias\f[R] option,+regular expressions must be enclosed in forward slashes+(\f[CR]/REGEX/\f[R]).+Elsewhere in hledger, these are not required.+.IP \(bu 2+In queries, to match a regular expression metacharacter like+\f[CR]$\f[R] as a literal character, prepend a backslash.+Eg to search for amounts with the dollar sign in hledger\-web, write+\f[CR]cur:\(rs$\f[R].+.IP \(bu 2+On the command line, some metacharacters like \f[CR]$\f[R] have a+special meaning to the shell and so must be escaped at least once more.+See Special characters.+.SS Argument files+You can save a set of command line options and arguments in a file, and+then use them by writing \f[CR]\(atFILE.args\f[R] as a hledger command+argument.+The \f[CR].args\f[R] file extension is conventional, but not required.+In an argument file,+.IP \(bu 2+Each line can contain one argument, flag, or option.+.IP \(bu 2+Blank lines or lines beginning with \f[CR]#\f[R] are ignored.+.IP \(bu 2+An option\(aqs flag and value should be joined by \f[CR]=\f[R].+.IP \(bu 2+An option value or an argument may contain spaces.+Don\(aqt use single or double quotes.+.IP \(bu 2+And generally, use one less level of quoting/escaping than at the+command line.+Eg \f[CR]cur:\(rs$\f[R], not \f[CR]cur:\(rs\(rs$\f[R] as on the command+line.+.PP+For example:+.IP+.EX+# cash.args++assets:cash+assets:charles schwab:sweep+cur:\(rs$+\-c=$1.+.EE+.IP+.EX+$ hledger bal \(atcash.args+.EE+.SS Config files+With hledger 1.40+, you can save extra command line options and+arguments in a more featureful hledger config file.+Here\(aqs a small example:+.IP+.EX+\f[I]# General options are listed first, and used with hledger commands that support them.\f[R]+\-\-pretty++\f[I]# Options following a \(ga[COMMAND]\(ga heading are used with that hledger command only.\f[R]+\f[B][print]\f[R]+\-\-explicit \-\-infer\-costs+.EE+.PP+To use a config file, specify it with the \f[CR]\-\-conf\f[R] option.+Its options will be inserted near the start of your command line, so you+can override them with command line options if needed.+.PP+Or, you can set up an automatic config file that is used whenever you+run hledger, by creating \f[CR]hledger.conf\f[R] in the current+directory or above, or \f[CR].hledger.conf\f[R] in your home directory+(\f[CR]\(ti/.hledger.conf\f[R]), or \f[CR]hledger.conf\f[R] in your XDG+config directory (\f[CR]\(ti/.config/hledger/hledger.conf\f[R]).+.PP+Here is another example config you could start with:+https://github.com/simonmichael/hledger/blob/master/hledger.conf.sample+.PP+You can put not only options, but also arguments in a config file.+If the first word in a config file\(aqs top (general) section does not+begin with a dash (eg: \f[CR]print\f[R]), it is treated as the command+argument (overriding any argument on the command line).+.PP+On unix machines, you can add a shebang line at the top of a config+file, set executable permission on the file, and use it like a script.+Eg (the \f[CR]\-S\f[R] is needed on some operating systems):+.IP+.EX+#!/usr/bin/env \-S hledger \-\-conf+.EE+.PP+You can ignore config files by adding the+\f[CR]\-n\f[R]/\f[CR]\-\-no\-conf\f[R] flag to the command line.+This is useful when using hledger in scripts, or when troubleshooting.+When both \f[CR]\-\-conf\f[R] and \f[CR]\-\-no\-conf\f[R] options are+used, the right\-most wins.+.PP+To inspect the processing of config files, use \f[CR]\-\-debug\f[R] or+\f[CR]\-\-debug=8\f[R].+Or, run the \f[CR]setup\f[R] command, which will display any active+config files.+(\f[CR]setup\f[R] is not affected by config files itself, unlike other+commands.)+.PP+\f[B]Warning!\f[R]+.PP+There aren\(aqt many hledger features that need a warning, but this is+one!+.PP+Automatic config files, while convenient, also make hledger less+predictable and dependable.+It\(aqs easy to make a config file that changes a report\(aqs behaviour,+or breaks your hledger\-using scripts/applications, in ways that will+surprise you later.+.PP+If you don\(aqt want this,+.IP "1." 3+Just don\(aqt create a hledger.conf file on your machine.+.IP "2." 3+Also be alert to downloaded directories which may contain a hledger.conf+file.+.IP "3." 3+Also if you are sharing scripts or examples or support, consider that+others may have a hledger.conf file.+.PP+Conversely, once you decide to use this feature, try to remember:+.IP "1." 3+Whenever a hledger command does not work as expected, try it again with+\f[CR]\-n\f[R] (\f[CR]\-\-no\-conf\f[R]) to see if a config file was to+blame.+.IP "2." 3+Whenever you call hledger from a script, consider whether that call+should use \f[CR]\-n\f[R] or not.+.IP "3." 3+Be conservative about what you put in your config file; try to consider+the effect on all your reports.+.IP "4." 3+To troubleshoot the effect of config files, run with+\f[CR]\-\-debug\f[R] or \f[CR]\-\-debug 8\f[R].+.PP+The config file feature was added in hledger 1.40.+.SS Shell completions+If you use the bash or zsh shells, you can optionally set up+context\-sensitive autocompletion for hledger command lines.+Try pressing \f[CR]hledger<SPACE><TAB><TAB>\f[R] (should list all+hledger commands) or \f[CR]hledger reg acct:<TAB><TAB>\f[R] (should list+your top\-level account names).+If completions aren\(aqt working, or for more details, see Install >+Shell completions.+.SH Output+.SS Output destination+hledger commands send their output to the terminal by default.+You can of course redirect this, eg into a file, using standard shell+syntax:+.IP+.EX+$ hledger print > foo.txt+.EE+.PP+Some commands (print, register, stats, the balance commands) also+provide the \f[CR]\-o\f[R]/\f[CR]\-\-output\-file\f[R] option, which+does the same thing without needing the shell.+Eg:+.IP+.EX+$ hledger print \-o foo.txt+$ hledger print \-o \- # write to stdout (the default)+.EE+.SS Output format+Some commands offer other kinds of output, not just text on the+terminal.+Here are those commands and the formats currently supported:+.PP+.TS+tab(@);+lw(20.6n) lw(5.1n) lw(6.2n) lw(9.3n) lw(6.2n) lw(11.3n) lw(5.1n) lw(6.2n).+T{+command+T}@T{+txt+T}@T{+html+T}@T{+csv/tsv+T}@T{+fods+T}@T{+beancount+T}@T{+sql+T}@T{+json+T}+_+T{+aregister+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}@T{+Y+T}+T{+balance+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}@T{+Y+T}+T{+balancesheet+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}@T{+Y+T}+T{+balancesheetequity+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}@T{+Y+T}+T{+cashflow+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}@T{+Y+T}+T{+incomestatement+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}@T{+Y+T}+T{+print+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}+T{+register+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}@T{+Y+T}+.TE+.PP+You can also see which output formats a command supports by running+\f[CR]hledger CMD \-h\f[R] and looking for the+\f[CR]\-O\f[R]/\f[CR]\-\-output\-format=FMT\f[R] option,+.PP+You can select the output format by using that option:+.IP+.EX+$ hledger print \-O csv # print CSV to standard output+.EE+.PP+or by choosing a suitable filename extension with the+\f[CR]\-o\f[R]/\f[CR]\-\-output\-file=FILE.FMT\f[R] option:+.IP+.EX+$ hledger balancesheet \-o foo.csv # write CSV to foo.csv+.EE+.PP+The \f[CR]\-O\f[R] option can be combined with \f[CR]\-o\f[R] to+override the file extension if needed:+.IP+.EX+$ hledger balancesheet \-o foo.txt \-O csv # write CSV to foo.txt+.EE+.PP+Here are some notes about the various output formats.+.SS Text output+This is the default: human readable, plain text report output, suitable+for viewing with a monospace font in a terminal.+If your data contains unicode or wide characters, you\(aqll need a+terminal and font that render those correctly.+(This can be challenging on MS Windows.)+.PP+Some reports (\f[CR]register\f[R], \f[CR]aregister\f[R]) will normally+use the full window width.+If this isn\(aqt working or you want to override it, you can use the+\f[CR]\-w\f[R]/\f[CR]\-\-width\f[R] option.+.PP+Balance reports (\f[CR]balance\f[R], \f[CR]balancesheet\f[R],+\f[CR]incomestatement\f[R]...)+use whatever width they need.+Multi\-period multi\-currency reports can often be wider than the+window.+Besides using a pager, helpful techniques for this situation include+\f[CR]\-\-layout=bare\f[R], \f[CR]\-X COMM\f[R], \f[CR]cur:\f[R],+\f[CR]\-\-transpose\f[R], \f[CR]\-\-tree\f[R], \f[CR]\-\-depth\f[R],+\f[CR]\-\-drop\f[R], switching to html output, etc.+.SS Box\-drawing characters+hledger draws simple table borders by default, to minimise the risk of+display problems caused by a terminal/font not supporting box\-drawing+characters.+.PP+But your terminal and font probably do support them, so we recommend+using the \f[CR]\-\-pretty\f[R] flag to show prettier tables in the+terminal.+This is a good flag to add to your hledger config file.+.SS Colour+hledger tries to automatically detect ANSI colour and text styling+support and use it when appropriate.+(Currently, it is used rather minimally: some reports show negative+numbers in red, and help output uses bold text for emphasis.)+.PP+You can override this by setting the \f[CR]NO_COLOR\f[R] environment+variable to disable it, or by using the \f[CR]\-\-color/\-\-colour\f[R]+option, perhaps in your config file, with a \f[CR]y\f[R]/\f[CR]yes\f[R]+or \f[CR]n\f[R]/\f[CR]no\f[R] value to force it on or off.+.SS Paging+In unix\-like environments, when displaying large output (in any output+format) in the terminal, hledger tries to use a pager when appropriate.+(You can disable this with the \f[CR]\-\-pager=no\f[R] option, perhaps+in your config file.)+.PP+The pager shows one page of text at a time, and lets you scroll around+to see more.+While it is active, usually \f[CR]SPACE\f[R] shows the next page,+\f[CR]h\f[R] shows help, and \f[CR]q\f[R] quits.+The home/end/page up/page down/cursor keys, and mouse scrolling, may+also work.+.PP+hledger will use the pager specified by the \f[CR]PAGER\f[R] environment+variable, otherwise \f[CR]less\f[R] if available, otherwise+\f[CR]more\f[R] if available.+(With one exception: \f[CR]hledger help \-p TOPIC\f[R] will always use+\f[CR]less\f[R], so that it can scroll to the topic.)+.PP+The pager is expected to display hledger\(aqs ANSI colour and text+styling.+If you see junk characters, you might need to configure your pager to+handle ANSI codes.+Or you could disable colour as described above.+.PP+If you are using the \f[CR]less\f[R] pager, hledger tries to provide a+consistently pleasant experience by running it with some extra options+added to your \f[CR]LESS\f[R] environment variable:+.PP+\-\-chop\-long\-lines \-\-hilite\-unread \-\-ignore\-case \-\-no\-init+\-\-quit\-if\-one\-screen \-\-shift=8 \-\-squeeze\-blank\-lines+\-\-use\-backslash+.PP+and when colour output is enabled:+.PP+\-\-RAW\-CONTROL\-CHARS+.PP+You can prevent this by setting your preferred options in the+\f[CR]HLEDGER_LESS\f[R] variable, which will be used instead of+\f[CR]LESS\f[R].+.SS HTML output+HTML output can be styled by an optional \f[CR]hledger.css\f[R] file in+the same directory.+.PP+HTML output will be a HTML fragment, not a complete HTML document.+Like other hledger output, for non\-ascii characters it will use the+system locale\(aqs text encoding (see Text encoding).+.SS CSV / TSV output+In CSV or TSV output, digit group marks (such as thousands separators)+are disabled automatically.+.SS FODS output+FODS is the OpenDocument Spreadsheet format as plain XML, as accepted by+LibreOffice and OpenOffice.+If you use their spreadsheet applications, this is better than CSV+because it works across locales (decimal point vs.+decimal comma, character encoding stored in XML header, thus no problems+with umlauts), it supports fixed header rows and columns, cell types+(string vs.+number vs.+date), separation of number and currency (currency is displayed but the+cell type is still a number accessible for computation), styles (bold),+borders.+Btw.+you can still extract CSV from FODS/ODS using various utilities like+\f[CR]libreoffice \-\-headless\f[R] or ods2csv.+.SS Beancount output+This is Beancount\(aqs journal format.+You can use this to export your hledger data to Beancount, eg to use the+Fava web app.+.PP+hledger will try to adjust your data to suit Beancount, automatically.+Be cautious and check the conversion until you are confident it is good.+If you plan to export to Beancount often, you may want to follow its+conventions, for a cleaner conversion:+.IP \(bu 2+use Beancount\-friendly account names+.IP \(bu 2+use currency codes instead of currency symbols+.IP \(bu 2+use cost notation instead of equity conversion postings+.IP \(bu 2+avoid virtual postings, balance assignments, and secondary dates.+.PP+There is one big adjustment you must handle yourself: for Beancount, the+top level account names must be \f[CR]Assets\f[R],+\f[CR]Liabilities\f[R], \f[CR]Equity\f[R], \f[CR]Income\f[R], and/or+\f[CR]Expenses\f[R].+You can use account aliases to rewrite your account names temporarily,+if needed, as in this hledger2beancount.conf config file.+.PP+2024\-12\-20: Some more things not yet handled for you:+.IP \(bu 2+P directives are not converted automatically \- convert those yourself.+.IP \(bu 2+Balance assignments are not converted (Beancount doesn\(aqt support+them) \- replace those with explicit amounts.+.SS Beancount account names+Aside from the top\-level names, hledger will adjust your account names+to make valid Beancount account names, by capitalising each part,+replacing spaces with \f[CR]\-\f[R], replacing other unsupported+characters with \f[CR]C<HEXBYTES>\f[R], prepending \f[CR]A\f[R] to+account name parts which don\(aqt begin with a letter or digit, and+appending \f[CR]:A\f[R] to account names which have only one part.+.SS Beancount commodity names+hledger will adjust your commodity names to make valid Beancount+commodity/currency names, which must be 2\-24 uppercase letters, digits,+or \f[CR]\(aq\f[R], \f[CR].\f[R], \f[CR]_\f[R], \f[CR]\-\f[R], beginning+with a letter and ending with a letter or digit.+hledger will convert known currency symbols to ISO 4217 currency codes,+capitalise letters, replace spaces with \f[CR]\-\f[R], replace other+unsupported characters with \f[CR]C<HEXBYTES>\f[R], and prepend or+append \f[CR]C\f[R] if needed.+.SS Beancount virtual postings+Beancount doesn\(aqt allow virtual postings; if you have any, they will+be omitted from beancount output.+.SS Beancount metadata+hledger tags will be converted to Beancount metadata (except for tags+whose name begins with \f[CR]_\f[R]).+Metadata names will be adjusted to be Beancount\-compatible: beginning+with a lowercase letter, at least two characters long, and with+unsupported characters encoded.+Metadata values will use Beancount\(aqs string type.+.PP+In hledger, objects can have the same tag repeated with multiple values.+Eg an \f[CR]assets:cash\f[R] account might have both+\f[CR]type:Asset\f[R] and \f[CR]type:Cash\f[R] tags.+For Beancount these will be combined into one, with the values combined,+comma separated.+Eg: \f[CR]type: \(dqAsset, Cash\(dq\f[R].+.SS Beancount costs+Beancount doesn\(aqt allow redundant costs and conversion postings as+hledger does.+If you have any of these, the conversion postings will be omitted.+Currently we support at most one cost + conversion postings group per+transaction.+.SS Beancount operating currency+Declaring an operating currency (or several) improves Beancount and Fava+reports.+Currently hledger will declare each currency used in cost amounts as an+operating currency.+If needed, replace these with your own declaration, like+.IP+.EX+option \(dqoperating_currency\(dq \(dqUSD\(dq+.EE+.SS SQL output+SQL output is expected to work at least with SQLite, MySQL and Postgres.+.PP+The SQL statements are expected to be executed in the empty database.+If you already have tables created via SQL output of hledger, you would+probably want to either clear data from these (via \f[CR]delete\f[R] or+\f[CR]truncate\f[R] SQL statements) or \f[CR]drop\f[R] the tables+completely before import; otherwise your postings would be duplicated.+.PP+For SQLite, it is more useful if you modify the generated \f[CR]id\f[R]+field to be a PRIMARY KEY.+Eg:+.IP+.EX+$ hledger print \-O sql | sed \(aqs/id serial/id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL/g\(aq | ...+.EE+.PP+This is not yet much used; feedback is welcome.+.SS JSON output+Our JSON is rather large and verbose, since it is a faithful+representation of hledger\(aqs internal data types.+To understand its structure, read the Haskell type definitions, which+are mostly in+https://github.com/simonmichael/hledger/blob/master/hledger\-lib/Hledger/Data/Types.hs.+hledger\-web\(aqs OpenAPI specification may also be relevant.+.PP+hledger stores numbers with sometimes up to 255 significant digits.+This is too many digits for most JSON consumers, so in JSON output we+round numbers to at most 10 decimal places.+(We don\(aqt limit the number of integer digits.)+If you find this causing problems, please let us know.+Related: #1195+.PP+This is not yet much used; feedback is welcome.+.SS Commodity styles+When displaying amounts, hledger infers a standard display style for+each commodity/currency, as described below in Commodity display style.+.PP+If needed, this can be overridden by a+\f[CR]\-c/\-\-commodity\-style\f[R] option (except for cost amounts and+amounts displayed by the \f[CR]print\f[R] command, which are always+displayed with all decimal digits).+For example, the following will force dollar amounts to be displayed as+shown:+.IP+.EX+$ hledger print \-c \(aq$1.000,0\(aq+.EE+.PP+This option can be repeated to set the display style for multiple+commodities/currencies.+Its argument is as described in the commodity directive.+Note that omitting the commodity symbol will set the display style for+just the no\-symbol commodity, not all commodities.+.PP+In some cases hledger will adjust number formatting to improve their+parseability (such as adding trailing decimal marks when needed).+.SS Debug output+We intend hledger to be relatively easy to troubleshoot, introspect and+develop.+You can add \f[CR]\-\-debug[=N]\f[R] to any hledger command line to see+additional debug output.+N ranges from 1 (least output, the default) to 9 (maximum output).+Typically you would start with 1 and increase until you are seeing+enough.+Debug output goes to stderr, and is not affected by+\f[CR]\-o/\-\-output\-file\f[R] (unless you redirect stderr to stdout,+eg: \f[CR]2>&1\f[R]).+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:+.IP+.EX+hledger bal \-\-debug=3 2>hledger.log+.EE+.PP+(This option doesn\(aqt work in a config file yet.)+.SH Environment+These environment variables affect hledger:+.PP+\f[B]HLEDGER_LESS\f[R] If \f[CR]less\f[R] is your pager, this variable+specifies the \f[CR]less\f[R] options hledger should use.+(Otherwise, \f[CR]LESS\f[R] + custom options are used.)+.PP+\f[B]LEDGER_FILE\f[R] The default journal file, to be used when no+\f[CR]\-f/\-\-file\f[R] option is provided.+For example, it could be \f[CR]\(ti/finance/main.journal\f[R].+This can also be a glob pattern, eg \f[CR]./2???.journal\f[R].+(If the glob matches multiple files, only the alphanumerically first one+is used.)+If LEDGER_FILE points to a non\-existent file, an error will be raised.+If the value is the empty string, it is ignored.+.PP+If LEDGER_FILE is not set and \f[CR]\-f\f[R] is not provided, the+default journal file is \f[CR]$HOME/.hledger.journal\f[R] (or if a home+directory can\(aqt be detected, \f[CR]./.hledger.journal\f[R]).+.PP+See also Common tasks > Setting LEDGER_FILE.+.PP+\f[B]NO_COLOR\f[R] If this environment variable exists (with any value,+including empty), hledger will not use ANSI color codes in terminal+output, unless overridden by an explicit \f[CR]\-\-color=y\f[R] or+\f[CR]\-\-colour=y\f[R] option.+.SH PART 2: DATA FORMATS+.SH Journal+hledger\(aqs usual data source is a plain text file containing journal+entries in hledger \f[CR]journal\f[R] format.+If you\(aqre looking for a quick reference, jump ahead to the journal+cheatsheet (or use the table of contents at+https://hledger.org/hledger.html).+.PP+This file represents an accounting General Journal.+The \f[CR].journal\f[R] file extension is most often used, though not+strictly required.+The journal file contains a number of transaction entries, each+describing a transfer of money (or any commodity) between two or more+named accounts, in a simple format readable by both hledger and humans.+.PP+hledger\(aqs journal format is compatible with most of Ledger\(aqs+journal format, but not all of it.+The differences and interoperation tips are described at hledger and+Ledger.+With some care, and by avoiding incompatible features, you can keep your+hledger journal readable by Ledger and vice versa.+This can useful eg for comparing the behaviour of one app against the+other.+.PP+You can use hledger without learning any more about this file; just use+the add or web or import commands to create and update it.+.PP+Many users, though, edit the journal file with a text editor, and track+changes with a version control system such as git.+Editor add\-ons such as ledger\-mode or hledger\-mode for Emacs,+vim\-ledger for Vim, and hledger\-vscode for Visual Studio Code, make+this easier, adding colour, formatting, tab completion, and useful+commands.+See Editors at hledger.org for the full list.+.PP+A hledger journal file can contain three kinds of thing: comment lines,+transactions, and/or directives (including periodic transaction rules+and auto posting rules).+Understanding the journal file format will also give you a good+understanding of hledger\(aqs data model.+Here\(aqs a quick cheatsheet/overview, followed by detailed descriptions+of each part.+.SS Journal cheatsheet+.IP+.EX+# Here is the main syntax of hledger\(aqs journal format+# (omitting extra Ledger compatibility syntax).++###############################################################################++# 1. These are comment lines, for notes or temporarily disabling things.+; They begin with # or ;++comment+Or, lines can be enclosed within \(dqcomment\(dq / \(dqend comment\(dq.+This is a block of +commented lines.+end comment++# Some journal entries can have semicolon comments at end of line ; like this+# Some of them require 2 or more spaces before the semicolon.++###############################################################################++# 2. Directives customise processing or output in some way.+# You don\(aqt need any directives to get started.+# But they can add more error checking, or change how things are displayed.+# They begin with a word, letter, or symbol. +# They are most often placed at the top, before transactions.++account assets ; Declare valid account names and display order.+account assets:savings ; A subaccount. This one represents a bank account.+account assets:checking ; Another. Note, 2+ spaces after the account name.+account assets:receivable ; Accounting type is inferred from english names,+account passifs ; or declared with a \(dqtype\(dq tag, type:L+account expenses ; type:X+ ; A follow\-on comment line, indented.+account expenses:rent ; Expense and revenue categories are also accounts.+ ; Subaccounts inherit their parent\(aqs type.++commodity $0.00 ; Declare valid commodities and their display styles.+commodity 1.000,00 EUR++decimal\-mark . ; The decimal mark used in this file (if ambiguous).++payee Whole Foods ; Declare a valid payee name.++tag trip ; Declare a valid tag name.++P 2024\-03\-01 AAPL $179 ; Declare a market price for AAPL in $ on this date.++include other.journal ; Include another journal file here.++# Declare a recurring \(dqperiodic transaction\(dq, for budget/forecast reports+\(ti monthly set budget goals ; <\- Note, 2+ spaces before the description.+ (expenses:rent) $1000+ (expenses:food) $500++# Declare an auto posting rule, to modify existing transactions in reports+= revenues:consulting+ liabilities:tax:2024:us *0.25 ; Add a tax liability & expense+ expenses:tax:2024:us *\-0.25 ; for 25% of the revenue.++###############################################################################++# 3. Transactions are what it\(aqs all about.+# They are dated events, usually movements of money between 2 or more accounts.+# They begin with a numeric date.+# Here is their basic shape:+#+# DATE DESCRIPTION ; The transaction\(aqs date and optional description.+# ACCOUNT1 AMOUNT ; A posting of an amount to/from this account, indented.+# ACCOUNT2 AMOUNT ; A second posting, balancing the first.+# ... ; More if needed. Amounts must sum to zero.+# ; Note, 2+ spaces between account names and amounts.++2024\-01\-01 opening balances ; At the start, declare pre\-existing balances this way.+ assets:savings $10000 ; Account names can be anything. lower case is easy to type.+ assets:checking $1000 ; assets, liabilities, equity, revenues, expenses are common.+ liabilities:credit card $\-500 ; liabilities, equity, revenues balances are usually negative.+ equity:start ; One amount can be left blank. $\-10500 is inferred here.+ ; Some of these accounts we didn\(aqt declare above,+ ; so \-s/\-\-strict would complain.++2024\-01\-03 ! (12345) pay rent+ ; Additional transaction comment lines, indented.+ ; There can be a ! or * after the date meaning \(dqpending\(dq or \(dqcleared\(dq.+ ; There can be a parenthesised (code) after the date/status.+ ; Amounts\(aq sign shows direction of flow.+ assets:checking $\-500 ; Minus means removed from this account (credit).+ expenses:rent $500 ; Plus means added to this account (debit).++; Keeping transactions in date order is optional (but helps error checking).++2024\-01\-02 Gringott\(aqs Bank | withdrawal ; Description can be PAYEE | NOTE+ assets:bank:gold \-10 gold+ assets:pouch 10 gold++2024\-01\-02 shopping+ expenses:clothing 1 gold+ expenses:wands 5 gold+ assets:pouch \-6 gold++2024\-01\-02 receive gift+ revenues:gifts \-3 \(dqChocolate Frogs\(dq ; Complex commodity symbols+ assets:pouch 3 \(dqChocolate Frogs\(dq ; must be in double quotes.++2024\-01\-15 buy some shares, in two lots ; Cost can be noted.+ assets:investments:2024\-01\-15 2.0 AAAA \(at $1.50 ; \(at means per\-unit cost+ assets:investments:2024\-01\-15\-02 3.0 AAAA \(at\(at $4 ; \(at\(at means total cost+ ; \(ha Per\-lot subaccounts are sometimes useful.+ assets:checking $\-7++2024\-01\-15 assert some account balances on this date+ ; Balances can be asserted in any transaction, with =, for extra error checking.+ ; Assertion txns like this one can be made with hledger close \-\-assert \-\-show\-costs+ ;+ assets:savings $0 = $10000+ assets:checking $0 = $493+ assets:bank:gold 0 gold = \-10 gold+ assets:pouch 0 gold = 4 gold+ assets:pouch 0 \(dqChocolate Frogs\(dq = 3 \(dqChocolate Frogs\(dq+ assets:investments:2024\-01\-15 0.0 AAAA = 2.0 AAAA \(at $1.50+ assets:investments:2024\-01\-15\-02 0.0 AAAA = 3.0 AAAA \(at\(at $4+ liabilities:credit card $0 = $\-500++2024\-02\-01 note some event, or a transaction not yet fully entered, on this date+ ; Postings are not required.++# Consistent YYYY\-MM\-DD date format is recommended,+# but you can use . or / and omit leading zeros if you prefer.+2024.01.01+2024/1/1+.EE+.SS Comments+Lines in the journal will be ignored if they begin with a hash+(\f[CR]#\f[R]) or a semicolon (\f[CR];\f[R]).+(See also Other syntax.)+hledger will also ignore regions beginning with a \f[CR]comment\f[R]+line and ending with an \f[CR]end comment\f[R] line (or file end).+Here\(aqs a suggestion for choosing between them:+.IP \(bu 2+\f[CR]#\f[R] for top\-level notes+.IP \(bu 2+\f[CR];\f[R] for commenting out things temporarily+.IP \(bu 2+\f[CR]comment\f[R] for quickly commenting large regions (remember+it\(aqs there, or you might get confused)+.PP+Eg:+.IP+.EX+# a comment line+; another commentline+comment+A multi\-line comment block,+continuing until \(dqend comment\(dq directive+or the end of the current file.+end comment+.EE+.PP+Some hledger entries can have same\-line comments attached to them, from+; (semicolon) to end of line.+See Transaction comments, Posting comments, and Account comments below.+.SS Transactions+Transactions are the main unit of information in a journal file.+They represent events, typically a movement of some quantity of+commodities between two or more named accounts.+.PP+Each transaction is recorded as a journal entry, beginning with a simple+date in column 0.+This can be followed by any of the following optional fields, separated+by spaces:+.IP \(bu 2+a status character (empty, \f[CR]!\f[R], or \f[CR]*\f[R])+.IP \(bu 2+a code (any short number or text, enclosed in parentheses)+.IP \(bu 2+a description (any remaining text until end of line or a semicolon)+.IP \(bu 2+a comment (any remaining text following a semicolon until end of line,+and any following indented lines beginning with a semicolon)+.IP \(bu 2+0 or more indented \f[I]posting\f[R] lines, describing what was+transferred and the accounts involved (indented comment lines are also+allowed, but not blank lines or non\-indented lines).+.PP+Here\(aqs a simple journal file containing one transaction:+.IP+.EX+2008/01/01 income+ assets:bank:checking $1+ income:salary $\-1+.EE+.SS Dates+.SS Simple dates+Dates in the journal file use \f[I]simple dates\f[R] format:+\f[CR]YYYY\-MM\-DD\f[R] or \f[CR]YYYY/MM/DD\f[R] or+\f[CR]YYYY.MM.DD\f[R], with leading zeros optional.+The year may be omitted, in which case it will be inferred from the+context: the current transaction, the default year set with a+\f[CR]Y\f[R] directive, or the current date when the command is run.+Some examples: \f[CR]2010\-01\-31\f[R], \f[CR]2010/01/31\f[R],+\f[CR]2010.1.31\f[R], \f[CR]1/31\f[R].+.PP+(The UI also accepts simple dates, as well as the more flexible smart+dates documented in the hledger manual.)+.SS Posting dates+You can give individual postings a different date from their parent+transaction, by adding a posting comment containing a tag (see below)+like \f[CR]; date:DATE\f[R].+(There\(aqs also a Ledger\-compatible syntax, \f[CR]; [DATE]\f[R], which+can be convenient.)+.PP+This is probably the best way to control posting dates precisely.+Eg in this example the expense should appear in May reports, and the+deduction from checking should be reported on 6/1 for easy bank+reconciliation:+.IP+.EX+2015/5/30+ expenses:food $10 ; food purchased on saturday 5/30+ assets:checking ; bank cleared it on monday, date:6/1+.EE+.IP+.EX+$ hledger \-f t.j register food+2015\-05\-30 expenses:food $10 $10+.EE+.IP+.EX+$ hledger \-f t.j register checking+2015\-06\-01 assets:checking $\-10 $\-10+.EE+.PP+DATE should be a simple date; if the year is not specified it will use+the year of the transaction\(aqs date.+.PD 0+.P+.PD+The \f[CR]date:\f[R] tag must have a valid simple date value if it is+present, eg a \f[CR]date:\f[R] tag with no value is not allowed.+.SS Status+Transactions (or individual postings within a transaction) can have a+status mark, which is a single character before the transaction+description (or posting account name), separated from it by a space,+indicating one of three statuses:+.PP+.TS+tab(@);+l l.+T{+mark \ +T}@T{+status+T}+_+T{+\ +T}@T{+unmarked+T}+T{+\f[CR]!\f[R]+T}@T{+pending+T}+T{+\f[CR]*\f[R]+T}@T{+cleared+T}+.TE+.PP+When reporting, you can filter by status with the+\f[CR]\-U/\-\-unmarked\f[R], \f[CR]\-P/\-\-pending\f[R], and+\f[CR]\-C/\-\-cleared\f[R] flags (and you can combine these, eg+\f[CR]\-UP\f[R] to match all except cleared things).+Or you can use the \f[CR]status:\f[R], \f[CR]status:!\f[R], and+\f[CR]status:*\f[R] queries, or the U, P, C keys in hledger\-ui.+.PP+(Note: in Ledger the \(dqunmarked\(dq state is called \(dquncleared\(dq;+in hledger we renamed it to \(dqunmarked\(dq for semantic clarity.)+.PP+Status marks are optional, but can be helpful eg for reconciling with+real\-world accounts.+Some editor modes provide highlighting and shortcuts for working with+status.+Eg in Emacs ledger\-mode, you can toggle transaction status with C\-c+C\-e, or posting status with C\-c C\-c.+.PP+What \(dquncleared\(dq, \(dqpending\(dq, and \(dqcleared\(dq actually+mean is up to you.+Here\(aqs one suggestion:+.PP+.TS+tab(@);+lw(9.7n) lw(60.3n).+T{+status+T}@T{+meaning+T}+_+T{+uncleared+T}@T{+recorded but not yet reconciled; needs review+T}+T{+pending+T}@T{+tentatively reconciled (if needed, eg during a big reconciliation)+T}+T{+cleared+T}@T{+complete, reconciled as far as possible, and considered correct+T}+.TE+.PP+With this scheme, you would use \f[CR]\-PC\f[R] to see the current+balance at your bank, \f[CR]\-U\f[R] to see things which will probably+hit your bank soon (like uncashed checks), and no flags to see the most+up\-to\-date state of your finances.+.SS Code+After the status mark, but before the description, you can optionally+write a transaction \(dqcode\(dq, such as a check number or transaction+id, enclosed in parentheses,+.PP+This has a few limitations: The code must not contain a closing+parenthesis (or it will be truncated).+Codes tend to disrupt alignment of the register report, making it harder+to scan visually.+And you can\(aqt store more than one value there per transaction.+For these reasons you might want to avoid the code field and use+tags(#tags] instead.+.SS Description+After the date, status mark and/or code fields, the rest of the line (or+until a comment is begun with \f[CR];\f[R]) is the transaction\(aqs+description.+Here you can describe the transaction (called the \(dqnarration\(dq in+traditional bookkeeping), or you can record a payee/payer name, or you+can leave it empty.+.PP+Transaction descriptions show up in print output and in register+reports, and can be listed with the descriptions command.+.PP+You can query by description with \f[CR]desc:DESCREGEX\f[R], or pivot on+description with \f[CR]\-\-pivot desc\f[R].+.SS Payee and note+Sometimes people want a dedicated payee/payer field that can be queried+and checked more strictly.+If you want that, you can write a \f[CR]|\f[R] (pipe) character in the+description.+This divides it into a \(dqpayee\(dq field on the left, and a+\(dqnote\(dq field on the right.+(Either can be empty.)+.PP+You can query these with \f[CR]payee:PAYEEREGEX\f[R] and+\f[CR]note:NOTEREGEX\f[R], list their values with the payees and notes+commands, or pivot on \f[CR]payee\f[R] or \f[CR]note\f[R].+.PP+Note: in transactions with no \f[CR]|\f[R] character, description,+payee, and note all have the same value.+Once a \f[CR]|\f[R] is added, they become distinct.+(If you\(aqd like to change this behaviour, please propose it on the+mail list.)+.PP+If you want more strict error checking, you can declare the valid payee+names with payee directives, and then enforce these with hledger check+payees.+(Note: because of the above, for this you\(aqll need to ensure every+transaction description contains a \f[CR]|\f[R] and therefore a+checkable payee name, even if it\(aqs empty.)+.SS Transaction comments+Text following \f[CR];\f[R], after a transaction description, and/or on+indented lines immediately below it, form comments for that transaction.+They are reproduced by \f[CR]print\f[R] but otherwise ignored, except+they may contain tags, which are not ignored.+.IP+.EX+2012\-01\-01 something ; a transaction comment+ ; a second line of transaction comment+ expenses 1+ assets+.EE+.SS Postings+A posting is an addition of some amount to, or removal of some amount+from, an account.+Each posting line begins with at least one space or tab (2 or 4 spaces+is common), followed by:+.IP \(bu 2+(optional) a status character (empty, \f[CR]!\f[R], or \f[CR]*\f[R]),+followed by a space+.IP \(bu 2+(required) an account name (any text, optionally including single+spaces.+If anything follows the account name on the same line, the account name+must be ended by \f[B]two or more spaces\f[R].)+.IP \(bu 2+(optional) an amount+.IP \(bu 2+(optional) a same\-line posting comment, beginning with a semicolon+(\f[CR];\f[R]).+.PP+If the amount is positive, it is being added to the account; if+negative, it is being removed from the account.+.PP+The posting amounts in a transaction must sum up to zero, indicating+that the inflows and outflows are equal.+We call this a balanced transaction.+(You can read more about the details of transaction balancing below.)+.PP+If no amount is written, it will be calculated automatically from the+other postings in the transaction, so as to balance the transaction.+In other words, in any transaction you can leave one posting amountless+to save typing.+.SS Debits and credits+The traditional accounting concepts of debit and credit of course exist+in hledger, but we represent them with numeric sign.+Positive and negative posting amounts represent debits and credits+respectively.+.PP+You don\(aqt need to remember that, but if you would like to \- eg for+helping newcomers or for talking with your accountant \- here\(aqs a+handy mnemonic:+.PP+\f[I]\f[CI]debit / plus / left / short words\f[I]\f[R]+.PD 0+.P+.PD+\f[I]\f[CI]credit / minus / right / longer words\f[I]\f[R]+.SS Account names+Accounts are the main way of categorising things in hledger.+As in Double Entry Bookkeeping, they can represent real world accounts+(such as a bank account), or more abstract categories such as \(dqmoney+spent on food\(dq or \(dqmoney borrowed from Frank\(dq.+.PP+Account names are flexible.+They may be capitalised or not; they may contain letters, numbers,+punctuation, symbols, or single spaces; they may be in any language.+.PP+Typically we use the five traditional accounting categories as the+starting point for account names.+In english they are:+.PP+\f[CR]assets\f[R], \f[CR]liabilities\f[R], \f[CR]equity\f[R],+\f[CR]revenues\f[R], \f[CR]expenses\f[R]+.PP+These will be discussed more in Account types below.+In hledger docs you may see them referred to as A, L, E, R, X for short.+.SS Two space delimiter+Note the \f[B]two or more spaces\f[R] delimiter that\(aqs sometimes+required after account names.+\ hledger\(aqs account names, inherited from Ledger, are very+permissive; they may contain pretty much any kind of text, including+single spaces and semicolons.+Because of this, they must be terminated by \f[B]two or more spaces\f[R]+if there is anything following them on the same line.+For example, if an amount, balance assignment, or same\-line comment+follows an account name, they must be preceded by two or more spaces,+else they would be considered part of the account name:+.IP+.EX+bad: assets:accounts receivable $10 ; <\- too close!+good: assets:accounts receivable $10+.EE+.IP+.EX+bad: assets:accounts receivable =$1000 ; <\- too close!+good: assets:accounts receivable =$1000+.EE+.IP+.EX+bad: assets:accounts receivable ; comment. <\- too close!+good: assets:accounts receivable ; comment+.EE+.PP+This two\-space delimiter appears in a few places in hledger, such as+after account names in postings or account directives; also after the+period expression in periodic transaction rules.+When you are starting out, expect it to catch you out at least once.+It\(aqs annoying sometimes, but it lets us use expressive account names+while still keeping the syntax light.+.SS Account hierarchy+For more precise reporting, we usually divide accounts into more+detailed subaccounts, subsubaccounts, and so on, by writing a full colon+between account name parts.+For example, instead of writing \f[CR]assets\f[R] and+\f[CR]expenses\f[R], we might write \f[CR]assets:bank:checking\f[R] and+\f[CR]expenses:food\f[R].+From these names hledger will infer this hierarchy of five accounts:+.IP+.EX+assets+assets:bank+assets:bank:checking+expenses+expenses:food+.EE+.PP+Or as an outline:+.IP+.EX+assets+ bank+ checking+expenses+ food+.EE+.PP+hledger reports can summarise the account tree to any depth, so you can+make your subcategories as detailed as you like.+But don\(aqt go overboard, especially when getting started; simpler+categories can be less work.+.SS Other account name features+Enclosing the account name in parentheses or brackets, like+\f[CR](expenses:food)\f[R], enables a non\-standard bookkeeping feature:+virtual postings.+.PP+Account names can be rewritten and restructured, temporarily or+permanently, by account aliases.+.SS Amounts+After the account name, there is usually an amount.+(Remember: between account name and amount, there must be two or more+spaces.)+.PP+hledger\(aqs amount format is flexible, supporting several international+formats.+Here are some examples.+Amounts have a number (the \(dqquantity\(dq):+.IP+.EX+1+.EE+.PP+\&..and usually a currency symbol or commodity name (more on this+below), to the left or right of the quantity, with or without a+separating space:+.IP+.EX+$1+4000 AAPL+3 \(dqgreen apples\(dq+.EE+.PP+Amounts can be preceded by a minus sign (or a plus sign, though plus is+the default), The sign can be written before or after a left\-side+commodity symbol:+.IP+.EX+\-$1+$\-1+.EE+.PP+One or more spaces between the sign and the number are acceptable when+parsing (but they won\(aqt be displayed in output):+.IP+.EX++ $1+$\- 1+.EE+.PP+Scientific E notation is allowed:+.IP+.EX+1E\-6+EUR 1E3+.EE+.PP+.SS Decimal marks+A \f[I]decimal mark\f[R] can be written as a period or a comma:+.IP+.EX+1.23+1,23+.EE+.PP+Both of these are common in international number formats, so hledger is+not biased towards one or the other.+Because hledger also supports digit group marks (eg thousands+separators), this means that a number like \f[CR]1,000\f[R] or+\f[CR]1.000\f[R] containing just one period or comma is ambiguous.+In such cases, hledger by default assumes it is a decimal mark, and will+parse both of those as 1.+.PP+To help hledger parse such ambiguous numbers more accurately, if you use+digit group marks, we recommend declaring the decimal mark explicitly.+The best way is to add a \f[CR]decimal\-mark\f[R] directive at the top+of each data file, like this:+.IP+.EX+decimal\-mark .+.EE+.PP+Or you can declare it per commodity with \f[CR]commodity\f[R]+directives, described below.+.PP+hledger also accepts numbers like \f[CR]10.\f[R] with no digits after+the decimal mark (and will sometimes display numbers that way to+disambiguate them \- see Trailing decimal marks).+.SS Digit group marks+In the integer part of the amount quantity (left of the decimal mark),+groups of digits can optionally be separated by a \f[I]digit group+mark\f[R] \- a comma or period (whichever is not used as decimal mark),+or a space (several Unicode space variants, like no\-break space, are+also accepted).+\ So these are all valid amounts in a journal file:+.IP+.EX+ $1,000,000.00+ EUR 2.000.000,00+INR 9,99,99,999.00+ 1 000 000.00 ; <\- ordinary space + 1\ 000\ 000.00 ; <\- no\-break space+.EE+.SS Commodity+Amounts in hledger have both a \(dqquantity\(dq, which is a signed+decimal number, and a \(dqcommodity\(dq, which is a currency symbol,+stock ticker, or any word or phrase describing something you are+tracking.+.PP+If the commodity name contains non\-letters (spaces, numbers, or+punctuation), you must always write it inside double quotes+(\f[CR]\(dqgreen apples\(dq\f[R], \f[CR]\(dqABC123\(dq\f[R]).+.PP+If you write just a bare number, that too will have a commodity, with+name \f[CR]\(dq\(dq\f[R]; we call that the \(dqno\-symbol commodity\(dq.+.PP+Actually, hledger combines these single\-commodity amounts into more+powerful multi\-commodity amounts, which are what it works with most of+the time.+A multi\-commodity amount could be, eg:+\f[CR]1 USD, 2 EUR, 3.456 TSLA\f[R].+In practice, you will only see multi\-commodity amounts in hledger\(aqs+output; you can\(aqt write them directly in the journal file.+\+.PP+By default, the format of amounts in the journal influences how hledger+displays them in output.+This is explained in Commodity display style below.+.PP+.SS Costs+In traditional double entry bookkeeping, to record a transaction where+one commodity is exchanged for another, you add extra equity postings to+balance the two commodities.+Eg:+.IP+.EX+2026\-01\-01 buy euros+ assets:dollars $\-123+ equity:conversion $123+ equity:conversion €\-100+ assets:euros €100+.EE+.PP+hledger offers a more convenient \(at/\(at\(at \(dqcost notation\(dq as+an alternative: instead of equity postings, you can write the+\(dqconversion rate\(dq or \(dqtransacted price\(dq after a posting+amount.+hledger docs generically call this \(dqcost\(dq, whether buying or+selling.+It can be written as either \f[CR]\(at UNITPRICE\f[R] or+\f[CR]\(at\(at TOTALPRICE\f[R].+Eg you could write the above as:+.IP+.EX+2026\-01\-01 buy euros+ assets:dollars $\-123+ assets:euros €100 \(at $1.23 ; unit cost (exchange rate)+.EE+.PP+or:+.IP+.EX+2026\-01\-01 buy euros+ assets:dollars $\-123+ assets:euros €100 \(at\(at $123 ; total cost+.EE+.PP+The cost should normally be a positive amount.+Negative costs are supported, but can be confusing, as discussed at+\-\-infer\-market\-prices: market prices from transactions.+.PP+Costs participate in transaction balancing.+Amounts are converted to their cost before checking if the transaction+is balanced.+You could also write the above less redundantly, like so:+.IP+.EX+2026\-01\-01 buy euros+ assets:dollars ; $\-123 is inferred+ assets:euros €100 \(at $1.23+.EE+.PP+or:+.IP+.EX+2026\-01\-01 buy euros+ assets:dollars ; $\-123 is inferred+ assets:euros €100 \(at\(at $123+.EE+.PP+or even:+.IP+.EX+2026\-01\-01 buy euros+ assets:euros €100 ; \(at\(at $123 is inferred+ assets:dollars $\-123+.EE+.PP+This last form works for transactions involving exactly two commodities,+with neither cost notation nor equity postings.+Note, the order of postings is significant: the cost will be attached to+the first (top) posting.+So we had to switch the order of postings, to get the same meaning as+above.+Also, this form is the easiest to make undetected errors with; so it is+rejected by \f[CR]hledger check balanced\f[R], and by strict mode.+.PP+Advantages of cost notation:+.IP "1." 3+it\(aqs more compact and easier to read and write+.IP "2." 3+hledger reports can show such amounts converted to their cost, when you+add the \f[CR]\-B/\-\-cost\f[R] flag (see Cost reporting).+.PP+Advantages of equity postings+.IP "1." 3+they help to keep the accounting equation balanced (if you care about+that)+.IP "2." 3+they translate easily to any other double entry accounting system.+.PP+Most hledger users use cost notation and don\(aqt use equity postings.+.PP+But you can always convert cost notation to equity postings by adding+\f[CR]\-\-infer\-equity\f[R].+Eg try \f[CR]hledger print \-x \-\-infer\-equity\f[R].+.PP+And you can usually convert equity postings to cost notation by adding+\f[CR]\-\-infer\-costs\f[R] (see Requirements for detecting equity+conversion postings).+Eg try \f[CR]hledger print \-x \-\-infer\-costs\f[R].+.PP+Finally: using both equity postings and cost notation at the same time+is allowed, as long as the journal entry is well formed such that the+equity postings / cost equivalences can be detected.+(Otherwise you\(aqll get an error message saying that the transaction is+unbalanced.):+.IP+.EX+2026\-01\-01 buy euros+ assets:dollars $\-123+ equity:conversion $123+ equity:conversion €\-100+ assets:euros €100 \(at $1.23+.EE+.PP+So in principle you could enable both \f[CR]\-\-infer\-equity\f[R] and+\f[CR]\-\-infer\-costs\f[R] in your config file, and your reports would+have the advantages of both.+.SS Cost basis / lot syntax+If you are buying some commodity to hold as an investment, it may be+important to keep track of+.IP "1." 3+its original acquisition cost+.IP "2." 3+its original acquisition date+.IP "3." 3+and a sequence number or label, if needed, to disambiguate multiple+acquisitions on the same day, or to serve as a mnemonic for easy+reference.+.PP+In hledger we call these three the \(dqcost basis\(dq; and if an amount+being acquired has a cost basis, we call it a \(dqlot\(dq.+Tax authorities often require that lots are tracked carefully and+disposed of (sold) in a certain order.+.PP+Note, though \(dqcost basis\(dq sounds similar to the \(dqcost\(dq+(transacted price) discussed above, they are distinct concepts.+In some transactions the transacted price and basis cost are the same,+but in others they are not.+.PP+So cost basis has its own syntax, also called \(dqlot syntax\(dq.+hledger\(aqs lot syntax is like Ledger\(aqs: one or more of the+following annotations, following the main amount:+.IP \(bu 2+\f[CR]{LOTUNITCOST}\f[R] or \f[CR]{{LOTTOTALCOST}}\f[R] (see lot price)+.IP \(bu 2+\f[CR][LOTDATE]\f[R] (see lot date)+.IP \(bu 2+\f[CR](LOTLABEL)\f[R] (see lot note)+.PP+hledger does not yet do anything with this lot syntax, except to+preserve it and show it in \f[CR]print\f[R]\(aqs \f[CR]txt\f[R],+\f[CR]beancount\f[R], and \f[CR]json\f[R] output.+This means you can use this syntax in your hledger journals (plus an+amountless extra posting to help transactions balance, if needed), then+use the \f[CR]print\f[R] command to export to Ledger or Beancount or+rustledger, to use their lots/gains reports (see Export Lots workflow).+.SS Balance assertions+hledger supports Ledger\-style balance assertions in journal files.+These look like, for example, \f[CR]= EXPECTEDBALANCE\f[R] following a+posting\(aqs amount.+Eg here we assert the expected dollar balance in accounts a and b after+each posting:+.IP+.EX+2013/1/1+ a $1 = $1+ b = $\-1++2013/1/2+ a $1 = $2+ b $\-1 = $\-2+.EE+.PP+After reading a journal file, hledger will check all balance assertions+and report an error if any of them fail.+Balance assertions can protect you from, eg, inadvertently disrupting+reconciled balances while cleaning up old entries.+You can disable them temporarily with the+\f[CR]\-I/\-\-ignore\-assertions\f[R] flag, which can be useful for+troubleshooting or for reading Ledger files.+(Note: this flag currently does not disable balance assignments,+described below).+.SS Assertions and ordering+hledger calculates and checks an account\(aqs balance assertions in date+order (and when there are multiple assertions on the same day, in parse+order).+Note this is different from Ledger, which checks assertions always in+parse order, ignoring dates.+.PP+This means in hledger you can freely reorder transactions, postings, or+files, and balance assertions will usually keep working.+The exception is when you reorder multiple postings on the same day, to+the same account, which have balance assertions; those will likely need+updating.+.SS Assertions and multiple files+If an account has transactions appearing in multiple files, balance+assertions can still work \- but \f[I]only if those files are part of a+hierarchy made by include directives\f[R].+.PP+If the same files are specified with two \f[CR]\-f\f[R] options on the+command line, the assertions in the second will not see the balances+from the first.+.PP+To work around this, arrange your files in a hierarchy with+\f[CR]include\f[R].+Or, you could concatenate the files temporarily, and process them like+one big file.+.PP+Why does it work this way ?+It might be related to hledger\(aqs goal of stable predictable reports.+File hierarchy is considered \(dqpermanent\(dq, part of your data, while+the order of command line options/arguments is not.+We don\(aqt want transient changes to be able to change the meaning of+the data.+Eg it would be frustrating if tomorrow all your balance assertions broke+because you wrote command line arguments in a different order.+(Discussion welcome.)+.SS Assertions and costs+Balance assertions ignore costs, and should normally be written without+one:+.IP+.EX+2019/1/1+ (a) $1 \(at €1 = $1+.EE+.PP+We do allow costs to be written in balance assertion amounts, however,+and print shows them, but they don\(aqt affect whether the assertion+passes or fails.+This is for backward compatibility (hledger\(aqs close command used to+generate balance assertions with costs), and because balance+\f[I]assignments\f[R] do use costs (see below).+.SS Assertions and commodities+The balance assertions described so far are \(dq\f[B]single commodity+balance assertions\f[R]\(dq: they assert and check the balance in one+commodity, ignoring any others that may be present.+This is how balance assertions work in Ledger also.+.PP+If an account contains multiple commodities, you can assert their+balances by writing multiple postings with balance assertions, one for+each commodity:+.IP+.EX+2013/1/1+ usd $\-1+ eur €\-1+ both++2013/1/2+ both 0 = $1+ both 0 = €1+.EE+.PP+In hledger you can make a stronger \(dq\f[B]sole commodity balance+assertion\f[R]\(dq by writing two equals signs+(\f[CR]== EXPECTEDBALANCE\f[R]).+This also asserts that there are no other commodities in the account+besides the asserted one (or at least, that their current balance is+zero):+.IP+.EX+2013/1/1+ usd $\-1 == $\-1 ; these sole commodity assertions succeed+ eur €\-1 == €\-1+ both ;== $1 ; this one would fail because \(aqboth\(aq contains $ and €+.EE+.PP+It\(aqs less easy to make a \(dq\f[B]sole commodities balance+assertion\f[R]\(dq (note the plural) \- ie, asserting that an account+contains two or more specified commodities and no others.+It can be done by+.IP "1." 3+isolating each commodity in a subaccount, and asserting those+.IP "2." 3+and also asserting there are no commodities in the parent account+itself:+.IP+.EX+2013/1/1+ usd $\-1+ eur €\-1+ both 0 == 0 ; nothing up my sleeve+ both:usd $1 == $1 ; a dollar here+ both:eur €1 == €1 ; a euro there+.EE+.SS Assertions and subaccounts+All of the balance assertions above (both \f[CR]=\f[R] and+\f[CR]==\f[R]) are \(dq\f[B]subaccount\-exclusive balance+assertions\f[R]\(dq; they ignore any balances that exist in deeper+subaccounts.+.PP+In hledger you can make \(dq\f[B]subaccount\-inclusive balance+assertions\f[R]\(dq by adding a star after the equals (\f[CR]=*\f[R] or+\f[CR]==*\f[R]):+.IP+.EX+2019/1/1+ equity:start+ assets:checking $10+ assets:savings $10+ assets $0 ==* $20 ; assets + subaccounts contains $20 and nothing else+.EE+.SS Assertions and status+Balance assertions always consider postings of all statuses (unmarked,+pending, or cleared); they are not affected by the+\f[CR]\-U\f[R]/\f[CR]\-\-unmarked\f[R] /+\f[CR]\-P\f[R]/\f[CR]\-\-pending\f[R] /+\f[CR]\-C\f[R]/\f[CR]\-\-cleared\f[R] flags or the \f[CR]status:\f[R]+query.+.SS Assertions and virtual postings+Balance assertions always consider both real and virtual postings; they+are not affected by the \f[CR]\-\-real/\-R\f[R] flag or \f[CR]real:\f[R]+query.+.SS Assertions and auto postings+Balance assertions \f[I]are\f[R] affected by the \f[CR]\-\-auto\f[R]+flag, which generates auto postings, which can alter account balances.+Because auto postings are optional in hledger, accounts affected by them+effectively have two balances.+But balance assertions can only test one or the other of these.+So to avoid making fragile assertions, either:+.IP \(bu 2+assert the balance calculated with \f[CR]\-\-auto\f[R], and always use+\f[CR]\-\-auto\f[R] with that file+.IP \(bu 2+or assert the balance calculated without \f[CR]\-\-auto\f[R], and never+use \f[CR]\-\-auto\f[R] with that file+.IP \(bu 2+or avoid balance assertions on accounts affected by auto postings (or+avoid auto postings entirely).+.SS Assertions and precision+Balance assertions compare the exactly calculated amounts, which are not+always what is shown by reports.+Eg a commodity directive may limit the display precision, but this will+not affect balance assertions.+Balance assertion failure messages show exact amounts.+.SS Assertions and hledger add+Balance assertions can be included in the amounts given in+\f[CR]add\f[R].+All types of assertions are supported, and assertions can be used as in+a normal journal file.+.PP+All transactions, not just those that have an explicit assertion, are+validated against the existing assertions in the journal.+This means it is possible for an added transaction to fail even if its+assertions are correct as of the transaction date.+.PP+If this assertion checking is not desired, then it can be disabled with+\f[CR]\-I\f[R].+.PP+However, balance assignments are currently not supported.+.SS Posting comments+Text following \f[CR];\f[R], at the end of a posting line, and/or on+indented lines immediately below it, form comments for that posting.+They are reproduced by \f[CR]print\f[R] but otherwise ignored, except+they may contain tags, which are not ignored.+.IP+.EX+2012\-01\-01+ expenses 1 ; a comment for posting 1+ assets+ ; a comment for posting 2+ ; a second comment line for posting 2+.EE+.SS Transaction balancing+How exactly does hledger decide when a transaction is balanced ?+Especially when it involves costs, which often are not exact, because of+repeating decimals, or imperfect data from financial institutions ?+In each commodity, hledger sums the transaction\(aqs posting amounts,+after converting any with costs; then it checks if that sum is zero,+when rounded to a suitable number of decimal digits \- which we call the+\f[I]balancing precision\f[R].+.PP+Since version 1.50, hledger infers balancing precision in each+transaction from the amounts in that transaction\(aqs journal entry+(like Ledger).+Ie, when checking the balance of commodity A, it uses the highest+decimal precision seen for A in the journal entry (excluding cost+amounts).+This makes transaction balancing robust; any imbalances must be visibly+accounted for in the journal entry, display precision can be freely+increased with \f[CR]\-c\f[R], and compatibility with Ledger and+Beancount journals is good.+.PP+Note that hledger versions before 1.50 worked differently: they allowed+display precision to override the balancing precision.+This masked small imbalances and caused fragility (see issue #2402).+As a result, some journal entries (or CSV rules) that worked with+hledger <1.50, are now rejected with an \(dqunbalanced transaction\(dq+error.+If you hit this problem, it\(aqs easy to fix:+.IP \(bu 2+You can restore the old behaviour, by adding+\f[CR]\-\-txn\-balancing=old\f[R] to the command or to your+\f[CR]\(ti/.hledger.conf\f[R] file.+This lets you keep using old journals unchanged, though without the+above benefits.+.IP \(bu 2+Or you can fix the problem entries (recommended).+There are three ways, use whichever seems best:+.RS 2+.IP "1." 3+make cost amounts more precise (add more/better decimal digits)+.IP "2." 3+or make non\-cost amounts less precise (remove unnecessary decimal+digits that are raising the precision)+.IP "3." 3+or add a posting to absorb the imbalance (eg \(dqexpenses:rounding\(dq.+Remember that one posting may omit the amount; that\(aqs convenient+here.)+.RE+.SS Tags+Tags are a way to add extra labels or data fields to transactions,+postings, or accounts, which you can match with a \f[CR]tag:\f[R] query+in reports.+(See queries below.)+.PP+Tags are a single word or hyphenated word, immediately followed by a+full colon, written within a comment.+(Yes, storing data in comments is slightly weird.)+Here\(aqs a transaction with a tag:+.IP+.EX+2025\-01\-01 groceries ; some\-tag:+ assets:checking+ expenses:food $1+.EE+.PP+A tag can have a value, a single line of text written after the colon.+Tag values can\(aqt contain newlines.:+.IP+.EX+2025\-01\-01 groceries ; tag1: this is tag1\(aqs value+.EE+.PP+Multiple tags can be separated by comma.+Tag values can\(aqt contain commas.:+.IP+.EX+2025\-01\-01 groceries ; tag1:value 1, tag2:value 2, comment text+.EE+.PP+A tag can have multiple values:+.IP+.EX+2025\-01\-01 groceries ; tag1:value 1, tag1:value 2+.EE+.PP+You can write each tag on its own line of you prefer (but they still+can\(aqt contain commas):+.IP+.EX+2025\-01\-01 groceries+ ; tag1: value 1+ ; tag2: value 2+.EE+.PP+Tags can be attached to individual postings, rather than the overall+transaction:+.IP+.EX+2025\-01\-01 rent+ assets:checking+ expenses:rent $1000 ; postingtag:+.EE+.PP+Tags can be attached to accounts, in their account directive:+.IP+.EX+account assets:checking ; acct\-number: 123\-45\-6789+.EE+.SS Tag propagation+In addition to what they are attached to, tags also affect related data+in a few ways, allowing more powerful queries:+.IP "1." 3+Accounts \-> postings.+Postings inherit tags from their account.+.IP "2." 3+Transactions \-> postings.+Postings inherit tags from their transaction.+.IP "3." 3+Postings \-> transactions.+Transactions also acquire the tags of their postings.+\ +.PP+So when you use a \f[CR]tag:\f[R] query to match whole transactions,+individual postings, or accounts, it\(aqs good to understand how tags+behave.+Here\(aqs an example showing all three kinds of propagation:+.IP+.EX+account assets:checking+account expenses:food ; atag:++2025\-01\-01 groceries ; ttag:+ assets:checking ; p1tag:+ expenses:food $1 ; p2tag:+.EE+.PP+.TS+tab(@);+lw(13.3n) lw(13.8n) lw(43.0n).+T{+data part+T}@T{+has tags+T}@T{+explanation+T}+_+T{+assets:checking\ account+T}@T{+T}@T{+no tags attached+T}+T{+expenses:food account+T}@T{+atag+T}@T{+atag: in comment+T}+T{+assets:checking posting+T}@T{+p1tag, ttag+T}@T{+p1tag: in comment, ttag acquired from transaction+T}+T{+expenses:food posting+T}@T{+p2tag, atag, ttag+T}@T{+p2tag: in comment, atag from account, ttag from transaction+T}+T{+groceries transaction+T}@T{+ttag, p1tag, p2tag, atag+T}@T{+ttag: in comment, p1tag from first posting, p2tag and atag from second+posting+T}+.TE+.SS Displaying tags+You can use the \f[CR]tags\f[R] command to list tag names or values.+.PP+The \f[CR]print\f[R] command also shows tags.+.PP+You can use \-\-pivot to display tag values in other reports, in various+ways (eg appended to account names, like pseudo subaccounts).+.SS When to use tags ?+Tags provide more dimensions of categorisation, complementing accounts+and transaction descriptions.+When to use each of these is somewhat a matter of taste.+Accounts have the most built\-in support, and regex queries on+descriptions are also quite powerful.+So you may not need tags at all.+But if you want to track multiple cross\-cutting categories, they can be+a good fit.+For example, you could tag trip\-related transactions with+\f[CR]trip: YEAR:PLACE\f[R], without disturbing your usual account+categories.+.SS Tag names+What is allowed in a tag name ?+Most non\-whitespace characters.+Eg \f[CR]😀:\f[R] is a valid tag.+.PP+For extra error checking, you can declare valid tag names with the+\f[CR]tag\f[R] directive, and then enforce these with the+\f[CR]check\f[R] command.+But note that tags are detected quite loosely at present, sometimes+where you didn\(aqt intend them.+Eg a comment like \f[CR]; see https://foo.com\f[R] adds a+\f[CR]https\f[R] tag.+.PP+There are several tag names which have special significance to hledger.+They are explained elsewhere, but here\(aqs a quick reference:+.IP+.EX+ type \-\- declares an account\(aqs type+ date \-\- overrides a posting\(aqs date+ date2 \-\- overrides a posting\(aqs secondary date+ assert \-\- appears on txns generated by close \-\-assert+ retain \-\- appears on txns generated by close \-\-retain+ start \-\- appears on txns generated by close \-\-migrate/\-\-close/\-\-open/\-\-assign+ t \-\- appears on postings generated from timedot letters++ generated\-transaction \-\- appears on txns generated by a periodic rule+ modified\-transaction \-\- appears on txns which have had auto postings added+ generated\-posting \-\- appears on generated postings+ cost\-posting \-\- appears on postings which have (or could have) a cost,+ and which have equivalent conversion postings in the transaction+ conversion\-posting \-\- appears on postings which are to a V/Conversion account+ and which have an equivalent cost posting in the transaction+.EE+.PP+The second group above (generated\-transaction, etc.)+are normally hidden, with a \f[CR]_\f[R] prefix added.+This means \f[CR]print\f[R] doesn\(aqt show them by default; but you can+still use them in queries.+You can add the \f[CR]\-\-verbose\-tags\f[R] flag to make them visible+in \f[CR]print\f[R] output, which can be useful for troubleshooting.+.SS Directives+Besides transactions, there is something else you can put in a+\f[CR]journal\f[R] file: directives.+These are declarations, beginning with a keyword, that modify+hledger\(aqs behaviour.+Some directives can have more specific subdirectives, indented below+them.+hledger\(aqs directives are similar to Ledger\(aqs in many cases, but+there are also many differences.+Directives are not required, but can be useful.+Here are the main directives:+.PP+.TS+tab(@);+lw(39.7n) lw(30.3n).+T{+purpose+T}@T{+directive+T}+_+T{+\f[B]READING DATA:\f[R]+T}@T{+T}+T{+Rewrite account names+T}@T{+\f[CR]alias\f[R]+T}+T{+Comment out sections of the file+T}@T{+\f[CR]comment\f[R]+T}+T{+Declare file\(aqs decimal mark, to help parse amounts accurately+T}@T{+\f[CR]decimal\-mark\f[R]+T}+T{+Include other data files+T}@T{+\f[CR]include\f[R]+T}+T{+\f[B]GENERATING DATA:\f[R]+T}@T{+T}+T{+Generate recurring transactions or budget goals+T}@T{+\f[CR]\(ti\f[R]+T}+T{+Generate extra postings on existing transactions+T}@T{+\f[CR]=\f[R]+T}+T{+\f[B]CHECKING FOR ERRORS:\f[R]+T}@T{+T}+T{+Define valid entities to provide more error checking+T}@T{+\f[CR]account\f[R], \f[CR]commodity\f[R], \f[CR]payee\f[R],+\f[CR]tag\f[R]+T}+T{+\f[B]REPORTING:\f[R]+T}@T{+T}+T{+Declare accounts\(aq type and display order+T}@T{+\f[CR]account\f[R]+T}+T{+Declare commodity display styles+T}@T{+\f[CR]commodity\f[R]+T}+T{+Declare market prices+T}@T{+\f[CR]P\f[R]+T}+.TE+.SS Directives and multiple files+Directives vary in their scope, ie which journal entries and which input+files they affect.+Most often, a directive will affect the following entries and included+files if any, until the end of the current file \- and no further.+You might find this inconvenient!+For example, \f[CR]alias\f[R] directives do not affect parent or sibling+files.+But there are usually workarounds; for example, put \f[CR]alias\f[R]+directives in your top\-most file, before including other files.+.PP+The restriction, though it may be annoying at first, is in a good cause;+it allows reports to be stable and deterministic, independent of the+order of input.+Without it, reports could show different numbers depending on the order+of \-f options, or the positions of include directives in your files.+.SS Directive effects+Here are all hledger\(aqs directives, with their effects and scope+summarised \- nine main directives, plus four others which we consider+non\-essential:+.PP+.TS+tab(@);+lw(3.5n) lw(64.1n) lw(2.4n).+T{+directive+T}@T{+what it does+T}@T{+ends at file end?+T}+_+T{+\f[B]\f[CB]account\f[B]\f[R]+T}@T{+Declares an account, for checking all entries in all files; and its+display order and type.+Subdirectives: any text, ignored.+T}@T{+N+T}+T{+\f[B]\f[CB]alias\f[B]\f[R]+T}@T{+Rewrites account names, in following entries until end of current file+or \f[CR]end aliases\f[R].+Command line equivalent: \f[CR]\-\-alias\f[R]+T}@T{+Y+T}+T{+\f[B]\f[CB]comment\f[B]\f[R]+T}@T{+Ignores part of the journal file, until end of current file or+\f[CR]end comment\f[R].+T}@T{+Y+T}+T{+\f[B]\f[CB]commodity\f[B]\f[R]+T}@T{+Declares up to four things: 1.+a commodity symbol, for checking all amounts in all files 2.+the display style for all amounts of this commodity 3.+the decimal mark for parsing amounts of this commodity, in the rest of+this file and its children, if there is no \f[CR]decimal\-mark\f[R]+directive 4.+the precision to use for balanced\-transaction checking in this+commodity, in this file and its children.+\ Takes precedence over \f[CR]D\f[R].+Subdirectives: \f[CR]format\f[R] (ignored).+Command line equivalent: \f[CR]\-c/\-\-commodity\-style\f[R]+T}@T{+N,N,Y,Y+T}+T{+\f[B]\f[CB]decimal\-mark\f[B]\f[R]+T}@T{+Declares the decimal mark, for parsing amounts of all commodities in+following entries until next \f[CR]decimal\-mark\f[R] or end of current+file.+Included files can override.+Takes precedence over \f[CR]commodity\f[R] and \f[CR]D\f[R].+T}@T{+Y+T}+T{+\f[B]\f[CB]include\f[B]\f[R]+T}@T{+Includes entries and directives from another file, as if they were+written inline.+Command line alternative: multiple \f[CR]\-f/\-\-file\f[R]+T}@T{+N+T}+T{+\f[B]\f[CB]payee\f[B]\f[R]+T}@T{+Declares a payee name, for checking all entries in all files.+T}@T{+N+T}+T{+\f[B]\f[CB]P\f[B]\f[R]+T}@T{+Declares the market price of a commodity on some date, for value+reports.+T}@T{+N+T}+T{+\f[B]\f[CB]\(ti\f[B]\f[R] (tilde)+T}@T{+Declares a periodic transaction rule that generates future transactions+with \f[CR]\-\-forecast\f[R] and budget goals with+\f[CR]balance \-\-budget\f[R].+T}@T{+N+T}+T{+Other syntax:+T}@T{+T}@T{+T}+T{+\f[B]\f[CB]apply account\f[B]\f[R]+T}@T{+Prepends a common parent account to all account names, in following+entries until end of current file or \f[CR]end apply account\f[R].+T}@T{+Y+T}+T{+\f[B]\f[CB]D\f[B]\f[R]+T}@T{+Sets a default commodity to use for no\-symbol amounts;and, if there is+no \f[CR]commodity\f[R] directive for this commodity: its decimal mark,+balancing precision, and display style, as above.+T}@T{+Y,Y,N,N+T}+T{+\f[B]\f[CB]Y\f[B]\f[R]+T}@T{+Sets a default year to use for any yearless dates, in following entries+until end of current file.+T}@T{+Y+T}+T{+\f[B]\f[CB]=\f[B]\f[R] (equals)+T}@T{+Declares an auto posting rule that generates extra postings on matched+transactions with \f[CR]\-\-auto\f[R], in current, parent, and child+files (but not sibling files, see #1212).+T}@T{+partly+T}+T{+\f[B]Other Ledger directives\f[R]+T}@T{+Other directives from Ledger\(aqs file format are accepted but ignored.+T}@T{+T}+.TE+.SS \f[CR]account\f[R] directive+\f[CR]account\f[R] directives can be used to declare accounts (ie, the+places that amounts are transferred from and to).+Though not required, these declarations can provide several benefits:+.IP \(bu 2+They can document your intended chart of accounts, providing a+reference.+.IP \(bu 2+They can store additional account information as comments, or as tags+which can be used to filter or pivot reports.+.IP \(bu 2+They can restrict which accounts may be posted to by transactions, eg in+strict mode, which helps prevent errors.+.IP \(bu 2+They influence account display order in reports, allowing+non\-alphabetic sorting (eg Revenues to appear above Expenses).+.IP \(bu 2+They can help hledger know your accounts\(aq types (asset, liability,+equity, revenue, expense), enabling reports like balancesheet and+incomestatement.+.IP \(bu 2+They help with account name completion (in hledger add, hledger\-web,+hledger\-iadd, ledger\-mode, etc.)+.PP+They are written as the word \f[CR]account\f[R] followed by a+hledger\-style account name.+Eg:+.IP+.EX+account assets:bank:checking+.EE+.PP+Ledger\-style indented subdirectives are also accepted, but ignored:+.IP+.EX+account assets:bank:checking+ format subdirective ; currently ignored+.EE+.SS Account comments+Text following \f[B]two or more spaces\f[R] and \f[CR];\f[R] at the end+of an account directive line, and/or following \f[CR];\f[R] on indented+lines immediately below it, form comments for that account.+.PP+Same\-line account comments require two+ spaces before \f[CR];\f[R]+because that character can appear in account names.+.IP+.EX+account assets:bank:checking ; same\-line comment, at least 2 spaces before the semicolon+ ; next\-line comment+ ; some tags \- type:A, acctnum:12345+.EE+.SS Account tags+An account directive\(aqs comment may contain tags.+These will be propagated to all postings using that account, as hidden+but queryable posting tags, except where the posting already a tag of+the same name.+(Posting tags override account tags.)+.SS Account error checking+By default, accounts need not be declared; they come into existence when+a posting references them.+This is convenient, but it means hledger can\(aqt warn you when you+mis\-spell an account name in the journal.+Usually you\(aqll find that error later, as an extra account in balance+reports, or an incorrect balance when reconciling.+.PP+In strict mode, enabled with the \f[CR]\-s\f[R]/\f[CR]\-\-strict\f[R]+flag, or when you run \f[CR]hledger check accounts\f[R], hledger will+report an error if any transaction uses an account name that has not+been declared by an account directive.+Some notes:+.IP \(bu 2+The declaration is case\-sensitive; transactions must use the correct+account name capitalisation.+.IP \(bu 2+The account directive\(aqs scope is \(dqwhole file and below\(dq (see+directives).+This means it affects all of the current file, and any files it+includes, but not parent or sibling files.+The position of account directives within the file does not matter,+though it\(aqs usual to put them at the top.+.IP \(bu 2+Accounts can only be declared in \f[CR]journal\f[R] files, but will+affect included files of all types.+.IP \(bu 2+It\(aqs currently not possible to declare \(dqall possible+subaccounts\(dq with a wildcard; every account posted to must be+declared.+.IP \(bu 2+If you use the \-\-infer\-equity flag, you will also need declarations+for the account names it generates.+.SS Account display order+Account directives also cause hledger to display accounts in a+particular order, not just alphabetically.+Eg, here is a conventional ordering for the top\-level accounts:+.IP+.EX+account assets+account liabilities+account equity+account revenues+account expenses+.EE+.PP+Now hledger displays them in that order:+.IP+.EX+$ hledger accounts+assets+liabilities+equity+revenues+expenses+.EE+.PP+If there are undeclared accounts, those will be displayed last, in+alphabetical order.+.PP+Sorting is done within each group of sibling accounts, at each level of+the account tree.+Eg, a declaration like \f[CR]account parent:child\f[R] influences+\f[CR]child\f[R]\(aqs position among its siblings.+.PP+Note, it does not affect \f[CR]parent\f[R]\(aqs position; for that, you+need an \f[CR]account parent\f[R] declaration.+.PP+Sibling accounts are always displayed together; hledger won\(aqt display+\f[CR]x:y\f[R] in between \f[CR]a:b\f[R] and \f[CR]a:c\f[R].+.PP+An account directive both declares an account as a valid posting target,+and declares its display order; you can\(aqt easily do one without the+other.+.SS Account types+hledger knows that in accounting there are three main account types:+.PP+.TS+tab(@);+l l l.+T{+\f[CR]Asset\f[R]+T}@T{+\f[CR]A\f[R]+T}@T{+things you own+T}+T{+\f[CR]Liability\f[R]+T}@T{+\f[CR]L\f[R]+T}@T{+things you owe+T}+T{+\f[CR]Equity\f[R]+T}@T{+\f[CR]E\f[R]+T}@T{+owner\(aqs investment, balances the two above+T}+.TE+.PP+and two more representing changes in these:+.PP+.TS+tab(@);+l l l.+T{+\f[CR]Revenue\f[R]+T}@T{+\f[CR]R\f[R]+T}@T{+inflows (also known as \f[CR]Income\f[R])+T}+T{+\f[CR]Expense\f[R]+T}@T{+\f[CR]X\f[R]+T}@T{+outflows+T}+.TE+.PP+hledger also uses a few subtypes:+.PP+.TS+tab(@);+lw(23.3n) lw(23.3n) lw(23.3n).+T{+\f[CR]Cash\f[R]+T}@T{+\f[CR]C\f[R]+T}@T{+liquid assets (subtype of Asset)+T}+T{+\f[CR]Conversion\f[R]+T}@T{+\f[CR]V\f[R]+T}@T{+commodity conversions equity (subtype of Equity)+T}+T{+\f[CR]Gain\f[R]+T}@T{+\f[CR]G\f[R]+T}@T{+capital gains/losses (subtype of Revenue)+T}+.TE+.PP+As a convenience, hledger will detect most of these types automatically+from english account names.+But it\(aqs better to declare them explicitly by adding a+\f[CR]type:\f[R] tag in the account directives.+The tag\(aqs value can be any of the types or one\-letter abbreviations+above.+.PP+Here is a typical set of account type declarations.+Subaccounts will inherit their parent\(aqs type, or can override it:+.IP+.EX+account assets ; type: A+account liabilities ; type: L+account equity ; type: E+account revenues ; type: R+account expenses ; type: X++account assets:bank ; type: C+account assets:cash ; type: C++account equity:conversion ; type: V++account revenues:capital ; type: G+.EE+.PP+This enables the easy balancesheet, balancesheetequity, cashflow and+incomestatement reports, and querying by type:.+.PP+Tips:+.IP \(bu 2+You can list accounts and their types, for troubleshooting:+.RS 2+.IP+.EX+$ hledger accounts \-\-types [ACCTPAT] [type:TYPECODES] [\-DEPTH] [\-\-locations]+.EE+.RE+.IP \(bu 2+It\(aqs a good idea to declare at least one account for each account+type.+Having some types declared and some inferred can disrupt certain+reports.+.IP \(bu 2+The rules for inferring types from account names are as follows (using+Regular expressions).+.PD 0+.P+.PD+If they don\(aqt work for you, just ignore them and declare your types+with \f[CR]type:\f[R] tags.+.RS 2+.IP+.EX+If account\(aqs name contains this case insensitive regular expression | its type is+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-|\-\-\-\-\-\-\-\-\-\-\-\-\-+\(haassets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|current)(:|$) | Cash+\(haassets?(:|$) | Asset+\(ha(debts?|liabilit(y|ies))(:|$) | Liability+\(haequity:(trad(e|ing)|conversion)s?(:|$) | Conversion+\(haequity(:|$) | Equity+\(ha(income|revenue)s?(:|$) | Revenue+\(haexpenses?(:|$) | Expense+.EE+.RE+.IP \(bu 2+As mentioned above, subaccounts will inherit a type from their parent+account.+To be precise, an account\(aqs type is decided by the first of these+that exists:+.RS 2+.IP "1." 3+A \f[CR]type:\f[R] declaration for this account.+.IP "2." 3+A \f[CR]type:\f[R] declaration in the parent accounts above it,+preferring the nearest.+.IP "3." 3+An account type inferred from this account\(aqs name.+.IP "4." 3+An account type inferred from a parent account\(aqs name, preferring the+nearest parent.+.IP "5." 3+Otherwise, it will have no type.+.RE+.IP \(bu 2+Account aliases can disrupt account types.+.SS \f[CR]alias\f[R] directive+You can define account alias rules which rewrite your account names, or+parts of them, before generating reports.+This can be useful for:+.IP \(bu 2+expanding shorthand account names to their full form, allowing easier+data entry and a less verbose journal+.IP \(bu 2+adapting old journals to your current chart of accounts+.IP \(bu 2+experimenting with new account organisations, like a new hierarchy+.IP \(bu 2+combining two accounts into one, eg to see their sum or difference on+one line+.IP \(bu 2+customising reports+.PP+Account aliases also rewrite account names in account directives.+They do not affect account names being entered via hledger add or+hledger\-web.+.PP+Account aliases are very powerful.+They are generally easy to use correctly, but you can also generate+invalid account names with them; more on this below.+.PP+See also Rewrite account names.+.SS Basic aliases+To set an account alias, use the \f[CR]alias\f[R] directive in your+journal file.+This affects all subsequent journal entries in the current file or its+included files (but note: not sibling or parent files).+The spaces around the = are optional:+.IP+.EX+alias OLD = NEW+.EE+.PP+Or, you can use the \f[CR]\-\-alias \(aqOLD=NEW\(aq\f[R] option on the+command line.+This affects all entries.+It\(aqs useful for trying out aliases interactively.+.PP+OLD and NEW are case sensitive full account names.+hledger will replace any occurrence of the old account name with the new+one.+Subaccounts are also affected.+Eg:+.IP+.EX+alias checking = assets:bank:wells fargo:checking+; rewrites \(dqchecking\(dq to \(dqassets:bank:wells fargo:checking\(dq, or \(dqchecking:a\(dq to \(dqassets:bank:wells fargo:checking:a\(dq+.EE+.SS Regex aliases+There is also a more powerful variant that uses a regular expression,+indicated by wrapping the pattern in forward slashes.+(This is the only place where hledger requires forward slashes around a+regular expression.)+.PP+Eg:+.IP+.EX+alias /REGEX/ = REPLACEMENT+.EE+.PP+or:+.IP+.EX+$ hledger \-\-alias \(aq/REGEX/=REPLACEMENT\(aq ...+.EE+.PP+Any part of an account name matched by REGEX will be replaced by+REPLACEMENT.+REGEX is case\-insensitive as usual.+.PP+If you need to match a forward slash, escape it with a backslash, eg+\f[CR]/\(rs/=:\f[R].+.PP+If REGEX contains parenthesised match groups, these can be referenced by+the usual backslash and number in REPLACEMENT:+.IP+.EX+alias /\(ha(.+):bank:([\(ha:]+):(.*)/ = \(rs1:\(rs2 \(rs3+; rewrites \(dqassets:bank:wells fargo:checking\(dq to \(dqassets:wells fargo checking\(dq+.EE+.PP+REPLACEMENT continues to the end of line (or on command line, to end of+option argument), so it can contain trailing whitespace.+.SS Combining aliases+You can define as many aliases as you like, using journal directives+and/or command line options.+.PP+Recursive aliases \- where an account name is rewritten by one alias,+then by another alias, and so on \- are allowed.+Each alias sees the effect of previously applied aliases.+.PP+In such cases it can be important to understand which aliases will be+applied and in which order.+For (each account name in) each journal entry, we apply:+.IP "1." 3+\f[CR]alias\f[R] directives preceding the journal entry, most recently+parsed first (ie, reading upward from the journal entry, bottom to top)+.IP "2." 3+\f[CR]\-\-alias\f[R] options, in the order they appeared on the command+line (left to right).+.PP+In other words, for (an account name in) a given journal entry:+.IP \(bu 2+the nearest alias declaration before/above the entry is applied first+.IP \(bu 2+the next alias before/above that will be be applied next, and so on+.IP \(bu 2+aliases defined after/below the entry do not affect it.+.PP+This gives nearby aliases precedence over distant ones, and helps+provide semantic stability \- aliases will keep working the same way+independent of which files are being read and in which order.+.PP+In case of trouble, adding \f[CR]\-\-debug=6\f[R] to the command line+will show which aliases are being applied when.+.SS Aliases and multiple files+As explained at Directives and multiple files, \f[CR]alias\f[R]+directives do not affect parent or sibling files.+Eg in this command,+.IP+.EX+hledger \-f a.aliases \-f b.journal+.EE+.PP+account aliases defined in a.aliases will not affect b.journal.+Including the aliases doesn\(aqt work either:+.IP+.EX+include a.aliases++2023\-01\-01 ; not affected by a.aliases+ foo 1+ bar+.EE+.PP+This means that account aliases should usually be declared at the start+of your top\-most file, like this:+.IP+.EX+alias foo=Foo+alias bar=Bar++2023\-01\-01 ; affected by aliases above+ foo 1+ bar++include c.journal ; also affected+.EE+.SS \f[CR]end aliases\f[R] directive+You can clear (forget) all currently defined aliases (seen in the+journal so far, or defined on the command line) with this directive:+.IP+.EX+end aliases+.EE+.SS Aliases can generate bad account names+Be aware that account aliases can produce malformed account names, which+could cause confusing reports or invalid \f[CR]print\f[R] output.+For example, you could erase all account names:+.IP+.EX+2021\-01\-01+ a:aa 1+ b+.EE+.IP+.EX+$ hledger print \-\-alias \(aq/.*/=\(aq+2021\-01\-01+ 1+.EE+.PP+The above \f[CR]print\f[R] output is not a valid journal.+Or you could insert an illegal double space, causing \f[CR]print\f[R]+output that would give a different journal when reparsed:+.IP+.EX+2021\-01\-01+ old 1+ other+.EE+.IP+.EX+$ hledger print \-\-alias old=\(dqnew USD\(dq | hledger \-f\- print+2021\-01\-01+ new USD 1+ other+.EE+.SS Aliases and account types+If an account with a type declaration (see Declaring accounts > Account+types) is renamed by an alias, normally the account type remains in+effect.+.PP+However, renaming in a way that reshapes the account tree (eg renaming+parent accounts but not their children, or vice versa) could prevent+child accounts from inheriting the account type of their parents.+.PP+Secondly, if an account\(aqs type is being inferred from its name,+renaming it by an alias could prevent or alter that.+.PP+If you are using account aliases and the \f[CR]type:\f[R] query is not+matching accounts as you expect, try troubleshooting with the accounts+command, eg something like:+.IP+.EX+$ hledger accounts \-\-types \-1 \-\-alias assets=bassetts+.EE+.SS \f[CR]commodity\f[R] directive+The \f[CR]commodity\f[R] directive performs several functions:+.IP "1." 3+It declares which commodity symbols may be used in the journal, enabling+useful error checking with strict mode or the check command.+See Commodity error checking below.+.IP "2." 3+It declares how all amounts in this commodity should be displayed, eg+how many decimals to show.+See Commodity display style above.+.IP "3." 3+(If no \f[CR]decimal\-mark\f[R] directive is in effect:) It sets the+decimal mark to expect (period or comma) when parsing amounts in this+commodity, in this file and files it includes, from the directive until+end of current file.+See Decimal marks above.+.IP "4." 3+It declares the precision with which this commodity\(aqs amounts should+be compared when checking for balanced transactions, anywhere in this+file and files it includes, until end of current file.+.PP+Declaring commodities solves several common parsing/display problems, so+we recommend it.+.PP+Note that effects 3 and 4 above end at the end of the directive\(aqs+file, and will not affect sibling or parent files.+So if you are relying on them (especially 4) and using multiple files,+placing your commodity directives in a top\-level parent file might be+important.+Or, keep your decimal marks unambiguous and your entries well balanced+and precise.+.PP+Omitting the commodity symbol will set the display style for just the+no\-symbol commodity, not all commodities.+.PP+Commodity styles can be overridden by the+\f[CR]\-c/\-\-commodity\-style\f[R] command line option.+.PP+(Related: #793)+.SS Commodity directive syntax+A commodity directive is normally the word \f[CR]commodity\f[R] followed+by a sample amount, and optionally a comment.+Only the amount\(aqs symbol and the number\(aqs format is significant.+Eg:+.IP+.EX+commodity $1000.00+commodity 1.000,00 EUR+commodity 1 000 000.0000 ; the no\-symbol commodity+.EE+.PP+A commodity directive\(aqs sample amount must always include a period or+comma decimal mark (this rule helps disambiguate decimal marks and digit+group marks).+If you don\(aqt want to show any decimal digits, write the decimal mark+at the end:+.IP+.EX+commodity 1000. AAAA ; show AAAA with no decimals+.EE+.PP+Commodity symbols containing spaces, numbers, or punctuation must be+enclosed in double quotes, as usual:+.IP+.EX+commodity 1.0000 \(dqAAAA 2023\(dq+.EE+.PP+Commodity directives normally include a sample amount, but can declare+only a symbol (ie, just function 1 above):+.IP+.EX+commodity $+commodity INR+commodity \(dqAAAA 2023\(dq+commodity \(dq\(dq ; the no\-symbol commodity+.EE+.PP+Commodity directives may also be written with an indented+\f[CR]format\f[R] subdirective, as in Ledger.+The symbol is repeated and must be the same in both places.+Other subdirectives are currently ignored:+.IP+.EX+; display indian rupees with currency name on the left,+; thousands, lakhs and crores comma\-separated,+; period as decimal point, and two decimal places.+commodity INR+ format INR 1,00,00,000.00+ an unsupported subdirective ; ignored by hledger+.EE+.SS Commodity tags+A commodity directive\(aqs comment may contain tags.+These will be propagated to all postings using that commodity in their+main amount, as hidden but queryable posting tags, except where the+posting already a tag of the same name.+(Posting tags override account tags override commodity tags.)+.SS Commodity error checking+In strict mode (\f[CR]\-s\f[R]/\f[CR]\-\-strict\f[R]) (or when you run+\f[CR]hledger check commodities\f[R]), hledger will report an error if+an undeclared commodity symbol is used.+(With one exception: zero amounts are always allowed to have no+commodity symbol.)+It works like account error checking (described above).+.SS \f[CR]decimal\-mark\f[R] directive+You can use a \f[CR]decimal\-mark\f[R] directive \- usually one per+file, at the top of the file \- to declare which character represents a+decimal mark when parsing amounts in this file.+It can look like+.IP+.EX+decimal\-mark .+.EE+.PP+or+.IP+.EX+decimal\-mark ,+.EE+.PP+This prevents any ambiguity when parsing numbers in the file, so we+recommend it, especially if the file contains digit group marks (eg+thousands separators).+.SS \f[CR]include\f[R] directive+You can pull in the content of additional files by writing an include+directive, like this:+.IP+.EX+include SOMEFILE+.EE+.PP+This has the same effect as if SOMEFILE\(aqs content was inlined at this+point.+(With any include directives in SOMEFILE processed similarly,+recursively.)+.PP+Only journal files can include other files.+They can include journal, timeclock or timedot files, but not CSV files.+.PP+If the file path begins with a tilde, that means your home directory:+\f[CR]include \(ti/main.journal\f[R].+.PP+If it begins with a slash, it is an absolute path:+\f[CR]include /home/user/main.journal\f[R].+Otherwise it is relative to the including file\(aqs folder:+\f[CR]include ../finances/main.journal\f[R].+.PP+Also, the path may have a file type prefix to force a specific file+format, overriding the file extension(s) (as described in Data formats):+\f[CR]include timedot:notes/2023.md\f[R].+.PP+The path may contain glob patterns to match multiple files.+hledger\(aqs globs are similar to zsh\(aqs: \f[CR]?\f[R] to match any+character; \f[CR][a\-z]\f[R] to match any character in a range;+\f[CR]*\f[R] to match zero or more characters that aren\(aqt a path+separator (like \f[CR]/\f[R]); \f[CR]**\f[R] to match zero or more+subdirectories and/or zero or more characters at the start of a file+name; etc.+For convenience, \f[CR]include\f[R] always excludes the current file.+So, you can do+.IP \(bu 2+\f[CR]include *.journal\f[R] to include all other journal files in the+current directory (excluding dot files)+.IP \(bu 2+\f[CR]include **.journal\f[R] to include all other journal files in this+directory and below (excluding dot files and top\-level dot directories)+.IP \(bu 2+\f[CR]include timelogs/2???.timedot\f[R] to include all timedot files+named like a year number.+.PP+Note \f[CR]*\f[R] and \f[CR]**\f[R] usually won\(aqt match dot files or+dot directories, with one exception: \f[CR]**\f[R] does search+non\-top\-level dot directories.+If this causes problems, make your glob pattern more specific (eg+\f[CR]**.journal\f[R] instead of \f[CR]**\f[R]).+.PP+If you are using many, or deeply nested, include files, and have an+error that\(aqs hard to pinpoint: a good troubleshooting command is+\f[CR]hledger files \-\-debug=6\f[R] (or 7).+.SS \f[CR]P\f[R] directive+The \f[CR]P\f[R] directive declares a market price, which is a+conversion rate between two commodities on a certain date.+This allows value reports to convert amounts of one commodity to their+value in another, on or after that date.+These prices are often obtained from a stock exchange, cryptocurrency+exchange, or the foreign exchange market.+.PP+The format is:+.IP+.EX+P DATE COMMODITY1SYMBOL COMMODITY2AMOUNT+.EE+.PP+DATE is a simple date, COMMODITY1SYMBOL is the symbol of the commodity+being priced, and COMMODITY2AMOUNT is the amount (symbol and quantity)+of commodity 2 that one unit of commodity 1 is worth on this date.+Examples:+.IP+.EX+# one euro was worth $1.35 from 2009\-01\-01 onward:+P 2009\-01\-01 € $1.35++# and $1.40 from 2010\-01\-01 onward:+P 2010\-01\-01 € $1.40+.EE+.PP+The \f[CR]\-V\f[R], \f[CR]\-X\f[R] and \f[CR]\-\-value\f[R] flags use+these market prices to show amount values in another commodity.+See Value reporting.+.PP+.SS \f[CR]payee\f[R] directive+\f[CR]payee PAYEE NAME\f[R]+.PP+This directive can be used to declare a limited set of payees which may+appear in transaction descriptions.+The \(dqpayees\(dq check will report an error if any transaction refers+to a payee that has not been declared.+Eg:+.IP+.EX+payee Whole Foods ; a comment+.EE+.PP+Payees do not have tags (tags in the comment will be ignored).+.PP+To declare the empty payee name, use \f[CR]\(dq\(dq\f[R].+.IP+.EX+payee \(dq\(dq+.EE+.PP+Ledger\-style indented subdirectives, if any, are currently ignored.+.SS \f[CR]tag\f[R] directive+\f[CR]tag TAGNAME\f[R]+.PP+This directive can be used to declare a limited set of tag names allowed+in tags.+TAGNAME should be a valid tag name (no spaces).+Eg:+.IP+.EX+tag item\-id+.EE+.PP+Any indented subdirectives are currently ignored.+.PP+The \(dqtags\(dq check will report an error if any undeclared tag name+is used.+It is quite easy to accidentally create a tag through normal use of+colons in comments; if you want to prevent this, you can declare and+check your tags .+.SS Periodic transactions+The \f[CR]\(ti\f[R] directive declares a \(dqperiodic rule\(dq which+generates temporary extra transactions, usually recurring at some+interval, when hledger is run with the \f[CR]\-\-forecast\f[R] flag.+These \(dqforecast transactions\(dq are useful for forecasting future+activity.+They exist only for the duration of the report, and only when+\f[CR]\-\-forecast\f[R] is used; they are not saved in the journal file+by hledger.+.PP+Periodic rules also have a second use: with the \f[CR]\-\-budget\f[R]+flag they set budget goals for budgeting.+.PP+Periodic rules can be a little tricky, so before you use them, read this+whole section, or at least the following tips:+.IP "1." 3+Two spaces accidentally added or omitted will cause you trouble \- read+about this below.+.IP "2." 3+For troubleshooting, show the generated transactions with+\f[CR]hledger print \-\-forecast tag:generated\f[R] or+\f[CR]hledger register \-\-forecast tag:generated\f[R].+.IP "3." 3+Forecasted transactions will begin only after the last non\-forecasted+transaction\(aqs date.+.IP "4." 3+Forecasted transactions will end 6 months from today, by default.+See below for the exact start/end rules.+.IP "5." 3+period expressions can be tricky.+Their documentation needs improvement, but is worth studying.+.IP "6." 3+Some period expressions with a repeating interval must begin on a+natural boundary of that interval.+Eg in \f[CR]weekly from DATE\f[R], DATE must be a monday.+\f[CR]\(ti weekly from 2019/10/1\f[R] (a tuesday) will give an error.+.IP "7." 3+Other period expressions with an interval are automatically expanded to+cover a whole number of that interval.+(This is done to improve reports, but it also affects periodic+transactions.+Yes, it\(aqs a bit inconsistent with the above.)+Eg: \f[CR]\(ti every 10th day of month from 2023/01\f[R], which is+equivalent to \f[CR]\(ti every 10th day of month from 2023/01/01\f[R],+will be adjusted to start on 2019/12/10.+.SS Periodic rule syntax+A periodic transaction rule looks like a normal journal entry, with the+date replaced by a tilde (\f[CR]\(ti\f[R]) followed by a period+expression (mnemonic: \f[CR]\(ti\f[R] looks like a recurring sine+wave.):+.IP+.EX+# every first of month+\(ti monthly+ expenses:rent $2000+ assets:bank:checking++# every 15th of month in 2023\(aqs first quarter:+\(ti monthly from 2023\-04\-15 to 2023\-06\-16+ expenses:utilities $400+ assets:bank:checking+.EE+.PP+The period expression is the same syntax used for specifying+multi\-period reports, just interpreted differently; there, it specifies+report periods; here it specifies recurrence dates (the periods\(aq+start dates).+.SS Periodic rules and relative dates+Partial or relative dates (like \f[CR]12/31\f[R], \f[CR]25\f[R],+\f[CR]tomorrow\f[R], \f[CR]last week\f[R], \f[CR]next quarter\f[R]) are+usually not recommended in periodic rules, since the results will change+as time passes.+If used, they will be interpreted relative to, in order of preference:+.IP "1." 3+the first day of the default year specified by a recent \f[CR]Y\f[R]+directive+.IP "2." 3+or the date specified with \f[CR]\-\-today\f[R]+.IP "3." 3+or the date on which you are running the report.+.PP+They will not be affected at all by report period or forecast period+dates.+.SS Two spaces between period expression and description!+If the period expression is followed by a transaction description, these+must be separated by \f[B]two or more spaces\f[R].+This helps hledger know where the period expression ends, so that+descriptions can not accidentally alter their meaning, as in this+example:+.IP+.EX+; 2 or more spaces needed here, so the period is not understood as \(dqevery 2 months in 2023\(dq+; ||+; vv+\(ti every 2 months in 2023, we will review+ assets:bank:checking $1500+ income:acme inc+.EE+.PP+So,+.IP \(bu 2+Do write two spaces between your period expression and your transaction+description, if any.+.IP \(bu 2+Don\(aqt accidentally write two spaces in the middle of your period+expression.+.SS Auto postings+The \f[CR]=\f[R] directive declares an \(dqauto posting rule\(dq, which+adds extra postings to existing transactions.+(Remember, postings are the account name & amount lines below a+transaction\(aqs date & description.)+.PP+In the journal, an auto posting rule looks quite like a transaction, but+instead of date and description it has \f[CR]=\f[R] (mnemonic:+\(dqmatch\(dq) and a query, like this:+.IP+.EX+= QUERY+ ACCOUNT AMOUNT+ ...+.EE+.PP+Queries are just like command line queries; an account name substring is+most common.+Query terms containing spaces should be enclosed in single or double+quotes.+.PP+Each \f[CR]=\f[R] rule works like this: when hledger is run with the+\f[CR]\-\-auto\f[R] flag, wherever the QUERY matches a posting in the+journal, the rule\(aqs postings are added to that transaction,+immediately below the matched posting.+Note these generated postings are temporary, existing only for the+duration of the report, and only when \f[CR]\-\-auto\f[R] is used; they+are not saved in the journal file by hledger.+.PP+The postings can contain the special string \f[CR]%account\f[R] which+will be expanded to the account name of the matched account.+.PP+Generated postings\(aq amounts can depend on the matched posting\(aqs+amount.+So auto postings can be useful for, eg, adding tax postings with a+standard percentage.+AMOUNT can be:+.IP \(bu 2+a number with no commodity symbol, like \f[CR]2\f[R].+The matched posting\(aqs commodity symbol will be added to this.+.IP \(bu 2+a normal amount with a commodity symbol, like \f[CR]$2\f[R].+This will be used as\-is.+.IP \(bu 2+an asterisk followed by a number, like \f[CR]*2\f[R].+This will multiply the matched posting\(aqs amount (and total price, if+any) by the number.+.IP \(bu 2+an asterisk followed by an amount with commodity symbol, like+\f[CR]*$2\f[R].+This multiplies and also replaces the commodity symbol with this new+one.+.PP+Some examples:+.IP+.EX+; every time I buy food, schedule a dollar donation+= expenses:food+ (liabilities:charity) $\-1++; when I buy a gift, also deduct that amount from a budget envelope subaccount+= expenses:gifts+ assets:checking:gifts *\-1+ assets:checking *1++2017/12/1+ expenses:food $10+ assets:checking++2017/12/14+ expenses:gifts $20+ assets:checking+.EE+.IP+.EX+$ hledger print \-\-auto+2017\-12\-01+ expenses:food $10+ assets:checking+ (liabilities:charity) $\-1++2017\-12\-14+ expenses:gifts $20+ assets:checking+ assets:checking:gifts \-$20+ assets:checking $20+.EE+.PP+Note that depending fully on generated data such as this has some+drawbacks \- it\(aqs less portable, less future\-proof, less auditable+by others, and less robust (eg your balance assertions will depend on+whether you use or don\(aqt use \f[CR]\-\-auto\f[R]).+An alternative is to use auto postings in \(dqone time\(dq fashion \-+use them to help build a complex journal entry, view it with+\f[CR]hledger print \-\-auto\f[R], and then copy that output into the+journal file to make it permanent.+.SS Auto postings and multiple files+An auto posting rule can affect any transaction in the current file, or+in any parent file or child file.+Note, currently it will not affect sibling files (when multiple+\f[CR]\-f\f[R]/\f[CR]\-\-file\f[R] are used \- see #1212).+.SS Auto postings and dates+A posting date (or secondary date) in the matched posting, or (taking+precedence) a posting date in the auto posting rule itself, will also be+used in the generated posting.+.SS Auto postings and transaction balancing / inferred amounts / balance assertions+Currently, auto postings are added:+.IP \(bu 2+after missing amounts are inferred, and transactions are checked for+balancedness,+.IP \(bu 2+but before balance assertions are checked.+.PP+Note this means that journal entries must be balanced both before and+after auto postings are added.+This changed in hledger 1.12+; see #893 for background.+.PP+This also means that you cannot have more than one auto\-posting with a+missing amount applied to a given transaction, as it will be unable to+infer amounts.+.SS Auto posting tags+Automated postings will have some extra tags:+.IP \(bu 2+\f[CR]generated\-posting:= QUERY\f[R] \- shows this was generated by an+auto posting rule, and the query+.IP \(bu 2+\f[CR]_generated\-posting:= QUERY\f[R] \- a hidden tag, which does not+appear in hledger\(aqs output.+This can be used to match postings generated \(dqjust now\(dq, rather+than generated in the past and saved to the journal.+.PP+Also, any transaction that has been changed by auto posting rules will+have these tags added:+.IP \(bu 2+\f[CR]modified:\f[R] \- this transaction was modified+.IP \(bu 2+\f[CR]_modified:\f[R] \- a hidden tag not appearing in the comment; this+transaction was modified \(dqjust now\(dq.+.SS Auto postings on forecast transactions only+Tip: you can can make auto postings that will apply to forecast+transactions but not recorded transactions, by adding+\f[CR]tag:_generated\-transaction\f[R] to their QUERY.+This can be useful when generating new journal entries to be saved in+the journal.+.SS Other syntax+hledger journal format supports quite a few other features, mainly to+make interoperating with or converting from Ledger easier.+Note some of the features below are powerful and can be useful in+special cases, but in general, features in this section are considered+less important or even not recommended for most users.+Downsides are mentioned to help you decide if you want to use them.+.SS Balance assignments+Ledger\-style balance assignments are also supported.+These are like balance assertions, but with no posting amount on the+left side of the equals sign; instead it is calculated automatically so+as to satisfy the assertion.+This can be a convenience during data entry, eg when setting opening+balances:+.IP+.EX+; starting a new journal, set asset account balances+2016/1/1 opening balances+ assets:checking = $409.32+ assets:savings = $735.24+ assets:cash = $42+ equity:opening balances+.EE+.PP+or when adjusting a balance to reality:+.IP+.EX+; no cash left; update balance, record any untracked spending as a generic expense+2016/1/15+ assets:cash = $0+ expenses:misc+.EE+.PP+The calculated amount depends on the account\(aqs balance in the+commodity at that point (which depends on the previously\-dated postings+of the commodity to that account since the last balance assertion or+assignment).+.PP+Downsides: using balance assignments makes your journal less explicit;+to know the exact amount posted, you have to run hledger or do the+calculations yourself, instead of just reading it.+Also balance assignments\(aq forcing of balances can hide errors.+These things make your financial data less portable, less future\-proof,+and less trustworthy in an audit.+.SS Balance assignments and costs+A cost in a balance assignment will cause the calculated amount to have+that cost attached:+.IP+.EX+2019/1/1+ (a) = $1 \(at €2+.EE+.IP+.EX+$ hledger print \-\-explicit+2019\-01\-01+ (a) $1 \(at €2 = $1 \(at €2+.EE+.SS Balance assignments and multiple files+Balance assignments handle multiple files like balance assertions.+They see balance from other files previously included from the current+file, but not from previous sibling or parent files.+.SS Bracketed posting dates+For setting posting dates and secondary posting dates, Ledger\(aqs+bracketed date syntax is also supported: \f[CR][DATE]\f[R],+\f[CR][DATE=DATE2]\f[R] or \f[CR][=DATE2]\f[R] in posting comments.+hledger will attempt to parse any square\-bracketed sequence of the+\f[CR]0123456789/\-.=\f[R] characters in this way.+With this syntax, DATE infers its year from the transaction and DATE2+infers its year from DATE.+.PP+Downsides: another syntax to learn, redundant with hledger\(aqs+\f[CR]date:\f[R]/\f[CR]date2:\f[R] tags, and confusingly similar to+Ledger\(aqs lot date syntax.+.SS \f[CR]D\f[R] directive+\f[CR]D AMOUNT\f[R]+.PP+This directive sets a default commodity, to be used for any subsequent+commodityless amounts (ie, plain numbers) seen while parsing the+journal.+This effect lasts until the next \f[CR]D\f[R] directive, or the end of+the current file.+.PP+For compatibility/historical reasons, \f[CR]D\f[R] also acts like a+\f[CR]commodity\f[R] directive (setting the commodity\(aqs decimal mark+for parsing and display style for output).+So its argument is not just a commodity symbol, but a full amount+demonstrating the style.+The amount must include a decimal mark (either period or comma).+Eg:+.IP+.EX+; commodity\-less amounts should be treated as dollars+; (and displayed with the dollar sign on the left, thousands separators and two decimal places)+D $1,000.00++1/1+ a 5 ; <\- commodity\-less amount, parsed as $5 and displayed as $5.00+ b+.EE+.PP+Interactions with other directives:+.PP+For setting a commodity\(aqs display style, a \f[CR]commodity\f[R]+directive has highest priority, then a \f[CR]D\f[R] directive.+.PP+For detecting a commodity\(aqs decimal mark during parsing,+\f[CR]decimal\-mark\f[R] has highest priority, then+\f[CR]commodity\f[R], then \f[CR]D\f[R].+.PP+For checking commodity symbols with the check command, a+\f[CR]commodity\f[R] directive is required+(\f[CR]hledger check commodities\f[R] ignores \f[CR]D\f[R] directives).+.PP+Downsides: omitting commodity symbols makes your financial data less+explicit, less portable, and less trustworthy in an audit.+It is usually an unsustainable shortcut; sooner or later you will want+to track multiple commodities.+D is overloaded with functions redundant with \f[CR]commodity\f[R] and+\f[CR]decimal\-mark\f[R].+And it works differently from Ledger\(aqs \f[CR]D\f[R].+.SS \f[CR]apply account\f[R] directive+This directive sets a default parent account, which will be prepended to+all accounts in following entries, until an \f[CR]end apply account\f[R]+directive or end of current file.+Eg:+.IP+.EX+apply account home++2010/1/1+ food $10+ cash++end apply account+.EE+.PP+is equivalent to:+.IP+.EX+2010/01/01+ home:food $10+ home:cash $\-10+.EE+.PP+\f[CR]account\f[R] directives are also affected, and so is any+\f[CR]include\f[R]d content.+.PP+Account names entered via hledger add or hledger\-web are not affected.+.PP+Account aliases, if any, are applied after the parent account is+prepended.+.PP+Downsides: this can make your financial data less explicit, less+portable, and less trustworthy in an audit.+.SS \f[CR]Y\f[R] directive+\f[CR]Y YEAR\f[R]+.PP+or (deprecated backward\-compatible forms):+.PP+\f[CR]year YEAR\f[R] \f[CR]apply year YEAR\f[R]+.PP+The space is optional.+This sets a default year to be used for subsequent dates which don\(aqt+specify a year.+Eg:+.IP+.EX+Y2009 ; set default year to 2009++12/15 ; equivalent to 2009/12/15+ expenses 1+ assets++year 2010 ; change default year to 2010++2009/1/30 ; specifies the year, not affected+ expenses 1+ assets++1/31 ; equivalent to 2010/1/31+ expenses 1+ assets+.EE+.PP+Downsides: omitting the year (from primary transaction dates, at least)+makes your financial data less explicit, less portable, and less+trustworthy in an audit.+Such dates can get separated from their corresponding Y directive, eg+when evaluating a region of the journal in your editor.+A missing Y directive makes reports dependent on today\(aqs date.+.SS Secondary dates+A secondary date is written after the primary date, following an equals+sign: \f[CR]DATE1=DATE2\f[R].+If the year is omitted, the primary date\(aqs year is assumed.+When running reports, the primary (left side) date is used by default,+but with the \f[CR]\-\-date2\f[R] flag (\f[CR]\-\-aux\-date\f[R]+or\f[CR]\-\-effective\f[R] also work, for Ledger users), the secondary+(right side) date will be used instead.+.PP+The meaning of secondary dates is up to you.+Eg it could be \(dqprimary is the bank\(aqs clearing date, secondary is+the date the transaction was initiated, if different\(dq.+.PP+In practice, this feature usually adds confusion:+.IP \(bu 2+You have to remember the primary and secondary dates\(aq meaning, and+follow that consistently.+.IP \(bu 2+It splits your bookkeeping into two modes, and you have to remember+which mode is appropriate for a given report.+.IP \(bu 2+Usually your balance assertions will work with only one of these modes.+.IP \(bu 2+It makes your financial data more complicated, less portable, and less+clear in an audit.+.IP \(bu 2+It interacts with every feature, creating an ongoing cost for+implementors.+.IP \(bu 2+It distracts new users and supporters.+.IP \(bu 2+Posting dates are simpler and work better.+.PP+So secondary dates are officially deprecated in hledger, remaining only+as a Ledger compatibility aid; we recommend using posting dates instead.+.SS Star comments+Lines beginning with \f[CR]*\f[R] (star/asterisk) are also comment+lines.+This feature allows Emacs users to insert org headings in their journal,+allowing them to fold/unfold/navigate it like an outline when viewed+with org mode.+.PP+Downsides: another, unconventional comment syntax to learn.+Decreases your journal\(aqs portability.+And switching to Emacs org mode just for folding/unfolding meant losing+the benefits of ledger mode; nowadays you can add outshine mode to+ledger mode to get folding without losing ledger mode\(aqs features.+.SS Valuation expressions+Ledger allows a valuation function or value to be written in double+parentheses after an amount.+hledger ignores these.+.SS Virtual postings+A posting with parentheses around the account name, like+\f[CR](some:account) 10\f[R], is called an \f[I]unbalanced virtual+posting\f[R].+These postings do not participate in transaction balancing.+(And if you write them without an amount, a zero amount is always+inferred.)+These can occasionally be convenient for special circumstances, but they+violate double entry bookkeeping and make your data less portable across+applications, so many people avoid using them at all.+.PP+A posting with brackets around the account name+(\f[CR][some:account]\f[R]) is called a \f[I]balanced virtual+posting\f[R].+The balanced virtual postings in a transaction must add up to zero, just+like ordinary postings, but separately from them.+These are not part of double entry bookkeeping either, but they are at+least balanced.+An example:+.IP+.EX+2022\-01\-01 buy food with cash, update budget envelope subaccounts, & something else+ assets:cash $\-10 ; <\- these balance each other+ expenses:food $7 ; <\-+ expenses:food $3 ; <\-+ [assets:checking:budget:food] $\-10 ; <\- and these balance each other+ [assets:checking:available] $10 ; <\-+ (something:else) $5 ; <\- this is not required to balance+.EE+.PP+Ordinary postings, whose account names are neither parenthesised nor+bracketed, are called \f[I]real postings\f[R].+You can exclude virtual postings from reports with the+\f[CR]\-R/\-\-real\f[R] flag or a \f[CR]real:1\f[R] query.+.SS Other Ledger directives+These other Ledger directives are currently accepted but ignored.+This allows hledger to read more Ledger files, but be aware that+hledger\(aqs reports may differ from Ledger\(aqs if you use these.+.IP+.EX+apply fixed COMM AMT+apply tag TAG+assert EXPR+bucket / A ACCT+capture ACCT REGEX+check EXPR+define VAR=EXPR+end apply fixed+end apply tag+end apply year+end tag+eval / expr EXPR+python+ PYTHONCODE+tag NAME+value EXPR+\-\-command\-line\-flags+.EE+.PP+See also https://hledger.org/ledger.html for a detailed hledger/Ledger+syntax comparison.+.SS Ledger virtual costs+In Ledger, \f[CR](\(at) UNITCOST\f[R] and+\f[CR](\(at\(at) TOTALCOST\f[R] are virtual costs, which do not generate+market prices.+In hledger, these are equivalent to \f[CR]\(at\f[R] and+\f[CR]\(at\(at\f[R].+.SS Ledger lot syntax+In Ledger, these optional annotations after an amount help specify the+cost basis of a newly acquired lot, or select existing lot(s) to dispose+of:+.IP \(bu 2+\f[CR]{LOTUNITCOST}\f[R] and \f[CR]{{LOTTOTALCOST}}\f[R] (lot price)+.IP \(bu 2+\f[CR][LOTDATE]\f[R] (lot date)+.IP \(bu 2+\f[CR](LOTNOTE)\f[R] (lot note)+.PP+hledger does not yet calculate lots itself, but it accepts these+annotations and will show them in \f[CR]print\f[R]\(aqs \f[CR]txt\f[R],+\f[CR]beancount\f[R], and \f[CR]json\f[R] output formats.+This means you can use this syntax in your hledger journals (with an+amountless extra posting to help transactions balance, when needed), and+use the \f[CR]print\f[R] command to export to Ledger or Beancount when+you want to calculate lots and capital gains.+.SS Ledger fixed lot costs+.IP \(bu 2+\f[CR]{=UNITCOST}\f[R] and \f[CR]{{=TOTALCOST}}\f[R] (fixed price)+.RS 2+.IP \(bu 2+when buying, means \(dqthis cost is also the fixed value, don\(aqt let+it fluctuate in value reports\(dq+.RE+.PP+Probably equivalent to \f[CR]\(at\f[R]/\f[CR]\(at\(at\f[R], I\(aqm not+sure.+.PP+\f[B]Beancount\f[R] has simpler notation and different behaviour:+.IP \(bu 2+\f[CR]\(at UNITCOST\f[R] and \f[CR]\(at\(at TOTALCOST\f[R]+.RS 2+.IP \(bu 2+expresses a cost without creating a lot, as in hledger+.IP \(bu 2+when buying (acquiring) or selling (disposing of) a lot, and combined+with \f[CR]{...}\f[R]: is not used except to document the cost/selling+price+.RE+.IP \(bu 2+\f[CR]{UNITCOST}\f[R] and \f[CR]{{TOTALCOST}}\f[R]+.RS 2+.IP \(bu 2+when buying, expresses the cost for transaction balancing, and also+creates a lot with this cost basis attached+.IP \(bu 2+when selling,+.RS 2+.IP \(bu 2+selects a lot by its cost basis+.IP \(bu 2+raises an error if that lot is not present or can not be selected+unambiguously (depending on booking method configured)+.IP \(bu 2+expresses the selling price for transaction balancing+.RE+.RE+.IP \(bu 2+\f[CR]{}\f[R], \f[CR]{YYYY\-MM\-DD}\f[R], \f[CR]{\(dqLABEL\(dq}\f[R],+\f[CR]{UNITCOST, \(dqLABEL\(dq}\f[R],+\f[CR]{UNITCOST, YYYY\-MM\-DD, \(dqLABEL\(dq}\f[R]+.RS 2+.IP \(bu 2+when selling, other combinations of date/cost/label, like the above, are+accepted for selecting the lot.+.RE+.PP+Currently, hledger+.IP \(bu 2+supports \f[CR]\(at\f[R] and \f[CR]\(at\(at\f[R]+.IP \(bu 2+accepts the \f[CR]{UNITCOST}\f[R]/\f[CR]{{TOTALCOST}}\f[R] notation, but+ignores it+.IP \(bu 2+and rejects the rest.+.PP+.SH CSV+hledger can read transactions from CSV (comma\-separated values) files.+More precisely, it can read DSV (delimiter\-separated values), from a+file or standard input.+Comma\-separated, semicolon\-separated and tab\-separated are the most+common variants, and hledger will recognise these three automatically+based on a \f[CR].csv\f[R], \f[CR].ssv\f[R] or \f[CR].tsv\f[R] file name+extension or a \f[CR]csv:\f[R], \f[CR]ssv:\f[R] or \f[CR]tsv:\f[R] file+path prefix.+.PP+(To learn about producing CSV or TSV \f[I]output\f[R], see Output+format.)+.PP+Each CSV file must be described by a corresponding \f[I]rules file\f[R].+This contains rules describing the CSV data (header line, fields layout,+date format etc.), how to construct hledger transactions from it, and+how to categorise transactions based on description or other attributes.+.PP+By default, hledger expects this rules file to be named like the CSV+file, with an extra \f[CR].rules\f[R] extension added, in the same+directory.+Eg when asked to read \f[CR]foo/FILE.csv\f[R], hledger looks for+\f[CR]foo/FILE.csv.rules\f[R].+You can specify a different rules file with the \f[CR]\-\-rules\f[R]+option.+.PP+At minimum, the rules file must identify the date and amount fields, and+often it also specifies the date format and how many header lines there+are.+Here\(aqs a simple CSV file and a rules file for it:+.IP+.EX+Date, Description, Id, Amount+12/11/2019, Foo, 123, 10.23+.EE+.IP+.EX+# basic.csv.rules+skip 1+fields date, description, , amount+date\-format %d/%m/%Y+.EE+.IP+.EX+$ hledger print \-f basic.csv+2019\-11\-12 Foo+ expenses:unknown 10.23+ income:unknown \-10.23+.EE+.PP+There\(aqs an introductory Tutorial: Import CSV data on hledger.org, and+more CSV rules examples below, and a larger collection at+https://github.com/simonmichael/hledger/tree/master/examples/csv.+.SS CSV rules cheatsheet+The following kinds of rule can appear in the rules file, in any order.+(Blank lines and lines beginning with \f[CR]#\f[R] or \f[CR];\f[R] or+\f[CR]*\f[R] are ignored.)+.PP+.TS+tab(@);+lw(23.7n) lw(46.3n).+T{+\f[B]\f[CB]source\f[B]\f[R]+T}@T{+optionally declare which file to read data from+T}+T{+\f[B]\f[CB]archive\f[B]\f[R]+T}@T{+optionally enable an archive of imported files+T}+T{+\f[B]\f[CB]encoding\f[B]\f[R]+T}@T{+optionally declare which text encoding the data has+T}+T{+\f[B]\f[CB]separator\f[B]\f[R]+T}@T{+declare the field separator, instead of relying on file extension+T}+T{+\f[B]\f[CB]decimal\-mark\f[B]\f[R]+T}@T{+declare the decimal mark used in CSV amounts, when ambiguous+T}+T{+\f[B]\f[CB]date\-format\f[B]\f[R]+T}@T{+declare how to parse CSV dates/date\-times+T}+T{+\f[B]\f[CB]timezone\f[B]\f[R]+T}@T{+declare the time zone of ambiguous CSV date\-times+T}+T{+\f[B]\f[CB]newest\-first\f[B]\f[R]+T}@T{+improve txn order when: there are multiple records, newest first, all+with the same date+T}+T{+\f[B]\f[CB]intra\-day\-reversed\f[B]\f[R]+T}@T{+improve txn order when: same\-day txns are in opposite order to the+overall file+T}+T{+\f[B]\f[CB]skip\f[B]\f[R]+T}@T{+(at top level) skip header line(s) at start of file+T}+T{+\f[B]\f[CB]fields\f[B] list\f[R]+T}@T{+name CSV fields for easy reference, and optionally assign their values+to hledger fields+T}+T{+\f[B]Field assignment\f[R]+T}@T{+assign a CSV value or interpolated text value to a hledger field+T}+T{+\f[B]\f[CB]if\f[B] block\f[R]+T}@T{+conditionally assign values to hledger fields, or \f[CR]skip\f[R] a+record or \f[CR]end\f[R] (skip rest of file)+T}+T{+\f[B]\f[CB]if\f[B] table\f[R]+T}@T{+conditionally assign values to hledger fields, using compact syntax+T}+T{+\f[B]\f[CB]skip\f[B]\f[R]+T}@T{+(inside an \f[CR]if\f[R] rule) skip current record(s)+T}+T{+\f[B]\f[CB]end\f[B]\f[R]+T}@T{+(inside an \f[CR]if\f[R] rule) skip all remaining records+T}+T{+\f[B]\f[CB]balance\-type\f[B]\f[R]+T}@T{+select which type of balance assertions/assignments to generate+T}+T{+\f[B]\f[CB]include\f[B]\f[R]+T}@T{+inline another CSV rules file+T}+.TE+.PP+Working with CSV tips can be found below, including How CSV rules are+evaluated.+.SS \f[CR]source\f[R]+If you tell hledger to read a csv file with \f[CR]\-f foo.csv\f[R], it+will look for rules in \f[CR]foo.csv.rules\f[R].+Or, you can tell it to read the rules file, with+\f[CR]\-f foo.csv.rules\f[R], and it will look for data in+\f[CR]foo.csv\f[R] (since 1.30).+These are mostly equivalent, but the second method provides some extra+features.+For one, the data file can be missing, without causing an error; it is+just considered empty.+.PP+For more flexibility, add a \f[CR]source\f[R] rule, which lets you+specify a different data file:+.IP+.EX+source ./Checking1.csv+.EE+.PP+If the file does not exist, it is just considered empty, without raising+an error.+.PP+If you specify just a file name with no path, hledger will look for it+in the \f[CR]\(ti/Downloads\f[R] folder:+.IP+.EX+source Checking1.csv+.EE+.PP+You can use a glob pattern, to avoid specifying the file name exactly:+.IP+.EX+source Checking1*.csv+.EE+.PP+This has another benefit: if the pattern matches multiple files, hledger+will read the newest (most recently modified) one.+This avoids problems if you have downloaded a file multiple times+without cleaning up.+.PP+All this enables a convenient workflow where can you just download CSV+files, then run \f[CR]hledger import rules/*\f[R].+.PP+See also \(dqWorking with CSV > Reading files specified by rule\(dq.+.SS Data cleaning / data generating commands+After \f[CR]source\f[R]\(aqs file pattern, you can write \f[CR]|\f[R]+(pipe) and a data cleaning command (or command pipeline).+If hledger\(aqs CSV rules aren\(aqt enough, you can pre\-process the+downloaded data here with a shell command or script, to make it more+suitable for conversion.+The command will be executed by your default shell, in the directory of+the rules file, will receive the data file\(aqs content as standard+input, and should output zero or more lines of+character\-separated\-values, suitable for conversion by the CSV rules.+.PP+Examples:+.IP+.EX+source ./paypal.json | paypalcsv+source data/simplefin.json | simplefincsv \- \(aqchase.*card\(aq+source OfxDownload*.csv | grep \-vE \(aq\(ha(([\(ha,]*,){6}[\(ha,]*|)$\(aq | sort \-t, \-n +2+source History_for_Account_Z20144832*.csv # | grep \-E \(aq\(ha([\(ha,]*,){12}[\(ha,]*$\(aq | sed \-E \-e \(aqs/\(ha //\(aq \-e \(aqs/\(rs.([0\-9]),/.\(rs10,/g\(aq \-e \(aqs/,([0\-9]+),/,\(rs1.00,/g\(aq+.EE+.PP+Or, after \f[CR]source\f[R] you can write \f[CR]|\f[R] and a data+generating command (with no file pattern before the \f[CR]|\f[R]).+This command receives no input, and should output zero or more lines of+character\-separated values, suitable for conversion by the CSV rules.+.PP+Examples:+.IP+.EX+source | paypaljson | paypalcsv+source | paypalcsv data/paypal.json +source | simplefinjson >data/simplefin.json && simplefincsv data/simplefin.json \(aqchase.*card\(aq+source | simplefincsv data/simplefin.json \(aqunify.*checking\(aq+.EE+.PP+(\f[CR]paypal*\f[R] and \f[CR]simplefin*\f[R] scripts are in bin/)+.PP+Whenever hledger runs one of these commands, it will echo the command on+stderr.+If the command produces error output, but exits successfully, hledger+will show the error output as a warning.+If the command fails, hledger will fail and show the error output in the+error message.+.PP+\f[I]Added in 1.50; experimental.\f[R]+.SS \f[CR]archive\f[R]+With \f[CR]archive\f[R] added to a rules file, the \f[CR]import\f[R]+command will archive each successfully processed data file or data+command output in a nearby \f[CR]data/\f[R] directory.+The archive file name will be based on the rules file and the data+file\(aqs modification date and extension (or for a data\-generating+command, the current date and the \(dq.csv\(dq extension).+The original data file, if any, will be removed.+.PP+Also, in this mode \f[CR]import\f[R] will prefer the oldest file matched+by the \f[CR]source\f[R] rule\(aqs glob pattern, not the newest.+(So if there are multiple downloads, they will be imported and archived+oldest first.)+.PP+Archiving is optional, but it can be useful for troubleshooting your CSV+rules, regenerating entries with improved rules, checking for variations+in your bank\(aqs CSV, etc.+.PP+\f[I]Added in 1.50; experimental.\f[R]+.SS \f[CR]encoding\f[R]+.IP+.EX+encoding ENCODING+.EE+.PP+hledger normally expects non\-ascii text to be using the system+locale\(aqs text encoding.+If you need to read CSV files which have some other encoding, you can do+it by adding \f[CR]encoding ENCODING\f[R] to your CSV rules.+Eg: \f[CR]encoding iso\-8859\-1\f[R].+.PP+The following encodings are supported:+.PP+\f[CR]ascii\f[R], \f[CR]utf\-8\f[R], \f[CR]utf\-16\f[R],+\f[CR]utf\-32\f[R], \f[CR]iso\-8859\-1\f[R], \f[CR]iso\-8859\-2\f[R],+\f[CR]iso\-8859\-3\f[R], \f[CR]iso\-8859\-4\f[R],+\f[CR]iso\-8859\-5\f[R], \f[CR]iso\-8859\-6\f[R],+\f[CR]iso\-8859\-7\f[R], \f[CR]iso\-8859\-8\f[R],+\f[CR]iso\-8859\-9\f[R], \f[CR]iso\-8859\-10\f[R],+\f[CR]iso\-8859\-11\f[R], \f[CR]iso\-8859\-13\f[R],+\f[CR]iso\-8859\-14\f[R], \f[CR]iso\-8859\-15\f[R],+\f[CR]iso\-8859\-16\f[R], \f[CR]cp1250\f[R], \f[CR]cp1251\f[R],+\f[CR]cp1252\f[R], \f[CR]cp1253\f[R], \f[CR]cp1254\f[R],+\f[CR]cp1255\f[R], \f[CR]cp1256\f[R], \f[CR]cp1257\f[R],+\f[CR]cp1258\f[R], \f[CR]koi8\-r\f[R], \f[CR]koi8\-u\f[R],+\f[CR]gb18030\f[R], \f[CR]macintosh\f[R], \f[CR]jis\-x\-0201\f[R],+\f[CR]jis\-x\-0208\f[R], \f[CR]iso\-2022\-jp\f[R],+\f[CR]shift\-jis\f[R], \f[CR]cp437\f[R], \f[CR]cp737\f[R],+\f[CR]cp775\f[R], \f[CR]cp850\f[R], \f[CR]cp852\f[R], \f[CR]cp855\f[R],+\f[CR]cp857\f[R], \f[CR]cp860\f[R], \f[CR]cp861\f[R], \f[CR]cp862\f[R],+\f[CR]cp863\f[R], \f[CR]cp864\f[R], \f[CR]cp865\f[R], \f[CR]cp866\f[R],+\f[CR]cp869\f[R], \f[CR]cp874\f[R], \f[CR]cp932\f[R].+.PP+\f[I]Added in 1.42.\f[R]+.SS \f[CR]separator\f[R]+You can use the \f[CR]separator\f[R] rule to read other kinds of+character\-separated data.+The argument is any single separator character, or the words+\f[CR]tab\f[R] or \f[CR]space\f[R] (case insensitive).+Eg, for comma\-separated values (CSV):+.IP+.EX+separator ,+.EE+.PP+or for semicolon\-separated values (SSV):+.IP+.EX+separator ;+.EE+.PP+or for tab\-separated values (TSV):+.IP+.EX+separator TAB+.EE+.PP+If the input file has a \f[CR].csv\f[R], \f[CR].ssv\f[R] or+\f[CR].tsv\f[R] file extension (or a \f[CR]csv:\f[R], \f[CR]ssv:\f[R],+\f[CR]tsv:\f[R] prefix), the appropriate separator will be inferred+automatically, and you won\(aqt need this rule.+.SS \f[CR]skip\f[R]+.IP+.EX+skip N+.EE+.PP+The word \f[CR]skip\f[R] followed by a number (or no number, meaning 1)+tells hledger to ignore this many non\-empty lines at the start of the+input data.+You\(aqll need this whenever your CSV data contains header lines.+Note, empty and blank lines are skipped automatically, so you don\(aqt+need to count those.+.PP+\f[CR]skip\f[R] has a second meaning: it can be used inside if blocks+(described below), to skip one or more records whenever the condition is+true.+Records skipped in this way are ignored, except they are still required+to be valid CSV.+.SS \f[CR]date\-format\f[R]+.IP+.EX+date\-format DATEFMT+.EE+.PP+This is a helper for the \f[CR]date\f[R] (and \f[CR]date2\f[R]) fields.+If your CSV dates are not formatted like \f[CR]YYYY\-MM\-DD\f[R],+\f[CR]YYYY/MM/DD\f[R] or \f[CR]YYYY.MM.DD\f[R], you\(aqll need to add a+date\-format rule describing them with a strptime\-style date parsing+pattern \- see+https://hackage.haskell.org/package/time/docs/Data\-Time\-Format.html#v:formatTime.+The pattern must parse the CSV date value completely.+Some examples:+.IP+.EX+# MM/DD/YY+date\-format %m/%d/%y+.EE+.IP+.EX+# D/M/YYYY+# The \- makes leading zeros optional.+date\-format %\-d/%\-m/%Y+.EE+.IP+.EX+# YYYY\-Mmm\-DD+date\-format %Y\-%h\-%d+.EE+.IP+.EX+# M/D/YYYY HH:MM AM some other junk+# Note the time and junk must be fully parsed, though only the date is used.+date\-format %\-m/%\-d/%Y %l:%M %p some other junk+.EE+.PP+Note currently there is no locale awareness for things like+\f[CR]%b\f[R], and setting LC_TIME won\(aqt help.+.SS \f[CR]timezone\f[R]+.IP+.EX+timezone TIMEZONE+.EE+.PP+When CSV contains date\-times that are implicitly in some time zone+other than yours, but containing no explicit time zone information, you+can use this rule to declare the CSV\(aqs native time zone, which helps+prevent off\-by\-one dates.+.PP+When the CSV date\-times do contain time zone information, you don\(aqt+need this rule; instead, use \f[CR]%Z\f[R] in \f[CR]date\-format\f[R]+(or \f[CR]%z\f[R], \f[CR]%EZ\f[R], \f[CR]%Ez\f[R]; see the formatTime+link above).+.PP+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:+.IP+.EX+$ TZ=\-1000 hledger print \-f foo.csv # or TZ=\-1000 hledger import foo.csv+.EE+.PP+\f[CR]timezone\f[R] currently does not understand timezone names, except+\(dqUTC\(dq, \(dqGMT\(dq, \(dqEST\(dq, \(dqEDT\(dq, \(dqCST\(dq,+\(dqCDT\(dq, \(dqMST\(dq, \(dqMDT\(dq, \(dqPST\(dq, or \(dqPDT\(dq.+For others, use numeric format: +HHMM or \-HHMM.+.SS \f[CR]newest\-first\f[R]+hledger tries to ensure that the generated transactions will be ordered+chronologically, including same\-day transactions.+Usually it can auto\-detect how the CSV records are ordered.+But if it encounters CSV where all records are on the same date, it+assumes that the records are oldest first.+If in fact the CSV\(aqs records are normally newest first, like:+.IP+.EX+2022\-10\-01, txn 3...+2022\-10\-01, txn 2...+2022\-10\-01, txn 1...+.EE+.PP+you can add the \f[CR]newest\-first\f[R] rule to help hledger generate+the transactions in correct order.+.IP+.EX+# same\-day CSV records are newest first+newest\-first+.EE+.SS \f[CR]intra\-day\-reversed\f[R]+If CSV records within a single day are ordered opposite to the overall+record order, you can add the \f[CR]intra\-day\-reversed\f[R] rule to+improve the order of journal entries.+Eg, here the overall record order is newest first, but same\-day records+are oldest first:+.IP+.EX+2022\-10\-02, txn 3...+2022\-10\-02, txn 4...+2022\-10\-01, txn 1...+2022\-10\-01, txn 2...+.EE+.IP+.EX+# transactions within each day are reversed with respect to the overall date order+intra\-day\-reversed+.EE+.SS \f[CR]decimal\-mark\f[R]+.IP+.EX+decimal\-mark .+.EE+.PP+or:+.IP+.EX+decimal\-mark ,+.EE+.PP+hledger automatically accepts either period or comma as a decimal mark+when parsing numbers (cf Amounts).+However if any numbers in the CSV contain digit group marks, such as+thousand\-separating commas, you should declare the decimal mark+explicitly with this rule, to avoid misparsed numbers.+.SS CSV fields and hledger fields+This can be confusing, so let\(aqs start with an overview:+.IP \(bu 2+\f[B]CSV fields\f[R] are provided by your data file.+They are named by their position in the CSV record, starting with 1.+You can also give them a readable name.+.IP \(bu 2+\f[B]hledger fields\f[R] are predefined; \f[CR]date\f[R],+\f[CR]description\f[R], \f[CR]account1\f[R], \f[CR]amount1\f[R],+\f[CR]account2\f[R] are some of them.+They correspond to parts of a transaction\(aqs journal entry, mostly.+.IP \(bu 2+The CSV fields and hledger fields are the only fields you\(aqll be+working with; you can\(aqt define new fields, or variables as in a+programming language.+(But you could add extra CSV fields to the data in preprocessing, before+running the rules.)+.IP \(bu 2+For each CSV record, you\(aqll assign values to one or more of the+hledger fields to build up a transaction (journal entry).+Values can be static text, CSV field values from the current record, or+a combination of these.+.IP \(bu 2+For simple cases, you can give a CSV field the same name as one of the+hledger fields, then its value will be automatically assigned to that+hledger field.+.IP \(bu 2+CSV fields can only be read, not written to.+They\(aqll be on the right hand side, with a % prefix.+Eg+.RS 2+.IP \(bu 2+testing a CSV field\(aqs value: \f[CR]if %CSVFIELD ...\f[R]+.IP \(bu 2+interpolating its value: \f[CR]HLEDGERFIELD %CSVFIELD\f[R]+.RE+.IP \(bu 2+hledger fields can only be written to, not read.+They\(aqll be on the left hand side (or in a fields list), with no+prefix.+Eg+.RS 2+.IP \(bu 2+setting the transaction\(aqs description to a value:+\f[CR]description VALUE\f[R]+.IP \(bu 2+setting the transaction\(aqs description to the second CSV field\(aqs+value:+.PD 0+.P+.PD+\f[CR]fields date, description, amount\f[R]+.RE+.SS \f[CR]fields\f[R] list+.IP+.EX+fields FIELDNAME1, FIELDNAME2, ...+.EE+.PP+A fields list (the word \f[CR]fields\f[R] followed by comma\-separated+field names) is optional, but convenient.+It does two things:+.IP "1." 3+It names the CSV field in each column.+This can be convenient if you are referencing them in other rules, so+you can say \f[CR]%SomeField\f[R] instead of remembering \f[CR]%13\f[R].+.IP "2." 3+Whenever you use one of the special hledger field names (described+below), it assigns the CSV value in this position to that hledger field.+This is the quickest way to populate hledger\(aqs fields and build a+transaction.+.PP+Here\(aqs an example that says \(dquse the 1st, 2nd and 4th fields as+the transaction\(aqs date, description and amount; name the last two+fields for later reference; and ignore the others\(dq:+.IP+.EX+fields date, description, , amount, , , somefield, anotherfield+.EE+.PP+In a fields list, the separator is always comma; it is unrelated to the+CSV file\(aqs separator.+Also:+.IP \(bu 2+There must be least two items in the list (at least one comma).+.IP \(bu 2+Field names may not contain spaces.+Spaces before/after field names are optional.+.IP \(bu 2+Field names may contain \f[CR]_\f[R] (underscore) or \f[CR]\-\f[R]+(hyphen).+.IP \(bu 2+Fields you don\(aqt care about can be given a dummy name or an empty+name.+.PP+If the CSV contains column headings, it\(aqs convenient to use these for+your field names, suitably modified (eg lower\-cased with spaces+replaced by underscores).+.PP+Sometimes you may want to alter a CSV field name to avoid assigning to a+hledger field with the same name.+Eg you could call the CSV\(aqs \(dqbalance\(dq field \f[CR]balance_\f[R]+to avoid directly setting hledger\(aqs \f[CR]balance\f[R] field (and+generating a balance assertion).+.SS Field assignment+.IP+.EX+HLEDGERFIELD FIELDVALUE+.EE+.PP+Field assignments are the more flexible way to assign CSV values to+hledger fields.+They can be used instead of or in addition to a fields list (see above).+.PP+To assign a value to a hledger field, write the field name (any of the+standard hledger field/pseudo\-field names, defined below), a space,+followed by a text value on the same line.+This text value may interpolate CSV fields, referenced either by their+1\-based position in the CSV record (\f[CR]%N\f[R]) or by the name they+were given in the fields list (\f[CR]%CSVFIELD\f[R]), and regular+expression match groups (\f[CR]\(rsN\f[R]).+.PP+Some examples:+.IP+.EX+# set the amount to the 4th CSV field, with \(dq USD\(dq appended+amount %4 USD++# combine three fields to make a comment, containing note: and date: tags+comment note: %somefield \- %anotherfield, date: %1+.EE+.PP+Tips:+.IP \(bu 2+Interpolation strips outer whitespace (so a CSV value like+\f[CR]\(dq 1 \(dq\f[R] becomes \f[CR]1\f[R] when interpolated) (#1051).+.IP \(bu 2+Interpolations always refer to a CSV field \- you can\(aqt interpolate a+hledger field.+(See Referencing other fields below).+.SS Field names+Note the two kinds of field names mentioned here, and used only in+hledger CSV rules files:+.IP "1." 3+\f[B]CSV field names\f[R] (\f[CR]CSVFIELD\f[R] in these docs): you can+optionally name the CSV columns for easy reference (since hledger+doesn\(aqt yet automatically recognise column headings in a CSV file),+by writing arbitrary names in a \f[CR]fields\f[R] list, eg:+.RS 4+.IP+.EX+fields When, What, Some_Id, Net, Total, Foo, Bar+.EE+.RE+.IP "2." 3+Special \f[B]hledger field names\f[R] (\f[CR]HLEDGERFIELD\f[R] in these+docs): you must set at least some of these to generate the hledger+transaction from a CSV record, by writing them as the left hand side of+a field assignment, eg:+.RS 4+.IP+.EX+date %When+code %Some_Id+description %What+comment %Foo %Bar+amount1 $ %Total+.EE+.PP+or directly in a \f[CR]fields\f[R] list:+.IP+.EX+fields date, description, code, , amount1, Foo, Bar+currency $+comment %Foo %Bar+.EE+.RE+.PP+Here are all the special hledger field names available, and what happens+when you assign values to them:+.SS date field+Assigning to \f[CR]date\f[R] sets the transaction date.+.SS date2 field+\f[CR]date2\f[R] sets the transaction\(aqs secondary date, if any.+.SS status field+\f[CR]status\f[R] sets the transaction\(aqs status, if any.+.SS code field+\f[CR]code\f[R] sets the transaction\(aqs code, if any.+.SS description field+\f[CR]description\f[R] sets the transaction\(aqs description, if any.+.SS comment field+\f[CR]comment\f[R] sets the transaction\(aqs comment, if any.+.PP+\f[CR]commentN\f[R], where N is a number, sets the Nth posting\(aqs+comment.+.PP+You can assign multi\-line comments by writing literal \f[CR]\(rsn\f[R]+in the code.+A comment starting with \f[CR]\(rsn\f[R] will begin on a new line.+.PP+Comments can contain tags, as usual.+.PP+Posting comments can also contain a posting date.+A secondary date, or a year\-less date, will be ignored.+.SS account field+Assigning to \f[CR]accountN\f[R], where N is 1 to 99, sets the account+name of the Nth posting, and causes that posting to be generated.+.PP+Most often there are two postings, so you\(aqll want to set+\f[CR]account1\f[R] and \f[CR]account2\f[R].+Typically \f[CR]account1\f[R] is associated with the CSV file, and is+set once with a top\-level assignment, while \f[CR]account2\f[R] is set+based on each transaction\(aqs description, in conditional rules.+.PP+If a posting\(aqs account name is left unset but its amount is set (see+below), a default account name will be chosen (like+\(dqexpenses:unknown\(dq or \(dqincome:unknown\(dq).+.SS amount field+There are several ways to set posting amounts from CSV, useful in+different situations.+.IP "1." 3+\f[B]\f[CB]amount\f[B]\f[R] is the oldest and simplest.+Assigning to this sets the amount of the first and second postings.+In the second posting, the amount will be negated; also, if it has a+cost attached, it will be converted to cost.+.IP "2." 3+\f[B]\f[CB]amount\-in\f[B]\f[R] and \f[B]\f[CB]amount\-out\f[B]\f[R]+work exactly like the above, but should be used when the CSV has two+amount fields (such as \(dqDebit\(dq and \(dqCredit\(dq, or+\(dqInflow\(dq and \(dqOutflow\(dq).+Whichever field has a non\-zero value will be used as the amount of the+first and second postings.+Here are some tips to avoid confusion:+.RS 4+.IP \(bu 2+It\(aqs not \(dqamount\-in for posting 1 and amount\-out for posting+2\(dq, it is \(dqextract a single amount from the amount\-in or+amount\-out field, and use that for posting 1 and (negated) for posting+2\(dq.+.IP \(bu 2+Don\(aqt use both \f[CR]amount\f[R] and+\f[CR]amount\-in\f[R]/\f[CR]amount\-out\f[R] in the same rules file;+choose based on whether the amount is in a single CSV field or spread+across two fields.+.IP \(bu 2+In each record, at most one of the two CSV fields should contain a+non\-zero amount; the other field must contain a zero or nothing.+.IP \(bu 2+hledger assumes both CSV fields contain unsigned numbers, and it+automatically negates the amount\-out values.+.IP \(bu 2+If the data doesn\(aqt fit these requirements, you\(aqll probably need+an if rule (see below).+.RE+.IP "3." 3+\f[B]\f[CB]amountN\f[B]\f[R] (where N is a number from 1 to 99) sets the+amount of only a single posting: the Nth posting in the transaction.+You\(aqll usually need at least two such assignments to make a balanced+transaction.+You can also generate more than two postings, to represent more complex+transactions.+The posting numbers don\(aqt have to be consecutive; with if rules,+higher posting numbers can be useful to ensure a certain order of+postings.+.IP "4." 3+\f[B]\f[CB]amountN\-in\f[B]\f[R] and \f[B]\f[CB]amountN\-out\f[B]\f[R]+work exactly like the above, but should be used when the CSV has two+amount fields.+This is analogous to \f[CR]amount\-in\f[R] and \f[CR]amount\-out\f[R],+and those tips also apply here.+.IP "5." 3+Remember that a \f[CR]fields\f[R] list can also do assignments.+So in a fields list if you name a CSV field \(dqamount\(dq, that counts+as assigning to \f[CR]amount\f[R].+(If you don\(aqt want that, call it something else in the fields list,+like \(dqamount_\(dq.)+.IP "6." 3+The above don\(aqt handle every situation; if you need more flexibility,+use an \f[CR]if\f[R] rule to set amounts conditionally.+See \(dqWorking with CSV > Setting amounts\(dq below for more on this+and on amount\-setting generally.+.SS currency field+\f[CR]currency\f[R] sets a currency symbol, to be prepended to all+postings\(aq amounts.+You can use this if the CSV amounts do not have a currency symbol, eg if+it is in a separate column.+.PP+\f[CR]currencyN\f[R] prepends a currency symbol to just the Nth+posting\(aqs amount.+.SS balance field+\f[CR]balanceN\f[R] sets a balance assertion amount (or if the posting+amount is left empty, a balance assignment) on posting N.+.PP+\f[CR]balance\f[R] is a compatibility spelling for hledger <1.17; it is+equivalent to \f[CR]balance1\f[R].+.PP+You can adjust the type of assertion/assignment with the+\f[CR]balance\-type\f[R] rule (see below).+.PP+See the Working with CSV tips below for more about setting amounts and+currency.+.SS \f[CR]if\f[R] block+Rules can be applied conditionally, depending on patterns in the CSV+data.+This allows flexibility; in particular, it is how you can categorise+transactions, selecting an appropriate account name based on their+description (for example).+There are two ways to write conditional rules: \(dqif blocks\(dq,+described here, and \(dqif tables\(dq, described below.+.PP+An if block is the word \f[CR]if\f[R] and one or more \(dqmatcher\(dq+expressions (can be a word or phrase), one per line, starting either on+the same or next line; followed by one or more indented rules.+Eg,+.IP+.EX+if MATCHER+ RULE+.EE+.PP+or+.IP+.EX+if+MATCHER+MATCHER+MATCHER+ RULE+ RULE+.EE+.PP+If any of the matchers succeeds, all of the indented rules will be+applied.+They are usually field assignments, but the following special rules may+also be used within an if block:+.IP \(bu 2+\f[CR]skip\f[R] \- skips the matched CSV record (generating no+transaction from it)+.IP \(bu 2+\f[CR]end\f[R] \- skips the rest of the current CSV file.+.PP+Some examples:+.IP+.EX+# if the record contains \(dqgroceries\(dq, set account2 to \(dqexpenses:groceries\(dq+if groceries+ account2 expenses:groceries+.EE+.IP+.EX+# if the record contains any of these phrases, set account2 and a transaction comment as shown+if+monthly service fee+atm transaction fee+banking thru software+ account2 expenses:business:banking+ comment XXX deductible ? check it+.EE+.IP+.EX+# if an empty record is seen (assuming five fields), ignore the rest of the CSV file+if ,,,,+ end+.EE+.SS Matchers+There are two kinds of matcher:+.IP "1." 3+A whole record matcher is simplest: it is just a word, single\-line text+fragment, or other regular expression, which hledger will try to match+case\-insensitively anywhere within the CSV record.+.PD 0+.P+.PD+Eg: \f[CR]whole foods\f[R].+.IP "2." 3+A field matcher has a percent\-prefixed CSV field number or name before+the pattern.+.PD 0+.P+.PD+Eg: \f[CR]%3 whole foods\f[R] or \f[CR]%description whole foods\f[R].+.PD 0+.P+.PD+hledger will try to match the pattern just within the named CSV field.+.PP+When using these, there\(aqs two things to be aware of:+.IP "1." 3+Whole record matchers don\(aqt see the exact original record; they see a+reconstruction of it, in which values are comma\-separated, and quotes+enclosing values and whitespace outside those quotes are removed.+.PD 0+.P+.PD+Eg when reading an SSV record like:+\f[CR]2023\-01\-01 ; \(dqAcme, Inc. \(dq ; 1,000\f[R]+.PD 0+.P+.PD+the whole record matcher sees instead:+\f[CR]2023\-01\-01,Acme, Inc. ,1,000\f[R]+.IP "2." 3+Field matchers expect either a CSV field number, or a CSV field name+declared with \f[CR]fields\f[R].+Anything else will cause it to match against the empty string, and+probably fail silently (this makes it easier to reuse common rules with+different CSV files).+Don\(aqt use a hledger field name here (see CSV fields and hledger+fields).+.PP+You can also prefix a matcher with \f[CR]!\f[R] (and optional space) to+negate it.+Eg \f[CR]! whole foods\f[R], \f[CR]! %3 whole foods\f[R],+\f[CR]!%description whole foods\f[R] will match if \(dqwhole foods\(dq+is NOT present.+\f[I]Added in 1.32.\f[R]+.PP+The pattern is, as usual in hledger, a POSIX extended regular expression+that also supports GNU word boundaries (\f[CR]\(rsb\f[R],+\f[CR]\(rsB\f[R], \f[CR]\(rs<\f[R], \f[CR]\(rs>\f[R]) and nothing else.+For more details and tips, see Regular expressions in CSV rules below.+.SS Multiple matchers+When an if block has multiple matchers, each on its own line,+.IP \(bu 2+By default they are OR\(aqd (any of them can match).+.IP \(bu 2+Matcher lines beginning with \f[CR]&\f[R] (or \f[CR]&&\f[R], \f[I]since+1.42\f[R]) are AND\(aqed with the matcher above (all in the AND\(aqed+group must match).+.IP \(bu 2+Matcher lines beginning with \f[CR]& !\f[R] (\f[I]since 1.41\f[R], or+\f[CR]&& !\f[R], \f[I]since 1.42\f[R]) are first negated and then+AND\(aqed with the matcher above.+.PP+You can also combine multiple matchers one the same line separated by+\f[CR]&&\f[R] (AND) or \f[CR]&& !\f[R] (AND NOT).+Eg \f[CR]%description amazon && %date 2025\-01\-01\f[R] will match only+when the description field contains \(dqamazon\(dq and the date field+contains \(dq2025\-01\-01\(dq.+\f[I]Added in 1.42.\f[R]+.SS Match groups+\f[I]Added in 1.32\f[R]+.PP+Matchers can define match groups: parenthesised portions of the regular+expression which are available for reference in field assignments.+Groups are enclosed in regular parentheses (\f[CR](\f[R] and+\f[CR])\f[R]) and can be nested.+Each group is available in field assignments using the token+\f[CR]\(rsN\f[R], where N is an index into the match groups for this+conditional block (e.g.+\f[CR]\(rs1\f[R], \f[CR]\(rs2\f[R], etc.).+.PP+Example: Warp credit card payment postings to the beginning of the+billing period (Month start), to match how they are presented in+statements, using posting dates:+.IP+.EX+if %date (....\-..)\-..+ comment2 date:\(rs1\-01+.EE+.PP+Another example: Read the expense account from the CSV field, but throw+away a prefix:+.IP+.EX+if %account1 liabilities:family:(expenses:.*)+ account1 \(rs1+.EE+.SS \f[CR]if\f[R] table+\(dqif tables\(dq are an alternative to if blocks; they can express many+matchers and field assignments in a more compact tabular format, like+this:+.IP+.EX+if,HLEDGERFIELD1,HLEDGERFIELD2,...+MATCHERA,VALUE1,VALUE2,...+MATCHERB && MATCHERC,VALUE1,VALUE2,... (*since 1.42*)+; Comment line that explains MATCHERD+MATCHERD,VALUE1,VALUE2,...+<empty line>+.EE+.PP+The first character after \f[CR]if\f[R] is taken to be this if+table\(aqs field separator.+It is unrelated to the separator used in the CSV file.+It should be a non\-alphanumeric character like \f[CR],\f[R] or+\f[CR]|\f[R] that does not appear anywhere else in the table (it should+not be used in field names or matchers or values, and it cannot be+escaped with a backslash).+.PP+Each line must contain the same number of separators; empty values are+allowed.+Whitespace can be used in the matcher lines for readability (but not in+the if line, currently).+You can use the comment lines in the table body.+The table must be terminated by an empty line (or end of file).+.PP+An if table like the above is interpreted as follows: try all of the+lines with matchers; whenever a line with matchers succeeds, assign all+of the values on that line to the corresponding hledger fields; If+multiple lines match, later lines will override fields assigned by the+earlier ones \- just like the sequence of \f[CR]if\f[R] blocks would+behave.+.PP+If table presented above is equivalent to this sequence of if blocks:+.IP+.EX+if MATCHERA+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++if MATCHERB && MATCHERC+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++; Comment line which explains MATCHERD+if MATCHERD+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...+.EE+.PP+Example:+.IP+.EX+if,account2,comment+atm transaction fee,expenses:business:banking,deductible? check it+%description groceries,expenses:groceries,+;; Comment line that desribes why this particular date is special+2023/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call\-out+.EE+.SS \f[CR]balance\-type\f[R]+Balance assertions generated by assigning to balanceN are of the simple+\f[CR]=\f[R] type by default, which is a single\-commodity,+subaccount\-excluding assertion.+You may find the subaccount\-including variants more useful, eg if you+have created some virtual subaccounts of checking to help with+budgeting.+You can select a different type of assertion with the+\f[CR]balance\-type\f[R] rule:+.IP+.EX+# balance assertions will consider all commodities and all subaccounts+balance\-type ==*+.EE+.PP+Here are the balance assertion types for quick reference:+.IP+.EX+= single commodity, exclude subaccounts+=* single commodity, include subaccounts+== multi commodity, exclude subaccounts+==* multi commodity, include subaccounts+.EE+.SS \f[CR]include\f[R]+.IP+.EX+include RULESFILE+.EE+.PP+This includes the contents of another CSV rules file at this point.+\f[CR]RULESFILE\f[R] is an absolute file path or a path relative to the+current file\(aqs directory.+This can be useful for sharing common rules between several rules files,+eg:+.IP+.EX+# someaccount.csv.rules++## someaccount\-specific rules+fields date,description,amount+account1 assets:someaccount+account2 expenses:misc++## common rules+include categorisation.rules+.EE+.SS Working with CSV+Some tips:+.SS Rapid feedback+It\(aqs a good idea to get rapid feedback while creating/troubleshooting+CSV rules.+Here\(aqs a good way, using entr from eradman.com/entrproject:+.IP+.EX+$ ls foo.csv* | entr bash \-c \(aqecho \-\-\-\-; hledger \-f foo.csv print desc:SOMEDESC\(aq+.EE+.PP+A desc: query (eg) is used to select just one, or a few, transactions of+interest.+\(dqbash \-c\(dq is used to run multiple commands, so we can echo a+separator each time the command re\-runs, making it easier to read the+output.+.SS Valid CSV+Note that hledger will only accept valid CSV conforming to RFC 4180, and+equivalent SSV and TSV formats (like RFC 4180 but with semicolon or tab+as separators).+This means, eg:+.IP \(bu 2+Values may be enclosed in double quotes, or not.+Enclosing in single quotes is not allowed.+(Eg \f[CR]\(aqA\(aq,\(aqB\(aq\f[R] is rejected.)+.IP \(bu 2+When values are enclosed in double quotes, spaces outside the quotes are+not allowed.+(Eg \f[CR]\(dqA\(dq, \(dqB\(dq\f[R] is rejected.)+.IP \(bu 2+When values are not enclosed in quotes, they may not contain double+quotes.+(Eg \f[CR]A\(dqA, B\f[R] is rejected.)+.PP+If your CSV/SSV/TSV is not valid in this sense, you\(aqll need to+transform it before reading with hledger.+Try using sed, or a more permissive CSV parser like python\(aqs csv lib.+.SS File Extension+To help hledger choose the CSV file reader and show the right error+messages (and choose the right field separator character by default),+it\(aqs best if CSV/SSV/TSV files are named with a \f[CR].csv\f[R],+\f[CR].ssv\f[R] or \f[CR].tsv\f[R] filename extension.+(More about this at Data formats.)+.PP+When reading files with the \(dqwrong\(dq extension, you can ensure the+CSV reader (and the default field separator) by prefixing the file path+with \f[CR]csv:\f[R], \f[CR]ssv:\f[R] or \f[CR]tsv:\f[R]: Eg:+.IP+.EX+$ hledger \-f ssv:foo.dat print+.EE+.PP+You can also override the default field separator with a separator rule+if needed.+.SS Reading CSV from standard input+You\(aqll need the file format prefix when reading CSV from stdin also,+since hledger assumes journal format by default.+Eg:+.IP+.EX+$ cat foo.dat | hledger \-f ssv:\- print+.EE+.SS Reading multiple CSV files+If you use multiple \f[CR]\-f\f[R] options to read multiple CSV files at+once, hledger will look for a correspondingly\-named rules file for each+CSV file.+But if you specify a rules file with \f[CR]\-\-rules\f[R], that rules+file will be used for all the CSV files.+.SS Reading files specified by rule+Instead of specifying a CSV file in the command line, you can specify a+rules file, as in \f[CR]hledger \-f foo.csv.rules CMD\f[R].+By default this will read data from foo.csv in the same directory, but+you can add a source rule to specify a different data file, perhaps+located in your web browser\(aqs download directory.+.PP+This feature was added in hledger 1.30, so you won\(aqt see it in most+CSV rules examples.+But it helps remove some of the busywork of managing CSV downloads.+Most of your financial institutions\(aqs default CSV filenames are+different and can be recognised by a glob pattern.+So you can put a rule like \f[CR]source Checking1*.csv\f[R] in+foo\-checking.csv.rules, and then periodically follow a workflow like:+.IP "1." 3+Download CSV from Foo\(aqs website, using your browser\(aqs defaults+.IP "2." 3+Run \f[CR]hledger import foo\-checking.csv.rules\f[R] to import any new+transactions+.PP+After import, you can: discard the CSV, or leave it where it is for a+while, or move it into your archives, as you prefer.+If you do nothing, next time your browser will save something like+Checking1\-2.csv, and hledger will use that because of the \f[CR]*\f[R]+wild card and because it is the most recent.+.SS Valid transactions+After reading a CSV file, hledger post\-processes and validates the+generated journal entries as it would for a journal file \- balancing+them, applying balance assignments, and canonicalising amount styles.+Any errors at this stage will be reported in the usual way, displaying+the problem entry.+.PP+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:+.IP+.EX+$ hledger \-f file.csv print | hledger \-f\- print+.EE+.SS Deduplicating, importing+When you download a CSV file periodically, eg to get your latest bank+transactions, the new file may overlap with the old one, containing some+of the same records.+.PP+The import command will (a) detect the new transactions, and (b) append+just those transactions to your main journal.+It is idempotent, so you don\(aqt have to remember how many times you+ran it or with which version of the CSV.+(It keeps state in a hidden \f[CR].latest.FILE.csv\f[R] file.)+This is the easiest way to import CSV data.+Eg:+.IP+.EX+# download the latest CSV files, then run this command.+# Note, no \-f flags needed here.+$ hledger import *.csv [\-\-dry]+.EE+.PP+This method works for most CSV files.+(Where records have a stable chronological order, and new records appear+only at the new end.)+.PP+A number of other tools and workflows, hledger\-specific and otherwise,+exist for converting, deduplicating, classifying and managing CSV data.+See:+.IP \(bu 2+https://hledger.org/cookbook.html#setups\-and\-workflows+.IP \(bu 2+https://plaintextaccounting.org \-> data import/conversion+.SS Regular expressions in CSV rules+Regular expressions in \f[CR]if\f[R] conditions (AKA matchers) are POSIX+extended regular expressions, that also support GNU word boundaries+(\f[CR]\(rsb\f[R], \f[CR]\(rsB\f[R], \f[CR]\(rs<\f[R],+\f[CR]\(rs>\f[R]), and nothing else.+(For more detail, see Regular expressions.)+.PP+Here are some examples that might be useful in CSV rules:+.IP \(bu 2+Is field \(dqfoo\(dq truly empty ?+\f[CR]if %foo \(ha$\f[R]+.IP \(bu 2+Is it empty or containing only whitespace ?+\f[CR]if %foo \(ha *$\f[R]+.IP \(bu 2+Is it non\-empty ?+\f[CR]if %foo .\f[R]+.IP \(bu 2+Does it contain non\-whitespace ?+\f[CR]if %foo [\(ha ]\f[R]+.PP+Testing the value of numeric fields is a little harder.+You can\(aqt use hledger queries like \f[CR]amt:0\f[R] or+\f[CR]amt:>10\f[R] in CSV rules.+But you can often achieve the same thing with a regular expression.+.PP+Note the content and layout of number fields in CSV varies, and can+change over time (eg if you switch data providers).+So numeric regexps are always somewhat specific to your particular CSV+data; and it\(aqs a good idea to make them defensive and robust if you+can.+.PP+Here are some examples:+.IP \(bu 2+Does foo contain a non\-zero number ?+\f[CR]if %foo [1\-9]\f[R]+.IP \(bu 2+Is it negative ?+\f[CR]if %foo \-\f[R]+.IP \(bu 2+Is it non\-negative ?+\f[CR]if ! %foo \-\f[R]+.IP \(bu 2+Is it >= 10 ?+\f[CR]if %foo [1\-9][0\-9]+\(rs.\f[R] (assuming a decimal period and no+leading zeros)+.IP \(bu 2+Is it >= 10 and < 20 ?+\f[CR]if %foo \(rsb1[0\-9]\(rs.\f[R]+.SS Setting amounts+Continuing from amount field above, here are more tips for+amount\-setting:+.IP "1." 3+\f[B]If the amount is in a single CSV field:\f[R]+.PD 0+.P+.PD+.RS 4+.IP "a." 3+\f[B]If its sign indicates direction of flow:\f[R]+.PD 0+.P+.PD+Assign it to \f[CR]amountN\f[R], to set the Nth posting\(aqs amount.+N is usually 1 or 2 but can go up to 99.+.IP "b." 3+\f[B]If another field indicates direction of flow:\f[R]+.PD 0+.P+.PD+Use one or more conditional rules to set the appropriate amount sign.+Eg:+.IP+.EX+# assume a withdrawal unless Type contains \(dqdeposit\(dq:+amount1 \-%Amount+if %Type deposit+ amount1 %Amount+.EE+.RE+.IP "2." 3+\f[B]If the amount is in two CSV fields (such as Debit and Credit, or In+and Out):\f[R]+.PD 0+.P+.PD+.RS 4+.IP "a." 3+\f[B]If both fields are unsigned:\f[R]+.PD 0+.P+.PD+Assign one field to \f[CR]amountN\-in\f[R] and the other to+\f[CR]amountN\-out\f[R].+hledger will automatically negate the \(dqout\(dq field, and will use+whichever field value is non\-zero as posting N\(aqs amount.+.IP "b." 3+\f[B]If either field is signed:\f[R]+.PD 0+.P+.PD+You will probably need to override hledger\(aqs sign for one or the+other field, as in the following example:+.IP+.EX+# Negate the \-out value, but only if it is not empty:+fields date, description, amount1\-in, amount1\-out+if %amount1\-out [1\-9]+ amount1\-out \-%amount1\-out+.EE+.IP "c." 3+\f[B]If both fields can contain a non\-zero value (or both can be+empty):\f[R]+.PD 0+.P+.PD+The \-in/\-out rules normally choose the value which is+non\-zero/non\-empty.+Some value pairs can be ambiguous, such as \f[CR]1\f[R] and+\f[CR]none\f[R].+For such cases, use conditional rules to help select the amount.+Eg, to handle the above you could select the value containing non\-zero+digits:+.IP+.EX+fields date, description, in, out+if %in [1\-9]+ amount1 %in+if %out [1\-9]+ amount1 %out+.EE+.RE+.IP "3." 3+\f[B]If you want posting 2\(aqs amount converted to cost:\f[R]+.PD 0+.P+.PD+Use the unnumbered \f[CR]amount\f[R] (or \f[CR]amount\-in\f[R] and+\f[CR]amount\-out\f[R]) syntax.+.IP "4." 3+\f[B]If the CSV has only balance amounts, not transaction amounts:\f[R]+.PD 0+.P+.PD+Assign to \f[CR]balanceN\f[R], to set a balance assignment on the Nth+posting, causing the posting\(aqs amount to be calculated automatically.+\f[CR]balance\f[R] with no number is equivalent to \f[CR]balance1\f[R].+In this situation hledger is more likely to guess the wrong default+account name, so you may need to set that explicitly.+.SS Amount signs+There is some special handling making it easier to parse and to reverse+amount signs.+(This only works for whole amounts, not for cost amounts such as COST in+\f[CR]amount1 AMT \(at COST\f[R]):+.IP \(bu 2+\f[B]If an amount value begins with a plus sign:\f[R]+.PD 0+.P+.PD+that will be removed: \f[CR]+AMT\f[R] becomes \f[CR]AMT\f[R]+.IP \(bu 2+\f[B]If an amount value is parenthesised:\f[R]+.PD 0+.P+.PD+it will be de\-parenthesised and sign\-flipped: \f[CR](AMT)\f[R] becomes+\f[CR]\-AMT\f[R]+.IP \(bu 2+\f[B]If an amount value has two minus signs (or two sets of parentheses,+or a minus sign and parentheses):\f[R]+.PD 0+.P+.PD+they cancel out and will be removed: \f[CR]\-\-AMT\f[R] or+\f[CR]\-(AMT)\f[R] becomes \f[CR]AMT\f[R]+.IP \(bu 2+\f[B]If an amount value contains just a sign (or just a set of+parentheses):\f[R]+.PD 0+.P+.PD+that is removed, making it an empty value.+\f[CR]\(dq+\(dq\f[R] or \f[CR]\(dq\-\(dq\f[R] or \f[CR]\(dq()\(dq\f[R]+becomes \f[CR]\(dq\(dq\f[R].+.PP+It\(aqs not possible (without preprocessing the CSV) to set an amount to+its absolute value, ie discard its sign.+.SS Setting currency/commodity+If the currency/commodity symbol is included in the CSV\(aqs amount+field(s):+.IP+.EX+2023\-01\-01,foo,$123.00+.EE+.PP+you don\(aqt have to do anything special for the commodity symbol, it+will be assigned as part of the amount.+Eg:+.IP+.EX+fields date,description,amount+.EE+.IP+.EX+2023\-01\-01 foo+ expenses:unknown $123.00+ income:unknown $\-123.00+.EE+.PP+If the currency is provided as a separate CSV field:+.IP+.EX+2023\-01\-01,foo,USD,123.00+.EE+.PP+You can assign that to the \f[CR]currency\f[R] pseudo\-field, which has+the special effect of prepending itself to every amount in the+transaction (on the left, with no separating space):+.IP+.EX+fields date,description,currency,amount+.EE+.IP+.EX+2023\-01\-01 foo+ expenses:unknown USD123.00+ income:unknown USD\-123.00+.EE+.PP+Or, you can use a field assignment to construct the amount yourself,+with more control.+Eg to put the symbol on the right, and separated by a space:+.IP+.EX+fields date,description,cur,amt+amount %amt %cur+.EE+.IP+.EX+2023\-01\-01 foo+ expenses:unknown 123.00 USD+ income:unknown \-123.00 USD+.EE+.PP+Note we used a temporary field name (\f[CR]cur\f[R]) that is not+\f[CR]currency\f[R] \- that would trigger the prepending effect, which+we don\(aqt want here.+.SS Amount decimal places+When you are reading CSV data, eg with a command like+\f[CR]hledger \-f foo.csv print\f[R], hledger will infer each+commodity\(aqs decimal precision (and other commodity display styles)+from the amounts \- much as when reading a journal file without+\f[CR]commodity\f[R] directives (see the link).+.PP+Note, the commodity styles are not inferred from the numbers in the+original CSV data; rather, they are inferred from the amounts generated+by the CSV rules.+.PP+When you are importing CSV data with the \f[CR]import\f[R] command, eg+\f[CR]hledger import foo.csv\f[R], there\(aqs another step:+\f[CR]import\f[R] tries to make the new entries conform to the+journal\(aqs existing styles.+So for each commodity \- let\(aqs say it\(aqs EUR \- \f[CR]import\f[R]+will choose:+.IP "1." 3+the style declared for EUR by a \f[CR]commodity\f[R] directive in the+journal+.IP "2." 3+otherwise, the style inferred from EUR amounts in the journal+.IP "3." 3+otherwise, the style inferred from EUR amounts generated by the CSV+rules.+.PP+TLDR: if \f[CR]import\f[R] is not generating the precisions or styles+you want, add a \f[CR]commodity\f[R] directive to specify them.+.SS Referencing other fields+In field assignments, you can interpolate only CSV fields, not hledger+fields.+In the example below, there\(aqs both a CSV field and a hledger field+named amount1, but %amount1 always means the CSV field, not the hledger+field:+.IP+.EX+# Name the third CSV field \(dqamount1\(dq+fields date,description,amount1++# Set hledger\(aqs amount1 to the CSV amount1 field followed by USD+amount1 %amount1 USD++# Set comment to the CSV amount1 (not the amount1 assigned above)+comment %amount1+.EE+.PP+Here, since there\(aqs no CSV amount1 field, %amount1 will produce a+literal \(dqamount1\(dq:+.IP+.EX+fields date,description,csvamount+amount1 %csvamount USD+# Can\(aqt interpolate amount1 here+comment %amount1+.EE+.PP+When there are multiple field assignments to the same hledger field,+only the last one takes effect.+Here, comment\(aqs value will be be B, or C if \(dqsomething\(dq is+matched, but never A:+.IP+.EX+comment A+comment B+if something+ comment C+.EE+.SS How CSV rules are evaluated+Here\(aqs how to think of CSV rules being evaluated.+If you get a confusing error while reading a CSV file, it may help to+try to understand which of these steps is failing:+.IP "1." 3+Any included rules files are inlined, from top to bottom, depth first+(scanning each included file for further includes, recursively, before+proceeding).+.IP "2." 3+Top level rules (\f[CR]date\-format\f[R], \f[CR]fields\f[R],+\f[CR]newest\-first\f[R], \f[CR]skip\f[R] etc) are read, top to bottom.+\(dqTop level rules\(dq means non\-conditional rules.+If a rule occurs more than once, the last one wins; except for+\f[CR]skip\f[R]/\f[CR]end\f[R] rules, where the first one wins.+.IP "3." 3+The CSV file is read as text.+Any non\-ascii characters will be decoded using the text encoding+specified by the \f[CR]encoding\f[R] rule, otherwise the system+locale\(aqs text encoding.+.IP "4." 3+Any top\-level skip or end rule is applied.+\f[CR]skip [N]\f[R] immediately skips the current or next N CSV records;+\f[CR]end\f[R] immediately skips all remaining CSV records (not normally+used at top level).+.IP "5." 3+Now any remaining CSV records are processed.+For each CSV record, in file order:+.RS 4+.IP \(bu 2+Is there a conditional skip/end rule that applies for this record ?+Search the \f[CR]if\f[R] blocks, from top to bottom, for a succeeding+one containing a \f[CR]skip\f[R] or \f[CR]end\f[R] rule.+If found, skip the specified number of CSV records, then continue at 5.+.PD 0+.P+.PD+Otherwise...+.IP \(bu 2+Do some basic validation on this CSV record (eg, check that it has at+least two fields).+.IP \(bu 2+For each hledger field (\f[CR]date\f[R], \f[CR]description\f[R],+\f[CR]account1\f[R], etc.):+.RS 2+.IP "1." 3+Get the field\(aqs assigned value, first searching top level+assignments, made directly or by the \f[CR]fields\f[R] rule, then+assignments made inside succeeding \f[CR]if\f[R] blocks.+If there are more than one, the last one wins.+.IP "2." 3+Compute the field\(aqs actual value (as text), by interpolating any+%CSVFIELD references within the assigned value; or by choosing a default+value if there was no assignment.+.RE+.IP \(bu 2+Generate a hledger transaction from the hledger field values, parsing+them if needed (eg from text to an amount).+.RE+.PP+This is all done by the CSV reader, one of several readers hledger can+use to read transactions from an input file.+When all input files have been read successfully, their transactions are+passed to whichever hledger command the user specified.+.SS Well factored rules+Some things than can help reduce duplication and complexity in rules+files:+.IP \(bu 2+Extracting common rules usable with multiple CSV files into a+\f[CR]common.rules\f[R], and adding \f[CR]include common.rules\f[R] to+each CSV\(aqs rules file.+.IP \(bu 2+Splitting if blocks into smaller if blocks, extracting the frequently+used parts.+.SS CSV rules examples+.SS Bank of Ireland+Here\(aqs a CSV with two amount fields (Debit and Credit), and a balance+field, which we can use to add balance assertions, which is not+necessary but provides extra error checking:+.IP+.EX+Date,Details,Debit,Credit,Balance+07/12/2012,LODGMENT 529898,,10.0,131.21+07/12/2012,PAYMENT,5,,126+.EE+.IP+.EX+# bankofireland\-checking.csv.rules++# skip the header line+skip++# name the csv fields, and assign some of them as journal entry fields+fields date, description, amount\-out, amount\-in, balance++# We generate balance assertions by assigning to \(dqbalance\(dq+# above, but you may sometimes need to remove these because:+#+# \- the CSV balance differs from the true balance,+# by up to 0.0000000000005 in my experience+#+# \- it is sometimes calculated based on non\-chronological ordering,+# eg when multiple transactions clear on the same day++# date is in UK/Ireland format+date\-format %d/%m/%Y++# set the currency+currency EUR++# set the base account for all txns+account1 assets:bank:boi:checking+.EE+.IP+.EX+$ hledger \-f bankofireland\-checking.csv print+2012\-12\-07 LODGMENT 529898+ assets:bank:boi:checking EUR10.0 = EUR131.2+ income:unknown EUR\-10.0++2012\-12\-07 PAYMENT+ assets:bank:boi:checking EUR\-5.0 = EUR126.0+ expenses:unknown EUR5.0+.EE+.PP+The balance assertions don\(aqt raise an error above, because we\(aqre+reading directly from CSV, but they will be checked if these entries are+imported into a journal file.+.SS Coinbase+A simple example with some CSV from Coinbase.+The spot price is recorded using cost notation.+The legacy \f[CR]amount\f[R] field name conveniently sets amount 2+(posting 2\(aqs amount) to the total cost.+.IP+.EX+# Timestamp,Transaction Type,Asset,Quantity Transacted,Spot Price Currency,Spot Price at Transaction,Subtotal,Total (inclusive of fees and/or spread),Fees and/or Spread,Notes+# 2021\-12\-30T06:57:59Z,Receive,USDC,100,GBP,0.740000,\(dq\(dq,\(dq\(dq,\(dq\(dq,\(dqReceived 100.00 USDC from an external account\(dq+.EE+.IP+.EX+# coinbase.csv.rules+skip 1+fields Timestamp,Transaction_Type,Asset,Quantity_Transacted,Spot_Price_Currency,Spot_Price_at_Transaction,Subtotal,Total,Fees_Spread,Notes+date %Timestamp+date\-format %Y\-%m\-%dT%T%Z+description %Notes+account1 assets:coinbase:cc+amount %Quantity_Transacted %Asset \(at %Spot_Price_at_Transaction %Spot_Price_Currency+.EE+.IP+.EX+$ hledger print \-f coinbase.csv+2021\-12\-30 Received 100.00 USDC from an external account+ assets:coinbase:cc 100 USDC \(at 0.740000 GBP+ income:unknown \-74.000000 GBP+.EE+.SS Amazon+Here we convert amazon.com order history, and use an if block to+generate a third posting if there\(aqs a fee.+(In practice you\(aqd probably get this data from your bank instead, but+it\(aqs an example.)+.IP+.EX+\(dqDate\(dq,\(dqType\(dq,\(dqTo/From\(dq,\(dqName\(dq,\(dqStatus\(dq,\(dqAmount\(dq,\(dqFees\(dq,\(dqTransaction ID\(dq+\(dqJul 29, 2012\(dq,\(dqPayment\(dq,\(dqTo\(dq,\(dqFoo.\(dq,\(dqCompleted\(dq,\(dq$20.00\(dq,\(dq$0.00\(dq,\(dq16000000000000DGLNJPI1P9B8DKPVHL\(dq+\(dqJul 30, 2012\(dq,\(dqPayment\(dq,\(dqTo\(dq,\(dqAdapteva, Inc.\(dq,\(dqCompleted\(dq,\(dq$25.00\(dq,\(dq$1.00\(dq,\(dq17LA58JSKRD4HDGLNJPI1P9B8DKPVHL\(dq+.EE+.IP+.EX+# amazon\-orders.csv.rules++# skip one header line+skip 1++# name the csv fields, and assign the transaction\(aqs date, amount and code.+# Avoided the \(dqstatus\(dq and \(dqamount\(dq hledger field names to prevent confusion.+fields date, _, toorfrom, name, amzstatus, amzamount, fees, code++# how to parse the date+date\-format %b %\-d, %Y++# combine two fields to make the description+description %toorfrom %name++# save the status as a tag+comment status:%amzstatus++# set the base account for all transactions+account1 assets:amazon+# leave amount1 blank so it can balance the other(s).+# I\(aqm assuming amzamount excludes the fees, don\(aqt remember++# set a generic account2+account2 expenses:misc+amount2 %amzamount+# and maybe refine it further:+#include categorisation.rules++# add a third posting for fees, but only if they are non\-zero.+if %fees [1\-9]+ account3 expenses:fees+ amount3 %fees+.EE+.IP+.EX+$ hledger \-f amazon\-orders.csv print+2012\-07\-29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo. ; status:Completed+ assets:amazon+ expenses:misc $20.00++2012\-07\-30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc. ; status:Completed+ assets:amazon+ expenses:misc $25.00+ expenses:fees $1.00+.EE+.SS Paypal+Here\(aqs a real\-world rules file for (customised) Paypal CSV, with+some Paypal\-specific rules, and a second rules file included:+.IP+.EX+\(dqDate\(dq,\(dqTime\(dq,\(dqTimeZone\(dq,\(dqName\(dq,\(dqType\(dq,\(dqStatus\(dq,\(dqCurrency\(dq,\(dqGross\(dq,\(dqFee\(dq,\(dqNet\(dq,\(dqFrom Email Address\(dq,\(dqTo Email Address\(dq,\(dqTransaction ID\(dq,\(dqItem Title\(dq,\(dqItem ID\(dq,\(dqReference Txn ID\(dq,\(dqReceipt ID\(dq,\(dqBalance\(dq,\(dqNote\(dq+\(dq10/01/2019\(dq,\(dq03:46:20\(dq,\(dqPDT\(dq,\(dqCalm Radio\(dq,\(dqSubscription Payment\(dq,\(dqCompleted\(dq,\(dqUSD\(dq,\(dq\-6.99\(dq,\(dq0.00\(dq,\(dq\-6.99\(dq,\(dqsimon\(atjoyful.com\(dq,\(dqmemberships\(atcalmradio.com\(dq,\(dq60P57143A8206782E\(dq,\(dqMONTHLY \- $1 for the first 2 Months: Me \- Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month\(dq,\(dq\(dq,\(dqI\-R8YLY094FJYR\(dq,\(dq\(dq,\(dq\-6.99\(dq,\(dq\(dq+\(dq10/01/2019\(dq,\(dq03:46:20\(dq,\(dqPDT\(dq,\(dq\(dq,\(dqBank Deposit to PP Account \(dq,\(dqPending\(dq,\(dqUSD\(dq,\(dq6.99\(dq,\(dq0.00\(dq,\(dq6.99\(dq,\(dq\(dq,\(dqsimon\(atjoyful.com\(dq,\(dq0TU1544T080463733\(dq,\(dq\(dq,\(dq\(dq,\(dq60P57143A8206782E\(dq,\(dq\(dq,\(dq0.00\(dq,\(dq\(dq+\(dq10/01/2019\(dq,\(dq08:57:01\(dq,\(dqPDT\(dq,\(dqPatreon\(dq,\(dqPreApproved Payment Bill User Payment\(dq,\(dqCompleted\(dq,\(dqUSD\(dq,\(dq\-7.00\(dq,\(dq0.00\(dq,\(dq\-7.00\(dq,\(dqsimon\(atjoyful.com\(dq,\(dqsupport\(atpatreon.com\(dq,\(dq2722394R5F586712G\(dq,\(dqPatreon* Membership\(dq,\(dq\(dq,\(dqB\-0PG93074E7M86381M\(dq,\(dq\(dq,\(dq\-7.00\(dq,\(dq\(dq+\(dq10/01/2019\(dq,\(dq08:57:01\(dq,\(dqPDT\(dq,\(dq\(dq,\(dqBank Deposit to PP Account \(dq,\(dqPending\(dq,\(dqUSD\(dq,\(dq7.00\(dq,\(dq0.00\(dq,\(dq7.00\(dq,\(dq\(dq,\(dqsimon\(atjoyful.com\(dq,\(dq71854087RG994194F\(dq,\(dqPatreon* Membership\(dq,\(dq\(dq,\(dq2722394R5F586712G\(dq,\(dq\(dq,\(dq0.00\(dq,\(dq\(dq+\(dq10/19/2019\(dq,\(dq03:02:12\(dq,\(dqPDT\(dq,\(dqWikimedia Foundation, Inc.\(dq,\(dqSubscription Payment\(dq,\(dqCompleted\(dq,\(dqUSD\(dq,\(dq\-2.00\(dq,\(dq0.00\(dq,\(dq\-2.00\(dq,\(dqsimon\(atjoyful.com\(dq,\(dqtle\(atwikimedia.org\(dq,\(dqK9U43044RY432050M\(dq,\(dqMonthly donation to the Wikimedia Foundation\(dq,\(dq\(dq,\(dqI\-R5C3YUS3285L\(dq,\(dq\(dq,\(dq\-2.00\(dq,\(dq\(dq+\(dq10/19/2019\(dq,\(dq03:02:12\(dq,\(dqPDT\(dq,\(dq\(dq,\(dqBank Deposit to PP Account \(dq,\(dqPending\(dq,\(dqUSD\(dq,\(dq2.00\(dq,\(dq0.00\(dq,\(dq2.00\(dq,\(dq\(dq,\(dqsimon\(atjoyful.com\(dq,\(dq3XJ107139A851061F\(dq,\(dq\(dq,\(dq\(dq,\(dqK9U43044RY432050M\(dq,\(dq\(dq,\(dq0.00\(dq,\(dq\(dq+\(dq10/22/2019\(dq,\(dq05:07:06\(dq,\(dqPDT\(dq,\(dqNoble Benefactor\(dq,\(dqSubscription Payment\(dq,\(dqCompleted\(dq,\(dqUSD\(dq,\(dq10.00\(dq,\(dq\-0.59\(dq,\(dq9.41\(dq,\(dqnoble\(atbene.fac.tor\(dq,\(dqsimon\(atjoyful.com\(dq,\(dq6L8L1662YP1334033\(dq,\(dqJoyful Systems\(dq,\(dq\(dq,\(dqI\-KC9VBGY2GWDB\(dq,\(dq\(dq,\(dq9.41\(dq,\(dq\(dq+.EE+.IP+.EX+# paypal\-custom.csv.rules++# Tips:+# Export from Activity \-> Statements \-> Custom \-> Activity download+# Suggested transaction type: \(dqBalance affecting\(dq+# Paypal\(aqs default fields in 2018 were:+# \(dqDate\(dq,\(dqTime\(dq,\(dqTimeZone\(dq,\(dqName\(dq,\(dqType\(dq,\(dqStatus\(dq,\(dqCurrency\(dq,\(dqGross\(dq,\(dqFee\(dq,\(dqNet\(dq,\(dqFrom Email Address\(dq,\(dqTo Email Address\(dq,\(dqTransaction ID\(dq,\(dqShipping Address\(dq,\(dqAddress Status\(dq,\(dqItem Title\(dq,\(dqItem ID\(dq,\(dqShipping and Handling Amount\(dq,\(dqInsurance Amount\(dq,\(dqSales Tax\(dq,\(dqOption 1 Name\(dq,\(dqOption 1 Value\(dq,\(dqOption 2 Name\(dq,\(dqOption 2 Value\(dq,\(dqReference Txn ID\(dq,\(dqInvoice Number\(dq,\(dqCustom Number\(dq,\(dqQuantity\(dq,\(dqReceipt ID\(dq,\(dqBalance\(dq,\(dqAddress Line 1\(dq,\(dqAddress Line 2/District/Neighborhood\(dq,\(dqTown/City\(dq,\(dqState/Province/Region/County/Territory/Prefecture/Republic\(dq,\(dqZip/Postal Code\(dq,\(dqCountry\(dq,\(dqContact Phone Number\(dq,\(dqSubject\(dq,\(dqNote\(dq,\(dqCountry Code\(dq,\(dqBalance Impact\(dq+# This rules file assumes the following more detailed fields, configured in \(dqCustomize report fields\(dq:+# \(dqDate\(dq,\(dqTime\(dq,\(dqTimeZone\(dq,\(dqName\(dq,\(dqType\(dq,\(dqStatus\(dq,\(dqCurrency\(dq,\(dqGross\(dq,\(dqFee\(dq,\(dqNet\(dq,\(dqFrom Email Address\(dq,\(dqTo Email Address\(dq,\(dqTransaction ID\(dq,\(dqItem Title\(dq,\(dqItem ID\(dq,\(dqReference Txn ID\(dq,\(dqReceipt ID\(dq,\(dqBalance\(dq,\(dqNote\(dq++fields date, time, timezone, description_, type, status_, currency, grossamount, feeamount, netamount, fromemail, toemail, code, itemtitle, itemid, referencetxnid, receiptid, balance, note++skip 1++date\-format %\-m/%\-d/%Y++# ignore some paypal events+if+In Progress+Temporary Hold+Update to+ skip++# add more fields to the description+description %description_ %itemtitle++# save some other fields as tags+comment itemid:%itemid, fromemail:%fromemail, toemail:%toemail, time:%time, type:%type, status:%status_++# convert to short currency symbols+if %currency USD+ currency $+if %currency EUR+ currency E+if %currency GBP+ currency P++# generate postings++# the first posting will be the money leaving/entering my paypal account+# (negative means leaving my account, in all amount fields)+account1 assets:online:paypal+amount1 %netamount++# the second posting will be money sent to/received from other party+# (account2 is set below)+amount2 \-%grossamount++# if there\(aqs a fee, add a third posting for the money taken by paypal.+if %feeamount [1\-9]+ account3 expenses:banking:paypal+ amount3 \-%feeamount+ comment3 business:++# choose an account for the second posting++# override the default account names:+# if the amount is positive, it\(aqs income (a debit)+if %grossamount \(ha[\(ha\-]+ account2 income:unknown+# if negative, it\(aqs an expense (a credit)+if %grossamount \(ha\-+ account2 expenses:unknown++# apply common rules for setting account2 & other tweaks+include common.rules++# apply some overrides specific to this csv++# Transfers from/to bank. These are usually marked Pending,+# which can be disregarded in this case.+if+Bank Account+Bank Deposit to PP Account+ description %type for %referencetxnid %itemtitle+ account2 assets:bank:wf:pchecking+ account1 assets:online:paypal++# Currency conversions+if Currency Conversion+ account2 equity:currency conversion+.EE+.IP+.EX+# common.rules++if+darcs+noble benefactor+ account2 revenues:foss donations:darcshub+ comment2 business:++if+Calm Radio+ account2 expenses:online:apps++if+electronic frontier foundation+Patreon+wikimedia+Advent of Code+ account2 expenses:dues++if Google+ account2 expenses:online:apps+ description google | music+.EE+.IP+.EX+$ 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\(atjoyful.com, toemail:memberships\(atcalmradio.com, time:03:46:20, type:Subscription Payment, status:Completed+ assets:online:paypal $\-6.99 = $\-6.99+ expenses:online:apps $6.99++2019\-10\-01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E ; itemid:, fromemail:, toemail:simon\(atjoyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $6.99 = $0.00+ assets:bank:wf:pchecking $\-6.99++2019\-10\-01 (2722394R5F586712G) Patreon Patreon* Membership ; itemid:, fromemail:simon\(atjoyful.com, toemail:support\(atpatreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed+ assets:online:paypal $\-7.00 = $\-7.00+ expenses:dues $7.00++2019\-10\-01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership ; itemid:, fromemail:, toemail:simon\(atjoyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $7.00 = $0.00+ assets:bank:wf:pchecking $\-7.00++2019\-10\-19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation ; itemid:, fromemail:simon\(atjoyful.com, toemail:tle\(atwikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed+ assets:online:paypal $\-2.00 = $\-2.00+ expenses:dues $2.00+ expenses:banking:paypal ; business:++2019\-10\-19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M ; itemid:, fromemail:, toemail:simon\(atjoyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $2.00 = $0.00+ assets:bank:wf:pchecking $\-2.00++2019\-10\-22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems ; itemid:, fromemail:noble\(atbene.fac.tor, toemail:simon\(atjoyful.com, time:05:07:06, type:Subscription Payment, status:Completed+ assets:online:paypal $9.41 = $9.41+ revenues:foss donations:darcshub $\-10.00 ; business:+ expenses:banking:paypal $0.59 ; business:+.EE+.PP+.SH Timeclock+hledger can read time logs in the timeclock time logging format of+timeclock.el.+As with Ledger, hledger\(aqs timeclock format is a subset/variant of+timeclock.el\(aqs.+.PP+hledger\(aqs timeclock format was updated in hledger 1.43 and 1.50.+If your old time logs are rejected, you should adapt them to modern+hledger; for now, you can restore the pre\-1.43 behaviour with the+\f[CR]\-\-old\-timeclock\f[R] flag.+.PP+Here the timeclock format in hledger 1.50+:+.IP+.EX+# Comment lines like these, and blank lines, are ignored:+# comment line+; comment line+* comment line++# Lines beginning with b, h, or capital O are also ignored, for compatibility:+b SIMPLEDATE HH:MM[:SS][+\-ZZZZ][ TEXT]+h SIMPLEDATE HH:MM[:SS][+\-ZZZZ][ TEXT]+O SIMPLEDATE HH:MM[:SS][+\-ZZZZ][ TEXT]++# Lines beginning with i or o are are clock\-in / clock\-out entries:+i SIMPLEDATE HH:MM[:SS][+\-ZZZZ] ACCOUNT[ DESCRIPTION][;COMMENT]]+o SIMPLEDATE HH:MM[:SS][+\-ZZZZ][ ACCOUNT][;COMMENT]+.EE+.PP+The date is a hledger simple date (YYYY\-MM\-DD or similar).+The time parts must use two digits.+The seconds are optional.+A + or \- four\-digit time zone is accepted for compatibility, but+currently ignored; times are always interpreted as a local time.+.PP+In clock\-in entries (\f[CR]i\f[R]), the account name is required.+A transaction description, separated from the account name by 2+ spaces,+is optional.+A transaction comment, beginning with \f[CR];\f[R], is also optional.+(Indented following comment lines are also allowed, as in journal+format.)+.PP+In clock\-out entries (\f[CR]o\f[R]) have no description, but can have a+comment if you wish.+A clock\-in and clock\-out pair form a \(dqtransaction\(dq posting some+number of hours to an account \- also known as a session.+Eg:+.IP+.EX+i 2015/03/30 09:00:00 session1+o 2015/03/30 10:00:00+.EE+.IP+.EX+$ hledger \-f a.timeclock print+2015\-03\-30 * 09:00\-10:00+ (session1) 1.00h+.EE+.PP+Clock\-ins and clock\-outs are matched by their account/session name.+If a clock\-out does not specify a name, the most recent unclosed+clock\-in is closed.+You can have multiple sessions active simultaneously.+Entries are processed in the order they are parsed.+Sessions spanning more than one day are automatically split at day+boundaries.+.PP+Eg, the following time log:+.IP+.EX+i 2015/03/30 09:00:00 some account optional description after 2 spaces ; optional comment, tags:+o 2015/03/30 09:20:00+i 2015/03/31 22:21:45 another:account+o 2015/04/01 02:00:34+i 2015/04/02 12:00:00 another:account ; this demonstrates multple sessions being clocked in+i 2015/04/02 13:00:00 some account+o 2015/04/02 14:00:00+o 2015/04/02 15:00:00 another:account+.EE+.PP+generates these transactions:+.IP+.EX+$ hledger \-f t.timeclock print+2015\-03\-30 * optional description after 2 spaces ; optional comment, tags:+ (some account) 0.33h++2015\-03\-31 * 22:21\-23:59+ (another:account) 1.64h++2015\-04\-01 * 00:00\-02:00+ (another:account) 2.01h++2015\-04\-02 * 12:00\-15:00 ; this demonstrates multiple sessions being clocked in+ (another:account) 3.00h++2015\-04\-02 * 13:00\-14:00+ (some account) 1.00h+.EE+.PP+Here is a sample.timeclock to download and some queries to try:+.IP+.EX+$ 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+.EE+.PP+To generate time logs, ie to clock in and clock out, you could:+.IP \(bu 2+use these shell aliases at the command line:+.RS 2+.IP+.EX+alias ti=\(aqecho i \(gadate \(dq+%Y\-%m\-%d %H:%M:%S\(dq\(ga $* >>$TIMELOG\(aq+alias to=\(aqecho o \(gadate \(dq+%Y\-%m\-%d %H:%M:%S\(dq\(ga >>$TIMELOG\(aq+.EE+.RE+.IP \(bu 2+or Emacs\(aqs built\-in timeclock.el, or the extended timeclock\-x.el,+and perhaps the extras in ledgerutils.el+.IP \(bu 2+or use the old \f[CR]ti\f[R] and \f[CR]to\f[R] scripts in the ledger 2.x+repository.+These rely on a \(dqtimeclock\(dq executable which I think is just the+ledger 2 executable renamed.+.PP+.SH Timedot+\f[CR]timedot\f[R] format is hledger\(aqs human\-friendly time logging+format.+Compared to \f[CR]timeclock\f[R] format, it is more convenient for+quick, approximate, and retroactive time logging, and more+human\-readable (you can see at a glance where time was spent).+A quick example:+.IP+.EX+2023\-05\-01+hom:errands .... .... ; two hours; the space is ignored+fos:hledger:timedot .. ; half an hour+per:admin:finance ; no time spent yet+.EE+.PP+hledger reads this as a transaction on this day with three (unbalanced)+postings, where each dot represents \(dq0.25\(dq.+No commodity symbol is assumed, but we typically interpret it as hours.+.IP+.EX+$ hledger \-f a.timedot print # .timedot file extension (or timedot: prefix) is required+2023\-05\-01 *+ (hom:errands) 2.00 ; two hours+ (fos:hledger:timedot) 0.50 ; half an hour+ (per:admin:finance) 0+.EE+.PP+A timedot file contains a series of transactions (usually one per day).+Each begins with a \f[B]simple date\f[R] (Y\-M\-D, Y/M/D, or Y.M.D),+optionally be followed on the same line by a transaction description,+and/or a transaction comment following a semicolon.+.PP+After the date line are zero or more time postings, consisting of:+.IP \(bu 2+\f[B]An account name\f[R] \- any hledger\-style account name, optionally+indented.+.IP \(bu 2+\f[B]Two or more spaces\f[R] \- required if there is an amount (as in+journal format).+.IP \(bu 2+\f[B]A timedot amount\f[R], which can be+.RS 2+.IP \(bu 2+empty (representing zero)+.IP \(bu 2+a number, optionally followed by a unit \f[CR]s\f[R], \f[CR]m\f[R],+\f[CR]h\f[R], \f[CR]d\f[R], \f[CR]w\f[R], \f[CR]mo\f[R], or+\f[CR]y\f[R], representing a precise number of seconds, minutes, hours,+days weeks, months or years (hours is assumed by default), which will be+converted to hours according to 60s = 1m, 60m = 1h, 24h = 1d, 7d = 1w,+30d = 1mo, 365d = 1y.+.IP \(bu 2+one or more dots (period characters), each representing 0.25.+These are the dots in \(dqtimedot\(dq.+Spaces are ignored and can be used for grouping/alignment.+.IP \(bu 2+\f[I]Added in 1.32\f[R] one or more letters.+These are like dots but they also generate a tag \f[CR]t:\f[R] (short+for \(dqtype\(dq) with the letter as its value, and a separate posting+for each of the values.+This provides a second dimension of categorisation, viewable in reports+with \f[CR]\-\-pivot t\f[R].+.RE+.IP \(bu 2+\f[B]An optional comment\f[R] following a semicolon (a hledger\-style+posting comment).+.PP+There is some flexibility to help with keeping time log data and notes+in the same file:+.IP \(bu 2+Blank lines and lines beginning with \f[CR]#\f[R] or \f[CR];\f[R] are+ignored.+.IP \(bu 2+After the first date line, lines which do not contain a double space are+parsed as postings with zero amount.+(hledger\(aqs register reports will show these if you add \-E).+.IP \(bu 2+Before the first date line, lines beginning with \f[CR]*\f[R] (eg org+headings) are ignored.+And from the first date line onward, Emacs org mode heading prefixes at+the start of lines (one or more \f[CR]*\f[R]\(aqs followed by a space)+will be ignored.+This means the time log can also be a org outline.+.PP+Timedot files don\(aqt support directives like journal files.+So a common pattern is to have a main journal file (eg+\f[CR]time.journal\f[R]) that contains any needed directives, and then+includes the timedot file (\f[CR]include time.timedot\f[R]).+.SS Timedot examples+Numbers:+.IP+.EX+2016/2/3+inc:client1 4+fos:hledger 3h+biz:research 60m+.EE+.PP+Dots:+.IP+.EX+# on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.+2016/2/1+inc:client1 .... .... .... .... .... ....+fos:haskell .... ..+biz:research .++2016/2/2+inc:client1 .... ....+biz:research .+.EE+.IP+.EX+$ hledger \-f a.timedot print date:2016/2/2+2016\-02\-02 *+ (inc:client1) 2.00++2016\-02\-02 *+ (biz:research) 0.25+.EE+.IP+.EX+$ hledger \-f a.timedot bal \-\-daily \-\-tree+Balance changes in 2016\-02\-01\-2016\-02\-03:++ || 2016\-02\-01d 2016\-02\-02d 2016\-02\-03d +============++========================================+ biz || 0.25 0.25 1.00 + research || 0.25 0.25 1.00 + fos || 1.50 0 3.00 + haskell || 1.50 0 0 + hledger || 0 0 3.00 + inc || 6.00 2.00 4.00 + client1 || 6.00 2.00 4.00 +\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || 7.75 2.25 8.00 +.EE+.PP+Letters:+.IP+.EX+# Activity types:+# c cleanup/catchup/repair+# e enhancement+# s support+# l learning/research++2023\-11\-01+work:adm ccecces+.EE+.IP+.EX+$ hledger \-f a.timedot print+2023\-11\-01+ (work:adm) 1 ; t:c+ (work:adm) 0.5 ; t:e+ (work:adm) 0.25 ; t:s+.EE+.IP+.EX+$ hledger \-f a.timedot bal+ 1.75 work:adm+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 1.75 +.EE+.IP+.EX+$ hledger \-f a.timedot bal \-\-pivot t+ 1.00 c+ 0.50 e+ 0.25 s+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 1.75 +.EE+.PP+Org:+.IP+.EX+* 2023 Work Diary+** Q1+*** 2023\-02\-29+**** DONE+0700 yoga+**** UNPLANNED+**** BEGUN+hom:chores+ cleaning ...+ water plants+ outdoor \- one full watering can+ indoor \- light watering+**** TODO+adm:planning: trip+*** LATER+.EE+.PP+Using \f[CR].\f[R] as account name separator:+.IP+.EX+2016/2/4+fos.hledger.timedot 4h+fos.ledger ..+.EE+.IP+.EX+$ hledger \-f a.timedot \-\-alias \(aq/\(rs./=:\(aq bal \-t+ 4.50 fos+ 4.00 hledger:timedot+ 0.50 ledger+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 4.50+.EE+.SH PART 3: REPORTING CONCEPTS+.SH Time periods+.SS Report start & end date+Most hledger reports will by default show the full time period+represented by the journal.+The report start date will be the earliest transaction or posting date,+and the report end date will be the latest transaction, posting, or+market price date.+.PP+Often you will want to see a shorter period, such as the current month.+You can specify a start and/or end date with the+\f[CR]\-b/\-\-begin\f[R], \f[CR]\-e/\-\-end\f[R], or+\f[CR]\-p/\-\-period\f[R] options, or a \f[CR]date:\f[R] query argument,+described below.+All of these accept the smart date syntax, also described below.+.PP+End dates are exclusive; specify the day after the last day you want to+see in the report.+.PP+When dates are specified by multiple options, the last (right\-most)+option wins.+And when \f[CR]date:\f[R] queries and date options are combined, the+report period will be their intersection.+.PP+Examples:+.TP+\f[CR]\-b 2016/3/17\f[R]+beginning on St.+Patrick\(cqs day 2016+.TP+\f[CR]\-e 12/1\f[R]+ending at the start of December 1st in the current year+.TP+\f[CR]\-p \(aqthis month\(aq\f[R]+during the current month+.TP+\f[CR]\-p thismonth\f[R]+same as above, spaces are optional+.TP+\f[CR]\-b 2023\f[R]+beginning on the first day of 2023+.TP+\f[CR]date:2023..\f[R] or \f[CR]date:2023\-\f[R]+same as above+.PP+\f[CR]\-b 2024 \-e 2025 \-p \(aq2000 to 2030\(aq date:2020\-01 date:2020\f[R]+:+.PD 0+.P+.PD+during January 2020 (the smallest common period, with the \-p overriding+\-b and \-e)+.SS Smart dates+In hledger\(aqs user interfaces (though not in the journal file), you+can optionally use \(dqsmart date\(dq syntax.+Smart dates can be written with english words, can be relative, and can+have parts omitted.+Missing parts are inferred as 1, when needed.+Smart dates can be interpreted as dates or periods depending on the+context.+.PP+Examples:+.PP+\f[CR]2004\-01\-01\f[R], \f[CR]2004/10/1\f[R], \f[CR]2004.9.1\f[R],+\f[CR]20240504\f[R], \f[CR]2024Q1\f[R] :+.PD 0+.P+.PD+Exact dates.+The year must have at least four digits, the month must be 1\-12, the+day must be 1\-31, the separator can be \f[CR]\-\f[R] or \f[CR]/\f[R] or+\f[CR].\f[R] or nothing.+The q can be upper or lower case and the quarter number must be 1\-4.+.TP+\f[CR]2004\-10\f[R]+start of month+.TP+\f[CR]2004q3\f[R]+start of third quarter of 2004+.TP+\f[CR]q3\f[R]+start of third quarter of current year+.TP+\f[CR]2004\f[R]+start of year+.TP+\f[CR]10/1\f[R] or \f[CR]oct\f[R] or \f[CR]october\f[R]+October 1st in current year+.TP+\f[CR]21\f[R]+21st day in current month+.TP+\f[CR]yesterday, today, tomorrow\f[R]+\-1, 0, 1 days from today+.TP+\f[CR]last/this/next day/week/month/quarter/year\f[R]+\-1, 0, 1 periods from the current period+.TP+\f[CR]last/this/next tuesday\f[R]+the previous occurrence of the named day, or the next occurrence after+today+.TP+\f[CR]last/this/next february\f[R]+the previous occurrence of 1st of the named month, or the next+occurrence after the current month+.TP+\f[CR]in n days/weeks/months/quarters/years\f[R]+n periods from the current period+.TP+\f[CR]n days/weeks/months/quarters/years ahead\f[R]+n periods from the current period+.TP+\f[CR]n days/weeks/months/quarters/years ago\f[R]+\-n periods from the current period+.TP+\f[CR]20181201\f[R]+8 digit YYYYMMDD with valid year month and day+.TP+\f[CR]201812\f[R]+6 digit YYYYMM with valid year and month+.PP+Dates with no separators are allowed but might give surprising results+if mistyped:+.IP \(bu 2+\f[CR]20181301\f[R] (YYYYMMDD with an invalid month) is parsed as an+eight\-digit year+.IP \(bu 2+\f[CR]20181232\f[R] (YYYYMMDD with an invalid day) gives a parse error+.IP \(bu 2+\f[CR]201801012\f[R] (a valid YYYYMMDD followed by additional digits)+gives a parse error+.PP+The meaning of relative dates depends on today\(aqs date.+If you need to test or reproduce old reports, you can use the+\f[CR]\-\-today\f[R] option to override that.+(Except for periodic transaction rules, which are not affected by+\f[CR]\-\-today\f[R].)+.SS Report intervals+A report interval can be specified so that reports like register,+balance or activity become multi\-period, showing each subperiod as a+separate row or column.+.PP+The following standard intervals can be enabled with command\-line+flags:+.IP \(bu 2+\f[CR]\-D/\-\-daily\f[R]+.IP \(bu 2+\f[CR]\-W/\-\-weekly\f[R]+.IP \(bu 2+\f[CR]\-M/\-\-monthly\f[R]+.IP \(bu 2+\f[CR]\-Q/\-\-quarterly\f[R]+.IP \(bu 2+\f[CR]\-Y/\-\-yearly\f[R]+.PP+More complex intervals can be specified using \f[CR]\-p/\-\-period\f[R],+described below.+.SS Date adjustments+.SS Start date adjustment+If you let hledger infer a report\(aqs start date, it will adjust the+date to the previous natural boundary of the report interval, for+convenient periodic reports.+(If you don\(aqt want that, specify a start date.)+.PP+For example, if the journal\(aqs first transaction is on january 10th,+.IP \(bu 2+\f[CR]hledger register\f[R] (no report interval) will start the report+on january 10th.+.IP \(bu 2+\f[CR]hledger register \-\-monthly\f[R] will start the report on the+previous month boundary, january 1st.+.IP \(bu 2+\f[CR]hledger register \-\-monthly \-\-begin 1/5\f[R] will start the+report on january 5th [1].+.PP+Also if you are generating transactions or budget goals with periodic+transaction rules, their start date may be adjusted in a similar way (in+certain situations).+.SS End date adjustment+A report\(aqs end date is always adjusted to include a whole number of+intervals, so that the last subperiod has the same length as the others.+.PP+For example, if the journal\(aqs last transaction is on february 20th,+.IP \(bu 2+\f[CR]hledger register\f[R] will end the report on february 20th.+.IP \(bu 2+\f[CR]hledger register \-\-monthly\f[R] will end the report at the end+of february.+.IP \(bu 2+\f[CR]hledger register \-\-monthly \-\-end 2/14\f[R] also will end the+report at the end of february (overriding the requested end date).+.IP \(bu 2+\f[CR]hledger register \-\-monthly \-\-begin 1/5 \-\-end 2/14\f[R] will+end the report on march 4th [1].+.PP+[1] Since hledger 1.29.+.SS Period headings+With non\-standard subperiods, hledger will show+\(dqSTARTDATE..ENDDATE\(dq headings.+With standard subperiods (ie, starting on a natural interval boundary),+you\(aqll see more compact headings, which are usually preferable.+(Though month names will be in english, currently.)+.PP+So if you are specifying a start date and you want compact headings:+choose a start of year for yearly reports, a start of quarter for+quarterly reports, a start of month for monthly reports, etc.+(Remember, you can write eg \f[CR]\-b 2024\f[R] or \f[CR]1/1\f[R] as a+shortcut for a start of year, or \f[CR]2024\-04\f[R] or+\f[CR]202404\f[R] or \f[CR]Apr\f[R] for a start of month or quarter.)+.PP+For weekly reports, choose a date that\(aqs a Monday.+(You can try different dates until you see the short headings, or write+eg \f[CR]\-b \(aq3 weeks ago\(aq\f[R].)+.SS Period expressions+The \f[CR]\-p/\-\-period\f[R] option specifies a period expression,+which is a compact way of expressing a start date, end date, and/or+report interval.+.PP+Here\(aqs a period expression with a start and end date (specifying the+first quarter of 2009):+.PP+.TS+tab(@);+l.+T{+\f[CR]\-p \(dqfrom 2009/1/1 to 2009/4/1\(dq\f[R]+T}+.TE+.PP+Several keywords like \(dqfrom\(dq and \(dqto\(dq are supported for+readability; these are optional.+\(dqto\(dq can also be written as \(dq..\(dq or \(dq\-\(dq.+The spaces are also optional, as long as you don\(aqt run two dates+together.+So the following are equivalent to the above:+.PP+.TS+tab(@);+l.+T{+\f[CR]\-p \(dq2009/1/1 2009/4/1\(dq\f[R]+T}+T{+\f[CR]\-p2009/1/1to2009/4/1\f[R]+T}+T{+\f[CR]\-p2009/1/1..2009/4/1\f[R]+T}+.TE+.PP+Dates are smart dates, so if the current year is 2009, these are also+equivalent to the above:+.PP+.TS+tab(@);+l.+T{+\f[CR]\-p \(dq1/1 4/1\(dq\f[R]+T}+T{+\f[CR]\-p \(dqjan\-apr\(dq\f[R]+T}+T{+\f[CR]\-p \(dqthis year to 4/1\(dq\f[R]+T}+.TE+.PP+If you specify only one date, the missing start or end date will be the+earliest or latest transaction date in the journal:+.PP+.TS+tab(@);+l l.+T{+\f[CR]\-p \(dqfrom 2009/1/1\(dq\f[R]+T}@T{+everything after january 1, 2009+T}+T{+\f[CR]\-p \(dqsince 2009/1\(dq\f[R]+T}@T{+the same, since is a synonym+T}+T{+\f[CR]\-p \(dqfrom 2009\(dq\f[R]+T}@T{+the same+T}+T{+\f[CR]\-p \(dqto 2009\(dq\f[R]+T}@T{+everything before january 1, 2009+T}+.TE+.PP+You can also specify a period by writing a single partial or full date:+.PP+.TS+tab(@);+lw(14.5n) lw(55.5n).+T{+\f[CR]\-p \(dq2009\(dq\f[R]+T}@T{+the year 2009; equivalent to \(lq2009/1/1 to 2010/1/1\(rq+T}+T{+\f[CR]\-p \(dq2009/1\(dq\f[R]+T}@T{+the month of january 2009; equivalent to \(lq2009/1/1 to 2009/2/1\(rq+T}+T{+\f[CR]\-p \(dq2009/1/1\(dq\f[R]+T}@T{+the first day of 2009; equivalent to \(lq2009/1/1 to 2009/1/2\(rq+T}+.TE+.PP+or by using the \(dqQ\(dq quarter\-year syntax (case insensitive):+.PP+.TS+tab(@);+lw(15.3n) lw(54.7n).+T{+\f[CR]\-p \(dq2009Q1\(dq\f[R]+T}@T{+first quarter of 2009, equivalent to \(lq2009/1/1 to 2009/4/1\(rq+T}+T{+\f[CR]\-p \(dqq4\(dq\f[R]+T}@T{+fourth quarter of the current year+T}+.TE+.SS Period expressions with a report interval+A period expression can also begin with a report interval, separated+from the start/end dates (if any) by a space or the word \f[CR]in\f[R]:+.PP+.TS+tab(@);+l.+T{+\f[CR]\-p \(dqweekly from 2009/1/1 to 2009/4/1\(dq\f[R]+T}+T{+\f[CR]\-p \(dqmonthly in 2008\(dq\f[R]+T}+T{+\f[CR]\-p \(dqquarterly\(dq\f[R]+T}+.TE+.SS More complex report intervals+Some more complex intervals can be specified within period expressions,+such as:+.IP \(bu 2+\f[CR]biweekly\f[R] (every two weeks)+.IP \(bu 2+\f[CR]fortnightly\f[R]+.IP \(bu 2+\f[CR]bimonthly\f[R] (every two months)+.IP \(bu 2+\f[CR]every day|week|month|quarter|year\f[R]+.IP \(bu 2+\f[CR]every N days|weeks|months|quarters|years\f[R]+.PP+Weekly on a custom day:+.IP \(bu 2+\f[CR]every Nth day of week\f[R] (\f[CR]th\f[R], \f[CR]nd\f[R],+\f[CR]rd\f[R], or \f[CR]st\f[R] are all accepted after the number)+.IP \(bu 2+\f[CR]every WEEKDAYNAME\f[R] (full or three\-letter english weekday+name, case insensitive)+.PP+Monthly on a custom day:+.IP \(bu 2+\f[CR]every Nth day [of month]\f[R] (\f[CR]31st day\f[R] will be+adjusted to each month\(aqs last day)+.IP \(bu 2+\f[CR]every Nth WEEKDAYNAME [of month]\f[R]+.PP+Yearly on a custom month and day:+.IP \(bu 2+\f[CR]every MM/DD [of year]\f[R] (month number and day of month number)+.IP \(bu 2+\f[CR]every MONTHNAME DDth [of year]\f[R] (full or three\-letter english+month name, case insensitive, and day of month number)+.IP \(bu 2+\f[CR]every DDth MONTHNAME [of year]\f[R] (equivalent to the above)+.PP+Examples:+.PP+.TS+tab(@);+lw(26.8n) lw(43.2n).+T{+\f[CR]\-p \(dqbimonthly from 2008\(dq\f[R]+T}@T{+T}+T{+\f[CR]\-p \(dqevery 2 weeks\(dq\f[R]+T}@T{+T}+T{+\f[CR]\-p \(dqevery 5 months from 2009/03\(dq\f[R]+T}@T{+T}+T{+\f[CR]\-p \(dqevery 2nd day of week\(dq\f[R]+T}@T{+periods will go from Tue to Tue+T}+T{+\f[CR]\-p \(dqevery Tue\(dq\f[R]+T}@T{+same+T}+T{+\f[CR]\-p \(dqevery 15th day\(dq\f[R]+T}@T{+period boundaries will be on 15th of each month+T}+T{+\f[CR]\-p \(dqevery 2nd Monday\(dq\f[R]+T}@T{+period boundaries will be on second Monday of each month+T}+T{+\f[CR]\-p \(dqevery 11/05\(dq\f[R]+T}@T{+yearly periods with boundaries on 5th of November+T}+T{+\f[CR]\-p \(dqevery 5th November\(dq\f[R]+T}@T{+same+T}+T{+\f[CR]\-p \(dqevery Nov 5th\(dq\f[R]+T}@T{+same+T}+.TE+.PP+Show historical balances at end of the 15th day of each month (N is an+end date, exclusive as always):+.IP+.EX+$ hledger balance \-H \-p \(dqevery 16th day\(dq+.EE+.PP+Group postings from the start of wednesday to end of the following+tuesday (N is both (inclusive) start date and (exclusive) end date):+.IP+.EX+$ hledger register checking \-p \(dqevery 3rd day of week\(dq+.EE+.SS Multiple weekday intervals+This special form is also supported:+.IP \(bu 2+\f[CR]every WEEKDAYNAME,WEEKDAYNAME,...\f[R] (full or three\-letter+english weekday names, case insensitive)+.PP+Also, \f[CR]weekday\f[R] and \f[CR]weekendday\f[R] are shorthand for+\f[CR]mon,tue,wed,thu,fri\f[R] and \f[CR]sat,sun\f[R].+.PP+This is mainly intended for use with \f[CR]\-\-forecast\f[R], to+generate periodic transactions on arbitrary days of the week.+It may be less useful with \f[CR]\-p\f[R], since it divides each week+into subperiods of unequal length, which is unusual.+(Related: #1632)+.PP+Examples:+.PP+.TS+tab(@);+lw(17.8n) lw(52.2n).+T{+\f[CR]\-p \(dqevery mon,wed,fri\(dq\f[R]+T}@T{+dates will be Mon, Wed, Fri; periods will be Mon\-Tue, Wed\-Thu,+Fri\-Sun+T}+T{+\f[CR]\-p \(dqevery weekday\(dq\f[R]+T}@T{+dates will be Mon, Tue, Wed, Thu, Fri; periods will be Mon, Tue, Wed,+Thu, Fri\-Sun+T}+T{+\f[CR]\-p \(dqevery weekendday\(dq\f[R]+T}@T{+dates will be Sat, Sun; periods will be Sat, Sun\-Fri+T}+.TE+.SH Depth+With the \f[CR]\-\-depth NUM\f[R] option (short form, usually preferred:+\f[CR]\-NUM\f[R]), reports will show accounts only to the specified+depth, hiding deeper subaccounts.+Use this when you want a summary with less detail.+This flag has the same effect as a \f[CR]depth:\f[R] query argument.+So all of these are equivalent: \f[CR]depth:2\f[R],+\f[CR]\-\-depth=2\f[R], \f[CR]\-2\f[R].+.PP+You can also provide custom depths for specific accounts, by providing a+\f[CR]REGEX=NUM\f[R] argument instead of just \f[CR]NUM\f[R] \f[I](since+1.41)\f[R].+For example, \f[CR]\-\-depth assets=2\f[R] (or+\f[CR]depth:assets=2\f[R]) will collapse accounts matching the regular+expression \(dqassets\(dq to depth 2.+So \f[CR]assets:bank:savings\f[R] would be collapsed to+\f[CR]assets:bank\f[R], but \f[CR]liabilities:bank:credit card\f[R]+would not be affected.+.PP+If REGEX contains spaces or other special characters, enclose it in+quotes in the usual way.+Eg: \f[CR]\-\-depth \(aqcredit card=2\(aq\f[R]+.SS Combining depth options+If a command line contains multiple general depth options, the last one+wins.+(Useful for overriding a depth specified by scripts.)+.PP+Or a command may contain a combination of general and custom depth+options.+In this case, the most specifically (deepest) matching option wins.+Some examples:+.IP \(bu 2+\f[CR]\-\-depth assets=3 \-\-depth expenses=2 \-\-depth 1\f[R] would+collapse accounts containing \(dqassets\(dq to depth 3, accounts+containing \(dqexpenses\(dq to depth 2, and all other accounts to depth+1.+.IP \(bu 2+\f[CR]\-\-depth assets=1 \-\-depth savings=2\f[R] would collapse+\f[CR]assets:bank:savings\f[R] to depth 2 (not depth 1; because+\(dqsavings\(dq matches a deeper part of the account name than+\(dqassets\(dq).+.PP+Note currently, to override a custom depth option+\f[CR]\-\-depth REGEX=NUM\f[R] with a later option, the later option+must use the same REGEX.+.SH Queries+Many hledger commands accept query arguments, which restrict their scope+and let you report on a precise subset of your data.+Here\(aqs a quick overview of hledger\(aqs queries:+.IP \(bu 2+By default, a query argument is treated as a case\-insensitive substring+pattern for matching account names.+Eg:+.RS 2+.PP+\f[CR]dining groceries\f[R]+.PD 0+.P+.PD+\f[CR]car:fuel\f[R]+.PD 0+.P+.PD+.RE+.IP \(bu 2+Patterns containing spaces or other special characters must be enclosed+in single or double quotes:+.RS 2+.PP+\f[CR]\(aqpersonal care\(aq\f[R]+.PD 0+.P+.PD+.RE+.IP \(bu 2+Patterns are actually regular expressions, so you can add regexp+metacharacters for more precision (or you may need to backslash\-escape+certain characters; see \(dqRegular expressions\(dq above):+.RS 2+.PP+\f[CR]\(aq\(haexpenses\(rsb\(aq\f[R]+.PD 0+.P+.PD+\f[CR]\(aqfood$\(aq\f[R]+.PD 0+.P+.PD+\f[CR]\(aqfuel|repair\(aq\f[R]+.PD 0+.P+.PD+\f[CR]\(aqaccounts (payable|receivable)\(aq\f[R]+.PD 0+.P+.PD+.RE+.IP \(bu 2+To match something other than the account name, you can add a query type+prefix, such as:+.RS 2+.PP+\f[CR]date:202312\-\f[R]+.PD 0+.P+.PD+\f[CR]status:\f[R]+.PD 0+.P+.PD+\f[CR]desc:amazon\f[R]+.PD 0+.P+.PD+\f[CR]cur:USD\f[R]+.PD 0+.P+.PD+\f[CR]cur:\(rs\(rs$\f[R]+.PD 0+.P+.PD+\f[CR]amt:\(aq>0\(aq\f[R]+.PD 0+.P+.PD+\f[CR]acct:groceries\f[R] (but \f[CR]acct:\f[R] is the default, so we+usually don\(aqt bother writing it)+.PD 0+.P+.PD+.RE+.IP \(bu 2+To negate a query, add a \f[CR]not:\f[R] prefix:+.RS 2+.PP+\f[CR]not:status:\(aq*\(aq\f[R]+.PD 0+.P+.PD+\f[CR]not:desc:\(aqopening|closing\(aq\f[R]+.PD 0+.P+.PD+\f[CR]not:cur:USD\f[R]+.PD 0+.P+.PD+.RE+.IP \(bu 2+Multiple query terms can be combined, as space\-separated queries Eg:+\f[CR]hledger print date:2022 desc:amazon desc:amzn\f[R] (show+transactions dated in 2022 whose description contains \(dqamazon\(dq or+\(dqamzn\(dq).+.PD 0+.P+.PD+.IP \(bu 2+Or more flexibly as boolean queries.+Eg:+\f[CR]hledger print expr:\(aqdate:2022 and (desc:amazon or desc:amzn) and not date:202210\(aq\f[R]+.PD 0+.P+.PD+.PP+All hledger commands use the same query language, but different commands+may interpret the query in different ways.+We haven\(aqt described the commands yet (that\(aqs coming in PART 4:+COMMANDS below) but here\(aqs the gist of it:+.IP \(bu 2+Transaction\-oriented commands (\f[CR]print\f[R], \f[CR]aregister\f[R],+\f[CR]close\f[R], \f[CR]import\f[R], \f[CR]descriptions\f[R]..)+try to match transactions (including the transaction\(aqs postings).+.IP \(bu 2+Posting\-oriented commands (\f[CR]register\f[R], \f[CR]balance\f[R],+\f[CR]balancesheet\f[R], \f[CR]incomestatement\f[R],+\f[CR]accounts\f[R]..)+try to match postings.+Postings inherit their transaction\(aqs attributes for querying+purposes, so transaction fields like date or description can still be+referenced in a posting query.+.IP \(bu 2+A few commands match in more specific ways.+(Eg \f[CR]aregister\f[R], which has a special first argument.)+.SS Query types+Here are the query types available:+.SS acct: query+\f[B]\f[CB]acct:REGEX\f[B]\f[R], or just \f[B]\f[CB]REGEX\f[B]\f[R]+.PD 0+.P+.PD+Match account names containing this case insensitive regular expression.+.PD 0+.P+.PD+This is the default query type, so we usually don\(aqt bother writing+the \(dqacct:\(dq prefix.+.SS amt: query+\f[B]\f[CB]amt:N, amt:\(aq<N\(aq, amt:\(aq<=N\(aq, amt:\(aq>N\(aq, amt:\(aq>=N\(aq\f[B]\f[R]+.PD 0+.P+.PD+Match postings with a single\-commodity amount equal to, less than, or+greater than N. (Postings with multi\-commodity amounts are not tested+and will always match.)+\f[CR]amt:\f[R] needs quotes to hide the less than/greater than sign+from the command line shell.+.PP+The comparison has two modes: if N is preceded by a + or \- sign (or is+0), the two signed numbers are compared.+Otherwise, the absolute magnitudes are compared, ignoring sign.+.PP+Keep in mind that \f[CR]amt:\f[R] matches posting amounts, not account+balances.+.SS code: query+\f[B]\f[CB]code:REGEX\f[B]\f[R]+.PD 0+.P+.PD+Match by transaction code (eg check number).+.SS cur: query+\f[B]\f[CB]cur:REGEX\f[B]\f[R]+.PD 0+.P+.PD+Match postings or transactions including any amounts whose+currency/commodity symbol is fully matched by REGEX.+(Contrary to hledger\(aqs usual infix matching.+To do infix matching, write \f[CR].*REGEX.*\f[R].)+Note, to match special characters which are regex\-significant, you need+to escape them with \f[CR]\(rs\f[R].+And for characters which are significant to your shell you will usually+need one more level of escaping.+Eg to match the dollar sign: \f[CR]cur:\(rs\(rs$\f[R] or+\f[CR]cur:\(aq\(rs$\(aq\f[R]+.SS desc: query+\f[B]\f[CB]desc:REGEX\f[B]\f[R]+.PD 0+.P+.PD+Match transaction descriptions.+.SS date: query+\f[B]\f[CB]date:PERIODEXPR\f[B]\f[R]+.PD 0+.P+.PD+Match dates (or with the \f[CR]\-\-date2\f[R] flag, secondary dates)+within the specified period.+PERIODEXPR is a period expression.+Examples:+.PD 0+.P+.PD+\f[CR]date:2016\f[R], \f[CR]date:thismonth\f[R],+\f[CR]date:2/1\-2/15\f[R], \f[CR]date:2021\-07\-27..nextquarter\f[R].+.PP+PERIODEXPR may include a report interval (since 1.52).+On the command line, this is equivalent to specifying a report interval+with a command line option.+In other contexts (hledger\-ui, hledger\-web), the report interval may+be ignored.+.SS date2: query+\f[B]\f[CB]date2:PERIODEXPR\f[B]\f[R]+.PD 0+.P+.PD+If you use secondary dates: this matches secondary dates within the+specified period.+It is not affected by the \f[CR]\-\-date2\f[R] flag.+A report interval in PERIODEXPR will be ignored.+.SS depth: query+\f[B]\f[CB]depth:[REGEXP=]N\f[B]\f[R]+.PD 0+.P+.PD+Match (or display, depending on command) accounts at or above this+depth, optionally only for accounts matching a provided regular+expression.+See Depth for detailed rules.+.SS note: query+\f[B]\f[CB]note:REGEX\f[B]\f[R]+.PD 0+.P+.PD+Match transaction notes (the part of the description right of+\f[CR]|\f[R], or the whole description if there\(aqs no \f[CR]|\f[R]).+.SS payee: query+\f[B]\f[CB]payee:REGEX\f[B]\f[R]+.PD 0+.P+.PD+Match transaction payee/payer names (the part of the description left of+\f[CR]|\f[R], or the whole description if there\(aqs no \f[CR]|\f[R]).+.SS real: query+\f[B]\f[CB]real:, real:0\f[B]\f[R]+.PD 0+.P+.PD+Match real or virtual postings respectively.+.SS status: query+\f[B]\f[CB]status:, status:!, status:*\f[B]\f[R]+.PD 0+.P+.PD+Match unmarked, pending, or cleared transactions respectively.+.SS type: query+\f[B]\f[CB]type:TYPECODES\f[B]\f[R]+.PD 0+.P+.PD+Match by account type (see Declaring accounts > Account types).+\f[CR]TYPECODES\f[R] is one or more of the single\-letter account type+codes \f[CR]ALERXCVG\f[R], case insensitive.+Note \f[CR]type:A\f[R], \f[CR]type:E\f[R], and \f[CR]type:R\f[R] will+also match their respective subtypes \f[CR]C\f[R] (Cash), \f[CR]V\f[R]+(Conversion), and \f[CR]G\f[R] (Gain).+Certain kinds of account alias can disrupt account types, see Rewriting+accounts > Aliases and account types.+.SS tag: query+\f[B]\f[CB]tag:NAMEREGEX[=VALREGEX]\f[B]\f[R]+.PD 0+.P+.PD+Match by tag name, and optionally also by tag value.+Note:+.IP \(bu 2+Both regular expressions do infix matching.+If you need a complete match, use \f[CR]\(ha\f[R] and \f[CR]$\f[R].+.PD 0+.P+.PD+Eg: \f[CR]tag:\(aq\(hafullname$\(aq\f[R],+\f[CR]tag:\(aq\(hafullname$=\(hafullvalue$\f[R]+.IP \(bu 2+To match values, ignoring names, do \f[CR]tag:.=VALREGEX\f[R]+.IP \(bu 2+Accounts also inherit the tags of their parent accounts.+.IP \(bu 2+Postings also inherit the tags of their account and their transaction .+.IP \(bu 2+Transactions also acquire the tags of their postings.+.SS Negative queries+.SS not: query+\f[B]\f[CB]not:QUERY\f[B]\f[R]+.PD 0+.P+.PD+You can prepend \f[B]\f[CB]not:\f[B]\f[R] to a query to negate the+match.+.PD 0+.P+.PD+Eg: \f[CR]not:equity\f[R], \f[CR]not:desc:apple\f[R]+.PD 0+.P+.PD+(Also, a trick: \f[CR]not:not:...\f[R] can sometimes solve query+problems conveniently.)+.SS Space\-separated queries+When given multiple space\-separated query terms, most commands select+things which match:+.IP \(bu 2+any of the description terms AND+.IP \(bu 2+any of the account terms AND+.IP \(bu 2+any of the status terms AND+.IP \(bu 2+all the other terms.+.PP+The print command is a little different, showing transactions which:+.IP \(bu 2+match any of the description terms AND+.IP \(bu 2+have any postings matching any of the positive account terms AND+.IP \(bu 2+have no postings matching any of the negative account terms AND+.IP \(bu 2+match all the other terms.+.SS Boolean queries+You can write more complicated \(dqboolean\(dq query expressions,+enclosed in quotes and prefixed with \f[CR]expr:\f[R].+These can combine subqueries with NOT, AND, OR operators (case+insensitive), and parentheses for grouping.+Eg, to show transactions involving both cash and expense accounts:+.IP+.EX+hledger print expr:\(aqcash AND expenses\(aq+.EE+.PP+The prefix and enclosing quotes are required, so don\(aqt write+\f[CR]hledger print cash AND expenses\f[R].+That would be a space\-separated query showing transactions involving+accounts with any of \(dqcash\(dq, \(dqand\(dq, \(dqexpenses\(dq in+their names.+.PP+You can write space\-separated queries \f[I]inside\f[R] a boolean query,+and they will combine as described above, but it might be confusing and+best avoided.+Eg these are equivalent, showing transactions involving cash or expenses+accounts:+.IP+.EX+hledger print expr:\(aqcash expenses\(aq+hledger print cash expenses+.EE+.PP+There is a restriction with \f[CR]date:\f[R] queries: they may not be+used inside OR expressions.+.PP+Actually, there are three types of boolean query: \f[CR]expr:\f[R] for+general use, and \f[CR]any:\f[R] and \f[CR]all:\f[R] variants which can+be useful with \f[CR]print\f[R].+.SS expr: query+\f[B]\f[CB]expr:\(aqQUERYEXPR\(aq\f[B]\f[R]+.PD 0+.P+.PD+For example,+\f[CR]expr:\(aqdate:lastmonth AND NOT (food OR rent)\(aq\f[R] means+\(dqmatch things which are dated in the last month and do not have food+or rent in the account name\(dq.+.PP+When using \f[CR]expr:\f[R] with transaction\-oriented commands like+\f[CR]print\f[R], posting\-oriented query terms like \f[CR]acct:\f[R]+and \f[CR]amt:\f[R] are considered to match the transaction if they+match any of its postings.+.PD 0+.P+.PD+So, \f[CR]hledger print expr:\(aqcash and amt:>0\(aq\f[R] means \(dqshow+transactions with (at least one posting involving a cash account) and+(at least one posting with a positive amount)\(dq.+.SS any: query+\f[B]\f[CB]any:\(aqQUERYEXPR\(aq\f[B]\f[R]+.PD 0+.P+.PD+Like \f[CR]expr:\f[R], but when used with transaction\-oriented commands+like \f[CR]print\f[R], it matches the transaction only if a posting can+be matched by all of QUERYEXPR.+.PD 0+.P+.PD+So, \f[CR]hledger print any:\(aqcash and amt:>0\(aq\f[R] means \(dqshow+transactions where at least one posting posts a positive amount to a+cash account\(dq.+.SS all: query+\f[B]\f[CB]all:\(aqQUERYEXPR\(aq\f[B]\f[R]+.PD 0+.P+.PD+Like \f[CR]expr:\f[R], but when used with transaction\-oriented commands+like \f[CR]print\f[R], it matches the transaction only if all postings+are matched by all of QUERYEXPR (and there is at least one posting).+.PD 0+.P+.PD+So, \f[CR]hledger print all:\(aqcash and amt:0\(aq\f[R] means \(dqshow+transactions where all postings involve a cash account and have a zero+amount\(dq.+.PD 0+.P+.PD+Or, \f[CR]hledger print all:\(aqcash or checking\(aq\f[R] means \(dqshow+transactions which touch only cash and/or checking accounts\(dq.+.SS Queries and command options+Some queries can also be expressed as command\-line options:+\f[CR]depth:2\f[R] is equivalent to \f[CR]\-\-depth 2\f[R],+\f[CR]date:2023\f[R] is equivalent to \f[CR]\-p 2023\f[R], etc.+When you mix command options and query arguments, generally the+resulting query is their intersection.+.SS Queries and account aliases+When account names are rewritten with \f[CR]\-\-alias\f[R] or+\f[CR]alias\f[R], \f[CR]acct:\f[R] will match either the old or the new+account name.+.SS Queries and valuation+When amounts are converted to other commodities in cost or value+reports, \f[CR]cur:\f[R] and \f[CR]amt:\f[R] match the old commodity+symbol and the old amount quantity, not the new ones.+(Except in hledger 1.22, #1625.)+.SH Pivoting+Normally, hledger groups amounts and displays their totals by account+(name).+With \f[CR]\-\-pivot PIVOTEXPR\f[R], some other field\(aqs (or multiple+fields\(aq) value is used as a synthetic account name, causing different+grouping and display.+PIVOTEXPR can be+.IP \(bu 2+any of these standard transaction or posting fields (their value is+substituted): \f[CR]status\f[R], \f[CR]code\f[R], \f[CR]desc\f[R],+\f[CR]payee\f[R], \f[CR]note\f[R], \f[CR]acct\f[R],+\f[CR]comm\f[R]/\f[CR]cur\f[R], \f[CR]amt\f[R], \f[CR]cost\f[R]+.IP \(bu 2+or a tag name+.IP \(bu 2+or any combination of these, colon\-separated.+.PP+Some special cases:+.IP \(bu 2+Colons appearing in PIVOTEXPR or in a pivoted tag value will generate+account hierarchy.+.IP \(bu 2+When pivoting a posting that has multiple values for a tag, the tag\(aqs+first value will be used as the pivoted value.+.IP \(bu 2+When a posting has multiple commodities, the pivoted value of+\(dqcomm\(dq/\(dqcur\(dq will be \(dq\(dq.+Also when an unrecognised tag name or field is provided, its pivoted+value will be \(dq\(dq.+(If this causes confusing output, consider excluding those postings from+the report.)+.PP+Examples:+.IP+.EX+2016/02/16 Yearly Dues Payment+ assets:bank account 2 EUR+ income:dues \-2 EUR ; member: John Doe, kind: Lifetime+.EE+.PP+Normal balance report showing account names:+.IP+.EX+$ hledger balance+ 2 EUR assets:bank account+ \-2 EUR income:dues+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0+.EE+.PP+Pivoted balance report, using member: tag values instead:+.IP+.EX+$ hledger balance \-\-pivot member+ 2 EUR+ \-2 EUR John Doe+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0+.EE+.PP+One way to show only amounts with a member: value (using a query):+.IP+.EX+$ hledger balance \-\-pivot member tag:member=.+ \-2 EUR John Doe+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \-2 EUR+.EE+.PP+Another way (the acct: query matches against the pivoted \(dqaccount+name\(dq):+.IP+.EX+$ hledger balance \-\-pivot member acct:.+ \-2 EUR John Doe+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \-2 EUR+.EE+.PP+Hierarchical reports can be generated with multiple pivot values:+.IP+.EX+$ hledger balance Income:Dues \-\-pivot kind:member+ \-2 EUR Lifetime:John Doe+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ \-2 EUR+.EE+.SH Generating data+hledger can enrich the data provided to it, or generate new data, in a+number of ways.+Mostly, this is done only if you request it:+.IP \(bu 2+Missing amounts or missing costs in transactions are inferred+automatically when possible.+.IP \(bu 2+The \f[CR]\-\-infer\-equity\f[R] flag infers missing conversion equity+postings from \(at/\(at\(at costs.+.IP \(bu 2+The \f[CR]\-\-infer\-costs\f[R] flag infers missing costs from+conversion equity postings.+.IP \(bu 2+The \f[CR]\-\-infer\-market\-prices\f[R] flag infers \f[CR]P\f[R] price+directives from costs.+.IP \(bu 2+The \f[CR]\-\-auto\f[R] flag adds extra postings to transactions matched+by auto posting rules.+.IP \(bu 2+The \f[CR]\-\-forecast\f[R] option generates transactions from periodic+transaction rules.+.IP \(bu 2+The \f[CR]balance \-\-budget\f[R] report infers budget goals from+periodic transaction rules.+.IP \(bu 2+Commands like \f[CR]close\f[R], \f[CR]rewrite\f[R], and+\f[CR]hledger\-interest\f[R] generate transactions or postings.+.IP \(bu 2+CSV data is converted to transactions by applying CSV conversion rules..+etc.+.PP+Such generated data is temporary, existing only at report time.+You can convert it to permanent recorded data by, eg, capturing the+output of \f[CR]hledger print\f[R] and saving it in your journal file.+This can sometimes be useful as a data entry aid.+.PP+If you are curious what data is being generated and why, run+\f[CR]hledger print \-x \-\-verbose\-tags\f[R].+\f[CR]\-x/\-\-explicit\f[R] shows inferred amounts and+\f[CR]\-\-verbose\-tags\f[R] adds tags like+\f[CR]generated\-transaction\f[R] (from periodic rules) and+\f[CR]generated\-posting\f[R], \f[CR]modified\f[R] (from auto posting+rules).+Similar hidden tags (with an underscore prefix) are always present,+also, so you can always match such data with queries like+\f[CR]tag:generated\f[R] or \f[CR]tag:modified\f[R].+.SH Forecasting+Forecasting, or speculative future reporting, can be useful for+estimating future balances, or for exploring different future scenarios.+.PP+The simplest and most flexible way to do it with hledger is to manually+record a bunch of future\-dated transactions.+You could keep these in a separate \f[CR]future.journal\f[R] and include+that with \f[CR]\-f\f[R] only when you want to see them.+.SS \-\-forecast+There is another way: with the \f[CR]\-\-forecast\f[R] option, hledger+can generate temporary \(dqforecast transactions\(dq for reporting+purposes, according to periodic transaction rules defined in the+journal.+Each rule can generate multiple recurring transactions, so by changing+one rule you can change many forecasted transactions.+.PP+Forecast transactions usually start after ordinary transactions end.+By default, they begin after your latest\-dated ordinary transaction, or+today, whichever is later, and they end six months from today.+(The exact rules are a little more complicated, and are given below.)+.PP+This is the \(dqforecast period\(dq, which need not be the same as the+report period.+You can override it \- eg to forecast farther into the future, or to+force forecast transactions to overlap your ordinary transactions \- by+giving the \-\-forecast option a period expression argument, like+\f[CR]\-\-forecast=..2099\f[R] or+\f[CR]\-\-forecast=2023\-02\-15..\f[R].+Note that the \f[CR]=\f[R] is required.+.SS Inspecting forecast transactions+\f[CR]print\f[R] is the best command for inspecting and troubleshooting+forecast transactions.+Eg:+.IP+.EX+\(ti monthly from 2022\-12\-20 rent+ assets:bank:checking+ expenses:rent $1000+.EE+.IP+.EX+$ hledger print \-\-forecast \-\-today=2023/4/21+2023\-05\-20 rent+ ; generated\-transaction: \(ti monthly from 2022\-12\-20+ assets:bank:checking+ expenses:rent $1000++2023\-06\-20 rent+ ; generated\-transaction: \(ti monthly from 2022\-12\-20+ assets:bank:checking+ expenses:rent $1000++2023\-07\-20 rent+ ; generated\-transaction: \(ti monthly from 2022\-12\-20+ assets:bank:checking+ expenses:rent $1000++2023\-08\-20 rent+ ; generated\-transaction: \(ti monthly from 2022\-12\-20+ assets:bank:checking+ expenses:rent $1000++2023\-09\-20 rent+ ; generated\-transaction: \(ti monthly from 2022\-12\-20+ assets:bank:checking+ expenses:rent $1000+.EE+.PP+Here there are no ordinary transactions, so the forecasted transactions+begin on the first occurrence after today\(aqs date.+(You won\(aqt normally use \f[CR]\-\-today\f[R]; it\(aqs just to make+these examples reproducible.)+.SS Forecast reports+Forecast transactions affect all reports, as you would expect.+Eg:+.IP+.EX+$ hledger areg rent \-\-forecast \-\-today=2023/4/21+Transactions in expenses:rent and subaccounts:+2023\-05\-20 rent as:ba:checking $1000 $1000+2023\-06\-20 rent as:ba:checking $1000 $2000+2023\-07\-20 rent as:ba:checking $1000 $3000+2023\-08\-20 rent as:ba:checking $1000 $4000+2023\-09\-20 rent as:ba:checking $1000 $5000+.EE+.IP+.EX+$ hledger bal \-M expenses \-\-forecast \-\-today=2023/4/21+Balance changes in 2023\-05\-01..2023\-09\-30:++ || May Jun Jul Aug Sep +===============++===================================+ expenses:rent || $1000 $1000 $1000 $1000 $1000 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || $1000 $1000 $1000 $1000 $1000 +.EE+.SS Forecast tags+Forecast transactions generated by \-\-forecast have a hidden tag,+\f[CR]_generated\-transaction\f[R].+So if you ever need to match forecast transactions, you could use+\f[CR]tag:_generated\-transaction\f[R] (or just+\f[CR]tag:generated\f[R]) in a query.+.PP+For troubleshooting, you can add the \f[CR]\-\-verbose\-tags\f[R] flag.+Then, visible \f[CR]generated\-transaction\f[R] tags will be added also,+so you can view them with the \f[CR]print\f[R] command.+Their value indicates which periodic rule was responsible.+.SS Forecast period, in detail+Forecast start/end dates are chosen so as to do something useful by+default in almost all situations, while also being flexible.+Here are (with luck) the exact rules, to help with troubleshooting:+.PP+The forecast period starts on:+.IP \(bu 2+the later of+.RS 2+.IP \(bu 2+the start date in the periodic transaction rule+.IP \(bu 2+the start date in \f[CR]\-\-forecast\f[R]\(aqs argument+.RE+.IP \(bu 2+otherwise (if those are not available): the later of+.RS 2+.IP \(bu 2+the report start date specified with+\f[CR]\-b\f[R]/\f[CR]\-p\f[R]/\f[CR]date:\f[R]+.IP \(bu 2+the day after the latest ordinary transaction in the journal+.RE+.IP \(bu 2+otherwise (if none of these are available): today.+.PP+The forecast period ends on:+.IP \(bu 2+the earlier of+.RS 2+.IP \(bu 2+the end date in the periodic transaction rule+.IP \(bu 2+the end date in \f[CR]\-\-forecast\f[R]\(aqs argument+.RE+.IP \(bu 2+otherwise: the report end date specified with+\f[CR]\-e\f[R]/\f[CR]\-p\f[R]/\f[CR]date:\f[R]+.IP \(bu 2+otherwise: 180 days (\(ti6 months) from today.+.SS Forecast troubleshooting+When \-\-forecast is not doing what you expect, one of these tips should+help:+.IP \(bu 2+Remember to use the \f[CR]\-\-forecast\f[R] option.+.IP \(bu 2+Remember to have at least one periodic transaction rule in your journal.+.IP \(bu 2+Test with \f[CR]print \-\-forecast\f[R].+.IP \(bu 2+Check for typos or too\-restrictive start/end dates in your periodic+transaction rule.+.IP \(bu 2+Leave at least 2 spaces between the rule\(aqs period expression and+description fields.+.IP \(bu 2+Check for future\-dated ordinary transactions suppressing forecasted+transactions.+.IP \(bu 2+Try setting explicit report start and/or end dates with \f[CR]\-b\f[R],+\f[CR]\-e\f[R], \f[CR]\-p\f[R] or \f[CR]date:\f[R]+.IP \(bu 2+Try adding the \f[CR]\-E\f[R] flag to encourage display of empty+periods/zero transactions.+.IP \(bu 2+Try setting explicit forecast start and/or end dates with+\f[CR]\-\-forecast=START..END\f[R]+.IP \(bu 2+Consult Forecast period, in detail, above.+.IP \(bu 2+Check inside the engine: add \f[CR]\-\-debug=2\f[R] (eg).+.SH Budgeting+With the balance command\(aqs \f[CR]\-\-budget\f[R] report, each+periodic transaction rule generates recurring budget goals in specified+accounts, and goals and actual performance can be compared.+See the balance command\(aqs doc below.+.PP+You can generate budget goals and forecast transactions at the same+time, from the same or different periodic transaction rules:+\f[CR]hledger bal \-M \-\-budget \-\-forecast ...\f[R]+.PP+See also: Budgeting and Forecasting.+.SH Amount formatting+.SS Commodity display style+For the amounts in each commodity, hledger chooses a consistent display+style (symbol placement, decimal mark and digit group marks, number of+decimal digits) to use in most reports.+This is inferred as follows:+.PP+First, if there\(aqs a \f[CR]D\f[R] directive declaring a default+commodity, that commodity symbol and amount format is applied to all+no\-symbol amounts in the journal.+.PP+Then each commodity\(aqs display style is determined from its+\f[CR]commodity\f[R] directive.+We recommend always declaring commodities with \f[CR]commodity\f[R]+directives, since they help ensure consistent display styles and+precisions, and bring other benefits such as error checking for+commodity symbols.+Here\(aqs an example:+.IP+.EX+# Set display styles (and decimal marks, for parsing, if there is no decimal\-mark directive)+# for the $, EUR, INR and no\-symbol commodities:+commodity $1,000.00+commodity EUR 1.000,00+commodity INR 9,99,99,999.00+commodity 1 000 000.9455+.EE+.PP+But for convenience, if a \f[CR]commodity\f[R] directive is not present,+hledger infers a commodity\(aqs display styles from its amounts as they+are written in the journal (excluding cost amounts and amounts in+periodic transaction rules or auto posting rules).+It uses+.IP \(bu 2+the symbol placement and decimal mark of the first amount seen+.IP \(bu 2+the digit group marks of the first amount with digit group marks+.IP \(bu 2+and the maximum number of decimal digits seen across all amounts.+.PP+And as fallback if no applicable amounts are found, it would use a+default style, like \f[CR]$1000.00\f[R] (symbol on the left with no+space, period as decimal mark, and two decimal digits).+.PP+Finally, commodity styles can be overridden by the+\f[CR]\-c/\-\-commodity\-style\f[R] command line option.+.SS Rounding+Amounts are stored internally as decimal numbers with up to 255 decimal+places.+They are displayed with their original journal precisions by print and+print\-like reports, and rounded to their display precision (the number+of decimal digits specified by the commodity display style) by other+reports.+When rounding, hledger uses banker\(aqs rounding (it rounds to the+nearest even digit).+So eg 0.5 displayed with zero decimal digits appears as \(dq0\(dq.+.SS Trailing decimal marks+If you\(aqre wondering why your \f[CR]print\f[R] report sometimes shows+trailing decimal marks, with no decimal digits; it does this when+showing amounts that have digit group marks but no decimal digits, to+disambiguate them and allow them to be re\-parsed reliably (see Decimal+marks).+Eg:+.IP+.EX+commodity $1,000.00++2023\-01\-02+ (a) $1000+.EE+.IP+.EX+$ hledger print+2023\-01\-02+ (a) $1,000.+.EE+.PP+If this is a problem (eg when exporting to Ledger), you can avoid it by+disabling digit group marks, eg with \-c/\-\-commodity (for each+affected commodity):+.IP+.EX+$ hledger print \-c \(aq$1000.00\(aq+2023\-01\-02+ (a) $1000+.EE+.PP+or by forcing print to always show decimal digits, with \-\-round:+.IP+.EX+$ hledger print \-c \(aq$1,000.00\(aq \-\-round=soft+2023\-01\-02+ (a) $1,000.00+.EE+.SS Amount parseability+More generally, hledger output falls into three rough categories, which+format amounts a little bit differently to suit different consumers:+.PP+\f[B]1.+\(dqhledger\-readable output\(dq \- should be readable by hledger (and+by humans)\f[R]+.IP \(bu 2+This is produced by reports that show full journal entries:+\f[CR]print\f[R], \f[CR]import\f[R], \f[CR]close\f[R],+\f[CR]rewrite\f[R] etc.+.IP \(bu 2+It shows amounts with their original journal precisions, which may not+be consistent from one amount to the next.+.IP \(bu 2+It adds a trailing decimal mark when needed to avoid showing ambiguous+amounts.+.IP \(bu 2+It can be parsed reliably (by hledger and ledger2beancount at least, but+perhaps not by Ledger..)+.PP+\f[B]2.+\(dqhuman\-readable output\(dq \- usually for humans\f[R]+.IP \(bu 2+This is produced by all other reports.+.IP \(bu 2+It shows amounts with standard display precisions, which will be+consistent within each commodity.+.IP \(bu 2+It shows ambiguous amounts unmodified.+.IP \(bu 2+It can be parsed reliably in the context of a known report (when you+know decimals are consistently not being shown, you can assume a single+mark is a digit group mark).+.PP+\f[B]3.+\(dqmachine\-readable output\(dq \- usually for other software\f[R]+.IP \(bu 2+This is produced by all reports when an output format like+\f[CR]csv\f[R], \f[CR]tsv\f[R], \f[CR]json\f[R], or \f[CR]sql\f[R] is+selected.+.IP \(bu 2+It shows amounts as 1 or 2 do, but without digit group marks.+.IP \(bu 2+It can be parsed reliably (if needed, the decimal mark can be changed+with \-c/\-\-commodity\-style).+.SH Cost reporting+In some transactions \- for example a currency conversion, or a purchase+or sale of stock \- one commodity is exchanged for another.+In these transactions there is a conversion rate, also called the cost+(when buying) or selling price (when selling).+(In hledger docs we just say \(dqcost\(dq generically for convenience.)+With the \f[CR]\-B/\-\-cost\f[R] flag, hledger can show amounts \(dqat+cost\(dq, converted to the cost\(aqs commodity.+.SS Recording costs+We\(aqll explore several ways of recording transactions involving costs.+These are also summarised at hledger Cookbook > Cost notation.+.PP+Costs can be recorded explicitly in the journal, using the+\f[CR]\(at UNITCOST\f[R] or \f[CR]\(at\(at TOTALCOST\f[R] notation+described in Journal > Costs:+.PP+\f[B]Variant 1\f[R]+.IP+.EX+2022\-01\-01+ assets:dollars $\-135+ assets:euros €100 \(at $1.35 ; $1.35 per euro (unit cost)+.EE+.PP+\f[B]Variant 2\f[R]+.IP+.EX+2022\-01\-01+ assets:dollars $\-135+ assets:euros €100 \(at\(at $135 ; $135 total cost+.EE+.PP+Typically, writing the unit cost (variant 1) is preferable; it can be+more effort, requiring more attention to decimal digits; but it reveals+the per\-unit cost basis, and makes stock sales easier.+.PP+Costs can also be left implicit, and hledger will infer the cost that is+consistent with a balanced transaction:+.PP+\f[B]Variant 3\f[R]+.IP+.EX+2022\-01\-01+ assets:dollars $\-135+ assets:euros €100+.EE+.PP+Here, hledger will attach a \f[CR]\(at\(at €100\f[R] cost to the first+amount (you can see it with \f[CR]hledger print \-x\f[R]).+This form looks convenient, but there are downsides:+.IP \(bu 2+It sacrifices some error checking.+For example, if you accidentally wrote €10 instead of €100, hledger+would not be able to detect the mistake.+.IP \(bu 2+It is sensitive to the order of postings \- if they were reversed, a+different entry would be inferred and reports would be different.+.IP \(bu 2+The per\-unit cost basis is not easy to read.+.PP+So generally this kind of entry is not recommended.+You can make sure you have none of these by using \f[CR]\-s\f[R] (strict+mode), or by running \f[CR]hledger check balanced\f[R].+.SS Reporting at cost+Now when you add the \f[CR]\-B\f[R]/\f[CR]\-\-cost\f[R] flag to reports+(\(dqB\(dq is from Ledger\(aqs \-B/\-\-basis/\-\-cost flag), any amounts+which have been annotated with costs will be converted to their+cost\(aqs commodity (in the report output).+Ie they will be displayed \(dqat cost\(dq or \(dqat sale price\(dq.+.PP+Some things to note:+.IP \(bu 2+Costs are attached to specific posting amounts in specific transactions,+and once recorded they do not change.+This contrasts with market prices, which are ambient and fluctuating.+.IP \(bu 2+Conversion to cost is performed before conversion to market value+(described below).+.SS Equity conversion postings+There is a problem with the entries above \- they are not conventional+Double Entry Bookkeeping (DEB) notation, and because of the+\(dqmagical\(dq transformation of one commodity into another, they cause+an imbalance in the Accounting Equation.+This shows up as a non\-zero grand total in balance reports like+\f[CR]hledger bse\f[R].+.PP+For most hledger users, this doesn\(aqt matter in practice and can+safely be ignored !+But if you\(aqd like to learn more, keep reading.+.PP+Conventional DEB uses an extra pair of equity postings to balance the+transaction.+Of course you can do this in hledger as well:+.PP+\f[B]Variant 4\f[R]+.IP+.EX+2022\-01\-01+ assets:dollars $\-135+ assets:euros €100+ equity:conversion $135+ equity:conversion €\-100+.EE+.PP+Now the transaction is perfectly balanced according to standard DEB, and+\f[CR]hledger bse\f[R]\(aqs total will not be disrupted.+.PP+And, hledger can still infer the cost for cost reporting, but it\(aqs+not done by default \- you must add the \f[CR]\-\-infer\-costs\f[R] flag+like so:+.IP+.EX+$ hledger print \-\-infer\-costs+2022\-01\-01 one hundred euros purchased at $1.35 each+ assets:dollars $\-135 \(at\(at €100+ assets:euros €100+ equity:conversion $135+ equity:conversion €\-100+.EE+.IP+.EX+$ hledger bal \-\-infer\-costs \-B+ €\-100 assets:dollars + €100 assets:euros +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- + 0 +.EE+.PP+Here are some downsides of this kind of entry:+.IP \(bu 2+The per\-unit cost basis is not easy to read.+.IP \(bu 2+Instead of \f[CR]\-B\f[R] you must remember to type+\f[CR]\-B \-\-infer\-costs\f[R].+.IP \(bu 2+\f[CR]\-\-infer\-costs\f[R] works only where hledger can identify the+two equity:conversion postings and match them up with the two+non\-equity postings.+So writing the journal entry in a particular format becomes more+important.+More on this below.+.SS Inferring equity conversion postings+Can we go in the other direction ?+Yes, if you have transactions written with the \(at/\(at\(at cost+notation, hledger can infer the missing equity postings, if you add the+\f[CR]\-\-infer\-equity\f[R] flag.+Eg:+.IP+.EX+2022\-01\-01+ assets:dollars \-$135+ assets:euros €100 \(at $1.35+.EE+.IP+.EX+$ hledger print \-\-infer\-equity+2022\-01\-01+ assets:dollars $\-135+ assets:euros €100 \(at $1.35+ equity:conversion:$\-€:€ €\-100+ equity:conversion:$\-€:$ $135.00+.EE+.PP+The equity account names will be \(dqequity:conversion:A\-B:A\(dq and+\(dqequity:conversion:A\-B:B\(dq where A is the alphabetically first+commodity symbol.+You can customise the \(dqequity:conversion\(dq part by declaring an+account with the \f[CR]V\f[R]/\f[CR]Conversion\f[R] account type.+.PP+Note you will need to add account declarations for these to your+journal, if you use \f[CR]check accounts\f[R] or+\f[CR]check \-\-strict\f[R].+(And unlike normal postings, generated equity postings do not inherit+tags from account declarations.)+.SS Combining costs and equity conversion postings+Finally, you can use both the \(at/\(at\(at cost notation and equity+postings at the same time.+This in theory gives the best of all worlds \- preserving the accounting+equation, revealing the per\-unit cost basis, and providing more+flexibility in how you write the entry:+.PP+\f[B]Variant 5\f[R]+.IP+.EX+2022\-01\-01 one hundred euros purchased at $1.35 each+ assets:dollars $\-135+ equity:conversion $135+ equity:conversion €\-100+ assets:euros €100 \(at $1.35+.EE+.PP+All the other variants above can (usually) be rewritten to this final+form with:+.IP+.EX+$ hledger print \-x \-\-infer\-costs \-\-infer\-equity+.EE+.PP+Downsides:+.IP \(bu 2+The precise format of the journal entry becomes more important.+If hledger can\(aqt detect and match up the cost and equity postings, it+will give a transaction balancing error.+.IP \(bu 2+The add command does not yet accept this kind of entry (#2056).+.IP \(bu 2+This is the most verbose form.+.SS Requirements for detecting equity conversion postings+\f[CR]\-\-infer\-costs\f[R] has certain requirements (unlike+\f[CR]\-\-infer\-equity\f[R], which always works).+It will infer costs only in transactions with:+.IP \(bu 2+Two non\-equity postings, in different commodities.+Their order is significant: the cost will be added to the first of them.+.IP \(bu 2+Two postings to equity conversion accounts, next to one another, which+balance the two non\-equity postings.+This balancing is checked to the same precision (number of decimal+places) used in the conversion posting\(aqs amount.+Equity conversion accounts are:+.RS 2+.IP \(bu 2+any accounts declared with account type+\f[CR]V\f[R]/\f[CR]Conversion\f[R], or their subaccounts+.IP \(bu 2+otherwise, accounts named \f[CR]equity:conversion\f[R],+\f[CR]equity:trade\f[R], or \f[CR]equity:trading\f[R], or their+subaccounts.+.RE+.PP+And multiple such four\-posting groups can coexist within a single+transaction.+When \f[CR]\-\-infer\-costs\f[R] fails, it does not infer a cost in that+transaction, and does not raise an error (ie, it infers costs where it+can).+.PP+Reading variant 5 journal entries, combining cost notation and equity+postings, has all the same requirements.+When reading such an entry fails, hledger raises an \(dqunbalanced+transaction\(dq error.+.SS Infer cost and equity by default ?+Should \f[CR]\-\-infer\-costs\f[R] and \f[CR]\-\-infer\-equity\f[R] be+enabled by default ?+Try using them always, eg with a shell alias:+.IP+.EX+alias h=\(dqhledger \-\-infer\-equity \-\-infer\-costs\(dq+.EE+.PP+and let us know what problems you find.+.PP+.SH Value reporting+hledger can also show amounts \(dqat market value\(dq, converted to some+other commodity using the market price or conversion rate on a certain+date.+.PP+This is controlled by the \f[CR]\-\-value=TYPE[,COMMODITY]\f[R] option.+We also provide simpler \f[CR]\-V\f[R] and \f[CR]\-X COMMODITY\f[R]+aliases for this, which are often sufficient.+The market prices are declared with a special \f[CR]P\f[R] directive,+and/or they can be inferred from the costs recorded in transactions, by+using the \f[CR]\-\-infer\-market\-prices\f[R] flag.+.SS \-X: Value in specified commodity+The \f[CR]\-X COMM\f[R] (or \f[CR]\-\-exchange=COMM\f[R]) option+converts amounts to their market value in the specified commodity, using+the market prices in effect on the \f[I]valuation date(s)\f[R], if any.+(More on these in a minute.)+.PP+Use this when you want to (eg) show everything in your base currency as+far as possible.+(Commodities for which no conversion rate can be found, will not be+converted.)+.PP+COMM should be the full commodity symbol or name.+Remember to quote special shell characters, if needed.+Some examples:+.IP \(bu 2+\f[CR]\-X€\f[R]+.IP \(bu 2+\f[CR]\-X$\f[R] (nothing after $, no quoting needed)+.IP \(bu 2+\f[CR]\-X CNY\f[R] (the space after \-X is optional)+.IP \(bu 2+\f[CR]\-X \(aqred apples\(aq\f[R]+.IP \(bu 2+\f[CR]\-X \(aqr&r\(aq\f[R]+.SS \-V: Value in default commodity(s)+The \f[CR]\-V/\-\-market\f[R] flag is a variant of \f[CR]\-X\f[R] where+you don\(aqt have to specify COMM.+Instead it tries to guess a \f[I]default valuation commodity\f[R] for+each original commodity, based on the market prices in effect on the+valuation date(s).+.PP+\f[CR]\-V\f[R] can often be a convenient shortcut for+\f[CR]\-X MYCURRENCY\f[R], but not always; depending on your data it+could guess multiple valuation commodities.+Usually you want to convert to a single commodity, so it\(aqs better to+use \f[CR]\-X\f[R], unless you\(aqre sure \f[CR]\-V\f[R] is doing what+you want.+.SS Valuation date+Market prices can change from day to day.+hledger will use the prices on a particular valuation date (or on more+than one date).+By default hledger uses \(dqend\(dq dates for valuation.+More specifically:+.IP \(bu 2+For single period reports (including normal print and register reports):+.RS 2+.IP \(bu 2+If an explicit report end date is specified, that is used.+.IP \(bu 2+Otherwise the latest transaction date or non\-future P directive date is+used.+.RE+.IP \(bu 2+For multiperiod reports, each period is valued on its last day.+.PP+This can be customised with the \-\-value option described below, which+can select either \(dqthen\(dq, \(dqend\(dq, \(dqnow\(dq, or+\(dqcustom\(dq dates.+.SS Finding market price+To convert a commodity A to its market value in another commodity B,+hledger looks for a suitable market price (exchange rate) as follows, in+this order of preference:+.IP "1." 3+A \f[I]declared market price\f[R] or \f[I]inferred market price\f[R]:+A\(aqs latest market price in B on or before the valuation date as+declared by a P directive, or (with the+\f[CR]\-\-infer\-market\-prices\f[R] flag) inferred from costs.+\+.IP "2." 3+A \f[I]reverse market price\f[R]: the inverse of a declared or inferred+market price from B to A.+.IP "3." 3+A \f[I]forward chain of market prices\f[R]: a synthetic price formed by+combining the shortest chain of \(dqforward\(dq (only 1 above) market+prices, leading from A to B.+.IP "4." 3+\f[I]Any chain of market prices\f[R]: a chain of any market prices,+including both forward and reverse prices (1 and 2 above), leading from+A to B.+.PP+There is a limit to the length of these price chains; if hledger reaches+that length without finding a complete chain or exhausting all+possibilities, it will give up (with a \(dqgave up\(dq message visible+in \f[CR]\-\-debug=2\f[R] output).+That limit is currently 1000.+.PP+Amounts for which no suitable market price can be found, are not+converted.+.SS \-\-infer\-market\-prices: market prices from transactions+Normally, market value in hledger is fully controlled by, and requires,+P directives in your journal.+Since adding and updating those can be a chore, and since transactions+usually take place at close to market value, why not use the recorded+costs as additional market prices (as Ledger does) ?+Adding the \f[CR]\-\-infer\-market\-prices\f[R] flag to \f[CR]\-V\f[R],+\f[CR]\-X\f[R] or \f[CR]\-\-value\f[R] enables this.+.PP+So for example, \f[CR]hledger bs \-V \-\-infer\-market\-prices\f[R] will+get market prices both from P directives and from transactions.+If both occur on the same day, the P directive takes precedence.+.PP+There is a downside: value reports can sometimes be affected in+confusing/undesired ways by your journal entries.+If this happens to you, read all of this Value reporting section+carefully, and try adding \f[CR]\-\-debug\f[R] or \f[CR]\-\-debug=2\f[R]+to troubleshoot.+.PP+\f[CR]\-\-infer\-market\-prices\f[R] can infer market prices from:+.IP \(bu 2+multicommodity transactions with explicit prices+(\f[CR]\(at\f[R]/\f[CR]\(at\(at\f[R])+.IP \(bu 2+multicommodity transactions with implicit prices (no \f[CR]\(at\f[R],+two commodities, unbalanced).+(With these, the order of postings matters.+\f[CR]hledger print \-x\f[R] can be useful for troubleshooting.)+.IP \(bu 2+multicommodity transactions with equity postings, if cost is inferred+with \f[CR]\-\-infer\-costs\f[R].+.PP+There is a limitation (bug) currently: when a valuation commodity is not+specified, prices inferred with \f[CR]\-\-infer\-market\-prices\f[R] do+not help select a default valuation commodity, as \f[CR]P\f[R] prices+would.+So conversion might not happen because no valuation commodity was+detected (\f[CR]\-\-debug=2\f[R] will show this).+To be safe, specify the valuation commmodity, eg:+.IP \(bu 2+\f[CR]\-X EUR \-\-infer\-market\-prices\f[R], not+\f[CR]\-V \-\-infer\-market\-prices\f[R]+.IP \(bu 2+\f[CR]\-\-value=then,EUR \-\-infer\-market\-prices\f[R], not+\f[CR]\-\-value=then \-\-infer\-market\-prices\f[R]+.PP+Signed costs and market prices can be confusing.+For reference, here is the current behaviour, since hledger 1.25.+(If you think it should work differently, see #1870.)+.IP+.EX+2022\-01\-01 Positive Unit prices+ a A 1+ b B \-1 \(at A 1++2022\-01\-01 Positive Total prices+ a A 1+ b B \-1 \(at\(at A 1+++2022\-01\-02 Negative unit prices+ a A 1+ b B 1 \(at A \-1++2022\-01\-02 Negative total prices+ a A 1+ b B 1 \(at\(at A \-1+++2022\-01\-03 Double Negative unit prices+ a A \-1+ b B \-1 \(at A \-1++2022\-01\-03 Double Negative total prices+ a A \-1+ b B \-1 \(at\(at A \-1+.EE+.PP+All of the transactions above are considered balanced (and on each day,+the two transactions are considered equivalent).+Here are the market prices inferred for B:+.IP+.EX+$ hledger \-f\- \-\-infer\-market\-prices prices+P 2022\-01\-01 B A 1+P 2022\-01\-01 B A 1.0+P 2022\-01\-02 B A \-1+P 2022\-01\-02 B A \-1.0+P 2022\-01\-03 B A \-1+P 2022\-01\-03 B A \-1.0+.EE+.SS Valuation commodity+\f[B]When you specify a valuation commodity (\f[CB]\-X COMM\f[B] or+\f[CB]\-\-value TYPE,COMM\f[B]):\f[R]+.PD 0+.P+.PD+hledger will convert all amounts to COMM, wherever it can find a+suitable market price (including by reversing or chaining prices).+.PP+\f[B]When you leave the valuation commodity unspecified (\f[CB]\-V\f[B]+or \f[CB]\-\-value TYPE\f[B]):\f[R]+.PD 0+.P+.PD+For each commodity A, hledger picks a default valuation commodity as+follows, in this order of preference:+.IP "1." 3+The price commodity from the latest P\-declared market price for A on or+before valuation date.+.IP "2." 3+The price commodity from the latest P\-declared market price for A on+any date.+(Allows conversion to proceed when there are inferred prices before the+valuation date.)+.IP "3." 3+If there are no P directives at all (any commodity or date) and the+\f[CR]\-\-infer\-market\-prices\f[R] flag is used: the price commodity+from the latest transaction\-inferred price for A on or before valuation+date.+.PP+This means:+.IP \(bu 2+If you have P directives, they determine which commodities+\f[CR]\-V\f[R] will convert, and to what.+.IP \(bu 2+If you have no P directives, and use the+\f[CR]\-\-infer\-market\-prices\f[R] flag, costs determine it.+.PP+Amounts for which no valuation commodity can be found are not converted.+.SS \-\-value: Flexible valuation+\f[CR]\-V\f[R] and \f[CR]\-X\f[R] are special cases of the more general+\f[CR]\-\-value\f[R] option:+.IP+.EX+ \-\-value=TYPE[,COMM] TYPE is then, end, now or YYYY\-MM\-DD.+ COMM is an optional commodity symbol.+ Shows amounts converted to:+ \- default valuation commodity (or COMM) using market prices at posting dates+ \- default valuation commodity (or COMM) using market prices at period end(s)+ \- default valuation commodity (or COMM) using current market prices+ \- default valuation commodity (or COMM) using market prices at some date+.EE+.PP+The TYPE part selects cost or value and valuation date:+.TP+\f[CR]\-\-value=then\f[R]+Convert amounts to their value in the default valuation commodity, using+market prices on each posting\(aqs date.+.TP+\f[CR]\-\-value=end\f[R]+Convert amounts to their value in the default valuation commodity, using+market prices on the last day of the report period (or if unspecified,+the journal\(aqs end date); or in multiperiod reports, market prices on+the last day of each subperiod.+.TP+\f[CR]\-\-value=now\f[R]+Convert amounts to their value in the default valuation commodity using+current market prices (as of when report is generated).+.TP+\f[CR]\-\-value=YYYY\-MM\-DD\f[R]+Convert amounts to their value in the default valuation commodity using+market prices on this date.+.PP+To select a different valuation commodity, add the optional+\f[CR],COMM\f[R] part: a comma, then the target commodity\(aqs symbol.+Eg: \f[B]\f[CB]\-\-value=now,EUR\f[B]\f[R].+hledger will do its best to convert amounts to this commodity, deducing+market prices as described above.+.SS Valuation examples+Here are some quick examples of \f[CR]\-V\f[R]:+.IP+.EX+; one euro is worth this many dollars from nov 1+P 2016/11/01 € $1.10++; purchase some euros on nov 3+2016/11/3+ assets:euros €100+ assets:checking++; the euro is worth fewer dollars by dec 21+P 2016/12/21 € $1.03+.EE+.PP+How many euros do I have ?+.IP+.EX+$ hledger \-f t.j bal \-N euros+ €100 assets:euros+.EE+.PP+What are they worth at end of nov 3 ?+.IP+.EX+$ hledger \-f t.j bal \-N euros \-V \-e 2016/11/4+ $110.00 assets:euros+.EE+.PP+What are they worth after 2016/12/21 ?+(no report end date specified, defaults to today)+.IP+.EX+$ hledger \-f t.j bal \-N euros \-V+ $103.00 assets:euros+.EE+.PP+Here are some examples showing the effect of \f[CR]\-\-value\f[R], as+seen with \f[CR]print\f[R]:+.IP+.EX+P 2000\-01\-01 A 1 B+P 2000\-02\-01 A 2 B+P 2000\-03\-01 A 3 B+P 2000\-04\-01 A 4 B++2000\-01\-01+ (a) 1 A \(at 5 B++2000\-02\-01+ (a) 1 A \(at 6 B++2000\-03\-01+ (a) 1 A \(at 7 B+.EE+.PP+Show the cost of each posting:+.IP+.EX+$ hledger \-f\- print \-\-cost+2000\-01\-01+ (a) 5 B++2000\-02\-01+ (a) 6 B++2000\-03\-01+ (a) 7 B+.EE+.PP+Show the value as of the last day of the report period (2000\-02\-29):+.IP+.EX+$ hledger \-f\- print \-\-value=end date:2000/01\-2000/03+2000\-01\-01+ (a) 2 B++2000\-02\-01+ (a) 2 B+.EE+.PP+With no report period specified, the latest transaction date or price+date is used as valuation date (2000\-04\-01):+.IP+.EX+$ hledger \-f\- print \-\-value=end+2000\-01\-01+ (a) 3 B++2000\-02\-01+ (a) 3 B++2000\-03\-01+ (a) 3 B+.EE+.PP+The value today is the same (the 2000\-04\-01 price is still in effect):+.IP+.EX+$ hledger \-f\- print \-\-value=now+2000\-01\-01+ (a) 4 B++2000\-02\-01+ (a) 4 B++2000\-03\-01+ (a) 4 B+.EE+.PP+Show the value on 2000/01/15:+.IP+.EX+$ hledger \-f\- print \-\-value=2000\-01\-15+2000\-01\-01+ (a) 1 B++2000\-02\-01+ (a) 1 B++2000\-03\-01+ (a) 1 B+.EE+.SS Interaction of valuation and queries+When matching postings based on queries in the presence of valuation,+the following happens:+.IP "1." 3+The query is separated into two parts:+.RS 4+.IP "1." 3+the currency (\f[CR]cur:\f[R]) or amount (\f[CR]amt:\f[R]).+.IP "2." 3+all other parts.+.RE+.IP "2." 3+The postings are matched to the currency and amount queries based on+pre\-valued amounts.+.IP "3." 3+Valuation is applied to the postings.+.IP "4." 3+The postings are matched to the other parts of the query based on+post\-valued amounts.+.PP+Related: #1625+.SS Effect of valuation on reports+Here is a reference for how valuation is supposed to affect each part of+hledger\(aqs reports.+It may be useful when troubleshooting.+If you find problems, please report them, ideally with a reproducible+example.+Related: #329, #1083.+.PP+First, a quick glossary:+.TP+\f[I]cost\f[R]+calculated using price(s) recorded in the transaction(s).+.TP+\f[I]value\f[R]+market value using available market price declarations, or the unchanged+amount if no conversion rate can be found.+.TP+\f[I]report start\f[R]+the first day of the report period specified with \-b or \-p or date:,+otherwise today.+.TP+\f[I]report or journal start\f[R]+the first day of the report period specified with \-b or \-p or date:,+otherwise the earliest transaction date in the journal, otherwise today.+.TP+\f[I]report end\f[R]+the last day of the report period specified with \-e or \-p or date:,+otherwise today.+.TP+\f[I]report or journal end\f[R]+the last day of the report period specified with \-e or \-p or date:,+otherwise the latest transaction date in the journal, otherwise today.+.TP+\f[I]report interval\f[R]+a flag (\-D/\-W/\-M/\-Q/\-Y) or period expression that activates the+report\(aqs multi\-period mode (whether showing one or many subperiods).+.PP+.TS+tab(@);+lw(9.5n) lw(11.8n) lw(12.0n) lw(17.2n) lw(12.0n) lw(7.4n).+T{+Report type+T}@T{+\f[CR]\-B\f[R], \f[CR]\-\-cost\f[R]+T}@T{+\f[CR]\-V\f[R], \f[CR]\-X\f[R]+T}@T{+\f[CR]\-\-value=then\f[R]+T}@T{+\f[CR]\-\-value=end\f[R]+T}@T{+\f[CR]\-\-value=DATE\f[R], \f[CR]\-\-value=now\f[R]+T}+_+T{+\f[B]print\f[R]+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+T{+posting amounts+T}@T{+cost+T}@T{+value at report end or today+T}@T{+value at posting date+T}@T{+value at report or journal end+T}@T{+value at DATE/today+T}+T{+balance assertions/assignments+T}@T{+unchanged+T}@T{+unchanged+T}@T{+unchanged+T}@T{+unchanged+T}@T{+unchanged+T}+T{+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+T{+\f[B]register\f[R]+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+T{+starting balance (\-H)+T}@T{+cost+T}@T{+value at report or journal end+T}@T{+valued at day each historical posting was made+T}@T{+value at report or journal end+T}@T{+value at DATE/today+T}+T{+starting balance (\-H) with report interval+T}@T{+cost+T}@T{+value at day before report or journal start+T}@T{+valued at day each historical posting was made+T}@T{+value at day before report or journal start+T}@T{+value at DATE/today+T}+T{+posting amounts+T}@T{+cost+T}@T{+value at report or journal end+T}@T{+value at posting date+T}@T{+value at report or journal end+T}@T{+value at DATE/today+T}+T{+summary posting amounts with report interval+T}@T{+summarised cost+T}@T{+value at period ends+T}@T{+sum of postings in interval, valued at interval start+T}@T{+value at period ends+T}@T{+value at DATE/today+T}+T{+running total/average+T}@T{+sum/average of displayed values+T}@T{+sum/average of displayed values+T}@T{+sum/average of displayed values+T}@T{+sum/average of displayed values+T}@T{+sum/average of displayed values+T}+T{+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+T{+\f[B]balance (bs, bse, cf, is)\f[R]+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+T{+balance changes+T}@T{+sums of costs+T}@T{+value at report end or today of sums of postings+T}@T{+value at posting date+T}@T{+value at report or journal end of sums of postings+T}@T{+value at DATE/today of sums of postings+T}+T{+budget amounts (\-\-budget)+T}@T{+like balance changes+T}@T{+like balance changes+T}@T{+like balance changes+T}@T{+like balances+T}@T{+like balance changes+T}+T{+grand total+T}@T{+sum of displayed values+T}@T{+sum of displayed values+T}@T{+sum of displayed valued+T}@T{+sum of displayed values+T}@T{+sum of displayed values+T}+T{+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+T{+\f[B]balance (bs, bse, cf, is) with report interval\f[R]+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+T{+starting balances (\-H)+T}@T{+sums of costs of postings before report start+T}@T{+value at report start of sums of all postings before report start+T}@T{+sums of values of postings before report start at respective posting+dates+T}@T{+value at report start of sums of all postings before report start+T}@T{+sums of postings before report start+T}+T{+balance changes (bal, is, bs \-\-change, cf \-\-change)+T}@T{+sums of costs of postings in period+T}@T{+same as \-\-value=end+T}@T{+sums of values of postings in period at respective posting dates+T}@T{+balance change in each period, valued at period ends+T}@T{+value at DATE/today of sums of postings+T}+T{+end balances (bal \-H, is \-\-H, bs, cf)+T}@T{+sums of costs of postings from before report start to period end+T}@T{+same as \-\-value=end+T}@T{+sums of values of postings from before period start to period end at+respective posting dates+T}@T{+period end balances, valued at period ends+T}@T{+value at DATE/today of sums of postings+T}+T{+budget amounts (\-\-budget)+T}@T{+like balance changes/end balances+T}@T{+like balance changes/end balances+T}@T{+like balance changes/end balances+T}@T{+like balances+T}@T{+like balance changes/end balances+T}+T{+row totals, row averages (\-T, \-A)+T}@T{+sums, averages of displayed values+T}@T{+sums, averages of displayed values+T}@T{+sums, averages of displayed values+T}@T{+sums, averages of displayed values+T}@T{+sums, averages of displayed values+T}+T{+column totals+T}@T{+sums of displayed values+T}@T{+sums of displayed values+T}@T{+sums of displayed values+T}@T{+sums of displayed values+T}@T{+sums of displayed values+T}+T{+grand total, grand average+T}@T{+sum, average of column totals+T}@T{+sum, average of column totals+T}@T{+sum, average of column totals+T}@T{+sum, average of column totals+T}@T{+sum, average of column totals+T}+T{+T}@T{+T}@T{+T}@T{+T}@T{+T}@T{+T}+.TE+.PP+\f[CR]\-\-cumulative\f[R] is omitted to save space, it works like+\f[CR]\-H\f[R] but with a zero starting balance.+.SH PART 4: COMMANDS+.PP+Here are hledger\(aqs standard subcommands.+You can list these by running \f[CR]hledger\f[R].+If you have installed more add\-on commands, they also will be listed.+.PP+In the following command docs, each command\(aqs specific options are+shown.+Most commands also support the general options described above, though+some of them might have no effect.+(Usually if there\(aqs a sensible way for a general option to affect a+command, it will.)+You can list all of a command\(aqs options by running+\f[CR]hledger CMD \-h\f[R].+.PP+\f[B]Help commands\f[R]+.IP \(bu 2+commands \- show the hledger commands list (default)+.IP \(bu 2+demo \- show small hledger demos in the terminal+.IP \(bu 2+help \- show the hledger manual with info, man, or pager+.PP+\f[B]User interface commands\f[R]+.IP \(bu 2+repl \- run commands from an interactive prompt+.IP \(bu 2+run \- run commands from a script+.IP \(bu 2+ui \- (if installed) run hledger\(aqs terminal UI+.IP \(bu 2+web \- (if installed) run hledger\(aqs web UI+.PP+\f[B]Data entry commands\f[R]+.IP \(bu 2+add \- add transactions using terminal prompts+.IP \(bu 2+import \- add new transactions from other files, eg CSV files+.PP+\f[B]Basic report commands\f[R]+.IP \(bu 2+accounts \- show account names+.IP \(bu 2+codes \- show transaction codes+.IP \(bu 2+commodities \- show commodity/currency symbols+.IP \(bu 2+descriptions \- show transaction descriptions+.IP \(bu 2+files \- show input file paths+.IP \(bu 2+notes \- show note parts of transaction descriptions+.IP \(bu 2+payees \- show payee parts of transaction descriptions+.IP \(bu 2+prices \- show market prices+.IP \(bu 2+stats \- show journal statistics+.IP \(bu 2+tags \- show tag names+.PP+\f[B]Standard report commands\f[R]+.IP \(bu 2+print \- show transactions or export journal data+.IP \(bu 2+aregister (areg) \- show transactions in a particular account+.IP \(bu 2+register (reg) \- show postings in one or more accounts & running total+.IP \(bu 2+balancesheet (bs) \- show assets, liabilities and net worth+.IP \(bu 2+balancesheetequity (bse) \- show assets, liabilities and equity+.IP \(bu 2+cashflow (cf) \- show changes in liquid assets+.IP \(bu 2+incomestatement (is) \- show revenues and expenses+.PP+\f[B]Advanced report commands\f[R]+.IP \(bu 2+balance (bal) \- show balance changes, end balances, budgets, gains..+.IP \(bu 2+roi \- show return on investments+.PP+\f[B]Chart commands\f[R]+.IP \(bu 2+activity \- show bar charts of posting counts per period+.PP+\f[B]Data generation commands\f[R]+.IP \(bu 2+close \- generate balance\-zeroing/restoring transactions+.IP \(bu 2+rewrite \- generate auto postings, like print \-\-auto+.PP+\f[B]Maintenance commands\f[R]+.IP \(bu 2+check \- check for various kinds of error in the data+.IP \(bu 2+diff \- compare account transactions in two journal files+.IP \(bu 2+setup \- check and show the status of the hledger installation+.IP \(bu 2+test \- run self tests+.PP+Next, these commands are described in detail.+.SH Help commands+.SS commands+Show the hledger commands list.+.IP+.EX+Flags:+ \-\-builtin show only builtin commands, not addons+.EE+.SS demo+Play demos of hledger usage in the terminal, if asciinema is installed.+.IP+.EX+Flags:+ \-s \-\-speed=SPEED playback speed (1 is original speed, .5 is half, 2+ is double, etc (default: 2))+.EE+.PP+Run this command with no argument to list the demos.+To play a demo, write its number or a prefix or substring of its title.+Tips:+.PP+Make your terminal window large enough to see the demo clearly.+.PP+Use the \-s/\-\-speed SPEED option to set your preferred playback speed,+eg \f[CR]\-s4\f[R] to play at 4x original speed or \f[CR]\-s.5\f[R] to+play at half speed.+The default speed is 2x.+.PP+During playback, several keys are available: SPACE to pause/unpause, .+to step forward (while paused), CTRL\-c quit.+.PP+Examples:+.IP+.EX+$ hledger demo # list available demos+$ hledger demo 1 # play the first demo at default speed (2x)+$ hledger demo install \-s4 # play the \(dqinstall\(dq demo at 4x speed+.EE+.PP+This command is experimental: there aren\(aqt many useful demos yet.+.SS help+Show the hledger user manual with \f[CR]info\f[R], \f[CR]man\f[R], or a+pager.+With a (case insensitive) TOPIC argument, try to open it at that section+heading.+.IP+.EX+Flags:+ \-i show the manual with info+ \-m show the manual with man+ \-p show the manual with $PAGER or less+ (less is always used if TOPIC is specified)+.EE+.PP+This command shows the hledger manual built in to your hledger+executable.+It can be useful when offline, or when you prefer the terminal to a web+browser, or when the appropriate hledger manual or viewers are not+installed properly on your system.+.PP+By default it chooses the best viewer found in $PATH, trying in this+order: \f[CR]info\f[R], \f[CR]man\f[R], \f[CR]$PAGER\f[R],+\f[CR]less\f[R], \f[CR]more\f[R], stdout.+(If a TOPIC is specified, \f[CR]$PAGER\f[R] and \f[CR]more\f[R] are not+tried.)+You can force the use of info, man, or a pager with the \f[CR]\-i\f[R],+\f[CR]\-m\f[R], or \f[CR]\-p\f[R] flags.+If no viewer can be found, or if running non\-interactively, it just+prints the manual to stdout.+.PP+When using \f[CR]info\f[R], TOPIC can match either the full heading or a+prefix.+If your \f[CR]info \-\-version\f[R] is < 6, you\(aqll need to upgrade+it, eg with \(aq\f[CR]brew install texinfo\f[R]\(aq on mac.+.PP+When using \f[CR]man\f[R] or \f[CR]less\f[R], TOPIC must match the full+heading.+For a prefix match, you can write \(aq\f[CR]TOPIC.*\f[R]\(aq.+.PP+Examples+.IP+.EX+$ hledger help \-h # show the help command\(aqs usage+$ hledger help # show the manual with info, man or $PAGER+$ hledger help \(aqtime periods\(aq # show the manual\(aqs \(dqTime periods\(dq topic+$ hledger help \(aqtime periods\(aq \-m # use man, even if info is installed+.EE+.SH User interface commands+.SS repl+Start an interactive prompt, where you can run any of hledger\(aqs+commands.+Data files are parsed just once, so the commands run faster.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+This command is experimental and could change in the future.+.PP+\f[CR]hledger repl\f[R] starts a read\-eval\-print loop (REPL) where you+can enter commands interactively.+As with the \f[CR]run\f[R] command, each input file (or each input+file/input options combination) is parsed just once, so commands will+run more quickly than if you ran them individually at the command line.+.PP+Also like \f[CR]run\f[R], the input file(s) specified for the+\f[CR]repl\f[R] command will be the default input for all interactive+commands.+You can override this temporarily by specifying an \f[CR]\-f\f[R] option+in particular commands.+But note that commands will not see any changes made to input files (eg+by \f[CR]add\f[R]) until you exit and restart the REPL.+.PP+The command syntax is the same as with \f[CR]run\f[R]:+.IP \(bu 2+enter one hledger command at a time, without the usual+\f[CR]hledger\f[R] first word+.IP \(bu 2+empty lines and comment text from \f[CR]#\f[R] to end of line are+ignored+.IP \(bu 2+use single or double quotes to quote arguments when needed+.IP \(bu 2+type \f[CR]exit\f[R] or \f[CR]quit\f[R] or control\-D to exit the REPL.+.PP+While it is running, the REPL remembers your command history, and you+can navigate in the usual ways:+.IP \(bu 2+Keypad or Emacs navigation keys to edit the current command line+.IP \(bu 2+UP/DOWN or control\-P/control\-N to step back/forward through history+.IP \(bu 2+control\-R to search for a past command+.IP \(bu 2+TAB to complete file paths.+.PP+Generally \f[CR]repl\f[R] command lines should feel much like the normal+hledger CLI, but you may find differences.+\f[CR]repl\f[R] is a little stricter; eg it requires full command names+or official abbreviations (as seen in the commands list).+.PP+The \f[CR]commands\f[R] and \f[CR]help\f[R] commands, and the command+help flags (\f[CR]CMD \-\-tldr\f[R], \f[CR]CMD \-h/\-\-help\f[R],+\f[CR]CMD \-\-info\f[R], \f[CR]CMD \-\-man\f[R]), can be useful.+.PP+You can type control\-C to cancel a long\-running command (but only+once; typing it a second time will exit the REPL).+.PP+And in most shells you can type control\-Z to temporarily exit to the+shell (and then \f[CR]fg\f[R] to return to the REPL).+.SS Examples+Start the REPL and enter some commands:+.IP+.EX+$ hledger repl +Enter hledger commands. To exit, enter \(aqquit\(aq or \(aqexit\(aq, or send EOF.+% stats+Main file : .../2025.journal+\&...+% stats \-f 2024/2024.journal +Main file : .../2024.journal+\&...+% stats+Main file : .../2025.journal+\&...+.EE+.PP+or:+.IP+.EX+$ hledger repl \-f some.journal+Enter hledger commands. To exit, enter \(aqquit\(aq or \(aqexit\(aq, or send EOF.+% bs+\&...+% print \-b \(aqlast week\(aq+\&...+% bs \-f other.journal+\&...+.EE+.SS run+Run a sequence of hledger commands, provided as files or command line+arguments.+Data files are parsed just once, so the commands run faster.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+This command is experimental and could change in the future.+.PP+You can use \f[CR]run\f[R] in three ways:+.IP \(bu 2+\f[CR]hledger run \-\- CMD1 \-\- CMD2 \-\- CMD3\f[R] \- read commands+from the command line, separated by \f[CR]\-\-\f[R]+.IP \(bu 2+\f[CR]hledger run SCRIPTFILE1 SCRIPTFILE2\f[R] \- read commands from one+or more files+.IP \(bu 2+\f[CR]cat SCRIPTFILE1 | hledger run\f[R] \- read commands from standard+input.+.PP+\f[CR]run\f[R] first loads the input file(s) specified by+\f[CR]LEDGER_FILE\f[R] or by \f[CR]\-f\f[R] options, in the usual way.+Then it runs each command in turn, each using the same input data.+But if you want a particular command to use different input, you can+specify an \f[CR]\-f\f[R] option within that command.+This will override (not add to) the default input, just for that+command.+.PP+Each input file (more precisely, each combination of input file and+input options) is parsed only once.+This means that commands will not see any changes made to these files,+until the next run.+But the commands will run more quickly than if run individually+(typically about twice as fast).+.PP+Command scripts, whether in a file or written on the command line, have+a simple syntax:+.IP \(bu 2+each line may contain a single hledger command and its arguments,+without the usual \f[CR]hledger\f[R] first word+.IP \(bu 2+empty lines are ignored+.IP \(bu 2+text from \f[CR]#\f[R] to end of line is a comment, and ignored+.IP \(bu 2+you can use single or double quotes to quote arguments when needed, as+on the command line+.IP \(bu 2+these extra commands are available: \f[CR]echo TEXT\f[R] prints some+text, and \f[CR]exit\f[R] or \f[CR]quit\f[R] ends the run.+.PP+On unix systems you can use \f[CR]#!/usr/bin/env hledger run\f[R] in the+first line of a command file to make it a runnable script.+If that gives an error, use \f[CR]#!/usr/bin/env \-S hledger run\f[R].+.PP+It\(aqs ok to use the \f[CR]run\f[R] command recursively within a+command script.+.PP+You may find some differences in behaviour between \f[CR]run\f[R]+command lines and normal hledger command lines.+\f[CR]run\f[R] is a little stricter; eg it requires full command names+or official abbreviations (as seen in the commands list), and command+options must be written after the command name.+.SS Examples+Run commands from the command line:+.IP+.EX+hledger \-f some.journal run \-\- balance assets \-\-depth 2 \-\- balance liabilities \-f /some/other.journal \-\-depth 3 \-\-transpose \-\- stats+.EE+.PP+This would load \f[CR]some.journal\f[R], run+\f[CR]balance assets \-\-depth 2\f[R] on it, then run+\f[CR]balance liabilities \-\-depth 3 \-\-transpose\f[R] on+\f[CR]/some/other.journal\f[R], and finally run \f[CR]stats\f[R] on+\f[CR]some.journal\f[R]+.PP+Run commands from standard input:+.IP+.EX+(echo \(dqfiles\(dq; echo \(dqstats\(dq) | hledger \-f some.journal run+.EE+.PP+Run commands as a script:+.IP+.EX+$ cat report+#!/usr/bin/env \-S hledger run \-f some.journal++echo \(dqList of accounts in some.journal\(dq+accounts++echo \(dqAssets of some.journal\(dq+balance assets \-\-depth 2++echo \(dqLiabilities from /some/other.journal\(dq+balance liabilities \-f /some/other.journal \-\-depth 3 \-\-transpose++echo \(dqCommands from another.script, applied to another.journal\(dq+run \-f another.journal another.script+.EE+.IP+.EX+$ chmod +x report+$ ./report+List of accounts in some.journal+\&...+.EE+.SS ui+Runs hledger\-ui (if installed).+.SS web+Runs hledger\-web (if installed).+.SH Data entry commands+.SS add+Add new transactions to a journal file, with interactive prompting.+.IP+.EX+Flags:+ \-\-no\-new\-accounts don\(aqt allow creating new accounts+.EE+.PP+Many hledger users edit their journals directly with a text editor, or+generate them from CSV.+For more interactive data entry, there is the \f[CR]add\f[R] command,+which prompts interactively on the console for new transactions, and+appends them to the main journal file (which should be in journal+format).+Existing transactions are not changed.+This is one of the few hledger commands that writes to the journal file+(see also \f[CR]import\f[R]).+.PP+To use it, just run \f[CR]hledger add\f[R] and follow the prompts.+You can add as many transactions as you like; when you are finished,+enter \f[CR].\f[R] or press control\-d or control\-c to exit.+.PP+Features:+.IP \(bu 2+add tries to provide useful defaults, using the most similar (by+description) recent transaction (filtered by the query, if any) as a+template.+.IP \(bu 2+You can also set the initial defaults with command line arguments.+.IP \(bu 2+Readline\-style edit keys can be used during data entry.+.IP \(bu 2+The tab key will auto\-complete whenever possible \- accounts,+payees/descriptions, dates (\f[CR]yesterday\f[R], \f[CR]today\f[R],+\f[CR]tomorrow\f[R]).+If the input area is empty, it will insert the default value.+.IP \(bu 2+A parenthesised transaction code may be entered following a date.+.IP \(bu 2+Comments and tags may be entered following a description or amount.+.IP \(bu 2+If you make a mistake, enter \f[CR]<\f[R] at any prompt to go one step+backward.+.IP \(bu 2+Input prompts are displayed in a different colour when the terminal+supports it.+.PP+Notes:+.IP \(bu 2+If you enter a number with no commodity symbol, and you have declared a+default commodity with a \f[CR]D\f[R] directive, you might expect+\f[CR]add\f[R] to add this symbol for you.+It does not do this; we assume that if you are using a \f[CR]D\f[R]+directive you prefer not to see the commodity symbol repeated on amounts+in the journal.+.IP \(bu 2+\f[CR]add\f[R] creates entries in journal format; it won\(aqt work with+timeclock or timedot files.+.IP \(bu 2+There is a known issue on Windows if this hledger version is built from+stackage: the prompts will show ANSI junk instead of colours (#2410).+You can avoid this by using official hledger release binaries or by+building it with haskeline >=0.8.4; or by running \f[CR]add\f[R] with+\f[CR]\-\-color=no\f[R], perhaps configured in your config file.+.PP+Examples:+.IP \(bu 2+Record new transactions, saving to the default journal file:+.RS 2+.PP+\f[CR]hledger add\f[R]+.RE+.IP \(bu 2+Add transactions to 2024.journal, but also load 2023.journal for+completions:+.RS 2+.PP+\f[CR]hledger add \-\-file 2024.journal \-\-file 2023.journal\f[R]+.RE+.IP \(bu 2+Provide answers for the first four prompts:+.RS 2+.PP+\f[CR]hledger add today \(aqbest buy\(aq expenses:supplies \(aq$20\(aq\f[R]+.RE+.PP+There is a detailed tutorial at https://hledger.org/add.html.+.SS add and balance assertions+Since hledger 1.43, you can add a balance assertion by writing+\f[CR]AMOUNT = BALANCE\f[R] when asked for an amount.+Eg \f[CR]100 = 500\f[R].+.PP+Also, each time you enter a new amount, hledger re\-checks all balance+assertions in the journal and rejects the new amount if it would make+any of them fail.+You can run \f[CR]add\f[R] with+\f[CR]\-I\f[R]/\f[CR]\-\-ignore\-assertions\f[R] to disable balance+assertion checking.+.SS add and balance assignments+Since hledger 1.51, you can add a balance assignment by writing+\f[CR]= BALANCE\f[R] (or \f[CR]==\f[R], \f[CR]=*\f[R] etc) when asked+for an amount.+The missing amount will be calculated automatically.+.PP+\f[CR]add\f[R] normally won\(aqt let you add a new posting which is+dated earlier than an existing balance assignment.+(Because when \f[CR]add\f[R] runs, existing balance assignments have+already been calculated and converted to amounts and balance+assertions.)+You can allow it by disabling balance assertion checking with+\f[CR]\-I\f[R].+.SS import+Import new transactions from one or more data files to the main journal.+.IP+.EX+Flags:+ \-\-catchup just mark all transactions as already imported+ \-\-dry\-run just show the transactions to be imported+.EE+.PP+This command detects new transactions in one or more data files+specified as arguments, and appends them to the main journal.+.PP+You can import from any input file format hledger supports, but+CSV/SSV/TSV files, downloaded from financial institutions, are the most+common import source.+.PP+The import destination is the default journal file, or another specified+in the usual way with \f[CR]$LEDGER_FILE\f[R] or+\f[CR]\-f/\-\-file\f[R].+It should be in journal format.+.PP+Examples:+.IP+.EX+$ hledger import bank1\-checking.csv bank1\-savings.csv+.EE+.IP+.EX+$ hledger import *.csv+.EE+.SS Import dry run+It\(aqs useful to preview the import by running first with+\f[CR]\-\-dry\-run\f[R], to sanity check the range of dates being+imported, and to check the effect of your conversion rules if converting+from CSV.+Eg:+.IP+.EX+$ hledger import bank.csv \-\-dry\-run+.EE+.PP+The dry run output is valid journal format, so hledger can re\-parse it.+If the output is large, you could show just the uncategorised+transactions like so:+.IP+.EX+$ hledger import \-\-dry\-run bank.csv | hledger \-f\- \-I print unknown+.EE+.PP+You could also run this repeatedly to see the effect of edits to your+conversion rules:+.IP+.EX+$ watchexec \-\- \(dqhledger import \-\-dry\-run bank.csv | hledger \-f\- \-I print unknown\(dq+.EE+.PP+Once the conversion and dates look good enough to import to your+journal, perhaps with some manual fixups to follow, you would do the+actual import:+.IP+.EX+$ hledger import bank.csv+.EE+.SS Overlap detection+Reading CSV files is built in to hledger, and not specific to+\f[CR]import\f[R]; so you could also import by doing+\f[CR]hledger \-f bank.csv print >>$LEDGER_FILE\f[R].+.PP+But \f[CR]import\f[R] is easier and provides some advantages.+The main one is that it avoids re\-importing transactions it has seen on+previous runs.+This means you don\(aqt have to worry about overlapping data in+successive downloads of your bank CSV; just download and+\f[CR]import\f[R] as often as you like, and only the new transactions+will be imported each time.+.PP+We don\(aqt call this \(dqdeduplication\(dq, as it\(aqs generally not+possible to reliably detect duplicates in bank CSV.+Instead, \f[CR]import\f[R] remembers the latest date processed+previously in each CSV file (saving it in a hidden file), and skips any+records prior to that date.+This works well for most real\-world CSV, where:+.IP "1." 3+the data file name is stable (does not change) across imports+.IP "2." 3+the item dates are stable across imports+.IP "3." 3+the order of same\-date items is stable across imports+.IP "4." 3+the newest items have the newest dates+.PP+(Occasional violations of 2\-4 are often harmless; you can reduce the+chance of disruption by downloading and importing more often.)+.PP+Overlap detection is automatic, and shouldn\(aqt require much attention+from you, except perhaps at first import (see below).+But here\(aqs how it works:+.IP \(bu 2+For each \f[CR]FILE\f[R] being imported from:+.RS 2+.IP "1." 3+hledger reads a file named \f[CR].latest.FILE\f[R] file in the same+directory, if any.+This file contains the latest record date previously imported from FILE,+in YYYY\-MM\-DD format.+If multiple records with that date were imported, the date is repeated+on N lines.+.IP "2." 3+hledger reads records from FILE.+If a latest date was found in step 1, any records before that date, and+the first N records on that date, are skipped.+.RE+.IP \(bu 2+After a successful import from all FILEs, without error and without+\f[CR]\-\-dry\-run\f[R], hledger updates each FILE\(aqs+\f[CR].latest.FILE\f[R] for next time.+.PP+If this goes wrong, it\(aqs relatively easy to repair:+.IP \(bu 2+You\(aqll notice it before import when you preview with+\f[CR]import \-\-dry\-run\f[R].+.IP \(bu 2+Or after import when you try to reconcile your hledger account balances+with your bank.+.IP \(bu 2+\f[CR]hledger print \-f FILE.csv\f[R] will show all recently downloaded+transactions.+Compare these with your journal.+Copy/paste if needed.+.IP \(bu 2+Update your conversion rules and print again, if needed.+.IP \(bu 2+You can manually update or remove the .latest file, or use+\f[CR]import \-\-catchup FILE\f[R].+.IP \(bu 2+Download and import more often, eg twice a week, at least while you are+learning.+It\(aqs easier to review and troubleshoot when there are fewer+transactions.+.SS First import+The first time you import from a file, when no corresponding .latest+file has been created yet, all of the records will be imported.+.PP+But perhaps you have been entering the data manually, so you know that+all of these transactions are already recorded in the journal.+In this case you can run \f[CR]hledger import \-\-catchup\f[R] once.+This will create a .latest file containing the latest CSV record date,+so that none of those records will be re\-imported.+.PP+Or, if you know that some but not all of the transactions are in the+journal, you can create the .latest file yourself.+Eg, let\(aqs say you previously recorded foobank transactions up to+2024\-10\-31 in the journal.+Then in the directory where you\(aqll be saving \f[CR]foobank.csv\f[R],+you would create a \f[CR].latest.foobank.csv\f[R] file containing+.IP+.EX+2024\-10\-31+.EE+.PP+Or if you had three foobank transactions recorded with that date, you+would repeat the date that many times:+.IP+.EX+2024\-10\-31+2024\-10\-31+2024\-10\-31+.EE+.PP+Then \f[CR]hledger import foobank.csv [\-\-dry\-run]\f[R] will import+only the newer records.+.SS Importing balance assignments+Journal entries added by import will have all posting amounts made+explicit (like \f[CR]print \-x\f[R]).+.PP+This means that any balance assignments in the imported entries would+need to be evaluated.+But this generally isn\(aqt possible, as the main file\(aqs account+balances are not visible during import.+So try to avoid generating balance assignments with your CSV rules, or+importing from a journal that contains balance assignments.+(Balance assignments are best avoided anyway.)+.PP+But if you must use them, eg because your CSV includes only balances:+you can import with \f[CR]print\f[R], which leaves implicit amounts+implicit.+(\f[CR]print\f[R] can also do overlap detection like import, with the+\f[CR]\-\-new\f[R] flag):+.IP+.EX+$ hledger print \-\-new \-f bank.csv >> $LEDGER_FILE+.EE+.PP+(If you think \f[CR]import\f[R] should preserve implicit balances,+please test that and send a pull request.)+.SS Import and commodity styles+Amounts in entries added by import will be formatted according to the+journal\(aqs canonical commodity styles, as declared by+\f[CR]commodity\f[R] directives or inferred from the journal\(aqs+amounts.+.PP+Related: CSV > Amount decimal places.+.SS Import archiving+When importing from a CSV rules file+(\f[CR]hledger import bank.rules\f[R]), you can use the archive rule to+enable automatic archiving of the data file.+After a successful import, the data file (specified by+\f[CR]source\f[R]) will be moved to an archive folder (\f[CR]data/\f[R],+next to the rules file, auto\-created), and renamed similar to the rules+file, with a date.+This can be useful for troubleshooting, detecting variations in your+banks\(aq CSV data, regenerating entries with improved rules, etc.+.PP+The \f[CR]archive\f[R] rule also causes \f[CR]import\f[R] to handle+\f[CR]source\f[R] glob patterns differently: when there are multiple+matched files, it will pick the oldest, not the newest.+.SS Import special cases+.SS Deduplication+Here are two kinds of \(dqdeduplication\(dq which \f[CR]import\f[R] does+not handle (and should not, because these can happen legitimately in+financial data):+.IP \(bu 2+Two or more of the new CSV records are identical, and generate identical+new journal entries.+.IP \(bu 2+A new CSV record generates a journal entry identical to one(s) already+in the journal.+.SS Varying file name+If you have a download whose file name varies, you could rename it to a+fixed name after each download.+Or you could use a CSV \f[CR]source\f[R] rule with a suitable glob+pattern, and import from the .rules file.+.SS Multiple versions+Say you download \f[CR]bank.csv\f[R], import it, but forget to delete it+from your downloads folder.+The next time you download it, your web browser will save it as (eg)+\f[CR]bank (2).csv\f[R].+The source rule\(aqs glob patterns are for just this situation: instead+of specifying \f[CR]source bank.csv\f[R], specify+\f[CR]source bank*.csv\f[R].+Then \f[CR]hledger \-f bank.rules CMD\f[R] or+\f[CR]hledger import bank.rules\f[R] will automatically pick the newest+matched file (\f[CR]bank (2).csv\f[R]).+.PP+Alternately, what if you download, but forget to import or delete, then+download again ?+Now each of \f[CR]bank.csv\f[R] and \f[CR]bank (2).csv\f[R] might+contain data that\(aqs not in the other, and not in your journal.+In this case, it\(aqs best to import each of them in turn, oldest first+(otherwise, overlap detection could cause new records to be skipped).+Enabling import archiving ensures this.+Then \f[CR]hledger import bank.rules; hledger import bank.rules\f[R]+will import and archive first \f[CR]bank.csv\f[R], then+\f[CR]bank (2).csv\f[R].+.SH Basic report commands+.SS accounts+List the account names used or declared in the journal.+.IP+.EX+Flags:+ \-u \-\-used list accounts used+ \-d \-\-declared list accounts declared+ \-\-undeclared list accounts used but not declared+ \-\-unused list accounts declared but not used+ \-\-find list the first account matched by the first+ argument (a case\-insensitive infix regexp)+ \-\-directives show as account directives, for use in journals+ \-\-locations also show where accounts were declared+ \-\-types also show account types when known+ \-l \-\-flat list/tree mode: show accounts as a flat list+ (default)+ \-t \-\-tree list/tree mode: show accounts as a tree+ \-\-drop=N flat mode: omit N leading account name parts+.EE+.PP+This command lists account names \- all of them by default, or just the+ones which have been used in transactions (\f[CR]\-u/\-\-used\f[R]), or+declared with \f[CR]account\f[R] directives+(\f[CR]\-d/\-\-declared\f[R]), or used but not declared+(\f[CR]\-\-undeclared\f[R]), or declared but not used+(\f[CR]\-\-unused\f[R]), or just the first one matched by a pattern+(\f[CR]\-\-find\f[R], returning a non\-zero exit code if it fails).+.PP+You can add query arguments to select a subset of transactions or+accounts.+.PP+With \f[CR]\-\-directives\f[R], it shows valid account directives which+could be pasted into a journal file.+This is useful together with \f[CR]\-\-undeclared\f[R] when updating+your account declarations to satisfy \f[CR]hledger check accounts\f[R].+.PP+With \f[CR]\-\-locations\f[R], it also shows the file and line number of+each account\(aqs declaration, if any, and the account\(aqs overall+declaration order; these may be useful when troubleshooting account+display order.+.PP+With \f[CR]\-\-types\f[R], it also shows each account\(aqs type, if+it\(aqs known.+(See Declaring accounts > Account types.)+.PP+It shows a flat list by default.+With \f[CR]\-\-tree\f[R], it uses indentation to show the account+hierarchy.+In flat mode you can add \f[CR]\-\-drop N\f[R] to omit the first few+account name components.+Account names can be depth\-clipped with \f[CR]depth:N\f[R] or+\f[CR]\-\-depth N\f[R] or \f[CR]\-N\f[R].+.PP+Examples:+.IP+.EX+$ hledger accounts+assets:bank:checking+assets:bank:saving+assets:cash+expenses:food+expenses:supplies+income:gifts+income:salary+liabilities:debts+.EE+.IP+.EX+$ hledger accounts \-\-undeclared \-\-directives >> $LEDGER_FILE+$ hledger check accounts+.EE+.SS codes+List the codes seen in transactions, in the order parsed.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+This command prints the value of each transaction\(aqs code field, in+the order transactions were parsed.+The transaction code is an optional value written in parentheses between+the date and description, often used to store a cheque number, order+number or similar.+.PP+Transactions aren\(aqt required to have a code, and missing or empty+codes will not be shown by default.+With the \f[CR]\-E\f[R]/\f[CR]\-\-empty\f[R] flag, they will be printed+as blank lines.+.PP+You can add a query to select a subset of transactions.+.PP+Examples:+.IP+.EX+2022/1/1 (123) Supermarket + Food $5.00+ Checking ++2022/1/2 (124) Post Office+ Postage $8.32+ Checking++2022/1/3 Supermarket+ Food $11.23+ Checking ++2022/1/4 (126) Post Office+ Postage $3.21+ Checking+.EE+.IP+.EX+$ hledger codes+123+124+126+.EE+.IP+.EX+$ hledger codes \-E+123+124++126+.EE+.SS commodities+List the commodity symbols used or declared in the journal.+.IP+.EX+Flags:+ \-\-used list commodities used+ \-\-declared list commodities declared+ \-\-undeclared list commodities used but not declared+ \-\-unused list commodities declared but not used+ \-\-find list the first commodity matched by the first+ argument (a case\-insensitive infix regexp)+.EE+.PP+This command lists commodity symbols/names \- all of them by default, or+just the ones which have been used in transactions or \f[CR]P\f[R]+directives, or declared with \f[CR]commodity\f[R] directives, or used+but not declared, or declared but not used, or just the first one+matched by a pattern (with \f[CR]\-\-find\f[R], returning a non\-zero+exit code if it fails).+.PP+You can add \f[CR]cur:\f[R] query arguments to further limit the+commodities.+.SS descriptions+List the unique descriptions used in transactions.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+This command lists the unique descriptions that appear in transactions,+in alphabetic order.+You can add a query to select a subset of transactions.+.PP+Example:+.IP+.EX+$ hledger descriptions+Store Name+Gas Station | Petrol+Person A+.EE+.SS files+List all files included in the journal.+With a REGEX argument, only file names matching the regular expression+(case sensitive) are shown.+.IP+.EX+Flags:+no command\-specific flags+.EE+.SS notes+List the unique notes that appear in transactions.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+This command lists the unique notes that appear in transactions, in+alphabetic order.+You can add a query to select a subset of transactions.+The note is the part of the transaction description after a | character+(or if there is no |, the whole description).+.PP+Example:+.IP+.EX+$ hledger notes+Petrol+Snacks+.EE+.SS payees+List the payee/payer names used or declared in the journal.+.IP+.EX+Flags:+ \-\-used list payees used+ \-\-declared list payees declared+ \-\-undeclared list payees used but not declared+ \-\-unused list payees declared but not used+ \-\-find list the first payee matched by the first+ argument (a case\-insensitive infix regexp)+.EE+.PP+This command lists unique payee/payer names \- all of them by default,+or just the ones which have been used in transaction descriptions, or+declared with \f[CR]payee\f[R] directives, or used but not declared, or+declared but not used, or just the first one matched by a pattern (with+\f[CR]\-\-find\f[R], returning a non\-zero exit code if it fails).+.PP+The payee/payer name is the part of the transaction description before a+| character (or if there is no |, the whole description).+.PP+You can add query arguments to select a subset of transactions or+payees.+.PP+Example:+.IP+.EX+$ hledger payees+Store Name+Gas Station+Person A+.EE+.SS prices+Print the market prices declared with P directives.+With \-\-infer\-market\-prices, also show any additional prices inferred+from costs.+With \-\-show\-reverse, also show additional prices inferred by+reversing known prices.+.IP+.EX+Flags:+ \-\-show\-reverse also show the prices inferred by reversing known+ prices+.EE+.PP+Price amounts are always displayed with their full precision, except for+reverse prices which are limited to 8 decimal digits.+.PP+Prices can be filtered by a date:, cur: or amt: query.+.PP+Generally if you run this command with \-\-infer\-market\-prices+\-\-show\-reverse, it will show the same prices used internally to+calculate value reports.+But if in doubt, you can inspect those directly by running the value+report with \-\-debug=2.+.SS stats+Show journal and performance statistics.+.IP+.EX+Flags:+ \-1 show a single line of output+ \-v \-\-verbose show more detailed output+ \-o \-\-output\-file=FILE write output to FILE.+.EE+.PP+The stats command shows summary information for the whole journal, or a+matched part of it.+With a reporting interval, it shows a report for each report period.+.PP+It also shows some performance statistics:+.IP \(bu 2+how long the program ran for+.IP \(bu 2+the number of transactions processed per second+.IP \(bu 2+the peak live memory in use by the program to do its work+.IP \(bu 2+the peak allocated memory as seen by the program+.PP+By default, the output is reasonably discreet; it reveals the main file+name, your activity level, and the speed of your machine.+.PP+With \f[CR]\-v/\-\-verbose\f[R], more details are shown: the full paths+of all files, and the names of the commodities you work with.+.PP+With \f[CR]\-1\f[R], only one line of output is shown, in a+machine\-friendly tab\-separated format: the program version, the main+journal file name, and the performance stats,+.PP+The run time of \f[CR]stats\f[R] is similar to that of a balance report.+.PP+Example:+.IP+.EX+$ hledger stats \-f examples/1ktxns\-1kaccts.journal +Main file : .../1ktxns\-1kaccts.journal+Included files : 0+Txns span : 2000\-01\-01 to 2002\-09\-27 (1000 days)+Last txn : 2002\-09\-26 (7827 days ago)+Txns : 1000 (1.0 per day)+Txns last 30 days : 0 (0.0 per day)+Txns last 7 days : 0 (0.0 per day)+Payees/descriptions : 1000+Accounts : 1000 (depth 10)+Commodities : 26+Market prices : 1000+Runtime stats : 0.12 s elapsed, 8266 txns/s, 4 MB live, 16 MB alloc+.EE+.IP+.EX+$ hledger stats \-1 \-f examples/10ktxns\-1kaccts.journal+1.50.99\-g0835a2485\-20251119, mac\-aarch64 10ktxns\-1kaccts.journal 0.66 s elapsed 15244 txns/s 28 MB live 86 MB alloc+.EE+.PP+This command supports the \-o/\-\-output\-file option (but not+\-O/\-\-output\-format).+.SS tags+List the tag names used or declared in the journal, or their values.+.IP+.EX+Flags:+ \-\-used list tags used+ \-\-declared list tags declared+ \-\-undeclared list tags used but not declared+ \-\-unused list tags declared but not used+ \-\-find list the first tag whose name is matched by the+ first argument (a case\-insensitive infix regexp)+ \-\-values list tag values instead of tag names+ \-\-parsed show them in the order they were parsed (mostly),+ including duplicates+.EE+.PP+This command lists tag names \- all of them by default, or just the ones+which have been used on transactions/postings/accounts, or declared with+\f[CR]tag\f[R] directives, or used but not declared, or declared but not+used, or just the first one matched by a pattern (with+\f[CR]\-\-find\f[R], returning a non\-zero exit code if it fails).+.PP+Note this command\(aqs non\-standard first argument: it is a+case\-insensitive infix regular expression for matching tag names, which+limits the tags shown.+Any additional arguments are standard query arguments, which limit the+transactions, postings, or accounts providing tags.+.PP+With \f[CR]\-\-values\f[R], the tags\(aq unique non\-empty values are+listed instead.+.PP+With \f[CR]\-E\f[R]/\f[CR]\-\-empty\f[R], blank/empty values are also+shown.+.PP+With \f[CR]\-\-parsed\f[R], tags or values are shown in the order they+were parsed, with duplicates included.+(Except, tags from account declarations are always shown first.)+.PP+Remember that accounts also acquire tags from their parents; postings+also acquire tags from their account and transaction; and transactions+also acquire tags from their postings.+.SH Standard report commands+.SS print+Show full journal entries, representing transactions.+.IP+.EX+Flags:+ \-x \-\-explicit show all amounts explicitly+ \-\-invert display all amounts with reversed sign+ \-\-locations add tags showing file paths and line numbers+ \-m \-\-match=DESC fuzzy search for one recent transaction with+ description closest to DESC+ \-\-new show only newer\-dated transactions added in each+ file since last run+ \-\-round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none \- show original decimal digits,+ as in journal (default)+ soft \- just add or remove decimal zeros+ to match precision+ hard \- round posting amounts to precision+ (can unbalance transactions)+ all \- also round cost amounts to precision+ (can unbalance transactions)+ \-\-base\-url=URLPREFIX in html output, generate links to hledger\-web,+ with this prefix. (Usually the base url shown by+ hledger\-web; can also be relative.)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, beancount, csv, tsv, html, fods, json, sql.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+The print command displays full journal entries (transactions) from the+journal file, sorted by date (or with \f[CR]\-\-date2\f[R], by secondary+date).+.PP+Directives and inter\-transaction comments are not shown, currently.+This means the print command is somewhat lossy, and if you are using it+to reformat/regenerate your journal you should take care to also copy+over the directives and inter\-transaction comments.+.PP+Eg:+.IP+.EX+$ hledger print \-f examples/sample.journal date:200806+2008/06/01 gift+ assets:bank:checking $1+ income:gifts $\-1++2008/06/02 save+ assets:bank:saving $1+ assets:bank:checking $\-1++2008/06/03 * eat & shop+ expenses:food $1+ expenses:supplies $1+ assets:cash $\-2+.EE+.SS print amount explicitness+Normally, whether posting amounts are implicit or explicit is preserved.+For example, when an amount is omitted in the journal, it will not+appear in the output.+Similarly, if a conversion cost is implied but not written, it will not+appear in the output.+.PP+You can use the \f[CR]\-x\f[R]/\f[CR]\-\-explicit\f[R] flag to force+explicit display of all amounts and costs.+This can be useful for troubleshooting or for making your journal more+readable and robust against data entry errors.+\f[CR]\-x\f[R] is also implied by using any of+\f[CR]\-B\f[R],\f[CR]\-V\f[R],\f[CR]\-X\f[R],\f[CR]\-\-value\f[R].+.PP+The \f[CR]\-x\f[R]/\f[CR]\-\-explicit\f[R] flag will cause any postings+with a multi\-commodity amount (which can arise when a multi\-commodity+transaction has an implicit amount) to be split into multiple+single\-commodity postings, keeping the output parseable.+.SS print alignment+Amounts are shown right\-aligned within each transaction (but not+aligned across all transactions; you can achieve that with ledger\-mode+in Emacs).+.SS print amount style+Amounts will be displayed mostly in their commodity\(aqs display style,+with standardised symbol placement, decimal mark, and digit group marks.+This does not apply to their decimal digits; \f[CR]print\f[R] normally+shows the same decimal digits that are recorded in each journal entry.+.PP+You can override the decimal precisions with \f[CR]print\f[R]\(aqs+special \f[CR]\-\-round\f[R] option (\f[I]since 1.32\f[R]).+\f[CR]\-\-round\f[R] tries to show amounts with their commodities\(aq+standard decimal precisions, increasingly strongly:+.IP \(bu 2+\f[CR]\-\-round=none\f[R] show amounts with original precisions+(default)+.IP \(bu 2+\f[CR]\-\-round=soft\f[R] add/remove decimal zeros in amounts (except+costs)+.IP \(bu 2+\f[CR]\-\-round=hard\f[R] round amounts (except costs), possibly hiding+significant digits+.IP \(bu 2+\f[CR]\-\-round=all\f[R] round all amounts and costs+.PP+\f[CR]soft\f[R] is good for non\-lossy cleanup, displaying more+consistent decimals where possible, without making entries unbalanced.+.PP+\f[CR]hard\f[R] or \f[CR]all\f[R] can be good for stronger cleanup, when+decimal rounding is wanted.+Note rounding can produce unbalanced journal entries, perhaps requiring+manual fixup.+.SS print parseability+Normally, print\(aqs output is a valid hledger journal, which you can+\(dqpipe\(dq to a second hledger command for further processing.+This is sometimes convenient for achieving certain kinds of query+(though less needed now that queries have become more powerful):+.IP+.EX+# Show running total of food expenses paid from cash.+# \-f\- reads from stdin. \-I/\-\-ignore\-assertions is sometimes needed.+$ hledger print assets:cash | hledger \-f\- \-I reg expenses:food+.EE+.PP+But here are some things which can cause print\(aqs output to become+unparseable:+.IP \(bu 2+\f[CR]\-\-round\f[R] (see above) can disrupt transaction balancing.+.IP \(bu 2+Account aliases or pivoting can disrupt account names, balance+assertions, or balance assignments.+.IP \(bu 2+Value reporting also can disrupt balance assertions or balance+assignments.+.IP \(bu 2+Auto postings can generate too many amountless postings.+.IP \(bu 2+\f[CR]\-\-infer\-costs or \-\-infer\-equity\f[R] can generate+too\-complex redundant costs.+.IP \(bu 2+Because print always shows transactions in date order, balance+assertions involving non\-date\-ordered transactions (and same\-day+postings) could be disrupted.+.SS print, other features+With \f[CR]\-B\f[R]/\f[CR]\-\-cost\f[R], amounts with costs are shown+converted to cost.+.PP+With \f[CR]\-\-invert\f[R], posting amounts are shown with their sign+flipped.+It could be useful if you have accidentally recorded some transactions+with the wrong signs.+.PP+With \f[CR]\-\-new\f[R], print shows only transactions it has not seen+on a previous run.+This uses the same deduplication system as the \f[CR]import\f[R]+command.+(See import\(aqs docs for details.)+.PP+With \f[CR]\-m DESC\f[R]/\f[CR]\-\-match=DESC\f[R], print shows one+recent transaction whose description is most similar to DESC.+DESC should contain at least two characters.+If there is no similar\-enough match, no transaction will be shown and+the program exit code will be non\-zero.+.PP+With \f[CR]\-\-locations\f[R], print adds the source file and line+number to every transaction, as a tag.+.SS print output format+This command also supports the output destination and output format+options The output formats supported are \f[CR]txt\f[R],+\f[CR]beancount\f[R] (\f[I]Added in 1.32\f[R]), \f[CR]csv\f[R],+\f[CR]tsv\f[R] (\f[I]Added in 1.32\f[R]), \f[CR]json\f[R] and+\f[CR]sql\f[R].+.PP+The \f[CR]beancount\f[R] format tries to produce Beancount\-compatible+output, as follows:+.IP \(bu 2+Transaction and postings with unmarked status are converted to cleared+(\f[CR]*\f[R]) status.+.IP \(bu 2+Transactions\(aq payee and note are backslash\-escaped and+double\-quote\-escaped and wrapped in double quotes.+.IP \(bu 2+Transaction tags are copied to Beancount #tag format.+.IP \(bu 2+Commodity symbols are converted to upper case, and a small number of+currency symbols like \f[CR]$\f[R] are converted to the corresponding+currency names.+.IP \(bu 2+Account name parts are capitalised and unsupported characters are+replaced with \f[CR]\-\f[R].+If an account name part does not begin with a letter, or if the first+part is not Assets, Liabilities, Equity, Income, or Expenses, an error+is raised.+(Use \f[CR]\-\-alias\f[R] options to bring your accounts into+compliance.)+.IP \(bu 2+An \f[CR]open\f[R] directive is generated for each account used, on the+earliest transaction date.+.PP+Some limitations:+.IP \(bu 2+Balance assertions are removed.+.IP \(bu 2+Balance assignments become missing amounts.+.IP \(bu 2+Virtual and balanced virtual postings become regular postings.+.IP \(bu 2+Directives are not converted.+.PP+Here\(aqs an example of print\(aqs CSV output:+.IP+.EX+$ hledger print \-Ocsv+\(dqtxnidx\(dq,\(dqdate\(dq,\(dqdate2\(dq,\(dqstatus\(dq,\(dqcode\(dq,\(dqdescription\(dq,\(dqcomment\(dq,\(dqaccount\(dq,\(dqamount\(dq,\(dqcommodity\(dq,\(dqcredit\(dq,\(dqdebit\(dq,\(dqposting\-status\(dq,\(dqposting\-comment\(dq+\(dq1\(dq,\(dq2008/01/01\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq,\(dqincome\(dq,\(dq\(dq,\(dqassets:bank:checking\(dq,\(dq1\(dq,\(dq$\(dq,\(dq\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq+\(dq1\(dq,\(dq2008/01/01\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq,\(dqincome\(dq,\(dq\(dq,\(dqincome:salary\(dq,\(dq\-1\(dq,\(dq$\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq+\(dq2\(dq,\(dq2008/06/01\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq,\(dqgift\(dq,\(dq\(dq,\(dqassets:bank:checking\(dq,\(dq1\(dq,\(dq$\(dq,\(dq\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq+\(dq2\(dq,\(dq2008/06/01\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq,\(dqgift\(dq,\(dq\(dq,\(dqincome:gifts\(dq,\(dq\-1\(dq,\(dq$\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq+\(dq3\(dq,\(dq2008/06/02\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq,\(dqsave\(dq,\(dq\(dq,\(dqassets:bank:saving\(dq,\(dq1\(dq,\(dq$\(dq,\(dq\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq+\(dq3\(dq,\(dq2008/06/02\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq,\(dqsave\(dq,\(dq\(dq,\(dqassets:bank:checking\(dq,\(dq\-1\(dq,\(dq$\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq+\(dq4\(dq,\(dq2008/06/03\(dq,\(dq\(dq,\(dq*\(dq,\(dq\(dq,\(dqeat & shop\(dq,\(dq\(dq,\(dqexpenses:food\(dq,\(dq1\(dq,\(dq$\(dq,\(dq\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq+\(dq4\(dq,\(dq2008/06/03\(dq,\(dq\(dq,\(dq*\(dq,\(dq\(dq,\(dqeat & shop\(dq,\(dq\(dq,\(dqexpenses:supplies\(dq,\(dq1\(dq,\(dq$\(dq,\(dq\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq+\(dq4\(dq,\(dq2008/06/03\(dq,\(dq\(dq,\(dq*\(dq,\(dq\(dq,\(dqeat & shop\(dq,\(dq\(dq,\(dqassets:cash\(dq,\(dq\-2\(dq,\(dq$\(dq,\(dq2\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq+\(dq5\(dq,\(dq2008/12/31\(dq,\(dq\(dq,\(dq*\(dq,\(dq\(dq,\(dqpay off\(dq,\(dq\(dq,\(dqliabilities:debts\(dq,\(dq1\(dq,\(dq$\(dq,\(dq\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq+\(dq5\(dq,\(dq2008/12/31\(dq,\(dq\(dq,\(dq*\(dq,\(dq\(dq,\(dqpay off\(dq,\(dq\(dq,\(dqassets:bank:checking\(dq,\(dq\-1\(dq,\(dq$\(dq,\(dq1\(dq,\(dq\(dq,\(dq\(dq,\(dq\(dq+.EE+.IP \(bu 2+There is one CSV record per posting, with the parent transaction\(aqs+fields repeated.+.IP \(bu 2+The \(dqtxnidx\(dq (transaction index) field shows which postings belong+to the same transaction.+(This number might change if transactions are reordered within the file,+files are parsed/included in a different order, etc.)+.IP \(bu 2+The amount is separated into \(dqcommodity\(dq (the symbol) and+\(dqamount\(dq (numeric quantity) fields.+.IP \(bu 2+The numeric amount is repeated in either the \(dqcredit\(dq or+\(dqdebit\(dq column, for convenience.+(Those names are not accurate in the accounting sense; it just puts+negative amounts under credit and zero or greater amounts under debit.)+.SS aregister+(areg)+.PP+Show the transactions and running balances in one account, with each+transaction on one line.+.IP+.EX+Flags:+ \-\-txn\-dates filter strictly by transaction date, not posting+ date. Warning: this can show a wrong running+ balance.+ \-\-no\-elide don\(aqt show only 2 commodities per amount+ \-\-cumulative accumulation mode: show running total from report+ start date+ \-H \-\-historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date) (default)+ \-\-invert display all amounts with reversed sign+ \-\-drop=N omit N leading account name parts+ \-\-heading=YN show heading row above table: yes (default) or no+ \-w \-\-width=N set output width (default: terminal width). \-wN,M+ sets description width as well.+ \-\-align\-all guarantee alignment across all lines (slower)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+\f[CR]aregister\f[R] shows the overall transactions affecting a+particular account (and any subaccounts).+Each report line represents one transaction in this account.+Transactions before the report start date are included in the running+balance (\f[CR]\-\-historical\f[R] mode is the default).+You can suppress this behaviour using the \f[CR]\-\-cumulative\f[R]+option.+.PP+This is a more \(dqreal world\(dq, bank\-like view than the+\f[CR]register\f[R] command (which shows individual postings, possibly+from multiple accounts, not necessarily in historical mode).+As a quick rule of thumb:+.IP \(bu 2+\f[CR]aregister\f[R] is best when reconciling real\-world+asset/liability accounts+.IP \(bu 2+\f[CR]register\f[R] is best when reviewing individual revenues/expenses.+.PP+Note this command\(aqs non\-standard, and required, first argument; it+specifies the account whose register will be shown.+You can write the account\(aqs name, or (to save typing) a+case\-insensitive infix regular expression matching the name, which+selects the alphabetically first matched account.+(For example, if you have \f[CR]assets:personal checking\f[R] and+\f[CR]assets:business checking\f[R], \f[CR]hledger areg checking\f[R]+would select \f[CR]assets:business checking\f[R].)+.PP+Transactions involving subaccounts of this account will also be shown.+\f[CR]aregister\f[R] ignores depth limits, so its final total will+always match a historical balance report with similar arguments.+.PP+Any additional arguments are standard query arguments, which will limit+the transactions shown.+Note some queries will disturb the running balance, causing it to be+different from the account\(aqs real\-world running balance.+.PP+An example: this shows the transactions and historical running balance+during july, in the first account whose name contains \(dqchecking\(dq:+.IP+.EX+$ hledger areg checking date:jul+.EE+.PP+Each \f[CR]aregister\f[R] line item shows:+.IP \(bu 2+the transaction\(aqs date (or the relevant posting\(aqs date if+different, see below)+.IP \(bu 2+the names of all the other account(s) involved in this transaction+(probably abbreviated)+.IP \(bu 2+the total change to this account\(aqs balance from this transaction+.IP \(bu 2+the account\(aqs historical running balance after this transaction.+.PP+Transactions making a net change of zero are not shown by default; add+the \f[CR]\-E/\-\-empty\f[R] flag to show them.+.PP+For performance reasons, column widths are chosen based on the first+1000 lines; this means unusually wide values in later lines can cause+visual discontinuities as column widths are adjusted.+If you want to ensure perfect alignment, at the cost of more time and+memory, use the \f[CR]\-\-align\-all\f[R] flag.+.PP+By default, \f[CR]aregister\f[R] shows a heading above the data.+However, when reporting in a language different from English, it is+easier to omit this heading and prepend your own one.+For this purpose, use the \f[CR]\-\-heading=no\f[R] option.+.PP+This command also supports the output destination and output format+options.+The output formats supported are \f[CR]txt\f[R], \f[CR]csv\f[R],+\f[CR]tsv\f[R] (\f[I]Added in 1.32\f[R]), \f[CR]html\f[R],+\f[CR]fods\f[R] (\f[I]Added in 1.41\f[R]) and \f[CR]json\f[R].+.SS aregister and posting dates+aregister always shows one line (and date and amount) per transaction.+But sometimes transactions have postings with different dates.+Also, not all of a transaction\(aqs postings may be within the report+period.+To resolve this, aregister shows the earliest of the transaction\(aqs+date and posting dates that is in\-period, and the sum of the in\-period+postings.+In other words it will show a combined line item with just the earliest+date, and the running balance will (temporarily, until the+transaction\(aqs last posting) be inaccurate.+Use \f[CR]register \-H\f[R] if you need to see the individual postings.+.PP+There is also a \f[CR]\-\-txn\-dates\f[R] flag, which filters strictly+by transaction date, ignoring posting dates.+This too can cause an inaccurate running balance.+.SS register+(reg)+.PP+Show postings and their running total.+.IP+.EX+Flags:+ \-\-cumulative accumulation mode: show running total from report+ start date (default)+ \-H \-\-historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date)+ \-A \-\-average show running average of posting amounts instead+ of total (implies \-\-empty)+ \-m \-\-match=DESC fuzzy search for one recent posting with+ description closest to DESC+ \-r \-\-related show postings\(aq siblings instead+ \-\-invert display all amounts with reversed sign+ \-\-drop=N omit N leading account name parts+ \-\-sort=FIELDS sort by: date, desc, account, amount, absamount,+ or a comma\-separated combination of these. For a+ descending sort, prefix with \-. (Default: date)+ \-w \-\-width=N set output width (default: terminal width). \-wN,M+ sets description width as well.+ \-\-align\-all guarantee alignment across all lines (slower)+ \-\-base\-url=URLPREFIX in html output, generate links to hledger\-web,+ with this prefix. (Usually the base url shown by+ hledger\-web; can also be relative.)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, csv, tsv, html, fods, json.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+The register command displays matched postings, across all accounts, in+date order, with their running total or running historical balance.+(See also the \f[CR]aregister\f[R] command, which shows matched+transactions in a specific account.)+.PP+register normally shows line per posting, but note that multi\-commodity+amounts will occupy multiple lines (one line per commodity).+.PP+It is typically used with a query selecting a particular account, to see+that account\(aqs activity:+.IP+.EX+$ hledger register checking+2008/01/01 income assets:bank:checking $1 $1+2008/06/01 gift assets:bank:checking $1 $2+2008/06/02 save assets:bank:checking $\-1 $1+2008/12/31 pay off assets:bank:checking $\-1 0+.EE+.PP+With \f[CR]\-\-date2\f[R], it shows and sorts by secondary date instead.+.PP+For performance reasons, column widths are chosen based on the first+1000 lines; this means unusually wide values in later lines can cause+visual discontinuities as column widths are adjusted.+If you want to ensure perfect alignment, at the cost of more time and+memory, use the \f[CR]\-\-align\-all\f[R] flag.+.PP+The \f[CR]\-\-historical\f[R]/\f[CR]\-H\f[R] flag adds the balance from+any undisplayed prior postings to the running total.+This is useful when you want to see only recent activity, with a+historically accurate running balance:+.IP+.EX+$ hledger register checking \-b 2008/6 \-\-historical+2008/06/01 gift assets:bank:checking $1 $2+2008/06/02 save assets:bank:checking $\-1 $1+2008/12/31 pay off assets:bank:checking $\-1 0+.EE+.PP+The \f[CR]\-\-depth\f[R] option limits the amount of sub\-account detail+displayed.+.PP+The \f[CR]\-\-drop\f[R] option will trim leading segments from account+names.+.PP+The \f[CR]\-\-average\f[R]/\f[CR]\-A\f[R] flag shows the running average+posting amount instead of the running total (so, the final number+displayed is the average for the whole report period).+This flag implies \f[CR]\-\-empty\f[R] (see below).+It is affected by \f[CR]\-\-historical\f[R].+It works best when showing just one account and one commodity.+.PP+The \f[CR]\-\-related\f[R]/\f[CR]\-r\f[R] flag shows the \f[I]other\f[R]+postings in the transactions of the postings which would normally be+shown.+.PP+The \f[CR]\-\-invert\f[R] flag negates all amounts.+For example, it can be used on an income account where amounts are+normally displayed as negative numbers.+It\(aqs also useful to show postings on the checking account together+with the related account:+.PP+The \f[CR]\-\-sort=FIELDS\f[R] flag sorts by the fields given, which can+be any of \f[CR]account\f[R], \f[CR]amount\f[R], \f[CR]absamount\f[R],+\f[CR]date\f[R], or \f[CR]desc\f[R]/\f[CR]description\f[R], optionally+separated by commas.+For example, \f[CR]\-\-sort account,amount\f[R] will group all+transactions in each account, sorted by transaction amount.+Each field can be negated by a preceding \f[CR]\-\f[R], so+\f[CR]\-\-sort \-amount\f[R] will show transactions ordered from+smallest amount to largest amount.+.IP+.EX+$ hledger register \-\-related \-\-invert assets:checking+.EE+.PP+With a reporting interval, register shows summary postings, one per+interval, aggregating the postings to each account:+.IP+.EX+$ hledger register \-\-monthly income+2008/01 income:salary $\-1 $\-1+2008/06 income:gifts $\-1 $\-2+.EE+.PP+Periods with no activity, and summary postings with a zero amount, are+not shown by default; use the \f[CR]\-\-empty\f[R]/\f[CR]\-E\f[R] flag+to see them:+.IP+.EX+$ hledger register \-\-monthly income \-E+2008/01 income:salary $\-1 $\-1+2008/02 0 $\-1+2008/03 0 $\-1+2008/04 0 $\-1+2008/05 0 $\-1+2008/06 income:gifts $\-1 $\-2+2008/07 0 $\-2+2008/08 0 $\-2+2008/09 0 $\-2+2008/10 0 $\-2+2008/11 0 $\-2+2008/12 0 $\-2+.EE+.PP+Often, you\(aqll want to see just one line per interval.+The \f[CR]\-\-depth\f[R] option helps with this, causing subaccounts to+be aggregated:+.IP+.EX+$ hledger register \-\-monthly assets \-\-depth 1+2008/01 assets $1 $1+2008/06 assets $\-1 0+2008/12 assets $\-1 $\-1+.EE+.PP+Note when using report intervals, if you specify start/end dates these+will be adjusted outward if necessary to contain a whole number of+intervals.+This ensures that the first and last intervals are full length and+comparable to the others in the report.+.PP+If you have a deeply nested account tree some reports might benefit from+trimming leading segments from the account names using+\f[CR]\-\-drop\f[R].+.IP+.EX+$ hledger register \-\-monthly income \-\-drop 1+2008/01 salary $\-1 $\-1+2008/06 gifts $\-1 $\-2+.EE+.PP+With \f[CR]\-m DESC\f[R]/\f[CR]\-\-match=DESC\f[R], register does a+fuzzy search for one recent posting whose description is most similar to+DESC.+DESC should contain at least two characters.+If there is no similar\-enough match, no posting will be shown and the+program exit code will be non\-zero.+.SS Custom register output+register normally uses the full terminal width (or 80 columns if it+can\(aqt detect that).+You can override this with the \f[CR]\-\-width\f[R]/\f[CR]\-w\f[R]+option.+.PP+The description and account columns normally share the space equally+(about half of (width \- 40) each).+You can adjust this by adding a description width as part of+\-\-width\(aqs argument, comma\-separated: \f[CR]\-\-width W,D\f[R] .+Here\(aqs a diagram (won\(aqt display correctly in \-\-help):+.IP+.EX+<\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- width (W) \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->+date (10) description (D) account (W\-41\-D) amount (12) balance (12)+DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA+.EE+.PP+and some examples:+.IP+.EX+$ hledger reg # use terminal width (or 80 on windows)+$ hledger reg \-w 100 # use width 100+$ hledger reg \-w 100,40 # set overall width 100, description width 40+.EE+.PP+This command also supports the output destination and output format+options The output formats supported are \f[CR]txt\f[R], \f[CR]csv\f[R],+\f[CR]tsv\f[R] (\f[I]Added in 1.32\f[R]), and \f[CR]json\f[R].+.SS balancesheet+(bs)+.PP+Show the end balances in asset and liability accounts.+Amounts are shown with normal positive sign, as in conventional+financial statements.+.IP+.EX+Flags:+ \-\-sum calculation mode: show sum of posting amounts+ (default)+ \-\-valuechange calculation mode: show total change of value of+ period\-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ \-\-gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ \-\-count calculation mode: show the count of postings+ \-\-change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ \-\-cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. \-b/\-\-begin) to column end+ \-H \-\-historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ \-l \-\-flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth\-clipped.+ \-t \-\-tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ \-\-drop=N in list mode, omit N leading account name parts+ \-\-declared include non\-parent declared accounts (best used+ with \-E)+ \-A \-\-average show a row average column (in multicolumn+ reports)+ \-T \-\-row\-total show a row total column (in multicolumn reports)+ \-\-summary\-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ \-N \-\-no\-total omit the final total row+ \-\-no\-elide in tree mode, don\(aqt squash boring parent accounts+ \-\-format=FORMATSTR use this custom line format (in simple reports)+ \-S \-\-sort\-amount sort by amount instead of account code/name+ \-% \-\-percent express values in percentage of each column\(aqs+ total+ \-\-layout=ARG how to show multi\-commodity amounts:+ \(aqwide[,WIDTH]\(aq: all commodities on one line+ \(aqtall\(aq : each commodity on a new line+ \(aqbare\(aq : bare numbers, symbols in a column+ \-\-base\-url=URLPREFIX in html output, generate hyperlinks to+ hledger\-web, with this prefix. (Usually the base+ url shown by hledger\-web; can also be relative.)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+This command displays a balance sheet, showing historical ending+balances of asset and liability accounts.+(To see equity as well, use the balancesheetequity command.)+.PP+Accounts declared with the \f[CR]Asset\f[R], \f[CR]Cash\f[R] or+\f[CR]Liability\f[R] type are shown (see account types).+Or if no such accounts are declared, it shows top\-level accounts named+\f[CR]asset\f[R] or \f[CR]liability\f[R] (case insensitive, plurals+allowed) and their subaccounts.+.PP+Example:+.IP+.EX+$ hledger balancesheet+Balance Sheet 2008\-12\-31++ || 2008\-12\-31 +====================++============+ Assets || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ assets:bank:saving || $1 + assets:cash || $\-2 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ || $\-1 +====================++============+ Liabilities || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ liabilities:debts || $\-1 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ || $\-1 +====================++============+ Net: || 0 +.EE+.PP+This command is a higher\-level variant of the \f[CR]balance\f[R]+command, and supports many of that command\(aqs features, such as+multi\-period reports.+It is similar to \f[CR]hledger balance \-H assets liabilities\f[R], but+with smarter account detection, and liabilities displayed with their+sign flipped.+.PP+This command also supports the output destination and output format+options The output formats supported are \f[CR]txt\f[R], \f[CR]csv\f[R],+\f[CR]tsv\f[R] (\f[I]Added in 1.32\f[R]), \f[CR]html\f[R], and+\f[CR]json\f[R].+.SS balancesheetequity+(bse)+.PP+This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts.+Amounts are shown with normal positive sign, as in conventional+financial statements.+.IP+.EX+Flags:+ \-\-sum calculation mode: show sum of posting amounts+ (default)+ \-\-valuechange calculation mode: show total change of value of+ period\-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ \-\-gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ \-\-count calculation mode: show the count of postings+ \-\-change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ \-\-cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. \-b/\-\-begin) to column end+ \-H \-\-historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ \-l \-\-flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth\-clipped.+ \-t \-\-tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ \-\-drop=N in list mode, omit N leading account name parts+ \-\-declared include non\-parent declared accounts (best used+ with \-E)+ \-A \-\-average show a row average column (in multicolumn+ reports)+ \-T \-\-row\-total show a row total column (in multicolumn reports)+ \-\-summary\-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ \-N \-\-no\-total omit the final total row+ \-\-no\-elide in tree mode, don\(aqt squash boring parent accounts+ \-\-format=FORMATSTR use this custom line format (in simple reports)+ \-S \-\-sort\-amount sort by amount instead of account code/name+ \-% \-\-percent express values in percentage of each column\(aqs+ total+ \-\-layout=ARG how to show multi\-commodity amounts:+ \(aqwide[,WIDTH]\(aq: all commodities on one line+ \(aqtall\(aq : each commodity on a new line+ \(aqbare\(aq : bare numbers, symbols in a column+ \-\-base\-url=URLPREFIX in html output, generate hyperlinks to+ hledger\-web, with this prefix. (Usually the base+ url shown by hledger\-web; can also be relative.)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+This report shows accounts declared with the \f[CR]Asset\f[R],+\f[CR]Cash\f[R], \f[CR]Liability\f[R] or \f[CR]Equity\f[R] type (see+account types).+Or if no such accounts are declared, it shows top\-level accounts named+\f[CR]asset\f[R], \f[CR]liability\f[R] or \f[CR]equity\f[R] (case+insensitive, plurals allowed) and their subaccounts.+.PP+Example:+.IP+.EX+$ hledger balancesheetequity+Balance Sheet With Equity 2008\-12\-31++ || 2008\-12\-31 +====================++============+ Assets || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ assets:bank:saving || $1 + assets:cash || $\-2 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ || $\-1 +====================++============+ Liabilities || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ liabilities:debts || $\-1 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ || $\-1 +====================++============+ Equity || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ || 0 +====================++============+ Net: || 0 +.EE+.PP+This command is a higher\-level variant of the \f[CR]balance\f[R]+command, and supports many of that command\(aqs features, such as+multi\-period reports.+It is similar to+\f[CR]hledger balance \-H assets liabilities equity\f[R], but with+smarter account detection, and liabilities/equity displayed with their+sign flipped.+.PP+This report is the easiest way to see if the accounting equation (A+L+E+= 0) is satisfied (after you have done a \f[CR]close \-\-retain\f[R] to+merge revenues and expenses with equity, and perhaps added+\f[CR]\-\-infer\-equity\f[R] to balance your commodity conversions).+.PP+This command also supports the output destination and output format+options The output formats supported are \f[CR]txt\f[R], \f[CR]csv\f[R],+\f[CR]tsv\f[R], \f[CR]html\f[R], and \f[CR]json\f[R].+.SS cashflow+(cf)+.PP+This command displays a (simple) cashflow statement, showing the inflows+and outflows affecting \(dqcash\(dq (ie, liquid, easily convertible)+assets.+Amounts are shown with normal positive sign, as in conventional+financial statements.+.IP+.EX+Flags:+ \-\-sum calculation mode: show sum of posting amounts+ (default)+ \-\-valuechange calculation mode: show total change of value of+ period\-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ \-\-gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ \-\-count calculation mode: show the count of postings+ \-\-change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ \-\-cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. \-b/\-\-begin) to column end+ \-H \-\-historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ \-l \-\-flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth\-clipped.+ \-t \-\-tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ \-\-drop=N in list mode, omit N leading account name parts+ \-\-declared include non\-parent declared accounts (best used+ with \-E)+ \-A \-\-average show a row average column (in multicolumn+ reports)+ \-T \-\-row\-total show a row total column (in multicolumn reports)+ \-\-summary\-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ \-N \-\-no\-total omit the final total row+ \-\-no\-elide in tree mode, don\(aqt squash boring parent accounts+ \-\-format=FORMATSTR use this custom line format (in simple reports)+ \-S \-\-sort\-amount sort by amount instead of account code/name+ \-% \-\-percent express values in percentage of each column\(aqs+ total+ \-\-layout=ARG how to show multi\-commodity amounts:+ \(aqwide[,WIDTH]\(aq: all commodities on one line+ \(aqtall\(aq : each commodity on a new line+ \(aqbare\(aq : bare numbers, symbols in a column+ \-\-base\-url=URLPREFIX in html output, generate hyperlinks to+ hledger\-web, with this prefix. (Usually the base+ url shown by hledger\-web; can also be relative.)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+This report shows accounts declared with the \f[CR]Cash\f[R] type (see+account types).+Or if no such accounts are declared, it shows accounts+.IP \(bu 2+under a top\-level account named \f[CR]asset\f[R] (case insensitive,+plural allowed)+.IP \(bu 2+whose name contains some variation of \f[CR]cash\f[R], \f[CR]bank\f[R],+\f[CR]checking\f[R] or \f[CR]saving\f[R].+.PP+More precisely: all accounts matching this case insensitive regular+expression:+.PP+\f[CR]\(haassets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|currentcash)(:|$)\f[R]+.PP+and their subaccounts.+.PP+An example cashflow report:+.IP+.EX+$ hledger cashflow+Cashflow Statement 2008++ || 2008 +====================++======+ Cash flows || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-+ assets:bank:saving || $1 + assets:cash || $\-2 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-+ || $\-1 +.EE+.PP+This command is a higher\-level variant of the \f[CR]balance\f[R]+command, and supports many of that command\(aqs features, such as+multi\-period reports.+It is similar to+\f[CR]hledger balance assets not:fixed not:investment not:receivable\f[R],+but with smarter account detection.+.PP+This command also supports the output destination and output format+options The output formats supported are \f[CR]txt\f[R], \f[CR]csv\f[R],+\f[CR]tsv\f[R] (\f[I]Added in 1.32\f[R]), \f[CR]html\f[R], and+\f[CR]json\f[R].+.SS incomestatement+(is)+.PP+Show revenue inflows and expense outflows during the report period.+Amounts are shown with normal positive sign, as in conventional+financial statements.+.IP+.EX+Flags:+ \-\-sum calculation mode: show sum of posting amounts+ (default)+ \-\-valuechange calculation mode: show total change of value of+ period\-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ \-\-gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ \-\-count calculation mode: show the count of postings+ \-\-change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ \-\-cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. \-b/\-\-begin) to column end+ \-H \-\-historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ \-l \-\-flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth\-clipped.+ \-t \-\-tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ \-\-drop=N in list mode, omit N leading account name parts+ \-\-declared include non\-parent declared accounts (best used+ with \-E)+ \-A \-\-average show a row average column (in multicolumn+ reports)+ \-T \-\-row\-total show a row total column (in multicolumn reports)+ \-\-summary\-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ \-N \-\-no\-total omit the final total row+ \-\-no\-elide in tree mode, don\(aqt squash boring parent accounts+ \-\-format=FORMATSTR use this custom line format (in simple reports)+ \-S \-\-sort\-amount sort by amount instead of account code/name+ \-% \-\-percent express values in percentage of each column\(aqs+ total+ \-\-layout=ARG how to show multi\-commodity amounts:+ \(aqwide[,WIDTH]\(aq: all commodities on one line+ \(aqtall\(aq : each commodity on a new line+ \(aqbare\(aq : bare numbers, symbols in a column+ \-\-base\-url=URLPREFIX in html output, generate hyperlinks to+ hledger\-web, with this prefix. (Usually the base+ url shown by hledger\-web; can also be relative.)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+This command displays an income statement, showing revenues and expenses+during one or more periods.+.PP+It shows accounts declared with the \f[CR]Revenue\f[R] or+\f[CR]Expense\f[R] type (see account types).+Or if no such accounts are declared, it shows top\-level accounts named+\f[CR]revenue\f[R] or \f[CR]income\f[R] or \f[CR]expense\f[R] (case+insensitive, plurals allowed) and their subaccounts.+.PP+Example:+.IP+.EX+$ hledger incomestatement+Income Statement 2008++ || 2008 +===================++======+ Revenues || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-+ income:gifts || $1 + income:salary || $1 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-+ || $2 +===================++======+ Expenses || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-+ expenses:food || $1 + expenses:supplies || $1 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-+ || $2 +===================++======+ Net: || 0 +.EE+.PP+This command is a higher\-level variant of the \f[CR]balance\f[R]+command, and supports many of that command\(aqs features, such as+multi\-period reports.+It is similar to+\f[CR]hledger balance \(aq(revenues|income)\(aq expenses\f[R], but with+smarter account detection, and revenues/income displayed with their sign+flipped.+.PP+This command also supports the output destination and output format+options The output formats supported are \f[CR]txt\f[R], \f[CR]csv\f[R],+\f[CR]tsv\f[R] (\f[I]Added in 1.32\f[R]), \f[CR]html\f[R], and+\f[CR]json\f[R].+.SH Advanced report commands+.SS balance+(bal)+.PP+A flexible, general purpose \(dqsumming\(dq report that shows accounts+with some kind of numeric data.+This can be balance changes per period, end balances, budget+performance, unrealised capital gains, etc.+.IP+.EX+Flags:+ \-\-sum calculation mode: show sum of posting amounts+ (default)+ \-\-valuechange calculation mode: show total change of value of+ period\-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ \-\-gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ \-\-budget[=DESCPAT] calculation mode: show sum of posting amounts+ together with budget goals defined by periodic+ transactions. With a DESCPAT argument (must be+ separated by = not space),+ use only periodic transactions with matching+ description+ (case insensitive substring match).+ \-\-count calculation mode: show the count of postings+ \-\-change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports,+ default)+ \-\-cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. \-b/\-\-begin) to column end+ \-H \-\-historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ \-l \-\-flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth\-clipped.+ \-t \-\-tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ \-\-drop=N in list mode, omit N leading account name parts+ \-\-declared include non\-parent declared accounts (best used+ with \-E)+ \-A \-\-average show a row average column (in multicolumn+ reports)+ \-T \-\-row\-total show a row total column (in multicolumn reports)+ \-\-summary\-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ \-N \-\-no\-total omit the final total row+ \-\-no\-elide in tree mode, don\(aqt squash boring parent accounts+ \-\-format=FORMATSTR use this custom line format (in simple reports)+ \-S \-\-sort\-amount sort by amount instead of account code/name (in+ flat mode). With multiple columns, sorts by the row+ total, or by row average if that is displayed.+ \-% \-\-percent express values in percentage of each column\(aqs+ total+ \-r \-\-related show the other accounts transacted with, instead+ \-\-invert display all amounts with reversed sign+ \-\-transpose switch rows and columns (use vertical time axis)+ \-\-layout=ARG how to lay out multi\-commodity amounts and the+ overall table:+ \(aqwide[,W]\(aq: commodities on same line, up to W wide+ \(aqtall\(aq : commodities on separate lines+ \(aqbare\(aq : commodity symbols in a separate column+ \(aqtidy\(aq : each data field in its own column+ \-\-base\-url=URLPREFIX in html output, generate links to hledger\-web,+ with this prefix. (Usually the base url shown by+ hledger\-web; can also be relative.)+ \-O \-\-output\-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json, fods.+ \-o \-\-output\-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.+.EE+.PP+\f[CR]balance\f[R] is one of hledger\(aqs oldest and most versatile+commands, for listing account balances, balance changes, values, value+changes and more, during one time period or many.+Generally it shows a table, with rows representing accounts, and columns+representing periods.+.PP+Note there are some variants of the \f[CR]balance\f[R] command with+convenient defaults, which are simpler to use: \f[CR]balancesheet\f[R],+\f[CR]balancesheetequity\f[R], \f[CR]cashflow\f[R] and+\f[CR]incomestatement\f[R].+When you need more control, then use \f[CR]balance\f[R].+.SS balance features+Here\(aqs a quick overview of the \f[CR]balance\f[R] command\(aqs+features, followed by more detailed descriptions and examples.+Many of these work with the other balance\-like commands as well+(\f[CR]bs\f[R], \f[CR]cf\f[R], \f[CR]is\f[R]..).+.PP+\f[CR]balance\f[R] can show..+.IP \(bu 2+accounts as a list (\f[CR]\-l\f[R]) or a tree (\f[CR]\-t\f[R])+.IP \(bu 2+optionally depth\-limited (\f[CR]\-[1\-9]\f[R])+.IP \(bu 2+sorted by declaration order and name, or by amount+.PP+\&..and their..+.IP \(bu 2+balance changes (the default)+.IP \(bu 2+or actual and planned balance changes (\f[CR]\-\-budget\f[R])+.IP \(bu 2+or value of balance changes (\f[CR]\-V\f[R])+.IP \(bu 2+or change of balance values (\f[CR]\-\-valuechange\f[R])+.IP \(bu 2+or unrealised capital gain/loss (\f[CR]\-\-gain\f[R])+.IP \(bu 2+or balance changes from sibling postings+(\f[CR]\-\-related\f[R]/\f[CR]\-r\f[R])+.IP \(bu 2+or postings count (\f[CR]\-\-count\f[R])+.PP+\&..in..+.IP \(bu 2+one time period (the whole journal period by default)+.IP \(bu 2+or multiple periods (\f[CR]\-D\f[R], \f[CR]\-W\f[R], \f[CR]\-M\f[R],+\f[CR]\-Q\f[R], \f[CR]\-Y\f[R], \f[CR]\-p INTERVAL\f[R])+.PP+\&..either..+.IP \(bu 2+per period (the default)+.IP \(bu 2+or accumulated since report start date (\f[CR]\-\-cumulative\f[R])+.IP \(bu 2+or accumulated since account creation (\f[CR]\-\-historical/\-H\f[R])+.PP+\&..possibly converted to..+.IP \(bu 2+cost+(\f[CR]\-\-value=cost[,COMM]\f[R]/\f[CR]\-\-cost\f[R]/\f[CR]\-B\f[R])+.IP \(bu 2+or market value, as of transaction dates+(\f[CR]\-\-value=then[,COMM]\f[R])+.IP \(bu 2+or at period ends (\f[CR]\-\-value=end[,COMM]\f[R])+.IP \(bu 2+or now (\f[CR]\-\-value=now\f[R])+.IP \(bu 2+or at some other date (\f[CR]\-\-value=YYYY\-MM\-DD\f[R])+.PP+\&..with..+.IP \(bu 2+totals (\f[CR]\-T\f[R]), averages (\f[CR]\-A\f[R]), percentages+(\f[CR]\-%\f[R]), inverted sign (\f[CR]\-\-invert\f[R])+.IP \(bu 2+rows and columns swapped (\f[CR]\-\-transpose\f[R])+.IP \(bu 2+another field used as account name (\f[CR]\-\-pivot\f[R])+.IP \(bu 2+custom\-formatted line items (single\-period reports only)+(\f[CR]\-\-format\f[R])+.IP \(bu 2+commodities displayed on the same line or multiple lines+(\f[CR]\-\-layout\f[R])+.PP+This command supports the output destination and output format options,+with output formats \f[CR]txt\f[R], \f[CR]csv\f[R], \f[CR]tsv\f[R]+(\f[I]Added in 1.32\f[R]), \f[CR]json\f[R], and (multi\-period reports+only:) \f[CR]html\f[R], \f[CR]fods\f[R] (\f[I]Added in 1.40\f[R]).+In \f[CR]txt\f[R] output in a colour\-supporting terminal, negative+amounts are shown in red.+.SS Simple balance report+With no arguments, \f[CR]balance\f[R] shows a list of all accounts and+their change of balance \- ie, the sum of posting amounts, both inflows+and outflows \- during the entire period of the journal.+(\(dqSimple\(dq here means just one column of numbers, covering a single+period.+You can also have multi\-period reports, described later.)+.PP+For real\-world accounts, these numbers will normally be their end+balance at the end of the journal period; more on this below.+.PP+Accounts are sorted by declaration order if any, and then alphabetically+by account name.+For instance (using examples/sample.journal):+.IP+.EX+$ hledger \-f examples/sample.journal bal+ $1 assets:bank:saving+ $\-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $\-1 income:gifts+ $\-1 income:salary+ $1 liabilities:debts+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0 +.EE+.PP+Accounts with a zero balance (and no non\-zero subaccounts, in tree mode+\- see below) are hidden by default.+Use \f[CR]\-E/\-\-empty\f[R] to show them (revealing+\f[CR]assets:bank:checking\f[R] here):+.IP+.EX+$ hledger \-f examples/sample.journal bal \-E+ 0 assets:bank:checking+ $1 assets:bank:saving+ $\-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $\-1 income:gifts+ $\-1 income:salary+ $1 liabilities:debts+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0 +.EE+.PP+The total of the amounts displayed is shown as the last line, unless+\f[CR]\-N\f[R]/\f[CR]\-\-no\-total\f[R] is used.+.SS Balance report line format+For single\-period balance reports displayed in the terminal (only), you+can use \f[CR]\-\-format FMT\f[R] to customise the format and content of+each line.+Eg:+.IP+.EX+$ hledger \-f examples/sample.journal balance \-\-format \(dq%20(account) %12(total)\(dq+ assets $\-1+ bank:saving $1+ cash $\-2+ expenses $2+ food $1+ supplies $1+ income $\-2+ gifts $\-1+ salary $\-1+ liabilities:debts $1+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0+.EE+.PP+The FMT format string specifies the formatting applied to each+account/balance pair.+It may contain any suitable text, with data fields interpolated like so:+.PP+\f[CR]%[MIN][.MAX](FIELDNAME)\f[R]+.IP \(bu 2+MIN pads with spaces to at least this width (optional)+.IP \(bu 2+MAX truncates at this width (optional)+.IP \(bu 2+FIELDNAME must be enclosed in parentheses, and can be one of:+.RS 2+.IP \(bu 2+\f[CR]depth_spacer\f[R] \- a number of spaces equal to the account\(aqs+depth, or if MIN is specified, MIN * depth spaces.+.IP \(bu 2+\f[CR]account\f[R] \- the account\(aqs name+.IP \(bu 2+\f[CR]total\f[R] \- the account\(aqs balance/posted total, right+justified+.RE+.PP+Also, FMT can begin with an optional prefix to control how+multi\-commodity amounts are rendered:+.IP \(bu 2+\f[CR]%_\f[R] \- render on multiple lines, bottom\-aligned (the default)+.IP \(bu 2+\f[CR]%\(ha\f[R] \- render on multiple lines, top\-aligned+.IP \(bu 2+\f[CR]%,\f[R] \- render on one line, comma\-separated+.PP+There are some quirks.+Eg in one\-line mode, \f[CR]%(depth_spacer)\f[R] has no effect, instead+\f[CR]%(account)\f[R] has indentation built in.+\ Experimentation may be needed to get pleasing results.+.PP+Some example formats:+.IP \(bu 2+\f[CR]%(total)\f[R] \- the account\(aqs total+.IP \(bu 2+\f[CR]%\-20.20(account)\f[R] \- the account\(aqs name, left justified,+padded to 20 characters and clipped at 20 characters+.IP \(bu 2+\f[CR]%,%\-50(account) %25(total)\f[R] \- account name padded to 50+characters, total padded to 20 characters, with multiple commodities+rendered on one line+.IP \(bu 2+\f[CR]%20(total) %2(depth_spacer)%\-(account)\f[R] \- the default+format for the single\-column balance report+.SS Filtered balance report+You can show fewer accounts, a different time period, totals from+cleared transactions only, etc.+by using query arguments or options to limit the postings being matched.+Eg:+.IP+.EX+$ hledger \-f examples/sample.journal bal \-\-cleared assets date:200806+ $\-2 assets:cash+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ $\-2 +.EE+.SS List or tree mode+By default, or with \f[CR]\-l/\-\-flat\f[R], accounts are shown as a+flat list with their full names visible, as in the examples above.+.PP+With \f[CR]\-t/\-\-tree\f[R], the account hierarchy is shown, with+subaccounts\(aq \(dqleaf\(dq names indented below their parent:+.IP+.EX+$ hledger \-f examples/sample.journal balance+ $\-1 assets+ $1 bank:saving+ $\-2 cash+ $2 expenses+ $1 food+ $1 supplies+ $\-2 income+ $\-1 gifts+ $\-1 salary+ $1 liabilities:debts+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0+.EE+.PP+Notes:+.IP \(bu 2+\(dqBoring\(dq accounts are combined with their subaccount for more+compact output, unless \f[CR]\-\-no\-elide\f[R] is used.+Boring accounts have no balance of their own and just one subaccount (eg+\f[CR]assets:bank\f[R] and \f[CR]liabilities\f[R] above).+.IP \(bu 2+All balances shown are \(dqinclusive\(dq, ie including the balances from+all subaccounts.+Note this means some repetition in the output, which requires+explanation when sharing reports with non\-plaintextaccounting\-users.+A tree mode report\(aqs final total is the sum of the top\-level+balances shown, not of all the balances shown.+.IP \(bu 2+Each group of sibling accounts (ie, under a common parent) is sorted+separately.+.SS Depth limiting+With a \f[CR]depth:NUM\f[R] query, or \f[CR]\-\-depth NUM\f[R] option,+or just \f[CR]\-NUM\f[R] (eg: \f[CR]\-3\f[R]) balance reports will show+accounts only to the specified depth, hiding the deeper subaccounts.+This can be useful for getting an overview without too much detail.+.PP+Account balances at the depth limit always include the balances from any+deeper subaccounts (even in list mode).+Eg, limiting to depth 1:+.IP+.EX+$ hledger \-f examples/sample.journal balance \-1+ $\-1 assets+ $2 expenses+ $\-2 income+ $1 liabilities+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0 +.EE+.SS Dropping top\-level accounts+You can also hide one or more top\-level account name parts, using+\f[CR]\-\-drop NUM\f[R].+This can be useful for hiding repetitive top\-level account names:+.IP+.EX+$ hledger \-f examples/sample.journal bal expenses \-\-drop 1+ $1 food+ $1 supplies+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ $2 +.EE+.PP+.SS Showing declared accounts+With \f[CR]\-\-declared\f[R], accounts which have been declared with an+account directive will be included in the balance report, even if they+have no transactions.+(Since they will have a zero balance, you will also need+\f[CR]\-E/\-\-empty\f[R] to see them.)+.PP+More precisely, \f[I]leaf\f[R] declared accounts (with no subaccounts)+will be included, since those are usually the more useful in reports.+.PP+The idea of this is to be able to see a useful \(dqcomplete\(dq balance+report, even when you don\(aqt have transactions in all of your declared+accounts yet.+.SS Sorting by amount+With \f[CR]\-S/\-\-sort\-amount\f[R], accounts with the largest (most+positive) balances are shown first.+Eg: \f[CR]hledger bal expenses \-MAS\f[R] shows your biggest averaged+monthly expenses first.+When more than one commodity is present, they will be sorted by the+alphabetically earliest commodity first, and then by subsequent+commodities (if an amount is missing a commodity, it is treated as 0).+.PP+Revenues and liability balances are typically negative, however, so+\f[CR]\-S\f[R] shows these in reverse order.+To work around this, you can add \f[CR]\-\-invert\f[R] to flip the+signs.+Or you could use one of the higher\-level balance reports+(\f[CR]bs\f[R], \f[CR]is\f[R]..), which flip the sign automatically (eg:+\f[CR]hledger is \-MAS\f[R]).+.PP+.SS Percentages+With \f[CR]\-%/\-\-percent\f[R], balance reports show each account\(aqs+value expressed as a percentage of the (column) total.+.PP+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:+.IP+.EX+$ hledger bal \-% amt:\(ga>0\(ga+$ hledger bal \-% amt:\(ga<0\(ga+.EE+.PP+Similarly, if the amounts in a column have mixed commodities, convert+them to one commodity with \f[CR]\-B\f[R], \f[CR]\-V\f[R],+\f[CR]\-X\f[R] or \f[CR]\-\-value\f[R], or make a separate report for+each commodity:+.IP+.EX+$ hledger bal \-% cur:\(rs\(rs$+$ hledger bal \-% cur:€+.EE+.SS Multi\-period balance report+With a report interval (set by the \f[CR]\-D/\-\-daily\f[R],+\f[CR]\-W/\-\-weekly\f[R], \f[CR]\-M/\-\-monthly\f[R],+\f[CR]\-Q/\-\-quarterly\f[R], \f[CR]\-Y/\-\-yearly\f[R], or+\f[CR]\-p/\-\-period\f[R] flag), \f[CR]balance\f[R] shows a tabular+report, with columns representing successive time periods (and a title):+.IP+.EX+$ hledger \-f examples/sample.journal bal \-\-quarterly income expenses \-E+Balance changes in 2008:++ || 2008q1 2008q2 2008q3 2008q4 +===================++=================================+ expenses:food || 0 $1 0 0 + expenses:supplies || 0 $1 0 0 + income:gifts || 0 $\-1 0 0 + income:salary || $\-1 0 0 0 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || $\-1 $1 0 0 +.EE+.PP+Notes:+.IP \(bu 2+The report\(aqs start/end dates will be expanded, if necessary, to fully+encompass the displayed subperiods (so that the first and last+subperiods have the same duration as the others).+.IP \(bu 2+Leading and trailing periods (columns) containing all zeroes are not+shown, unless \f[CR]\-E/\-\-empty\f[R] is used.+.IP \(bu 2+Accounts (rows) containing all zeroes are not shown, unless+\f[CR]\-E/\-\-empty\f[R] is used.+.IP \(bu 2+Amounts with many commodities are shown in abbreviated form, unless+\f[CR]\-\-no\-elide\f[R] is used.+.IP \(bu 2+Average and/or total columns can be added with the+\f[CR]\-A/\-\-average\f[R] and \f[CR]\-T/\-\-row\-total\f[R] flags.+.IP \(bu 2+The \f[CR]\-\-transpose\f[R] flag can be used to exchange rows and+columns.+.IP \(bu 2+The \f[CR]\-\-pivot FIELD\f[R] option causes a different transaction+field to be used as \(dqaccount name\(dq.+See PIVOTING.+.IP \(bu 2+The \f[CR]\-\-summary\-only\f[R] flag (\f[CR]\-\-summary\f[R] also+works) hides all but the Total and Average columns (those should be+enabled with \f[CR]\-\-row\-total\f[R] and \f[CR]\-A/\-\-average\f[R]).+.PP+Multi\-period reports with many periods can be too wide for easy viewing+in the terminal.+Here are some ways to handle that:+.IP \(bu 2+Hide the totals row with \f[CR]\-N/\-\-no\-total\f[R]+.IP \(bu 2+Filter to a single currency with \f[CR]cur:\f[R]+.IP \(bu 2+Convert to a single currency with+\f[CR]\-V [\-\-infer\-market\-price]\f[R]+.IP \(bu 2+Use a more compact layout like \f[CR]\-\-layout=bare\f[R]+.IP \(bu 2+Maximize the terminal window+.IP \(bu 2+Reduce the terminal\(aqs font size+.IP \(bu 2+View with a pager like less, eg:+\f[CR]hledger bal \-D \-\-color=yes | less \-RS\f[R]+.IP \(bu 2+Output as CSV and use a CSV viewer like visidata+(\f[CR]hledger bal \-D \-O csv | vd \-f csv\f[R]), Emacs\(aq csv\-mode+(\f[CR]M\-x csv\-mode, C\-c C\-a\f[R]), or a spreadsheet+(\f[CR]hledger bal \-D \-o a.csv && open a.csv\f[R])+.IP \(bu 2+Output as HTML and view with a browser:+\f[CR]hledger bal \-D \-o a.html && open a.html\f[R]+.SS Balance change, end balance+It\(aqs important to be clear on the meaning of the numbers shown in+balance reports.+Here is some terminology we use:+.PP+A \f[B]\f[BI]balance change\f[B]\f[R] is the net amount added to, or+removed from, an account during some period.+.PP+An \f[B]\f[BI]end balance\f[B]\f[R] is the amount accumulated in an+account as of some date (and some time, but hledger doesn\(aqt store+that; assume end of day in your timezone).+It is the sum of previous balance changes.+.PP+We call it a \f[B]\f[BI]historical end balance\f[B]\f[R] if it includes+all balance changes since the account was created.+For a real world account, this means it will match the \(dqhistorical+record\(dq, eg the balances reported in your bank statements or bank web+UI.+(If they are correct!)+.PP+In general, balance changes are what you want to see when reviewing+revenues and expenses, and historical end balances are what you want to+see when reviewing or reconciling asset, liability and equity accounts.+.PP+\f[CR]balance\f[R] shows balance changes by default.+To see accurate historical end balances:+.IP "1." 3+Initialise account starting balances with an \(dqopening balances\(dq+transaction (a transfer from equity to the account), unless the journal+covers the account\(aqs full lifetime.+.IP "2." 3+Include all of of the account\(aqs prior postings in the report, by not+specifying a report start date, or by using the+\f[CR]\-H/\-\-historical\f[R] flag.+(\f[CR]\-H\f[R] causes report start date to be ignored when summing+postings.)+.SS Balance report modes+The balance command is quite flexible; here is the full detail on how to+control what it reports.+If the following seems complicated, don\(aqt worry \- this is for+advanced reporting, and it does take time and experimentation to get+familiar with all the report modes.+.PP+There are three important option groups:+.PP+\f[CR]hledger balance [CALCULATIONMODE] [ACCUMULATIONMODE] [VALUATIONMODE] ...\f[R]+.SS Calculation mode+The basic calculation to perform for each table cell.+It is one of:+.IP \(bu 2+\f[CR]\-\-sum\f[R] : sum the posting amounts (\f[B]default\f[R])+.IP \(bu 2+\f[CR]\-\-budget\f[R] : sum the amounts, but also show the budget goal+amount (for each account/period)+.IP \(bu 2+\f[CR]\-\-valuechange\f[R] : show the change in period\-end historical+balance values (caused by deposits, withdrawals, and/or market price+fluctuations)+.IP \(bu 2+\f[CR]\-\-gain\f[R] : show the unrealised capital gain/loss, (the+current valued balance minus each amount\(aqs original cost)+.IP \(bu 2+\f[CR]\-\-count\f[R] : show the count of postings+.SS Accumulation mode+How amounts should accumulate across a report\(aqs subperiods/columns.+Another way to say it: which time period\(aqs postings should contribute+to each cell\(aqs calculation.+It is one of:+.IP \(bu 2+\f[CR]\-\-change\f[R] : calculate with postings from column start to+column end, ie \(dqjust this column\(dq.+Typically used to see revenues/expenses.+(\f[B]default for balance, cashflow, incomestatement\f[R])+.IP \(bu 2+\f[CR]\-\-cumulative\f[R] : calculate with postings from report start to+column end, ie \(dqprevious columns plus this column\(dq.+Typically used to show changes accumulated since the report\(aqs start+date.+Not often used.+.IP \(bu 2+\f[CR]\-\-historical/\-H\f[R] : calculate with postings from journal+start to column end, ie \(dqall postings from before report start date+until this column\(aqs end\(dq.+Typically used to see historical end balances of+assets/liabilities/equity.+(\f[B]default for balancesheet, balancesheetequity\f[R])+.SS Valuation mode+Which kind of value or cost conversion should be applied, if any, before+displaying the report.+See Cost reporting and Value reporting for more about conversions.+.PP+A valuation (or cost) mode can be selected with the \-\-value option:+.IP \(bu 2+no conversion : don\(aqt convert to cost or value (\f[B]default\f[R])+.IP \(bu 2+\f[CR]\-\-value=cost[,COMM]\f[R] : convert amounts to cost (then+optionally to some other commodity)+.IP \(bu 2+\f[CR]\-\-value=then[,COMM]\f[R] : convert amounts to market value on+transaction dates+.IP \(bu 2+\f[CR]\-\-value=end[,COMM]\f[R] : convert amounts to market value on+period end date(s)+.PD 0+.P+.PD+(\f[B]default with \f[CB]\-\-valuechange\f[B], \f[CB]\-\-gain\f[B]\f[R])+.IP \(bu 2+\f[CR]\-\-value=now[,COMM]\f[R] : convert amounts to market value on+today\(aqs date+.IP \(bu 2+\f[CR]\-\-value=YYYY\-MM\-DD[,COMM]\f[R] : convert amounts to market+value on another date+.PP+or with the legacy \-B/\-V/\-X options, which are equivalent and easier+to type:+.IP \(bu 2+\f[CR]\-B\f[R]/\f[CR]\-\-cost\f[R] : like \-\-value=cost+.IP \(bu 2+\f[CR]\-V\f[R]/\f[CR]\-\-market\f[R] : like \-\-value=end+.IP \(bu 2+\f[CR]\-X COMM\f[R]/\f[CR]\-\-exchange COMM\f[R] : like+\-\-value=end,COMM+.PP+Note that \-\-value can also convert to cost, as a convenience; but+actually \-\-cost and \-\-value are independent options, and could be+used together.+.SS Combining balance report modes+Most combinations of these modes should produce reasonable reports, but+if you find any that seem wrong or misleading, let us know.+The following restrictions are applied:+.IP \(bu 2+\f[CR]\-\-valuechange\f[R] implies \f[CR]\-\-value=end\f[R]+.IP \(bu 2+\f[CR]\-\-valuechange\f[R] makes \f[CR]\-\-change\f[R] the default when+used with the \f[CR]balancesheet\f[R]/\f[CR]balancesheetequity\f[R]+commands+.IP \(bu 2+\f[CR]\-\-cumulative\f[R] or \f[CR]\-\-historical\f[R] disables+\f[CR]\-\-row\-total/\-T\f[R]+.PP+For reference, here is what the combinations of accumulation and+valuation show:+.PP+.TS+tab(@);+lw(7.9n) lw(16.4n) lw(16.9n) lw(15.1n) lw(13.7n).+T{+Valuation:> Accumulation:v+T}@T{+no valuation+T}@T{+\f[CR]\-\-value= then\f[R]+T}@T{+\f[CR]\-\-value= end\f[R]+T}@T{+\f[CR]\-\-value= YYYY\-MM\-DD /now\f[R]+T}+_+T{+\f[CR]\-\-change\f[R]+T}@T{+change in period+T}@T{+sum of posting\-date market values in period+T}@T{+period\-end value of change in period+T}@T{+DATE\-value of change in period+T}+T{+\f[CR]\-\-cumulative\f[R]+T}@T{+change from report start to period end+T}@T{+sum of posting\-date market values from report start to period end+T}@T{+period\-end value of change from report start to period end+T}@T{+DATE\-value of change from report start to period end+T}+T{+\f[CR]\-\-historical /\-H\f[R]+T}@T{+change from journal start to period end (historical end balance)+T}@T{+sum of posting\-date market values from journal start to period end+T}@T{+period\-end value of change from journal start to period end+T}@T{+DATE\-value of change from journal start to period end+T}+.TE+.SS Budget report+The \f[CR]\-\-budget\f[R] report is like a regular balance report, but+with two main differences:+.IP \(bu 2+Budget goals and performance percentages are also shown, in brackets+.IP \(bu 2+Accounts which don\(aqt have budget goals are hidden by default.+.PP+This is useful for comparing planned and actual income, expenses, time+usage, etc.+.PP+Periodic transaction rules are used to define budget goals.+For example, here\(aqs a periodic rule defining monthly goals for bus+travel and food expenses:+.IP+.EX+;; Budget+\(ti monthly+ (expenses:bus) $30+ (expenses:food) $400+.EE+.PP+After recording some actual expenses,+.IP+.EX+;; Two months worth of expenses+2017\-11\-01+ income $\-1950+ expenses:bus $35+ expenses:food:groceries $310+ expenses:food:dining $42+ expenses:movies $38+ assets:bank:checking++2017\-12\-01+ income $\-2100+ expenses:bus $53+ expenses:food:groceries $380+ expenses:food:dining $32+ expenses:gifts $100+ assets:bank:checking+.EE+.PP+we can see a budget report like this:+.IP+.EX+$ hledger bal \-M \-\-budget+Budget performance in 2017\-11\-01..2017\-12\-31:++ || Nov Dec +===============++============================================+ <unbudgeted> || $\-425 $\-565 + expenses || $425 [ 99% of $430] $565 [131% of $430] + expenses:bus || $35 [117% of $30] $53 [177% of $30] + expenses:food || $352 [ 88% of $400] $412 [103% of $400] +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || 0 [ 0% of $430] 0 [ 0% of $430] +.EE+.PP+This is \(dqgoal\-based budgeting\(dq; you define goals for accounts and+periods, often recurring, and hledger shows performance relative to the+goals.+This contrasts with \(dqenvelope budgeting\(dq, which is more detailed+and strict \- useful when cash is tight, but also quite a bit more work.+https://plaintextaccounting.org/Budgeting has more on this topic.+.SS Using the budget report+Historically this report has been confusing and fragile.+hledger\(aqs version should be relatively robust and intuitive, but you+may still find surprises.+Here are more notes to help with learning and troubleshooting.+.IP \(bu 2+In the above example, \f[CR]expenses:bus\f[R] and+\f[CR]expenses:food\f[R] are shown because they have budget goals during+the report period.+.IP \(bu 2+Their parent \f[CR]expenses\f[R] is also shown, with budget goals+aggregated from the children.+.IP \(bu 2+The subaccounts \f[CR]expenses:food:groceries\f[R] and+\f[CR]expenses:food:dining\f[R] are not shown since they have no budget+goal of their own, but they contribute to \f[CR]expenses:food\f[R]\(aqs+actual amount.+.IP \(bu 2+Unbudgeted accounts \f[CR]expenses:movies\f[R] and+\f[CR]expenses:gifts\f[R] are also not shown, but they contribute to+\f[CR]expenses\f[R]\(aqs actual amount.+.IP \(bu 2+The other unbudgeted accounts \f[CR]income\f[R] and+\f[CR]assets:bank:checking\f[R] are grouped as \f[CR]<unbudgeted>\f[R].+.IP \(bu 2+\f[CR]\-\-depth\f[R] or \f[CR]depth:\f[R] can be used to limit report+depth in the usual way (but will not reveal unbudgeted subaccounts).+.IP \(bu 2+Amounts are always inclusive of subaccounts (even in+\f[CR]\-l/\-\-list\f[R] mode).+.IP \(bu 2+Numbers displayed in a \-\-budget report will not always agree with the+totals, because of hidden unbudgeted accounts; this is normal.+\f[CR]\-E/\-\-empty\f[R] can be used to reveal the hidden accounts.+.IP \(bu 2+In the periodic rules used for setting budget goals, unbalanced postings+are convenient.+.IP \(bu 2+You can filter budget reports with the usual queries, eg to focus on+particular accounts.+It\(aqs common to restrict them to just expenses.+(The \f[CR]<unbudgeted>\f[R] account is occasionally hard to exclude;+this is because of date surprises, discussed below.)+.IP \(bu 2+When you have multiple currencies, you may want to convert them to one+(\f[CR]\-X COMM \-\-infer\-market\-prices\f[R]) and/or show just one at+a time (\f[CR]cur:COMM\f[R]).+If you do need to show multiple currencies at once,+\f[CR]\-\-layout bare\f[R] can be helpful.+.IP \(bu 2+You can \(dqroll over\(dq amounts (actual and budgeted) to the next+period with \f[CR]\-\-cumulative\f[R].+.PP+See also: https://hledger.org/budgeting.html.+.SS Budget date surprises+With small data, or when starting out, some of the generated budget goal+transaction dates might fall outside the report periods.+Eg with the following journal and report, the first period appears to+have no \f[CR]expenses:food\f[R] budget.+(Also the \f[CR]<unbudgeted>\f[R] account should be excluded by the+\f[CR]expenses\f[R] query, but isn\(aqt.):+.IP+.EX+\(ti monthly in 2020+ (expenses:food) $500++2020\-01\-15+ expenses:food $400+ assets:checking+.EE+.IP+.EX+$ hledger bal \-\-budget expenses+Budget performance in 2020\-01\-15:++ || 2020\-01\-15 +===============++====================+ <unbudgeted> || $400 + expenses:food || 0 [ 0% of $500] +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || $400 [80% of $500] +.EE+.PP+In this case, the budget goal transactions are generated on first days+of of month (this can be seen with+\f[CR]hledger print \-\-forecast tag:generated expenses\f[R]).+Whereas the report period defaults to just the 15th day of january (this+can be seen from the report table\(aqs column headings).+.PP+To fix this kind of thing, be more explicit about the report period+(and/or the periodic rules\(aq dates).+In this case, adding \f[CR]\-b 2020\f[R] does the trick.+.SS Selecting budget goals+By default, the budget report uses all available periodic transaction+rules to generate goals.+This includes rules with a different report interval from your report.+Eg if you have daily, weekly and monthly periodic rules, all of these+will contribute to the goals in a monthly budget report.+.PP+You can select a subset of periodic rules by providing an argument to+the \f[CR]\-\-budget\f[R] flag.+\f[CR]\-\-budget=DESCPAT\f[R] will match all periodic rules whose+description contains DESCPAT, a case\-insensitive substring (not a+regular expression or query).+This means you can give your periodic rules descriptions (remember that+two spaces are needed between period expression and description), and+then select from multiple budgets defined in your journal.+.SS Budgeting vs forecasting+\f[CR]\-\-forecast\f[R] and \f[CR]\-\-budget\f[R] both use the periodic+transaction rules in the journal to generate temporary transactions for+reporting purposes.+However they are separate features \- though you can use both at the+same time if you want.+Here are some differences between them:+.PP+.TS+tab(@);+lw(38.2n) lw(31.8n).+T{+\-\-forecast+T}@T{+\-\-budget+T}+_+T{+is a general option; it enables forecasting with all reports+T}@T{+is a balance command option; it selects the balance report\(aqs budget+mode+T}+T{+generates visible transactions which appear in reports+T}@T{+generates invisible transactions which produce goal amounts+T}+T{+generates forecast transactions from after the last regular transaction,+to the end of the report period; or with an argument+\f[CR]\-\-forecast=PERIODEXPR\f[R] generates them throughout the+specified period, both optionally restricted by periods specified in the+periodic transaction rules+T}@T{+generates budget goal transactions throughout the report period,+optionally restricted by periods specified in the periodic transaction+rules+T}+T{+uses all periodic rules+T}@T{+uses all periodic rules; or with an argument+\f[CR]\-\-budget=DESCPAT\f[R] uses just the rules matched by DESCPAT+T}+.TE+.SS Balance report layout+The \f[CR]\-\-layout\f[R] option affects how \f[CR]balance\f[R] and the+other balance\-like commands show multi\-commodity amounts and commodity+symbols.+It can improve readability, for humans and/or machines (other software).+It has four possible values:+.IP \(bu 2+\f[CR]\-\-layout=wide[,WIDTH]\f[R]: commodities are shown on a single+line, optionally elided to WIDTH+.IP \(bu 2+\f[CR]\-\-layout=tall\f[R]: each commodity is shown on a separate line+.IP \(bu 2+\f[CR]\-\-layout=bare\f[R]: commodity symbols are in their own column,+amounts are bare numbers+.IP \(bu 2+\f[CR]\-\-layout=tidy\f[R]: data is normalised to easily\-consumed+\(dqtidy\(dq form, with one row per data value.+(This one is currently supported only by the \f[CR]balance\f[R]+command.)+.PP+Here are the \f[CR]\-\-layout\f[R] modes supported by each output format+Only CSV output supports all of them:+.PP+.TS+tab(@);+l l l l l l.+T{+\-+T}@T{+txt+T}@T{+csv+T}@T{+html+T}@T{+json+T}@T{+sql+T}+_+T{+wide+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}+T{+tall+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}+T{+bare+T}@T{+Y+T}@T{+Y+T}@T{+Y+T}@T{+T}@T{+T}+T{+tidy+T}@T{+T}@T{+Y+T}@T{+T}@T{+T}@T{+T}+.TE+.PP+Examples:+.SS Wide layout+With many commodities, reports can be very wide:+.IP+.EX+$ hledger \-f examples/bcexample.hledger bal assets:us:etrade \-3 \-T \-Y \-\-layout=wide+Balance changes in 2012\-01\-01..2014\-12\-31:++ || 2012 2013 2014 Total +==================++====================================================================================================================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, \-98.12 USD, 10.00 VEA, 18.00 VHT \-11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, \-98.12 USD, 10.00 VEA, 18.00 VHT \-11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT +.EE+.PP+A width limit reduces the width, but some commodities will be hidden:+.IP+.EX+$ hledger \-f examples/bcexample.hledger bal assets:us:etrade \-3 \-T \-Y \-\-layout=wide,32+Balance changes in 2012\-01\-01..2014\-12\-31:++ || 2012 2013 2014 Total +==================++===========================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. \-11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. \-11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. +.EE+.SS Tall layout+Each commodity gets a new line (may be different in each column), and+account names are repeated:+.IP+.EX+$ hledger \-f examples/bcexample.hledger bal assets:us:etrade \-3 \-T \-Y \-\-layout=tall+Balance changes in 2012\-01\-01..2014\-12\-31:++ || 2012 2013 2014 Total +==================++==================================================+ Assets:US:ETrade || 10.00 ITOT 70.00 GLD \-11.00 ITOT 70.00 GLD + Assets:US:ETrade || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + Assets:US:ETrade || 12.00 VEA \-98.12 USD 14.00 VEA 5120.50 USD + Assets:US:ETrade || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + Assets:US:ETrade || 18.00 VHT 294.00 VHT +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || 10.00 ITOT 70.00 GLD \-11.00 ITOT 70.00 GLD + || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + || 12.00 VEA \-98.12 USD 14.00 VEA 5120.50 USD + || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + || 18.00 VHT 294.00 VHT +.EE+.SS Bare layout+Commodity symbols are kept in one column, each commodity has its own+row, amounts are bare numbers, account names are repeated:+.IP+.EX+$ hledger \-f examples/bcexample.hledger bal assets:us:etrade \-3 \-T \-Y \-\-layout=bare+Balance changes in 2012\-01\-01..2014\-12\-31:++ || Commodity 2012 2013 2014 Total +==================++=============================================+ Assets:US:ETrade || GLD 0 70.00 0 70.00 + Assets:US:ETrade || ITOT 10.00 18.00 \-11.00 17.00 + Assets:US:ETrade || USD 337.18 \-98.12 4881.44 5120.50 + Assets:US:ETrade || VEA 12.00 10.00 14.00 36.00 + Assets:US:ETrade || VHT 106.00 18.00 170.00 294.00 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || GLD 0 70.00 0 70.00 + || ITOT 10.00 18.00 \-11.00 17.00 + || USD 337.18 \-98.12 4881.44 5120.50 + || VEA 12.00 10.00 14.00 36.00 + || VHT 106.00 18.00 170.00 294.00 +.EE+.PP+Bare layout also affects CSV output, which is useful for producing data+that is easier to consume, eg for making charts:+.IP+.EX+$ hledger \-f examples/bcexample.hledger bal assets:us:etrade \-3 \-O csv \-\-layout=bare+\(dqaccount\(dq,\(dqcommodity\(dq,\(dqbalance\(dq+\(dqAssets:US:ETrade\(dq,\(dqGLD\(dq,\(dq70.00\(dq+\(dqAssets:US:ETrade\(dq,\(dqITOT\(dq,\(dq17.00\(dq+\(dqAssets:US:ETrade\(dq,\(dqUSD\(dq,\(dq5120.50\(dq+\(dqAssets:US:ETrade\(dq,\(dqVEA\(dq,\(dq36.00\(dq+\(dqAssets:US:ETrade\(dq,\(dqVHT\(dq,\(dq294.00\(dq+\(dqTotal:\(dq,\(dqGLD\(dq,\(dq70.00\(dq+\(dqTotal:\(dq,\(dqITOT\(dq,\(dq17.00\(dq+\(dqTotal:\(dq,\(dqUSD\(dq,\(dq5120.50\(dq+\(dqTotal:\(dq,\(dqVEA\(dq,\(dq36.00\(dq+\(dqTotal:\(dq,\(dqVHT\(dq,\(dq294.00\(dq+.EE+.PP+Bare layout will sometimes display an extra row for the no\-symbol+commodity, because of zero amounts (hledger treats zeroes as+commodity\-less, usually).+This can break \f[CR]hledger\-bar\f[R] confusingly (workaround: add a+\f[CR]cur:\f[R] query to exclude the no\-symbol row).+.SS Tidy layout+This produces normalised \(dqtidy data\(dq (see+https://cran.r\-project.org/web/packages/tidyr/vignettes/tidy\-data.html)+where every variable has its own column and each row represents a single+data point.+This is the easiest kind of data for other software to consume:+.IP+.EX+$ hledger \-f examples/bcexample.hledger bal assets:us:etrade \-3 \-Y \-O csv \-\-layout=tidy+\(dqaccount\(dq,\(dqperiod\(dq,\(dqstart_date\(dq,\(dqend_date\(dq,\(dqcommodity\(dq,\(dqvalue\(dq+\(dqAssets:US:ETrade\(dq,\(dq2012\(dq,\(dq2012\-01\-01\(dq,\(dq2012\-12\-31\(dq,\(dqGLD\(dq,\(dq0\(dq+\(dqAssets:US:ETrade\(dq,\(dq2012\(dq,\(dq2012\-01\-01\(dq,\(dq2012\-12\-31\(dq,\(dqITOT\(dq,\(dq10.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2012\(dq,\(dq2012\-01\-01\(dq,\(dq2012\-12\-31\(dq,\(dqUSD\(dq,\(dq337.18\(dq+\(dqAssets:US:ETrade\(dq,\(dq2012\(dq,\(dq2012\-01\-01\(dq,\(dq2012\-12\-31\(dq,\(dqVEA\(dq,\(dq12.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2012\(dq,\(dq2012\-01\-01\(dq,\(dq2012\-12\-31\(dq,\(dqVHT\(dq,\(dq106.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2013\(dq,\(dq2013\-01\-01\(dq,\(dq2013\-12\-31\(dq,\(dqGLD\(dq,\(dq70.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2013\(dq,\(dq2013\-01\-01\(dq,\(dq2013\-12\-31\(dq,\(dqITOT\(dq,\(dq18.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2013\(dq,\(dq2013\-01\-01\(dq,\(dq2013\-12\-31\(dq,\(dqUSD\(dq,\(dq\-98.12\(dq+\(dqAssets:US:ETrade\(dq,\(dq2013\(dq,\(dq2013\-01\-01\(dq,\(dq2013\-12\-31\(dq,\(dqVEA\(dq,\(dq10.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2013\(dq,\(dq2013\-01\-01\(dq,\(dq2013\-12\-31\(dq,\(dqVHT\(dq,\(dq18.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2014\(dq,\(dq2014\-01\-01\(dq,\(dq2014\-12\-31\(dq,\(dqGLD\(dq,\(dq0\(dq+\(dqAssets:US:ETrade\(dq,\(dq2014\(dq,\(dq2014\-01\-01\(dq,\(dq2014\-12\-31\(dq,\(dqITOT\(dq,\(dq\-11.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2014\(dq,\(dq2014\-01\-01\(dq,\(dq2014\-12\-31\(dq,\(dqUSD\(dq,\(dq4881.44\(dq+\(dqAssets:US:ETrade\(dq,\(dq2014\(dq,\(dq2014\-01\-01\(dq,\(dq2014\-12\-31\(dq,\(dqVEA\(dq,\(dq14.00\(dq+\(dqAssets:US:ETrade\(dq,\(dq2014\(dq,\(dq2014\-01\-01\(dq,\(dq2014\-12\-31\(dq,\(dqVHT\(dq,\(dq170.00\(dq+.EE+.SS Balance report output+As noted in Output format, if you choose HTML output (by using+\f[CR]\-O html\f[R] or \f[CR]\-o somefile.html\f[R]), you can create a+\f[CR]hledger.css\f[R] file in the same directory to customise the+report\(aqs appearance.+.PP+The HTML and FODS output formats can generate hyperlinks to a+\f[CR]hledger\-web\f[R] register view for each account and period.+E.g.+if your \f[CR]hledger\-web\f[R] server is reachable at+\f[CR]http://localhost:5000\f[R] then you might run the+\f[CR]balance\f[R] command with the extra option+\f[CR]\-\-base\-url=http://localhost:5000\f[R].+You can also produce relative links, like+\f[CR]\-\-base\-url=\(dqsome/path\(dq\f[R] or+\f[CR]\-\-base\-url=\(dq\(dq\f[R].)+.SS Some useful balance reports+Some frequently used \f[CR]balance\f[R] options/reports are:+.IP \(bu 2+\f[CR]bal \-M revenues expenses\f[R]+.PD 0+.P+.PD+Show revenues/expenses in each month.+Also available as the \f[CR]incomestatement\f[R] command.+.IP \(bu 2+\f[CR]bal \-M \-H assets liabilities\f[R]+.PD 0+.P+.PD+Show historical asset/liability balances at each month end.+Also available as the \f[CR]balancesheet\f[R] command.+.IP \(bu 2+\f[CR]bal \-M \-H assets liabilities equity\f[R]+.PD 0+.P+.PD+Show historical asset/liability/equity balances at each month end.+Also available as the \f[CR]balancesheetequity\f[R] command.+.IP \(bu 2+\f[CR]bal \-M assets not:receivable\f[R]+.PD 0+.P+.PD+Show changes to liquid assets in each month.+Also available as the \f[CR]cashflow\f[R] command.+.PP+Also:+.IP \(bu 2+\f[CR]bal \-M expenses \-2 \-SA\f[R]+.PD 0+.P+.PD+Show monthly expenses summarised to depth 2 and sorted by average+amount.+.IP \(bu 2+\f[CR]bal \-M \-\-budget expenses\f[R]+.PD 0+.P+.PD+Show monthly expenses and budget goals.+.IP \(bu 2+\f[CR]bal \-M \-\-valuechange investments\f[R]+.PD 0+.P+.PD+Show monthly change in market value of investment assets.+.IP \(bu 2+\f[CR]bal investments \-\-valuechange \-D date:lastweek amt:\(aq>1000\(aq \-STA [\-\-invert]\f[R]+.PD 0+.P+.PD+Show top gainers [or losers] last week+.SS roi+Shows the time\-weighted (TWR) and money\-weighted (IRR) rate of return+on your investments.+.IP+.EX+Flags:+ \-\-cashflow show all amounts that were used to compute+ returns+ \-\-investment=QUERY query to select your investment transactions+ \-\-profit\-loss=QUERY \-\-pnl query to select profit\-and\-loss or+ appreciation/valuation transactions+.EE+.PP+At a minimum, you need to supply a query (which could be just an account+name) to select your investment(s) with \f[CR]\-\-inv\f[R], and another+query to identify your profit and loss transactions with+\f[CR]\-\-pnl\f[R].+.PP+If you do not record changes in the value of your investment manually,+or do not require computation of time\-weighted return (TWR),+\f[CR]\-\-pnl\f[R] could be an empty query (\f[CR]\-\-pnl \(dq\(dq\f[R]+or \f[CR]\-\-pnl STR\f[R] where \f[CR]STR\f[R] does not match any of+your accounts).+.PP+This command will compute and display the internalized rate of return+(IRR, also known as money\-weighted rate of return) and time\-weighted+rate of return (TWR) for your investments for the time period requested.+IRR is always annualized due to the way it is computed, but TWR is+reported both as a rate over the chosen reporting period and as an+annual rate.+.PP+Price directives will be taken into account if you supply appropriate+\f[CR]\-\-cost\f[R] or \f[CR]\-\-value\f[R] flags (see VALUATION).+.PP+Note, in some cases this report can fail, for these reasons:+.IP \(bu 2+Error (NotBracketed): No solution for Internal Rate of Return (IRR).+Possible causes: IRR is huge (>1000000%), balance of investment becomes+negative at some point in time.+.IP \(bu 2+Error (SearchFailed): Failed to find solution for Internal Rate of+Return (IRR).+Either search does not converge to a solution, or converges too slowly.+.PP+Examples:+.IP \(bu 2+Using roi to compute total return of investment in stocks:+https://github.com/simonmichael/hledger/blob/master/examples/investing/roi\-unrealised.ledger+.IP \(bu 2+Cookbook > Return on Investment: https://hledger.org/roi.html+.SS Spaces and special characters in \f[CR]\-\-inv\f[R] and \f[CR]\-\-pnl\f[R]+Note that \f[CR]\-\-inv\f[R] and \f[CR]\-\-pnl\f[R]\(aqs argument is a+query, and queries could have several space\-separated terms (see+QUERIES).+.PP+To indicate that all search terms form single command\-line argument,+you will need to put them in quotes (see Special characters):+.IP+.EX+$ hledger roi \-\-inv \(aqterm1 term2 term3 ...\(aq+.EE+.PP+If any query terms contain spaces themselves, you will need an extra+level of nested quoting, eg:+.IP+.EX+$ hledger roi \-\-inv=\(dq\(aqAssets:Test 1\(aq\(dq \-\-pnl=\(dq\(aqEquity:Unrealized Profit and Loss\(aq\(dq+.EE+.SS Semantics of \f[CR]\-\-inv\f[R] and \f[CR]\-\-pnl\f[R]+Query supplied to \f[CR]\-\-inv\f[R] has to match all transactions that+are related to your investment.+Transactions not matching \f[CR]\-\-inv\f[R] will be ignored.+.PP+In these transactions, ROI will conside postings that match+\f[CR]\-\-inv\f[R] to be \(dqinvestment postings\(dq and other postings+(not matching \f[CR]\-\-inv\f[R]) will be sorted into two categories:+\(dqcash flow\(dq and \(dqprofit and loss\(dq, as ROI needs to know+which part of the investment value is your contributions and which is+due to the return on investment.+.IP \(bu 2+\(dqCash flow\(dq is depositing or withdrawing money, buying or selling+assets, or otherwise converting between your investment commodity and+any other commodity.+Example:+.RS 2+.IP+.EX+2019\-01\-01 Investing in Snake Oil+ assets:cash \-$100+ investment:snake oil++2020\-01\-01 Selling my Snake Oil+ assets:cash $10+ investment:snake oil = 0+.EE+.RE+.IP \(bu 2+\(dqProfit and loss\(dq is change in the value of your investment:+.RS 2+.IP+.EX+2019\-06\-01 Snake Oil falls in value+ investment:snake oil = $57+ equity:unrealized profit or loss+.EE+.RE+.PP+All non\-investment postings are assumed to be \(dqcash flow\(dq, unless+they match \f[CR]\-\-pnl\f[R] query.+Changes in value of your investment due to \(dqprofit and loss\(dq+postings will be considered as part of your investment return.+.PP+Example: if you use \f[CR]\-\-inv snake \-\-pnl equity:unrealized\f[R],+then postings in the example below would be classifed as:+.IP+.EX+2019\-01\-01 Snake Oil #1+ assets:cash \-$100 ; cash flow posting+ investment:snake oil ; investment posting++2019\-03\-01 Snake Oil #2+ equity:unrealized pnl \-$100 ; profit and loss posting+ snake oil ; investment posting++2019\-07\-01 Snake Oil #3+ equity:unrealized pnl ; profit and loss posting+ cash \-$100 ; cash flow posting+ snake oil $50 ; investment posting+.EE+.SS IRR and TWR explained+\(dqROI\(dq stands for \(dqreturn on investment\(dq.+Traditionally this was computed as a difference between current value of+investment and its initial value, expressed in percentage of the initial+value.+.PP+However, this approach is only practical in simple cases, where+investments receives no in\-flows or out\-flows of money, and where rate+of growth is fixed over time.+For more complex scenarios you need different ways to compute rate of+return, and this command implements two of them: IRR and TWR.+.PP+Internal rate of return, or \(dqIRR\(dq (also called \(dqmoney\-weighted+rate of return\(dq) takes into account effects of in\-flows and+out\-flows, and the time between them.+Investment at a particular fixed interest rate is going to give you more+interest than the same amount invested at the same interest rate, but+made later in time.+If you are withdrawing from your investment, your future gains would be+smaller (in absolute numbers), and will be a smaller percentage of your+initial investment, so your IRR will be smaller.+And if you are adding to your investment, you will receive bigger+absolute gains, which will be a bigger percentage of your initial+investment, so your IRR will be larger.+.PP+As mentioned before, in\-flows and out\-flows would be any cash that you+personally put in or withdraw, and for the \(dqroi\(dq command, these+are the postings that match the query in the\f[CR]\-\-inv\f[R] argument+and NOT match the query in the\f[CR]\-\-pnl\f[R] argument.+.PP+If you manually record changes in the value of your investment as+transactions that balance them against \(dqprofit and loss\(dq (or+\(dqunrealized gains\(dq) account or use price directives, then in order+for IRR to compute the precise effect of your in\-flows and out\-flows+on the rate of return, you will need to record the value of your+investement on or close to the days when in\- or out\-flows occur.+.PP+In technical terms, IRR uses the same approach as computation of net+present value, and tries to find a discount rate that makes net present+value of all the cash flows of your investment to add up to zero.+This could be hard to wrap your head around, especially if you+haven\(aqt done discounted cash flow analysis before.+Implementation of IRR in hledger should produce results that match the+\f[CR]=XIRR\f[R] formula in Excel.+.PP+Second way to compute rate of return that \f[CR]roi\f[R] command+implements is called \(dqtime\-weighted rate of return\(dq or+\(dqTWR\(dq.+Like IRR, it will account for the effect of your in\-flows and+out\-flows, but unlike IRR it will try to compute the true rate of+return of the underlying asset, compensating for the effect that+deposits and withdrawas have on the apparent rate of growth of your+investment.+.PP+TWR represents your investment as an imaginary \(dqunit fund\(dq where+in\-flows/ out\-flows lead to buying or selling \(dqunits\(dq of your+investment and changes in its value change the value of \(dqinvestment+unit\(dq.+Change in \(dqunit price\(dq over the reporting period gives you rate of+return of your investment, and make TWR less sensitive than IRR to the+effects of cash in\-flows and out\-flows.+.PP+References:+.IP \(bu 2+Explanation of rate of return+.IP \(bu 2+Explanation of IRR+.IP \(bu 2+Explanation of TWR+.IP \(bu 2+IRR vs TWR+.IP \(bu 2+Examples of computing IRR and TWR and discussion of the limitations of+both metrics+.SH Chart commands+.SS activity+Show an ascii barchart of posting counts per interval.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+The activity command displays an ascii histogram showing transaction+counts by day, week, month or other reporting interval (by day is the+default).+With query arguments, it counts only matched transactions.+.PP+Examples:+.IP+.EX+$ hledger activity \-\-quarterly+2008\-01\-01 **+2008\-04\-01 *******+2008\-07\-01 +2008\-10\-01 **+.EE+.SH Data generation commands+.SS close+(equity)+.PP+\f[CR]close\f[R] prints several kinds of \(dqclosing\(dq and/or+\(dqopening\(dq transactions, useful in various situations: migrating+balances to a new journal file, retaining earnings into equity,+consolidating balances, viewing lot costs..+Like \f[CR]print\f[R], it prints valid journal entries.+You can copy these into your journal file(s) when you are happy with how+they look.+.IP+.EX+Flags:+ \-\-clopen[=TAGVAL] show closing and opening balances transactions,+ for AL accounts by default+ \-\-close[=TAGVAL] show just a closing balances transaction+ \-\-open[=TAGVAL] show just an opening balances transaction+ \-\-assert[=TAGVAL] show a balance assertions transaction+ \-\-assign[=TAGVAL] show a balance assignments transaction+ \-\-retain[=TAGVAL] show a retain earnings transaction, for RX+ accounts by default+ \-x \-\-explicit show all amounts explicitly+ \-\-show\-costs show amounts with different costs separately+ \-\-interleaved show source and destination postings together+ \-\-assertion\-type=TYPE =, ==, =* or ==*+ \-\-close\-desc=DESC set closing transaction\(aqs description+ \-\-close\-acct=ACCT set closing transaction\(aqs destination account+ \-\-open\-desc=DESC set opening transaction\(aqs description+ \-\-open\-acct=ACCT set opening transaction\(aqs source account+ \-\-round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none \- show original decimal digits,+ as in journal (default)+ soft \- just add or remove decimal zeros+ to match precision+ hard \- round posting amounts to precision+ (can unbalance transactions)+ all \- also round cost amounts to precision+ (can unbalance transactions)+.EE+.PP+\f[CR]close\f[R] has six modes, selected by choosing one of the mode+flags: \f[CR]\-\-clopen\f[R], \f[CR]\-\-close\f[R] (default),+\f[CR]\-\-open\f[R], \f[CR]\-\-assert\f[R], \f[CR]\-\-assign\f[R], or+\f[CR]\-\-retain\f[R].+They are all doing the same kind of operation, but with different+defaults for different situations.+.PP+The journal entries generated by \f[CR]close\f[R] will have a+\f[CR]clopen:\f[R] tag, which is helpful when you want to exclude them+from reports.+If the main journal file name contains a number, the tag\(aqs value will+be that base file name with the number incremented.+Eg if the journal file is 2025.journal, the tag will be+\f[CR]clopen:2026\f[R].+Or you can set the tag value by providing an argument to the mode flag.+Eg \f[CR]\-\-close=foo\f[R] or \f[CR]\-\-clopen=2025\-main\f[R].+.SS close \-\-clopen+This is useful if migrating balances to a new journal file at the start+of a new year.+It prints a \(dqclosing balances\(dq transaction that zeroes out account+balances (Asset and Liability accounts, by default), and an opposite+\(dqopening balances\(dq transaction that restores them again.+Typically, you would run+.IP+.EX+hledger close \-\-clopen \-e NEWYEAR >> $LEDGER_FILE+.EE+.PP+and then move the opening transaction from the old file to the new file+(and probably also update your LEDGER_FILE environment variable).+.PP+Why might you do this ?+If your reports are fast, you may not need it.+But at some point you will probably want to partition your data by time,+for performance or data integrity or regulatory reasons.+A new file or set of files per year is common.+Then, having each file/fileset \(dqbookended\(dq with opening and+closing balance transactions will allow you to freely pick and choose+which files to read \- just the current year, any past year, any+sequence of years, or all of them \- while showing correct account+balances in each case.+The earliest opening balances transaction sets correct starting+balances, and any later closing/opening pairs will harmlessly cancel+each other out.+.PP+The balances will be transferred to and from+\f[CR]equity:opening/closing balances\f[R] by default.+You can override this by using \f[CR]\-\-close\-acct\f[R] and/or+\f[CR]\-\-open\-acct\f[R].+.PP+You can select a different set of accounts to close/open by providing an+account query.+Eg to add Equity accounts, provide arguments like+\f[CR]assets liabilities equity\f[R] or \f[CR]type:ALE\f[R].+When migrating to a new file, you\(aqll usually want to bring along the+AL or ALE accounts, but not the RX accounts (Revenue, Expense).+.PP+Assertions will be added indicating and checking the new balances of the+closed/opened accounts.+.SS close \-\-close+This prints just the closing balances transaction of+\f[CR]\-\-clopen\f[R].+It is the default if you don\(aqt specify a mode.+.PP+More customisation options are described below.+Among other things, you can use \f[CR]close \-\-close\f[R] to generate a+transaction moving the balances from any set of accounts, to a different+account.+(If you need to move just a portion of the balance, see hledger\-move.)+.SS close \-\-open+This prints just the opening balances transaction of+\f[CR]\-\-clopen\f[R].+(It is similar to Ledger\(aqs equity command.)+.SS close \-\-assert+This prints a transaction that asserts the account balances as they are+on the end date (and adds an \f[CR]assert:\f[R] tag).+It could be useful as documention and to guard against changes.+.SS close \-\-assign+This prints a transaction that assigns the account balances as they are+on the end date (and adds an \(dqassign:\(dq tag).+Unlike balance assertions, assignments will post changes to balances as+needed to reach the specified amounts.+.PP+This is another way to set starting balances when migrating to a new+file, and it will set them correctly even in the presence of earlier+files which do not have a closing balances transaction.+However, it can hide errors, and disturb the accounting equation, so+\f[CR]\-\-clopen\f[R] is usually recommended.+.SS close \-\-retain+This is like \f[CR]\-\-close\f[R], but it closes Revenue and Expense+account balances by default.+They will be transferred to \f[CR]equity:retained earnings\f[R], or+another account specified with \f[CR]\-\-close\-acct\f[R].+.PP+Revenues and expenses correspond to changes in equity.+They are categorised separately for reporting purposes, but+traditionally at the end of each accounting period, businesses+consolidate them into equity, This is called \(dqretaining earnings\(dq,+or \(dqclosing the books\(dq.+.PP+In personal accounting, there\(aqs not much reason to do this, and most+people don\(aqt.+(One reason to do it is to help the \f[CR]balancesheetequity\f[R] report+show a zero total, demonstrating that the accounting equation (A\-L=E)+is satisfied.)+.SS close customisation+In all modes, the following things can be overridden:+.IP \(bu 2+the accounts to be closed/opened, with account query arguments+.IP \(bu 2+the closing/opening dates, with \f[CR]\-e OPENDATE\f[R]+.IP \(bu 2+the balancing account, with \f[CR]\-\-close\-acct=ACCT\f[R] and/or+\f[CR]\-\-open\-acct=ACCT\f[R]+.IP \(bu 2+the transaction descriptions, with \f[CR]\-\-close\-desc=DESC\f[R] and+\f[CR]\-\-open\-desc=DESC\f[R]+.IP \(bu 2+the transactions\(aq \f[CR]clopen\f[R] tag value, with a+\f[CR]TAGVAL\f[R] argument for the mode flag (see above).+.PP+By default, the closing date is yesterday, or the journal\(aqs end date,+whichever is later; and the opening date is always one day after the+closing date.+You can change these by specifying a report end date; the closing date+will be the last day of the report period.+Eg \f[CR]\-e 2024\f[R] means \(dqclose on 2023\-12\-31, open on+2024\-01\-01\(dq.+.PP+With \f[CR]\-\-x/\-\-explicit\f[R], the balancing amount will be shown+explicitly, and if it involves multiple commodities, a separate posting+will be generated for each of them (similar to \f[CR]print \-x\f[R]).+.PP+With \f[CR]\-\-interleaved\f[R], each individual transfer is shown with+source and destination postings next to each other (perhaps useful for+troubleshooting).+.PP+With \f[CR]\-\-show\-costs\f[R], balances\(aq costs are also shown, with+different costs kept separate.+This may generate very large journal entries, if you have many currency+conversions or investment transactions.+\f[CR]close \-\-show\-costs\f[R] is currently the best way to view+investment lots with hledger.+(To move or dispose of lots, see the more capable+\f[CR]hledger\-move\f[R] script.)+.SS close and balance assertions+\f[CR]close\f[R] adds balance assertions verifying that the accounts+have been reset to zero in a closing transaction or restored to their+previous balances in an opening transaction.+These provide useful error checking, but you can ignore them temporarily+with \f[CR]\-I\f[R], or remove them if you prefer.+.PP+Single\-commodity, subaccount\-exclusive balance assertions+(\f[CR]=\f[R]) are generated by default.+This can be changed with \f[CR]\-\-assertion\-type=\(aq==*\(aq\f[R]+(eg).+.PP+When running \f[CR]close\f[R] you should probably avoid using+\f[CR]\-C\f[R], \f[CR]\-R\f[R], \f[CR]status:\f[R] (filtering by status+or realness) or \f[CR]\-\-auto\f[R] (generating postings), since the+generated balance assertions would then require these.+.PP+Transactions with multiple dates (eg posting dates) spanning the file+boundary also can disrupt the balance assertions:+.IP+.EX+2023\-12\-30 a purchase made in december, cleared in january+ expenses:food 5+ assets:bank:checking \-5 ; date: 2023\-01\-02+.EE+.PP+To solve this you can transfer the money to and from a temporary+account, splitting the multi\-day transaction into two single\-day+transactions:+.IP+.EX+; in 2022.journal:+2022\-12\-30 a purchase made in december, cleared in january+ expenses:food 5+ equity:pending \-5++; in 2023.journal:+2023\-01\-02 last year\(aqs transaction cleared+ equity:pending 5 = 0+ assets:bank:checking \-5+.EE+.SS close examples+.SS Retain earnings+Record 2022\(aqs revenues/expenses as retained earnings on 2022\-12\-31,+appending the generated transaction to the journal:+.IP+.EX+$ hledger close \-\-retain \-f 2022.journal \-p 2022 >> 2022.journal+.EE+.PP+After this, to see 2022\(aqs revenues and expenses you must exclude the+retain earnings transaction:+.IP+.EX+$ hledger \-f 2022.journal is not:desc:\(aqretain earnings\(aq+.EE+.SS Migrate balances to a new file+Close assets/liabilities on 2022\-12\-31 and re\-open them on+2023\-01\-01:+.IP+.EX+$ hledger close \-\-clopen \-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+.EE+.PP+After this, to see 2022\(aqs end\-of\-year balances you must exclude the+closing balances transaction:+.IP+.EX+$ hledger \-f 2022.journal bs not:desc:\(aqclosing balances\(aq+.EE+.PP+For more flexibility, it helps to tag closing and opening transactions+with eg \f[CR]clopen:NEWYEAR\f[R], then you can ensure correct balances+by excluding all opening/closing transactions except the first, like so:+.IP+.EX+$ hledger bs \-Y \-f 2021.j \-f 2022.j \-f 2023.j expr:\(aqtag:clopen=2021 or not tag:clopen\(aq+$ hledger bs \-Y \-f 2021.j \-f 2022.j expr:\(aqtag:clopen=2021 or not tag:clopen\(aq+$ hledger bs \-Y \-f 2022.j \-f 2023.j expr:\(aqtag:clopen=2022 or not tag:clopen\(aq+$ hledger bs \-Y \-f 2021.j expr:\(aqtag:clopen=2021 or not tag:clopen\(aq+$ hledger bs \-Y \-f 2022.j expr:\(aqtag:clopen=2022 or not tag:clopen\(aq+$ hledger bs \-Y \-f 2023.j # unclosed file, no query needed+.EE+.SS More detailed close examples+See examples/multi\-year.+.SS rewrite+Print all transactions, rewriting the postings of matched transactions.+For now the only rewrite available is adding new postings, like print+\-\-auto.+.IP+.EX+Flags:+ \-\-add\-posting=\(aqACCT AMTEXPR\(aq add a posting to ACCT, which may be+ parenthesised. AMTEXPR is either a literal+ amount, or *N which means the transaction\(aqs+ first matched amount multiplied by N (a+ decimal number). Two spaces separate ACCT+ and AMTEXPR.+ \-\-diff generate diff suitable as an input for+ patch tool+.EE+.PP+This is a start at a generic rewriter of transaction entries.+It reads the default journal and prints the transactions, like print,+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\(aqs first posting amount.+.PP+Examples:+.IP+.EX+$ hledger\-rewrite.hs \(haincome \-\-add\-posting \(aq(liabilities:tax) *.33 ; income tax\(aq \-\-add\-posting \(aq(reserve:gifts) $100\(aq+$ hledger\-rewrite.hs expenses:gifts \-\-add\-posting \(aq(reserve:gifts) *\-1\(dq\(aq+$ hledger\-rewrite.hs \-f rewrites.hledger+.EE+.PP+rewrites.hledger may consist of entries like:+.IP+.EX+= \(haincome amt:<0 date:2017+ (liabilities:tax) *0.33 ; tax on income+ (reserve:grocery) *0.25 ; reserve 25% for grocery+ (reserve:) *0.25 ; reserve 25% for grocery+.EE+.PP+Note the single quotes to protect the dollar sign from bash, and the two+spaces between account and amount.+.PP+More:+.IP+.EX+$ hledger rewrite [QUERY] \-\-add\-posting \(dqACCT AMTEXPR\(dq ...+$ hledger rewrite \(haincome \-\-add\-posting \(aq(liabilities:tax) *.33\(aq+$ hledger rewrite expenses:gifts \-\-add\-posting \(aq(budget:gifts) *\-1\(dq\(aq+$ hledger rewrite \(haincome \-\-add\-posting \(aq(budget:foreign currency) *0.25 JPY; diversify\(aq+.EE+.PP+Argument for \f[CR]\-\-add\-posting\f[R] option is a usual posting of+transaction with an exception for amount specification.+More precisely, you can use \f[CR]\(aq*\(aq\f[R] (star symbol) before+the amount to indicate that that this is a factor for an amount of+original matched posting.+If the amount includes a commodity name, the new posting amount will be+in the new commodity; otherwise, it will be in the matched posting+amount\(aqs commodity.+.SS Re\-write rules in a file+During the run this tool will execute so called \(dqAutomated+Transactions\(dq found in any journal it process.+I.e instead of specifying this operations in command line you can put+them in a journal file.+.IP+.EX+$ rewrite\-rules.journal+.EE+.PP+Make contents look like this:+.IP+.EX+= \(haincome+ (liabilities:tax) *.33++= expenses:gifts+ budget:gifts *\-1+ assets:budget *1+.EE+.PP+Note that \f[CR]\(aq=\(aq\f[R] (equality symbol) that is used instead of+date in transactions you usually write.+It indicates the query by which you want to match the posting to add new+ones.+.IP+.EX+$ hledger rewrite \-f input.journal \-f rewrite\-rules.journal > rewritten\-tidy\-output.journal+.EE+.PP+This is something similar to the commands pipeline:+.IP+.EX+$ hledger rewrite \-f input.journal \(aq\(haincome\(aq \-\-add\-posting \(aq(liabilities:tax) *.33\(aq \(rs+ | hledger rewrite \-f \- expenses:gifts \-\-add\-posting \(aqbudget:gifts *\-1\(aq \(rs+ \-\-add\-posting \(aqassets:budget *1\(aq \(rs+ > rewritten\-tidy\-output.journal+.EE+.PP+It is important to understand that relative order of such entries in+journal is important.+You can re\-use result of previously added postings.+.SS Diff output format+To use this tool for batch modification of your journal files you may+find useful output in form of unified diff.+.IP+.EX+$ hledger rewrite \-\-diff \-f examples/sample.journal \(aq\(haincome\(aq \-\-add\-posting \(aq(liabilities:tax) *.33\(aq+.EE+.PP+Output might look like:+.IP+.EX+\-\-\- /tmp/examples/sample.journal++++ /tmp/examples/sample.journal+\(at\(at \-18,3 +18,4 \(at\(at+ 2008/01/01 income+\- assets:bank:checking $1++ assets:bank:checking $1+ income:salary++ (liabilities:tax) 0+\(at\(at \-22,3 +23,4 \(at\(at+ 2008/06/01 gift+\- assets:bank:checking $1++ assets:bank:checking $1+ income:gifts++ (liabilities:tax) 0+.EE+.PP+If you\(aqll pass this through \f[CR]patch\f[R] tool you\(aqll get+transactions containing the posting that matches your query be updated.+Note that multiple files might be update according to list of input+files specified via \f[CR]\-\-file\f[R] options and \f[CR]include\f[R]+directives inside of these files.+.PP+Be careful.+Whole transaction being re\-formatted in a style of output from+\f[CR]hledger print\f[R].+.PP+See also:+.PP+https://github.com/simonmichael/hledger/issues/99+.SS rewrite vs. print \-\-auto+This command predates print \-\-auto, and currently does much the same+thing, but with these differences:+.IP \(bu 2+with multiple files, rewrite lets rules in any file affect all other+files.+print \-\-auto uses standard directive scoping; rules affect only child+files.+.IP \(bu 2+rewrite\(aqs query limits which transactions can be rewritten; all are+printed.+print \-\-auto\(aqs query limits which transactions are printed.+.IP \(bu 2+rewrite applies rules specified on command line or in the journal.+print \-\-auto applies rules specified in the journal.+.SH Maintenance commands+.SS check+Check for various kinds of errors in your data.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+hledger provides a number of built\-in correctness checks to help+validate your data and prevent errors.+Some are run automatically, some when you enable \f[CR]\-\-strict\f[R]+mode; or you can run any of them on demand by providing them as+arguments to the \f[CR]check\f[R] command.+\f[CR]check\f[R] produces no output and a zero exit code if all is well.+Eg:+.IP+.EX+hledger check # run basic checks+hledger check \-s # run basic and strict checks+hledger check ordereddates payees # run basic checks and two others+.EE+.PP+If you are an Emacs user, you can also configure flycheck\-hledger to+run these checks, providing instant feedback as you edit the journal.+.PP+Here are the checks currently available.+They are generally checked in the order they are shown here, and only+the first failure will be reported.+.SS Basic checks+These important checks are performed by default, by almost all hledger+commands:+.IP \(bu 2+\f[B]parseable\f[R] \- data files are in a supported format, with no+syntax errors and no invalid include directives.+This ensures that all files exist and are readable.+.IP \(bu 2+\f[B]autobalanced\f[R] \- all transactions are balanced, after+automatically inferring missing amounts and conversion rates and then+converting amounts to cost.+This ensures that each transaction\(aqs journal entry is well formed.+.IP \(bu 2+\f[B]assertions\f[R] \- all balance assertions in the journal are+passing.+Balance assertions are a strong defense against errors, catching many+problems.+This check is on by default, but if it gets in your way, you can disable+it temporarily with \f[CR]\-I\f[R]/\f[CR]\-\-ignore\-assertions\f[R], or+as a default by adding that flag to your config file.+(Then use \f[CR]\-s\f[R]/\f[CR]\-\-strict\f[R] or+\f[CR]hledger check assertions\f[R] when you want to enable it).+.SS Strict checks+When the \f[CR]\-s\f[R]/\f[CR]\-\-strict\f[R] flag is used (AKA strict+mode), all commands will perform the following additional checks (and+\f[CR]assertions\f[R], above).+These provide extra error\-catching power to help you keep your data+clean and correct:+.IP \(bu 2+\f[B]balanced\f[R] \- like \f[CR]autobalanced\f[R], but implicit+conversions between commodities are not allowed; all conversion+transactions must use cost notation or equity postings.+This prevents wrong conversions caused by typos.+.IP \(bu 2+\f[B]commodities\f[R] \- all commodity symbols used must be declared.+This guards against mistyping or omitting commodity symbols.+.IP \(bu 2+\f[B]accounts\f[R] \- all account names used must be declared.+This prevents the use of mis\-spelled or outdated account names.+.SS Other checks+These are not wanted by everyone, but can be run using the+\f[CR]check\f[R] command:+.IP \(bu 2+\f[B]tags\f[R] \- all tags used must be declared.+This prevents mis\-spelled tag names.+Note hledger fairly often finds unintended tags in comments.+.IP \(bu 2+\f[B]payees\f[R] \- all payees used in transactions must be declared.+This will force you to declare any new payee name before using it.+Most people will probably find this a bit too strict.+.IP \(bu 2+\f[B]ordereddates\f[R] \- within each file, transactions must be ordered+by date.+This is a simple and effective error catcher.+It\(aqs not included in strict mode, but you can add it by running+\f[CR]hledger check \-s ordereddates\f[R].+If enabled, this check is performed before balance assertions.+.IP \(bu 2+\f[B]recentassertions\f[R] \- all accounts with balance assertions must+have one that\(aqs within the 7 days before their latest posting.+This will encourage adding balance assertions for your active+asset/liability accounts, which in turn should encourage you to+reconcile regularly with those real world balances \- another strong+defense against errors.+(\f[CR]hledger close \-\-assert >>$LEDGER_FILE\f[R] is a convenient way+to add new balance assertions.+Later these become quite redundant, and you might choose to remove them+to reduce clutter.)+.IP \(bu 2+\f[B]uniqueleafnames\f[R] \- no two accounts may have the same last+account name part (eg the \f[CR]checking\f[R] in+\f[CR]assets:bank:checking\f[R]).+This ensures each account can be matched by a unique short name, easier+to remember and to type.+.SS Custom checks+You can build your own custom checks with add\-on command scripts.+See also Cookbook > Scripting.+Here are some examples from hledger/bin/:+.IP \(bu 2+\f[B]hledger\-check\-tagfiles\f[R] \- all tag values containing+\f[CR]/\f[R] exist as file paths+.IP \(bu 2+\f[B]hledger\-check\-fancyassertions\f[R] \- more complex balance+assertions are passing+.SS diff+Compares a particular account\(aqs transactions in two input files.+It shows any transactions to this account which are in one file but not+in the other.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+More precisely: for each posting affecting this account in either file,+this command looks for a corresponding posting in the other file which+posts the same amount to the same account (ignoring date, description,+etc).+.PP+Since it compares postings, not transactions, this also works when+multiple bank transactions have been combined into a single journal+entry.+.PP+This command is useful eg if you have downloaded an account\(aqs+transactions from your bank (eg as CSV data): when hledger and your bank+disagree about the account balance, you can compare the bank data with+your journal to find out the cause.+.PP+Examples:+.IP+.EX+$ hledger diff \-f $LEDGER_FILE \-f bank.csv assets:bank:giro +These transactions are in the first file only:++2014/01/01 Opening Balances+ assets:bank:giro EUR ...+ ...+ equity:opening balances EUR \-...++These transactions are in the second file only:+.EE+.SS setup+Check the status of the hledger installation.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+\f[CR]setup\f[R] tests your hledger installation and prints a list of+results, sometimes with helpful hints.+This is a good first command to run after installing hledger.+Also after upgrading, or when something\(aqs not working, or just when+you want a reminder of where things are.+.PP+It makes one network request to detect the latest hledger release+version.+It\(aqs ok if this fails or times out.+It will use ANSI color by default, unless disabled by NO_COLOR or+\-\-color=n.+It does not use a pager or a config file.+.PP+It expects that the hledger version you are running is installed in your+PATH.+If not, it will stop until you have done that (to keep things simple).+.PP+Example:+.IP+.EX+$ hledger setup+Checking your hledger setup..+Legend: good, neutral, unknown, warning++hledger+* is a released version ? no hledger 1.42.99\-gbca4b39c5\-20250425, mac\-aarch64+* is up to date ? yes 1.42.99 installed, latest is 1.42.1+* is a native binary for this machine ? yes aarch64+* is installed in PATH ? yes /Users/simon/.local/bin/hledger+* has a system text encoding configured ? yes UTF\-8, data files should use this encoding+* has a user config file ? (optional) no +* current directory has a local config ? yes /Users/simon/src/hledger/hledger.conf+* the config file is readable ? yes /Users/simon/src/hledger/hledger.conf++terminal+* the NO_COLOR variable is defined ? no +* \-\-color is configured by config file ? no +* hledger will use color by default ? yes +* the PAGER variable is defined ? yes less+* \-\-pager is configured by config file ? no +* hledger will use a pager when needed ? yes /opt/homebrew/bin/less+* the LESS variable is defined ? yes +* the HLEDGER_LESS variable is defined ? no +* adjusting LESS variable for color etc. ? yes +* \-\-pretty is enabled by config file ? no tables will use ASCII characters+* bash shell completions are installed ? ? +* zsh shell completions are installed ? ? ++journal+* the LEDGER_FILE variable is defined ? yes /Users/simon/finance/2025/2025.journal+* a default journal file is readable ? yes /Users/simon/finance/2025/2025.journal+* it includes additional files ? yes 15+* all commodities are declared ? yes 10+* all accounts are declared ? yes 160+* all accounts have types ? no 14 untyped+* accounts of each type were detected ? yes ALERXCV+* commodities/accounts are checked ? no use \-s to check commodities/accounts+* balance assertions are checked ? yes use \-I to ignore assertions+.EE+.SS test+Run built\-in unit tests.+.IP+.EX+Flags:+no command\-specific flags+.EE+.PP+This command runs the unit tests built in to hledger and hledger\-lib,+printing the results on stdout.+If any test fails, the exit code will be non\-zero.+.PP+This is mainly used by hledger developers, but you can also use it to+sanity\-check the installed hledger executable on your platform.+All tests are expected to pass \- if you ever see a failure, please+report as a bug!+.PP+Any arguments before a \f[CR]\-\-\f[R] argument will be passed to the+\f[CR]tasty\f[R] test runner as test\-selecting \-p patterns, and any+arguments after \f[CR]\-\-\f[R] will be passed to tasty unchanged.+.PP+Examples:+.IP+.EX+$ hledger test # run all unit tests+$ hledger test balance # run tests with \(dqbalance\(dq in their name+$ hledger test \-\- \-h # show tasty\(aqs options+.EE+.PP+.SH PART 5: COMMON TASKS+Here are some quick examples of how to do some basic tasks with hledger.+.SS Getting help+Here\(aqs how to list commands and view options and command docs:+.IP+.EX+$ hledger # show available commands+$ hledger \-\-help # show common options+$ hledger CMD \-\-help # show CMD\(aqs options, common options and CMD\(aqs documentation+.EE+.PP+You can also view your hledger version\(aqs manual in several formats by+using the help command.+Eg:+.IP+.EX+$ hledger help # show the hledger manual with info, man or $PAGER (best available)+$ hledger help journal # show the journal topic in the hledger manual+$ hledger help \-\-help # find out more about the help command+.EE+.PP+To view manuals and introductory docs on the web, visit+https://hledger.org.+Chat and mail list support and discussion archives can be found at+https://hledger.org/support.+.SS Constructing command lines+hledger has a flexible command line interface.+We strive to keep it simple and ergonomic, but if you run into one of+the sharp edges described in OPTIONS, here are some tips that might+help:+.IP \(bu 2+command\-specific options must go after the command (it\(aqs fine to put+common options there too: \f[CR]hledger CMD OPTS ARGS\f[R])+.IP \(bu 2+you can run addon commands via hledger (\f[CR]hledger ui [ARGS]\f[R]) or+directly (\f[CR]hledger\-ui [ARGS]\f[R])+.IP \(bu 2+enclose \(dqproblematic\(dq arguments in single quotes+.IP \(bu 2+if needed, also add a backslash to hide regular expression+metacharacters from the shell+.IP \(bu 2+to see how a misbehaving command line is being parsed, add+\f[CR]\-\-debug=2\f[R].+.SS Starting a journal file+hledger looks for your accounting data in a journal file,+\f[CR]$HOME/.hledger.journal\f[R] by default:+.IP+.EX+$ hledger stats+The hledger journal file \(dq/Users/simon/.hledger.journal\(dq was not found.+Please create it first, eg with \(dqhledger add\(dq or a text editor.+Or, specify an existing journal file with \-f or LEDGER_FILE.+.EE+.PP+You can override this by setting the \f[CR]LEDGER_FILE\f[R] environment+variable (see below).+It\(aqs a good practice to keep this important file under version+control, and to start a new file each year.+So you could do something like this:+.IP+.EX+$ mkdir \(ti/finance+$ cd \(ti/finance+$ git init+Initialized empty Git repository in /Users/simon/finance/.git/+$ touch 2023.journal+$ echo \(dqexport LEDGER_FILE=$HOME/finance/2023.journal\(dq >> \(ti/.profile+$ source \(ti/.profile+$ hledger stats+Main file : /Users/simon/finance/2023.journal+Included files : +Transactions span : to (0 days)+Last transaction : none+Transactions : 0 (0.0 per day)+Transactions last 30 days: 0 (0.0 per day)+Transactions last 7 days : 0 (0.0 per day)+Payees/descriptions : 0+Accounts : 0 (depth 0)+Commodities : 0 ()+Market prices : 0 ()+.EE+.SS Setting LEDGER_FILE+.SS Set LEDGER_FILE on unix+It depends on your shell, but running these commands in the terminal+will work for many people; adapt if needed:+.IP+.EX+$ echo \(aqexport LEDGER_FILE=\(ti/finance/main.journal\(aq >> \(ti/.profile+$ source \(ti/.profile+.EE+.PP+When correctly configured:+.IP \(bu 2+\f[CR]env | grep LEDGER_FILE\f[R] will show your new setting+.IP \(bu 2+and so should \f[CR]hledger setup\f[R] and \f[CR]hledger files\f[R].+.SS Set LEDGER_FILE on mac+In a terminal window, follow the unix procedure above.+.PP+Also, this optional step may be helpful for GUI applications:+.IP "1." 3+Add an entry to \f[CR]\(ti/.MacOSX/environment.plist\f[R] like+.RS 4+.IP+.EX+{+ \(dqLEDGER_FILE\(dq : \(dq\(ti/finance/main.journal\(dq+}+.EE+.RE+.IP "2." 3+Run \f[CR]killall Dock\f[R] in a terminal window (or restart the+machine), to complete the change.+.PP+When correctly configured for GUI applications:+.IP \(bu 2+apps started from the dock or a spotlight search, such as a GUI Emacs,+will be aware of the new LEDGER_FILE setting.+.SS Set LEDGER_FILE on Windows+It can be easier to create a default file at+\f[CR]C:\(rsUsers\(rsUSER\(rs.hledger.journal\f[R], and have it include+your other files.+See I\(aqm on Windows, how do I keep my files in AppData?+.PP+Otherwise: using the gui is easiest:+.IP "1." 3+In task bar, search for \f[CR]environment variables\f[R], and choose+\(dqEdit environment variables for your account\(dq.+.IP "2." 3+Create or change a \f[CR]LEDGER_FILE\f[R] setting in the User variables+pane.+A typical value would be+\f[CR]C:\(rsUsers\(rsUSER\(rsfinance\(rsmain.journal\f[R].+.IP "3." 3+Click OK to complete the change.+.IP "4." 3+And open a new powershell window.+(Existing windows won\(aqt see the change.)+.PP+Or at the command line, you can do it this way:+.IP "1." 3+In a powershell window, run+\f[CR][Environment]::SetEnvironmentVariable(\(dqLEDGER_FILE\(dq, \(dqC:\(rsUser\(rsUSER\(rsfinance\(rsmain.journal\(dq, [System.EnvironmentVariableTarget]::User)\f[R]+.IP "2." 3+And open a new powershell window.+(Existing windows won\(aqt see the change.)+.PP+Warning, doing this from the Windows command line can be tricky; other+methods you may find online:+.IP \(bu 2+may not affect the current window+.IP \(bu 2+may not be persistent+.IP \(bu 2+may not work unless you are an administrator+.IP \(bu 2+may limit values to 1024 characters+.IP \(bu 2+may break dynamic references to other variables+.IP \(bu 2+may require a new\-enough version of powershell+.IP \(bu 2+or may be intended for the older command window.+.IP \(bu 2+If you still have trouble, see eg Setting Windows PowerShell environment+variables or Adding path permanently to windows using powershell+doesn\(aqt appear to work.+.PP+When correctly configured:+.IP \(bu 2+in a new powershell window, \f[CR]$env:LEDGER_FILE\f[R] will show your+new setting+.IP \(bu 2+and so should \f[CR]hledger setup\f[R] and (once the file exists)+\f[CR]hledger files\f[R].+.SS Setting opening balances+Pick a starting date for which you can look up the balances of some+real\-world assets (bank accounts, wallet..)+and liabilities (credit cards..).+.PP+To avoid a lot of data entry, you may want to start with just one or two+accounts, like your checking account or cash wallet; and pick a recent+starting date, like today or the start of the week.+You can always come back later and add more accounts and older+transactions, eg going back to january 1st.+.PP+Add an opening balances transaction to the journal, declaring the+balances on this date.+Here are two ways to do it:+.IP \(bu 2+The first way: open the journal in any text editor and save an entry+like this:+.RS 2+.IP+.EX+2023\-01\-01 * opening balances+ assets:bank:checking $1000 = $1000+ assets:bank:savings $2000 = $2000+ assets:cash $100 = $100+ liabilities:creditcard $\-50 = $\-50+ equity:opening/closing balances+.EE+.PP+These are start\-of\-day balances, ie whatever was in the account at the+end of the previous day.+.PP+The * after the date is an optional status flag.+Here it means \(dqcleared & confirmed\(dq.+.PP+The currency symbols are optional, but usually a good idea as you\(aqll+be dealing with multiple currencies sooner or later.+.PP+The = amounts are optional balance assertions, providing extra error+checking.+.RE+.IP \(bu 2+The second way: run \f[CR]hledger add\f[R] and follow the prompts to+record a similar transaction:+.RS 2+.IP+.EX+$ hledger add+Adding transactions to journal file /Users/simon/finance/2023.journal+Any command line arguments will be used as defaults.+Use tab key to complete, readline keys to edit, enter to accept defaults.+An optional (CODE) may follow transaction dates.+An optional ; COMMENT may follow descriptions or amounts.+If you make a mistake, enter < at any prompt to go one step backward.+To end a transaction, enter . when prompted.+To quit, enter . at a date prompt or press control\-d or control\-c.+Date [2023\-02\-07]: 2023\-01\-01+Description: * opening balances+Account 1: assets:bank:checking+Amount 1: $1000+Account 2: assets:bank:savings+Amount 2 [$\-1000]: $2000+Account 3: assets:cash+Amount 3 [$\-3000]: $100+Account 4: liabilities:creditcard+Amount 4 [$\-3100]: $\-50+Account 5: equity:opening/closing balances+Amount 5 [$\-3050]: +Account 6 (or . or enter to finish this transaction): .+2023\-01\-01 * opening balances+ assets:bank:checking $1000+ assets:bank:savings $2000+ assets:cash $100+ liabilities:creditcard $\-50+ equity:opening/closing balances $\-3050++Save this transaction to the journal ? [y]: +Saved.+Starting the next transaction (. or ctrl\-D/ctrl\-C to quit)+Date [2023\-01\-01]: .+.EE+.RE+.PP+If you\(aqre using version control, this could be a good time to commit+the journal.+Eg:+.IP+.EX+$ git commit \-m \(aqinitial balances\(aq 2023.journal+.EE+.SS Recording transactions+As you spend or receive money, you can record these transactions using+one of the methods above (text editor, hledger add) or by using the+hledger\-iadd or hledger\-web add\-ons, or by using the import command+to convert CSV data downloaded from your bank.+.PP+Here are some simple transactions, see the hledger_journal(5) manual and+hledger.org for more ideas:+.IP+.EX+2023/1/10 * gift received+ assets:cash $20+ income:gifts++2023.1.12 * farmers market+ expenses:food $13+ assets:cash++2023\-01\-15 paycheck+ income:salary+ assets:bank:checking $1000+.EE+.SS Reconciling+Periodically you should reconcile \- compare your hledger\-reported+balances against external sources of truth, like bank statements or your+bank\(aqs website \- to be sure that your ledger accurately represents+the real\-world balances (and, that the real\-world institutions have+not made a mistake!).+This gets easy and fast with (1) practice and (2) frequency.+If you do it daily, it can take 2\-10 minutes.+If you let it pile up, expect it to take longer as you hunt down errors+and discrepancies.+.PP+A typical workflow:+.IP "1." 3+Reconcile cash.+Count what\(aqs in your wallet.+Compare with what hledger reports (\f[CR]hledger bal cash\f[R]).+If they are different, try to remember the missing transaction, or look+for the error in the already\-recorded transactions.+A register report can be helpful (\f[CR]hledger reg cash\f[R]).+If you can\(aqt find the error, add an adjustment transaction.+Eg if you have $105 after the above, and can\(aqt explain the missing+$2, it could be:+.RS 4+.IP+.EX+2023\-01\-16 * adjust cash+ assets:cash $\-2 = $105+ expenses:misc+.EE+.RE+.IP "2." 3+Reconcile checking.+Log in to your bank\(aqs website.+Compare today\(aqs (cleared) balance with hledger\(aqs cleared balance+(\f[CR]hledger bal checking \-C\f[R]).+If they are different, track down the error or record the missing+transaction(s) or add an adjustment transaction, similar to the above.+Unlike the cash case, you can usually compare the transaction history+and running balance from your bank with the one reported by+\f[CR]hledger reg checking \-C\f[R].+This will be easier if you generally record transaction dates quite+similar to your bank\(aqs clearing dates.+.IP "3." 3+Repeat for other asset/liability accounts.+.PP+Tip: instead of the register command, use hledger\-ui to see a+live\-updating register while you edit the journal:+\f[CR]hledger\-ui \-\-watch \-\-register checking \-C\f[R]+.PP+After reconciling, it could be a good time to mark the reconciled+transactions\(aq status as \(dqcleared and confirmed\(dq, if you want to+track that, by adding the \f[CR]*\f[R] marker.+Eg in the paycheck transaction above, insert \f[CR]*\f[R] between+\f[CR]2023\-01\-15\f[R] and \f[CR]paycheck\f[R]+.PP+If you\(aqre using version control, this can be another good time to+commit:+.IP+.EX+$ git commit \-m \(aqtxns\(aq 2023.journal+.EE+.SS Reporting+Here are some basic reports.+.PP+Show all transactions:+.IP+.EX+$ hledger print+2023\-01\-01 * opening balances+ assets:bank:checking $1000+ assets:bank:savings $2000+ assets:cash $100+ liabilities:creditcard $\-50+ equity:opening/closing balances $\-3050++2023\-01\-10 * gift received+ assets:cash $20+ income:gifts++2023\-01\-12 * farmers market+ expenses:food $13+ assets:cash++2023\-01\-15 * paycheck+ income:salary+ assets:bank:checking $1000++2023\-01\-16 * adjust cash+ assets:cash $\-2 = $105+ expenses:misc+.EE+.PP+Show account names, and their hierarchy:+.IP+.EX+$ hledger accounts \-\-tree+assets+ bank+ checking+ savings+ cash+equity+ opening/closing balances+expenses+ food+ misc+income+ gifts+ salary+liabilities+ creditcard+.EE+.PP+Show all account totals:+.IP+.EX+$ hledger balance+ $4105 assets+ $4000 bank+ $2000 checking+ $2000 savings+ $105 cash+ $\-3050 equity:opening/closing balances+ $15 expenses+ $13 food+ $2 misc+ $\-1020 income+ $\-20 gifts+ $\-1000 salary+ $\-50 liabilities:creditcard+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ 0+.EE+.PP+Show only asset and liability balances, as a flat list, limited to depth+2:+.IP+.EX+$ hledger bal assets liabilities \-2+ $4000 assets:bank+ $105 assets:cash+ $\-50 liabilities:creditcard+\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ $4055+.EE+.PP+Show the same thing without negative numbers, formatted as a simple+balance sheet:+.IP+.EX+$ hledger bs \-2+Balance Sheet 2023\-01\-16++ || 2023\-01\-16 +========================++============+ Assets || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ assets:bank || $4000 + assets:cash || $105 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ || $4105 +========================++============+ Liabilities || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ liabilities:creditcard || $50 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-+ || $50 +========================++============+ Net: || $4055 +.EE+.PP+The final total is your \(dqnet worth\(dq on the end date.+(Or use \f[CR]bse\f[R] for a full balance sheet with equity.)+.PP+Show income and expense totals, formatted as an income statement:+.IP+.EX+hledger is +Income Statement 2023\-01\-01\-2023\-01\-16++ || 2023\-01\-01\-2023\-01\-16 +===============++=======================+ Revenues || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ income:gifts || $20 + income:salary || $1000 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || $1020 +===============++=======================+ Expenses || +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ expenses:food || $13 + expenses:misc || $2 +\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-+ || $15 +===============++=======================+ Net: || $1005 +.EE+.PP+The final total is your net income during this period.+.PP+Show transactions affecting your wallet, with running total:+.IP+.EX+$ hledger register cash+2023\-01\-01 opening balances assets:cash $100 $100+2023\-01\-10 gift received assets:cash $20 $120+2023\-01\-12 farmers market assets:cash $\-13 $107+2023\-01\-16 adjust cash assets:cash $\-2 $105+.EE+.PP+Show weekly posting counts as a bar chart:+.IP+.EX+$ hledger activity \-W+2019\-12\-30 *****+2023\-01\-06 ****+2023\-01\-13 ****+.EE+.SS Migrating to a new file+At the end of the year, you may want to continue your journal in a new+file, so that old transactions don\(aqt slow down or clutter your+reports, and to help ensure the integrity of your accounting history.+See the close command.+.PP+If using version control, don\(aqt forget to \f[CR]git add\f[R] the new+file.+.SH BUGS+We welcome bug reports in the hledger issue tracker+(https://bugs.hledger.org), or on the hledger chat or mail list+(https://hledger.org/support).+.PP+Some known issues and limitations:+.PP+hledger uses the system\(aqs text encoding when reading non\-ascii text.+If no system encoding is configured, or if the data\(aqs encoding is+different, hledger will give an error.+(See Text encoding, Troubleshooting.)+.PP+On Microsoft Windows, depending what kind of terminal window you use,+non\-ascii characters, ANSI text formatting, and/or the add command\(aqs+TAB key, may not be fully supported.+(For best results, try a powershell window.)+.PP+When processing large data files, hledger uses more memory than Ledger.+.SS Troubleshooting+Here are some common issues you might encounter when you run hledger,+and how to resolve them (and remember also you can usually get quick+Support):+.PP+\f[B]PATH issues: I get an error like \(dqNo command \(aqhledger\(aq+found\(dq\f[R]+.PD 0+.P+.PD+Depending how you installed hledger, the executables may not be in your+shell\(aqs PATH.+Eg on unix systems, stack installs hledger in \f[CR]\(ti/.local/bin\f[R]+and cabal installs it in \f[CR]\(ti/.cabal/bin\f[R].+You may need to add one of these directories to your shell\(aqs PATH,+and/or open a new terminal window.+.PP+\f[B]LEDGER_FILE issues: I configured LEDGER_FILE but hledger is not+using it\f[R]+.PD 0+.P+.PD+.IP \(bu 2+\f[CR]LEDGER_FILE\f[R] should be a real environment variable, not just a+shell variable.+Eg on unix, the command \f[CR]env | grep LEDGER_FILE\f[R] should show+it.+You may need to use \f[CR]export\f[R] (see+https://stackoverflow.com/a/7411509).+On Windows, \f[CR]$env:LEDGER_FILE\f[R] should show it.+.IP \(bu 2+You may need to force your shell to see the new configuration.+A simple way is to close your terminal window and open a new one.+.PP+\f[B]Text decoding issues: I get errors like \(dqIllegal byte+sequence\(dq or \(dqInvalid or incomplete multibyte or wide+character\(dq or \(dqcommitAndReleaseBuffer: invalid argument (invalid+character)\(dq\f[R]+.PD 0+.P+.PD+hledger usually needs its input to be decodable with the system+locale\(aqs text encoding.+See Text encoding and Install: Text encoding.+.PP+\f[B]COMPATIBILITY ISSUES: hledger gives an error with my Ledger+file\f[R]+.PD 0+.P+.PD+Not all of Ledger\(aqs journal file syntax or feature set is supported.+See hledger and Ledger for full details.+++.SH AUTHORS+Simon Michael <simon@joyful.com> and contributors.+.br+See http://hledger.org/CREDITS.html++.SH COPYRIGHT+Copyright 2007-2023 Simon Michael and contributors.++.SH LICENSE+Released under GNU GPL v3 or later.++.SH SEE ALSO+hledger(1), hledger\-ui(1), hledger\-web(1), ledger(1)
embeddedfiles/hledger.info view
@@ -1,2856 +1,13899 @@-This is hledger.info, produced by makeinfo version 6.5 from stdin.---File: hledger.info, Node: Top, Next: EXAMPLES, Up: (dir)--hledger(1) hledger 1.14-***********************--This is hledger's command-line interface (there are also curses and web-interfaces). Its basic function is to read a plain text file describing-financial transactions (in accounting terms, a general journal) and-print useful reports on standard output, or export them as CSV. hledger-can also read some other file formats such as CSV files, translating-them to journal format. Additionally, hledger lists other hledger-*-executables found in the user's $PATH and can invoke them as-subcommands.-- hledger reads data from one or more files in hledger journal,-timeclock, timedot, or CSV format specified with '-f', or-'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps-'C:/Users/USER/.hledger.journal'). If using '$LEDGER_FILE', note this-must be a real environment variable, not a shell variable. You can-specify standard input with '-f-'.-- Transactions are dated movements of money between two (or more) named-accounts, and are recorded with journal entries like this:--2015/10/16 bought food- expenses:food $10- assets:cash-- For more about this format, see hledger_journal(5).-- Most users use a text editor to edit the journal, usually with an-editor mode such as ledger-mode for added convenience. hledger's-interactive add command is another way to record new transactions.-hledger never changes existing transactions.-- To get started, you can either save some entries like the above in-'~/.hledger.journal', or run 'hledger add' and follow the prompts. Then-try some commands like 'hledger print' or 'hledger balance'. Run-'hledger' with no arguments for a list of commands.-* Menu:--* EXAMPLES::-* OPTIONS::-* QUERIES::-* COMMANDS::-* ADD-ON COMMANDS::---File: hledger.info, Node: EXAMPLES, Next: OPTIONS, Prev: Top, Up: Top--1 EXAMPLES-**********--Two simple transactions in hledger journal format:--2015/9/30 gift received- assets:cash $20- income:gifts--2015/10/16 farmers market- expenses:food $10- assets:cash-- Some basic reports:--$ hledger print-2015/09/30 gift received- assets:cash $20- income:gifts $-20--2015/10/16 farmers market- expenses:food $10- assets:cash $-10--$ hledger accounts --tree-assets- cash-expenses- food-income- gifts--$ hledger balance- $10 assets:cash- $10 expenses:food- $-20 income:gifts---------------------- 0--$ hledger register cash-2015/09/30 gift received assets:cash $20 $20-2015/10/16 farmers market assets:cash $-10 $10-- More commands:--$ hledger # show available commands-$ hledger add # add more transactions to the journal file-$ hledger balance # all accounts with aggregated balances-$ hledger balance --help # show detailed help for balance command-$ hledger balance --depth 1 # only top-level accounts-$ hledger register # show account postings, with running total-$ hledger reg income # show postings to/from income accounts-$ hledger reg 'assets:some bank:checking' # show postings to/from this checking account-$ hledger print desc:shop # show transactions with shop in the description-$ hledger activity -W # show transaction counts per week as a bar chart---File: hledger.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top--2 OPTIONS-*********--* Menu:--* General options::-* Command options::-* Command arguments::-* Argument files::-* Special characters in arguments and queries::-* Command line tips::-* Unicode characters::-* Input files::-* Smart dates::-* Report start & end date::-* Report intervals::-* Period expressions::-* Depth limiting::-* Pivoting::-* Cost::-* Market value::-* Combining -B and -V::-* Output destination::-* Output format::-* Regular expressions::---File: hledger.info, Node: General options, Next: Command options, Up: OPTIONS--2.1 General options-===================--To see general usage help, including general options which are supported-by most hledger commands, run 'hledger -h'.-- General help options:--'-h --help'-- show general usage (or after COMMAND, command usage)-'--version'-- show version-'--debug[=N]'-- show debug output (levels 1-9, default: 1)-- General input options:--'-f FILE --file=FILE'-- use a different input file. For stdin, use - (default:- '$LEDGER_FILE' or '$HOME/.hledger.journal')-'--rules-file=RULESFILE'-- Conversion rules file to use when reading CSV (default: FILE.rules)-'--separator=CHAR'-- Field separator to expect when reading CSV (default: ',')-'--alias=OLD=NEW'-- rename accounts named OLD to NEW-'--anon'-- anonymize accounts and payees-'--pivot FIELDNAME'-- use some other field or tag for the account name-'-I --ignore-assertions'-- ignore any failing balance assertions-- General reporting options:--'-b --begin=DATE'-- include postings/txns on or after this date-'-e --end=DATE'-- include postings/txns before this date-'-D --daily'-- multiperiod/multicolumn report by day-'-W --weekly'-- multiperiod/multicolumn report by week-'-M --monthly'-- multiperiod/multicolumn report by month-'-Q --quarterly'-- multiperiod/multicolumn report by quarter-'-Y --yearly'-- multiperiod/multicolumn report by year-'-p --period=PERIODEXP'-- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)-'--date2'-- match the secondary date instead (see command help for other- effects)-'-U --unmarked'-- include only unmarked postings/txns (can combine with -P or -C)-'-P --pending'-- include only pending postings/txns-'-C --cleared'-- include only cleared postings/txns-'-R --real'-- include only non-virtual postings-'-NUM --depth=NUM'-- hide/aggregate accounts or postings more than NUM levels deep-'-E --empty'-- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)-'-B --cost'-- convert amounts to their cost at transaction time (using the- transaction price, if any)-'-V --value'-- convert amounts to their market value on the report end date (using- the most recent applicable market price, if any)-'--auto'-- apply automated posting rules to modify transactions.-'--forecast'-- apply periodic transaction rules to generate future transactions,- to 6 months from now or report end date.-- When a reporting option appears more than once in the command line,-the last one takes precedence.-- Some reporting options can also be written as query arguments.---File: hledger.info, Node: Command options, Next: Command arguments, Prev: General options, Up: OPTIONS--2.2 Command options-===================--To see options for a particular command, including command-specific-options, run: 'hledger COMMAND -h'.-- Command-specific options must be written after the command name, eg:-'hledger print -x'.-- Additionally, if the command is an addon, you may need to put its-options after a double-hyphen, eg: 'hledger ui -- --watch'. Or, you can-run the addon executable directly: 'hledger-ui --watch'.---File: hledger.info, Node: Command arguments, Next: Argument files, Prev: Command options, Up: OPTIONS--2.3 Command arguments-=====================--Most hledger commands accept arguments after the command name, which are-often a query, filtering the data in some way.---File: hledger.info, Node: Argument files, Next: Special characters in arguments and queries, Prev: Command arguments, Up: OPTIONS--2.4 Argument files-==================--You can save a set of command line options/arguments in a file, one per-line, and then reuse them by writing '@FILENAME' in a command line. To-prevent this expansion of '@'-arguments, precede them with a '--'-argument. For more, see Save frequently used options.---File: hledger.info, Node: Special characters in arguments and queries, Next: Command line tips, Prev: Argument files, Up: OPTIONS--2.5 Special characters in arguments and queries-===============================================--In shell command lines, option and argument values which contain-"problematic" characters, ie spaces, and also characters significant to-your shell such as '<', '>', '(', ')', '|' and '$', should be escaped by-enclosing them in quotes or by writing backslashes before the-characters. Eg:-- 'hledger register -p 'last year' "accounts receivable-(receivable|payable)" amt:\>100'.-* Menu:--* More escaping::-* Even more escaping::-* Less escaping::---File: hledger.info, Node: More escaping, Next: Even more escaping, Up: Special characters in arguments and queries--2.5.1 More escaping----------------------Characters significant both to the shell and in regular expressions may-need one extra level of escaping. These include parentheses, the pipe-symbol and the dollar sign. Eg, to match the dollar symbol, bash users-should do:-- 'hledger balance cur:'\$''-- or:-- 'hledger balance cur:\\$'---File: hledger.info, Node: Even more escaping, Next: Less escaping, Prev: More escaping, Up: Special characters in arguments and queries--2.5.2 Even more escaping---------------------------When hledger runs an addon executable (eg you type 'hledger ui', hledger-runs 'hledger-ui'), it de-escapes command-line options and arguments-once, so you might need to _triple_-escape. Eg in bash, running the ui-command and matching the dollar sign, it's:-- 'hledger ui cur:'\\$''-- or:-- 'hledger ui cur:\\\\$'-- If you asked why _four_ slashes above, this may help:--unescaped: '$'-escaped: '\$'-double-escaped: '\\$'-triple-escaped: '\\\\$'-- (The number of backslashes in fish shell is left as an exercise for-the reader.)-- You can always avoid the extra escaping for addons by running the-addon directly:-- 'hledger-ui cur:\\$'---File: hledger.info, Node: Less escaping, Prev: Even more escaping, Up: Special characters in arguments and queries--2.5.3 Less escaping----------------------Inside an argument file, or in the search field of hledger-ui or-hledger-web, or at a GHCI prompt, you need one less level of escaping-than at the command line. And backslashes may work better than quotes.-Eg:-- 'ghci> :main balance cur:\$'---File: hledger.info, Node: Command line tips, Next: Unicode characters, Prev: Special characters in arguments and queries, Up: OPTIONS--2.6 Command line tips-=====================--If in doubt, keep things simple:-- * write options after the command ('hledger CMD -OPTIONS ARGS')- * run add-on executables directly ('hledger-ui -OPTIONS ARGS')- * enclose problematic args in single quotes- * if needed, also add a backslash to escape regexp metacharacters-- To find out exactly how a command line is being parsed, add-'--debug=2' to troubleshoot.---File: hledger.info, Node: Unicode characters, Next: Input files, Prev: Command line tips, Up: OPTIONS--2.7 Unicode characters-======================--hledger is expected to handle unicode (non-ascii) characters, but this-requires a well-configured environment.-- To handle unicode characters in the command line or input data, a-system locale that can decode them must be configured (POSIX's default-'C' locale will not work). Eg in bash, you could do:--export LANG=en_US.UTF-8-- See Troubleshooting for more about this.-- Unicode characters should appear correctly in hledger's output. For-the hledger and hledger-ui tools, this requires that-- * your terminal supports unicode- * the terminal's font includes the required unicode glyphs- * the terminal is configured to display "wide" characters as double- width (otherwise report alignment will be off)---File: hledger.info, Node: Input files, Next: Smart dates, Prev: Unicode characters, Up: OPTIONS--2.8 Input files-===============--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:--$ setenv LEDGER_FILE ~/finance/2016.journal-$ hledger stats-- or with the '-f/--file' option:--$ hledger -f /some/file stats-- The file name '-' (hyphen) means standard input:--$ cat some.journal | hledger -f--- Usually the data file is in hledger's journal format, but it can also-be one of several other formats, listed below. hledger detects the-format automatically based on the file extension, or if that is not-recognised, by trying each built-in "reader" in turn:--Reader: Reads: Used for file extensions:------------------------------------------------------------------------------'journal' hledger's journal format, also '.journal' '.j'- some Ledger journals '.hledger' '.ledger'-'timeclock' timeclock files (precise time '.timeclock'- logging)-'timedot' timedot files (approximate time '.timedot'- logging)-'csv' comma-separated values (data '.csv'- interchange)-- 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:--$ hledger -f csv:/some/csv-file.dat stats-$ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:--- You can also specify multiple '-f' options, to read multiple files as-one big journal. There are some limitations with this:-- * directives in one file will not affect the other files- * balance assertions will not see any account balances from previous- files-- If you need those, either use the include directive, or concatenate-the files, eg: 'cat a.journal b.journal | hledger -f- CMD'.---File: hledger.info, Node: Smart dates, Next: Report start & end date, Prev: Input files, Up: OPTIONS--2.9 Smart dates-===============--hledger's user interfaces accept a flexible "smart date" syntax (unlike-dates in the journal file). Smart dates allow some english words, can-be relative to today's date, and can have less-significant date parts-omitted (defaulting to 1).-- Examples:--'2004/10/1', '2004-01-01', '2004.9.1' exact date, several separators allowed. Year is 4+ digits, month is 1-12, day is 1-31-'2004' start of year-'2004/10' start of month-'10/1' month and day in current year-'21' day in current month-'october, oct' start of month in current year-'yesterday, today, tomorrow' -1, 0, 1 days from today-'last/this/next -1, 0, 1 periods from the current period-day/week/month/quarter/year'-'20181201' 8 digit YYYYMMDD with valid year month and day-'201812' 6 digit YYYYMM with valid year and month-- Counterexamples - malformed digit sequences might give surprising-results:--'201813' 6 digits with an invalid month is parsed as start of 6-digit year-'20181301' 8 digits with an invalid month is parsed as start of 8-digit year-'20181232' 8 digits with an invalid day gives an error-'201801012' 9+ digits beginning with a valid YYYYMMDD gives an error---File: hledger.info, Node: Report start & end date, Next: Report intervals, Prev: Smart dates, Up: OPTIONS--2.10 Report start & end date-============================--Most hledger reports show the full span of time represented by the-journal data, by default. So, the effective report start and end dates-will be the earliest and latest transaction or posting dates found in-the journal.-- Often you will want to see a shorter time span, such as the current-month. You can specify a start and/or end date using '-b/--begin',-'-e/--end', '-p/--period' or a 'date:' query (described below). All of-these accept the smart date syntax. One important thing to be aware of-when specifying end dates: as in Ledger, end dates are exclusive, so you-need to write the date _after_ the last day you want to include.-- Examples:--'-b 2016/3/17' begin on St. Patrick's day 2016-'-e 12/1' end at the start of december 1st of the current year (11/30 will be the last date included)-'-b thismonth' all transactions on or after the 1st of the current month-'-p thismonth' all transactions in the current month-'date:2016/3/17-' the above written as queries instead-'date:-12/1'-'date:thismonth-'-'date:thismonth'---File: hledger.info, Node: Report intervals, Next: Period expressions, Prev: Report start & end date, Up: OPTIONS--2.11 Report intervals-=====================--A report interval can be specified so that commands like register,-balance and activity will divide their reports into multiple subperiods.-The basic intervals can be selected with one of '-D/--daily',-'-W/--weekly', '-M/--monthly', '-Q/--quarterly', or '-Y/--yearly'. More-complex intervals may be specified with a period expression. Report-intervals can not be specified with a query, currently.---File: hledger.info, Node: Period expressions, Next: Depth limiting, Prev: Report intervals, Up: OPTIONS--2.12 Period expressions-=======================--The '-p/--period' option accepts period expressions, a shorthand way of-expressing a start date, end date, and/or report interval all at once.-- Here's a basic period expression specifying the first quarter of-2009. Note, hledger always treats start dates as inclusive and end-dates as exclusive:-- '-p "from 2009/1/1 to 2009/4/1"'-- Keywords like "from" and "to" are optional, and so are the spaces, as-long as you don't run two dates together. "to" can also be written as-"-". These are equivalent to the above:--'-p "2009/1/1 2009/4/1"'-'-p2009/1/1to2009/4/1'-'-p2009/1/1-2009/4/1'-- Dates are smart dates, so if the current year is 2009, the above can-also be written as:--'-p "1/1 4/1"'-'-p "january-apr"'-'-p "this year to 4/1"'-- If you specify only one date, the missing start or end date will be-the earliest or latest transaction in your journal:--'-p "from 2009/1/1"' everything after january 1, 2009-'-p "from 2009/1"' the same-'-p "from 2009"' the same-'-p "to 2009"' everything before january 1, 2009-- A single date with no "from" or "to" defines both the start and end-date like so:--'-p "2009"' the year 2009; equivalent to "2009/1/1 to 2010/1/1"-'-p "2009/1"' the month of jan; equivalent to "2009/1/1 to 2009/2/1"-'-p "2009/1/1"' just that day; equivalent to "2009/1/1 to 2009/1/2"-- The argument of '-p' can also begin with, or be, a report interval-expression. The basic report intervals are 'daily', 'weekly',-'monthly', 'quarterly', or 'yearly', which have the same effect as the-'-D','-W','-M','-Q', or '-Y' flags. Between report interval and-start/end dates (if any), the word 'in' is optional. Examples:--'-p "weekly from 2009/1/1 to 2009/4/1"'-'-p "monthly in 2008"'-'-p "quarterly"'-- Note that 'weekly', 'monthly', 'quarterly' and 'yearly' intervals-will always start on the first day on week, month, quarter or year-accordingly, and will end on the last day of same period, even if-associated period expression specifies different explicit start and end-date.-- For example:--'-p "weekly from 2009/1/1 to 2009/4/1"' - starts on 2008/12/29, closest preceeding Monday-'-p "monthly in 2008/11/25"' - starts on 2018/11/01-'-p "quarterly from 2009-05-05 to 2009-06-01"' - starts on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2 2009-'-p "yearly from 2009-12-29"' - starts on 2009/01/01, first day of 2009-- The following more complex report intervals are also supported:-'biweekly', 'bimonthly', 'every day|week|month|quarter|year', 'every N-days|weeks|months|quarters|years'.-- All of these will start on the first day of the requested period and-end on the last one, as described above.-- Examples:--'-p "bimonthly from 2008"' - periods will have boundaries on 2008/01/01, 2008/03/01, ...-'-p "every 2 weeks"' - starts on closest preceeding Monday-'-p "every 5 month from 2009/03"' - periods will have boundaries on 2009/03/01, 2009/08/01, ...-- If you want intervals that start on arbitrary day of your choosing-and span a week, month or year, you need to use any of the following:-- 'every Nth day of week', 'every <weekday>', 'every Nth day [of-month]', 'every Nth weekday [of month]', 'every MM/DD [of year]', 'every-Nth MMM [of year]', 'every MMM Nth [of year]'.-- Examples:--'-p "every 2nd day of week"' - periods will go from Tue to Tue-'-p "every Tue"' - same-'-p "every 15th day"' - period boundaries will be on 15th of each month-'-p "every 2nd Monday"' - period boundaries will be on second Monday of each month-'-p "every 11/05"' - yearly periods with boundaries on 5th of Nov-'-p "every 5th Nov"' - same-'-p "every Nov 5th"' - same-- Show historical balances at end of 15th each month (N is exclusive-end date):-- 'hledger balance -H -p "every 16th day"'-- Group postings from start of wednesday to end of next tuesday (N is-start date and exclusive end date):-- 'hledger register checking -p "every 3rd day of week"'---File: hledger.info, Node: Depth limiting, Next: Pivoting, Prev: Period expressions, Up: OPTIONS--2.13 Depth limiting-===================--With the '--depth N' option (short form: '-N'), commands like account,-balance and register will show only the uppermost accounts in the-account tree, down to level N. Use this when you want a summary with-less detail. This flag has the same effect as a 'depth:' query argument-(so '-2', '--depth=2' or 'depth:2' are basically equivalent).---File: hledger.info, Node: Pivoting, Next: Cost, Prev: Depth limiting, Up: OPTIONS--2.14 Pivoting-=============--Normally hledger sums amounts, and organizes them in a hierarchy, based-on account name. The '--pivot FIELD' option causes it to sum and-organize hierarchy based on the value of some other field instead.-FIELD can be: 'code', 'description', 'payee', 'note', or the full name-(case insensitive) of any tag. As with account names, values containing-'colon:separated:parts' will be displayed hierarchically in reports.-- '--pivot' is a general option affecting all reports; you can think of-hledger transforming the journal before any other processing, replacing-every posting's account name with the value of the specified field on-that posting, inheriting it from the transaction or using a blank value-if it's not present.-- An example:--2016/02/16 Member Fee Payment- assets:bank account 2 EUR- income:member fees -2 EUR ; member: John Doe-- Normal balance report showing account names:--$ hledger balance- 2 EUR assets:bank account- -2 EUR income:member fees---------------------- 0-- Pivoted balance report, using member: tag values instead:--$ hledger balance --pivot member- 2 EUR- -2 EUR John Doe---------------------- 0-- One way to show only amounts with a member: value (using a query,-described below):--$ hledger balance --pivot member tag:member=.- -2 EUR John Doe---------------------- -2 EUR-- Another way (the acct: query matches against the pivoted "account-name"):--$ hledger balance --pivot member acct:.- -2 EUR John Doe---------------------- -2 EUR---File: hledger.info, Node: Cost, Next: Market value, Prev: Pivoting, Up: OPTIONS--2.15 Cost-=========--The '-B/--cost' flag converts amounts to their cost at transaction time,-if they have a transaction price specified.---File: hledger.info, Node: Market value, Next: Combining -B and -V, Prev: Cost, Up: OPTIONS--2.16 Market value-=================--The '-V/--value' flag converts reported amounts to their current market-value.-Specifically, when there is a market price (P directive) for the-amount's commodity, dated on or before today's date (or the report end-date if specified), the amount will be converted to the price's-commodity.-- When there are multiple applicable P directives, -V chooses the most-recent one, or in case of equal dates, the last-parsed one.-- For example:--# one euro is worth this many dollars from nov 1-P 2016/11/01 € $1.10--# purchase some euros on nov 3-2016/11/3- assets:euros €100- assets:checking--# the euro is worth fewer dollars by dec 21-P 2016/12/21 € $1.03-- How many euros do I have ?--$ hledger -f t.j bal -N euros- €100 assets:euros-- What are they worth at end of nov 3 ?--$ 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)--$ hledger -f t.j bal -N euros -V- $103.00 assets:euros-- Currently, hledger's -V only uses market prices recorded with P-directives, not transaction prices (unlike Ledger).-- Currently, -V has a limitation in multicolumn balance reports: it-uses the market prices on the report end date for all columns. (Instead-of the prices on each column's end date.)---File: hledger.info, Node: Combining -B and -V, Next: Output destination, Prev: Market value, Up: OPTIONS--2.17 Combining -B and -V-========================--Using -B/-cost and -V/-value together is currently allowed, but the-results are probably not meaningful. Let us know if you find a use for-this.---File: hledger.info, Node: Output destination, Next: Output format, Prev: Combining -B and -V, Up: OPTIONS--2.18 Output destination-=======================--Some commands (print, register, stats, the balance commands) can write-their output to a destination other than the console. This is-controlled by the '-o/--output-file' option.--$ hledger balance -o - # write to stdout (the default)-$ hledger balance -o FILE # write to FILE---File: hledger.info, Node: Output format, Next: Regular expressions, Prev: Output destination, Up: OPTIONS--2.19 Output format-==================--Some commands can write their output in other formats. Eg print and-register can output CSV, and the balance commands can output CSV or-HTML. This is controlled by the '-O/--output-format' option, or by-specifying a '.csv' or '.html' file extension with '-o/--output-file'.--$ hledger balance -O csv # write CSV to stdout-$ hledger balance -o FILE.csv # write CSV to FILE.csv---File: hledger.info, Node: Regular expressions, Prev: Output format, Up: OPTIONS--2.20 Regular expressions-========================--hledger uses regular expressions in a number of places:-- * query terms, on the command line and in the hledger-web search- form: 'REGEX', 'desc:REGEX', 'cur:REGEX', 'tag:...=REGEX'- * CSV rules conditional blocks: 'if REGEX ...'- * account alias directives and options: 'alias /REGEX/ =- REPLACEMENT', '--alias /REGEX/=REPLACEMENT'-- hledger's regular expressions come from the regex-tdfa library. In-general they:-- * are case insensitive- * are infix matching (do not need to match the entire thing being- matched)- * are POSIX extended regular expressions- * also support GNU word boundaries (\<, \>, \b, \B)- * and parenthesised capturing groups and numeric backreferences in- replacement strings- * do not support mode modifiers like (?s)-- Some things to note:-- * In the 'alias' directive and '--alias' option, regular expressions- must be enclosed in forward slashes ('/REGEX/'). Elsewhere in- hledger, these are not required.-- * In queries, to match a regular expression metacharacter like '$' as- a literal character, prepend a backslash. Eg to search for amounts- with the dollar sign in hledger-web, write 'cur:\$'.-- * On the command line, some metacharacters like '$' have a special- meaning to the shell and so must be escaped at least once more.- See Special characters.---File: hledger.info, Node: QUERIES, Next: COMMANDS, Prev: OPTIONS, Up: Top--3 QUERIES-*********--One of hledger's strengths is being able to quickly report on precise-subsets of your data. Most commands accept an optional query-expression, written as arguments after the command name, to filter the-data by date, account name or other criteria. The syntax is similar to-a web search: one or more space-separated search terms, quotes to-enclose whitespace, prefixes to match specific fields, a not: prefix to-negate the match.-- We do not yet support arbitrary boolean combinations of search terms;-instead most commands show transactions/postings/accounts which match-(or negatively match):-- * any of the description terms AND- * any of the account terms AND- * any of the status terms AND- * all the other terms.-- The print command instead shows transactions which:-- * match any of the description terms AND- * have any postings matching any of the positive account terms AND- * have no postings matching any of the negative account terms AND- * match all the other terms.-- The following kinds of search terms can be used. Remember these can-also be prefixed with *'not:'*, eg to exclude a particular subaccount.--*'REGEX', 'acct:REGEX'*-- match account names by this regular expression. (With no prefix,- 'acct:' is assumed.) same as above--*'amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N'*-- match postings with a single-commodity amount that is equal to,- less than, or greater than N. (Multi-commodity amounts are not- tested, and will always match.) The comparison has two modes: if N- is preceded by a + or - sign (or is 0), the two signed numbers are- compared. Otherwise, the absolute magnitudes are compared,- ignoring sign.-*'code:REGEX'*-- match by transaction code (eg check number)-*'cur:REGEX'*-- match postings or transactions including any amounts whose- currency/commodity symbol is fully matched by REGEX. (For a partial- match, use '.*REGEX.*'). Note, to match characters which are- regex-significant, like the dollar sign ('$'), you need to prepend- '\'. And when using the command line you need to add one more- level of quoting to hide it from the shell, so eg do: 'hledger- print cur:'\$'' or 'hledger print cur:\\$'.-*'desc:REGEX'*-- match transaction descriptions.-*'date:PERIODEXPR'*-- match dates within the specified period. PERIODEXPR is a period- expression (with no report interval). Examples: 'date:2016',- 'date:thismonth', 'date:2000/2/1-2/15', 'date:lastweek-'. If the- '--date2' command line flag is present, this matches secondary- dates instead.-*'date2:PERIODEXPR'*-- match secondary dates within the specified period.-*'depth:N'*-- match (or display, depending on command) accounts at or above this- depth-*'note:REGEX'*-- match transaction notes (part of description right of '|', or whole- description when there's no '|')-*'payee:REGEX'*-- match transaction payee/payer names (part of description left of- '|', or whole description when there's no '|')-*'real:, real:0'*-- match real or virtual postings respectively-*'status:, status:!, status:*'*-- match unmarked, pending, or cleared transactions respectively-*'tag:REGEX[=REGEX]'*-- match by tag name, and optionally also by tag value. Note a tag:- query is considered to match a transaction if it matches any of the- postings. Also remember that postings inherit the tags of their- parent transaction.-- The following special search term is used automatically in-hledger-web, only:--*'inacct:ACCTNAME'*-- tells hledger-web to show the transaction register for this- account. Can be filtered further with 'acct' etc.-- Some of these can also be expressed as command-line options (eg-'depth:2' is equivalent to '--depth 2'). Generally you can mix options-and query arguments, and the resulting query will be their intersection-(perhaps excluding the '-p/--period' option).---File: hledger.info, Node: COMMANDS, Next: ADD-ON COMMANDS, Prev: QUERIES, Up: Top--4 COMMANDS-**********--hledger provides a number of subcommands; 'hledger' with no arguments-shows a list.-- If you install additional 'hledger-*' packages, or if you put-programs or scripts named 'hledger-NAME' in your PATH, these will also-be listed as subcommands.-- Run a subcommand by writing its name as first argument (eg 'hledger-incomestatement'). You can also write one of the standard short aliases-displayed in parentheses in the command list ('hledger b'), or any any-unambiguous prefix of a command name ('hledger inc').-- Here are all the builtin commands in alphabetical order. See also-'hledger' for a more organised command list, and 'hledger CMD -h' for-detailed command help.-* Menu:--* accounts::-* activity::-* add::-* balance::-* balancesheet::-* balancesheetequity::-* cashflow::-* check-dates::-* check-dupes::-* close::-* files::-* help::-* import::-* incomestatement::-* prices::-* print::-* print-unique::-* register::-* register-match::-* rewrite::-* roi::-* stats::-* tags::-* test::---File: hledger.info, Node: accounts, Next: activity, Up: COMMANDS--4.1 accounts-============--accounts, a-Show account names.-- This command lists account names, either declared with account-directives (-declared), posted to (-used), or both (the default). With-query arguments, only matched account names and account names referenced-by matched postings are shown. It shows a flat list by default. With-'--tree', it uses indentation to show the account hierarchy. In flat-mode you can add '--drop N' to omit the first few account name-components. Account names can be depth-clipped with 'depth:N' or-'--depth N' or '-N'.-- Examples:--$ hledger accounts-assets:bank:checking-assets:bank:saving-assets:cash-expenses:food-expenses:supplies-income:gifts-income:salary-liabilities:debts---File: hledger.info, Node: activity, Next: add, Prev: accounts, Up: COMMANDS--4.2 activity-============--activity-Show an ascii barchart of posting counts per interval.-- The activity command displays an ascii histogram showing transaction-counts by day, week, month or other reporting interval (by day is the-default). With query arguments, it counts only matched transactions.-- Examples:--$ hledger activity --quarterly-2008-01-01 **-2008-04-01 *******-2008-07-01 -2008-10-01 **---File: hledger.info, Node: add, Next: balance, Prev: activity, Up: COMMANDS--4.3 add-=======--add-Prompt for transactions and add them to the journal.-- Many hledger users edit their journals directly with a text editor,-or generate them from CSV. For more interactive data entry, there is the-'add' command, which prompts interactively on the console for new-transactions, and appends them to the journal file (if there are-multiple '-f FILE' options, the first file is used.) Existing-transactions are not changed. This is the only hledger command that-writes to the journal file.-- To use it, just run 'hledger add' and follow the prompts. You can-add as many transactions as you like; when you are finished, enter '.'-or press control-d or control-c to exit.-- Features:-- * add tries to provide useful defaults, using the most similar (by- description) recent transaction (filtered by the query, if any) as- a template.- * You can also set the initial defaults with command line arguments.- * Readline-style edit keys can be used during data entry.- * The tab key will auto-complete whenever possible - accounts,- descriptions, dates ('yesterday', 'today', 'tomorrow'). If the- input area is empty, it will insert the default value.- * If the journal defines a default commodity, it will be added to any- bare numbers entered.- * A parenthesised transaction code may be entered following a date.- * Comments and tags may be entered following a description or amount.- * If you make a mistake, enter '<' at any prompt to restart the- transaction.- * Input prompts are displayed in a different colour when the terminal- supports it.-- Example (see the tutorial for a detailed explanation):--$ hledger add-Adding transactions to journal file /src/hledger/examples/sample.journal-Any command line arguments will be used as defaults.-Use tab key to complete, readline keys to edit, enter to accept defaults.-An optional (CODE) may follow transaction dates.-An optional ; COMMENT may follow descriptions or amounts.-If you make a mistake, enter < at any prompt to restart the transaction.-To end a transaction, enter . when prompted.-To quit, enter . at a date prompt or press control-d or control-c.-Date [2015/05/22]: -Description: supermarket-Account 1: expenses:food-Amount 1: $10-Account 2: assets:checking-Amount 2 [$-10.0]: -Account 3 (or . or enter to finish this transaction): .-2015/05/22 supermarket- expenses:food $10- assets:checking $-10.0--Save this transaction to the journal ? [y]: -Saved.-Starting the next transaction (. or ctrl-D/ctrl-C to quit)-Date [2015/05/22]: <CTRL-D> $---File: hledger.info, Node: balance, Next: balancesheet, Prev: add, Up: COMMANDS--4.4 balance-===========--balance, bal, b-Show accounts and their balances.-- The balance command is hledger's most versatile command. Note,-despite the name, it is not always used for showing real-world account-balances; the more accounting-aware balancesheet and incomestatement may-be more convenient for that.-- By default, it displays all accounts, and each account's change in-balance during the entire period of the journal. Balance changes are-calculated by adding up the postings in each account. You can limit the-postings matched, by a query, to see fewer accounts, changes over a-different time period, changes from only cleared transactions, etc.-- If you include an account's complete history of postings in the-report, the balance change is equivalent to the account's current ending-balance. For a real-world account, typically you won't have all-transactions in the journal; instead you'll have all transactions after-a certain date, and an "opening balances" transaction setting the-correct starting balance on that date. Then the balance command will-show real-world account balances. In some cases the -H/-historical flag-is used to ensure this (more below).-- The balance command can produce several styles of report:-* Menu:--* Classic balance report::-* Customising the classic balance report::-* Colour support::-* Flat mode::-* Depth limited balance reports::-* Multicolumn balance report::-* Budget report::-* Output format::---File: hledger.info, Node: Classic balance report, Next: Customising the classic balance report, Up: balance--4.4.1 Classic balance report-------------------------------This is the original balance report, as found in Ledger. It usually-looks like this:--$ hledger balance- $-1 assets- $1 bank:saving- $-2 cash- $2 expenses- $1 food- $1 supplies- $-2 income- $-1 gifts- $-1 salary- $1 liabilities:debts---------------------- 0-- By default, accounts are displayed hierarchically, with subaccounts-indented below their parent. At each level of the tree, accounts are-sorted by account code if any, then by account name. Or with-'-S/--sort-amount', by their balance amount.-- "Boring" accounts, which contain a single interesting subaccount and-no balance of their own, are elided into the following line for more-compact output. (Eg above, the "liabilities" account.) Use-'--no-elide' to prevent this.-- Account balances are "inclusive" - they include the balances of any-subaccounts.-- Accounts which have zero balance (and no non-zero subaccounts) are-omitted. Use '-E/--empty' to show them.-- A final total is displayed by default; use '-N/--no-total' to-suppress it, eg:--$ hledger balance -p 2008/6 expenses --no-total- $2 expenses- $1 food- $1 supplies---File: hledger.info, Node: Customising the classic balance report, Next: Colour support, Prev: Classic balance report, Up: balance--4.4.2 Customising the classic balance report-----------------------------------------------You can customise the layout of classic balance reports with '--format-FMT':--$ hledger balance --format "%20(account) %12(total)"- assets $-1- bank:saving $1- cash $-2- expenses $2- food $1- supplies $1- income $-2- gifts $-1- salary $-1- liabilities:debts $1----------------------------------- 0-- The FMT format string (plus a newline) specifies the formatting-applied to each account/balance pair. It may contain any suitable text,-with data fields interpolated like so:-- '%[MIN][.MAX](FIELDNAME)'-- * MIN pads with spaces to at least this width (optional)- * MAX truncates at this width (optional)- * FIELDNAME must be enclosed in parentheses, and can be one of:-- * 'depth_spacer' - a number of spaces equal to the account's- depth, or if MIN is specified, MIN * depth spaces.- * 'account' - the account's name- * 'total' - the account's balance/posted total, right justified-- Also, FMT can begin with an optional prefix to control how-multi-commodity amounts are rendered:-- * '%_' - render on multiple lines, bottom-aligned (the default)- * '%^' - render on multiple lines, top-aligned- * '%,' - render on one line, comma-separated-- There are some quirks. Eg in one-line mode, '%(depth_spacer)' has no-effect, instead '%(account)' has indentation built in. Experimentation-may be needed to get pleasing results.-- Some example formats:-- * '%(total)' - the account's total- * '%-20.20(account)' - the account's name, left justified, padded to- 20 characters and clipped at 20 characters- * '%,%-50(account) %25(total)' - account name padded to 50- characters, total padded to 20 characters, with multiple- commodities rendered on one line- * '%20(total) %2(depth_spacer)%-(account)' - the default format for- the single-column balance report---File: hledger.info, Node: Colour support, Next: Flat mode, Prev: Customising the classic balance report, Up: balance--4.4.3 Colour support-----------------------The balance command shows negative amounts in red, if:-- * the 'TERM' environment variable is not set to 'dumb'- * the output is not being redirected or piped anywhere---File: hledger.info, Node: Flat mode, Next: Depth limited balance reports, Prev: Colour support, Up: balance--4.4.4 Flat mode------------------To see a flat list instead of the default hierarchical display, use-'--flat'. In this mode, accounts (unless depth-clipped) show their full-names and "exclusive" balance, excluding any subaccount balances. In-this mode, you can also use '--drop N' to omit the first few account-name components.--$ hledger balance -p 2008/6 expenses -N --flat --drop 1- $1 food- $1 supplies---File: hledger.info, Node: Depth limited balance reports, Next: Multicolumn balance report, Prev: Flat mode, Up: balance--4.4.5 Depth limited balance reports--------------------------------------With '--depth N' or 'depth:N' or just '-N', balance reports show-accounts only to the specified numeric depth. This is very useful to-summarise a complex set of accounts and get an overview.--$ hledger balance -N -1- $-1 assets- $2 expenses- $-2 income- $1 liabilities-- Flat-mode balance reports, which normally show exclusive balances,-show inclusive balances at the depth limit.---File: hledger.info, Node: Multicolumn balance report, Next: Budget report, Prev: Depth limited balance reports, Up: balance--4.4.6 Multicolumn balance report-----------------------------------Multicolumn or tabular balance reports are a very useful hledger-feature, and usually the preferred style. They share many of the above-features, but they show the report as a table, with columns representing-time periods. This mode is activated by providing a reporting interval.-- There are three types of multicolumn balance report, showing-different information:-- 1. By default: each column shows the sum of postings in that period,- ie the account's change of balance in that period. This is useful- eg for a monthly income statement:-- $ hledger balance --quarterly income expenses -E- Balance changes in 2008:- - || 2008q1 2008q2 2008q3 2008q4 - ===================++=================================- expenses:food || 0 $1 0 0 - expenses:supplies || 0 $1 0 0 - income:gifts || 0 $-1 0 0 - income:salary || $-1 0 0 0 - -------------------++---------------------------------- || $-1 $1 0 0 -- 2. With '--cumulative': each column shows the ending balance for that- period, accumulating the changes across periods, starting from 0 at- the report start date:-- $ hledger balance --quarterly income expenses -E --cumulative- Ending balances (cumulative) in 2008:- - || 2008/03/31 2008/06/30 2008/09/30 2008/12/31 - ===================++=================================================- expenses:food || 0 $1 $1 $1 - expenses:supplies || 0 $1 $1 $1 - income:gifts || 0 $-1 $-1 $-1 - income:salary || $-1 $-1 $-1 $-1 - -------------------++-------------------------------------------------- || $-1 0 0 0 -- 3. With '--historical/-H': each column shows the actual historical- ending balance for that period, accumulating the changes across- periods, starting from the actual balance at the report start date.- This is useful eg for a multi-period balance sheet, and when you- are showing only the data after a certain start date:-- $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1- Ending balances (historical) in 2008/04/01-2008/12/31:- - || 2008/06/30 2008/09/30 2008/12/31 - ======================++=====================================- assets:bank:checking || $1 $1 0 - assets:bank:saving || $1 $1 $1 - assets:cash || $-2 $-2 $-2 - liabilities:debts || 0 0 $1 - ----------------------++-------------------------------------- || 0 0 0 -- Multicolumn balance reports display accounts in flat mode by default;-to see the hierarchy, use '--tree'.-- With a reporting interval (like '--quarterly' above), the report-start/end dates will be adjusted if necessary so that they encompass the-displayed report periods. This is so that the first and last periods-will be "full" and comparable to the others.-- The '-E/--empty' flag does two things in multicolumn balance reports:-first, the report will show all columns within the specified report-period (without -E, leading and trailing columns with all zeroes are not-shown). Second, all accounts which existed at the report start date-will be considered, not just the ones with activity during the report-period (use -E to include low-activity accounts which would otherwise-would be omitted).-- The '-T/--row-total' flag adds an additional column showing the total-for each row.-- The '-A/--average' flag adds a column showing the average value in-each row.-- Here's an example of all three:--$ hledger balance -Q income expenses --tree -ETA-Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4 Total Average -============++===================================================- expenses || 0 $2 0 0 $2 $1 - food || 0 $1 0 0 $1 0 - supplies || 0 $1 0 0 $1 0 - income || $-1 $-1 0 0 $-2 $-1 - gifts || 0 $-1 0 0 $-1 0 - salary || $-1 0 0 0 $-1 0 -------------++---------------------------------------------------- || $-1 $1 0 0 0 0 --# Average is rounded to the dollar here since all journal amounts are-- Limitations:-- In multicolumn reports the '-V/--value' flag uses the market price on-the report end date, for all columns (not the price on each column's end-date).-- Eliding of boring parent accounts in tree mode, as in the classic-balance report, is not yet supported in multicolumn reports.---File: hledger.info, Node: Budget report, Next: , Prev: Multicolumn balance report, Up: balance--4.4.7 Budget report----------------------With '--budget', extra columns are displayed showing budget goals for-each account and period, if any. Budget goals are defined by periodic-transactions. This is very useful for comparing planned and actual-income, expenses, time usage, etc. -budget is most often combined with-a report interval.-- For example, you can take average monthly expenses in the common-expense categories to construct a minimal monthly budget:--;; Budget-~ monthly- income $2000- expenses:food $400- expenses:bus $50- expenses:movies $30- assets:bank:checking--;; Two months worth of expenses-2017-11-01- income $1950- expenses:food $396- expenses:bus $49- expenses:movies $30- expenses:supplies $20- assets:bank:checking--2017-12-01- income $2100- expenses:food $412- expenses:bus $53- expenses:gifts $100- assets:bank:checking-- You can now see a monthly budget report:--$ hledger balance -M --budget-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] -- Note this is different from a normal balance report in several ways:-- * Only accounts with budget goals during the report period are shown,- by default.-- * In each column, in square brackets after the actual amount,- budgeted amounts are shown, along with the percentage of budget- used.-- * All parent accounts are always shown, even in flat mode. Eg- assets, assets:bank, and expenses above.-- * Amounts always include all subaccounts, budgeted or unbudgeted,- even in flat mode.-- This means that the numbers displayed will not always add up! Eg-above, the 'expenses' actual amount includes the gifts and supplies-transactions, but the 'expenses:gifts' and 'expenses:supplies' accounts-are not 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:--$ hledger balance -M --budget --empty-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:gifts || 0 $100 - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - expenses:supplies || $20 0 - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] -- You can roll over unspent budgets to next period with '--cumulative':--$ hledger balance -M --budget --cumulative-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - expenses || $495 [ 103% of $480] $1060 [ 110% of $960] - expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100] - expenses:food || $396 [ 99% of $400] $808 [ 101% of $800] - expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60] - income || $1950 [ 98% of $2000] $4050 [ 101% of $4000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] -- For more examples, see Budgeting and Forecasting.-* Menu:--* Nested budgets::---File: hledger.info, Node: Nested budgets, Up: Budget report--4.4.7.1 Nested budgets-......................--You can add budgets to any account in your account hierarchy. If you-have budgets on both parent account and some of its children, then-budget(s) of the child account(s) would be added to the budget of their-parent, much like account balances behave.-- In the most simple case this means that once you add a budget to any-account, all its parents would have budget as well.-- To illustrate this, consider the following budget:--~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities-- With this, monthly budget for electronics is defined to be $100 and-budget for personal expenses is an additional $1000, which implicity-means that budget for both 'expenses:personal' and 'expenses' is $1100.-- Transactions in 'expenses:personal:electronics' will be counted both-towards its $100 budget and $1100 of 'expenses:personal' , and-transactions in any other subaccount of 'expenses:personal' would be-counted towards only towards the budget of 'expenses:personal'.-- For example, let's consider these transactions:--~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities--2019/01/01 Google home hub- expenses:personal:electronics $90.00- liabilities $-90.00--2019/01/02 Phone screen protector- expenses:personal:electronics:upgrades $10.00- liabilities--2019/01/02 Weekly train ticket- expenses:personal:train tickets $153.00- liabilities--2019/01/03 Flowers- expenses:personal $30.00- liabilities-- 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:--$ hledger balance --budget -M-Budget performance in 2019/01:-- || Jan -===============================++===============================- expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - liabilities || $-283.00 [ 26% of $-1100.00] --------------------------------++-------------------------------- || 0 [ 0] -- And with '--empty', we can get a better picture of budget allocation-and consumption:--$ hledger balance --budget -M --empty-Budget performance in 2019/01:-- || Jan -========================================++===============================- expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - expenses:personal:electronics:upgrades || $10.00 - expenses:personal:train tickets || $153.00 - liabilities || $-283.00 [ 26% of $-1100.00] -----------------------------------------++-------------------------------- || 0 [ 0] --4.4.8 Output format----------------------The balance command supports output destination and output format-selection.---File: hledger.info, Node: balancesheet, Next: balancesheetequity, Prev: balance, Up: COMMANDS--4.5 balancesheet-================--balancesheet, bs-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date). It assumes that these accounts are under a top-level 'asset' or-'liability' account (case insensitive, plural forms also allowed).-- Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-- Example:--$ hledger balancesheet-Balance Sheet--Assets:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1--Liabilities:- $1 liabilities:debts---------------------- $1--Total:---------------------- 0-- With a reporting interval, multiple columns will be shown, one for-each report period. As with multicolumn balance reports, you can alter-the report mode with '--change'/'--cumulative'/'--historical'. Normally-balancesheet shows historical ending balances, which is what you need-for a balance sheet; note this means it ignores report begin dates.-- This command also supports output destination and output format-selection.---File: hledger.info, Node: balancesheetequity, Next: cashflow, Prev: balancesheet, Up: COMMANDS--4.6 balancesheetequity-======================--balancesheetequity, bse-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level 'equity' account).-- Example:--$ hledger balancesheetequity-Balance Sheet With Equity--Assets:- $-2 assets- $1 bank:saving- $-3 cash---------------------- $-2--Liabilities:- $1 liabilities:debts---------------------- $1--Equity:- $1 equity:owner---------------------- $1--Total:---------------------- 0---File: hledger.info, Node: cashflow, Next: check-dates, Prev: balancesheetequity, Up: COMMANDS--4.7 cashflow-============--cashflow, cf-This command displays a simple cashflow statement, showing changes in-"cash" accounts. It assumes that these accounts are under a top-level-'asset' account (case insensitive, plural forms also allowed) and do not-contain 'receivable' or 'A/R' in their name. Note this report shows all-account balances with normal positive sign (like conventional financial-statements, unlike balance/print/register) (experimental).-- Example:--$ hledger cashflow-Cashflow Statement--Cash flows:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1--Total:---------------------- $-1-- With a reporting interval, multiple columns will be shown, one for-each report period. Normally cashflow shows changes in assets per-period, though as with multicolumn balance reports you can alter the-report mode with '--change'/'--cumulative'/'--historical'.-- This command also supports output destination and output format-selection.---File: hledger.info, Node: check-dates, Next: check-dupes, Prev: cashflow, Up: COMMANDS--4.8 check-dates-===============--check-dates-Check that transactions are sorted by increasing date. With -date2,-checks secondary dates instead. With -strict, dates must also be-unique. With a query, only matched transactions' dates are checked.-Reads the default journal file, or another specified with -f.---File: hledger.info, Node: check-dupes, Next: close, Prev: check-dates, Up: COMMANDS--4.9 check-dupes-===============--check-dupes-Reports account names having the same leaf but different prefixes. In-other words, two or more leaves that are categorized differently. Reads-the default journal file, or another specified as an argument.-- An example: http://stefanorodighiero.net/software/hledger-dupes.html---File: hledger.info, Node: close, Next: files, Prev: check-dupes, Up: COMMANDS--4.10 close-==========--close, equity-Prints a "closing balances" transaction and an "opening balances"-transaction that bring account balances to and from zero, respectively.-Useful for bringing asset/liability balances forward into a new journal-file, or for closing out revenues/expenses to retained earnings at the-end of a period.-- The closing transaction transfers balances to "equity:closing-balances". The opening transaction transfers balances from-"equity:opening balances". You can chose to print just one of the-transactions by using the '--opening' or '--closing' flag.-- If you split your journal files by time (eg yearly), you will-typically run this command at the end of the year, and save the closing-transaction as last entry of the old file, and the opening transaction-as the first entry of the new file. This makes the files self-contained, so that correct balances are reported no matter which of them-are loaded. Ie, if you load just one file, the balances are initialised-correctly; or if you load several files, the redundant closing/opening-transactions cancel each other out. (They will show up in print or-register reports; you can exclude them with a query like-'not:desc:'(opening|closing) balances''.)-- If you're running a business, you might also use this command to-"close the books" at the end of an accounting period, transferring-income statement account balances to retained earnings. (You may want-to change the equity account name to something like "equity:retained-earnings".)-- By default, the closing transaction is dated yesterday, the balances-are calculated as of end of yesterday, and the opening transaction is-dated today. To close on some other date, use: 'hledger close -e-OPENINGDATE'. Eg, to close/open on the 2018/2019 boundary, use '-e-2019'. You can also use -p or 'date:PERIOD' (any starting date is-ignored).-- Both transactions will include balance assertions for the-closed/reopened accounts. You probably shouldn't use status or realness-filters (like -C or -R or 'status:') with this command, or the generated-balance assertions will depend on these flags. Likewise, if you run-this command with -auto, the balance assertions will probably always-require -auto.-- Examples:-- Carrying asset/liability balances into a new file for 2019, all from-command line:-- _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-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal-- Now:--$ 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:--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:--; in 2018.journal:-2018/12/30 a purchase made in 2018, clearing the following year- expenses:food 5- liabilities:pending--; in 2019.journal:-2019/1/2 clearance of last year's pending transactions- liabilities:pending 5 = 0- assets:checking---File: hledger.info, Node: files, Next: help, Prev: close, Up: COMMANDS--4.11 files-==========--files-List all files included in the journal. With a REGEX argument, only-file names matching the regular expression (case sensitive) are shown.---File: hledger.info, Node: help, Next: import, Prev: files, Up: COMMANDS--4.12 help-=========--help-Show any of the hledger manuals.-- The 'help' command displays any of the main hledger manuals, in one-of several ways. Run it with no argument to list the manuals, or-provide a full or partial manual name to select one.-- hledger manuals are available in several formats. hledger help will-use the first of these display methods that it finds: info, man, $PAGER,-less, stdout (or when non-interactive, just stdout). You can force a-particular viewer with the '--info', '--man', '--pager', '--cat' flags.-- Examples:--$ hledger help-Please choose a manual by typing "hledger help MANUAL" (a substring is ok).-Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot--$ hledger help h --man--hledger(1) hledger User Manuals hledger(1)--NAME- hledger - a command-line accounting tool--SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [ARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]- hledger--DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any-...---File: hledger.info, Node: import, Next: incomestatement, Prev: help, Up: COMMANDS--4.13 import-===========--import-Read new transactions added to each FILE since last run, and add them to-the main journal file. Or with -dry-run, just print the transactions-that would be added.-- The input files are specified as arguments - no need to write -f-before each one. So eg to add new transactions from all CSV files to-the main journal, it's just: 'hledger import *.csv'-- New transactions are detected in the same way as print -new: by-assuming transactions are always added to the input files in increasing-date order, and by saving '.latest.FILE' state files.-- The -dry-run output is in journal format, so you can filter it, eg to-see only uncategorised transactions:--$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions---File: hledger.info, Node: incomestatement, Next: prices, Prev: import, Up: COMMANDS--4.14 incomestatement-====================--incomestatement, is-This command displays a simple income statement, showing revenues and-expenses during a period. It assumes that these accounts are under a-top-level 'revenue' or 'income' or 'expense' account (case insensitive,-plural forms also allowed). Note this report shows all account balances-with normal positive sign (like conventional financial statements,-unlike balance/print/register) (experimental).-- This command displays a simple income statement. It currently-assumes that you have top-level accounts named 'income' (or 'revenue')-and 'expense' (plural forms also allowed.)--$ hledger incomestatement-Income Statement--Revenues:- $-2 income- $-1 gifts- $-1 salary---------------------- $-2--Expenses:- $2 expenses- $1 food- $1 supplies---------------------- $2--Total:---------------------- 0-- With a reporting interval, multiple columns will be shown, one for-each report period. Normally incomestatement shows revenues/expenses-per period, though as with multicolumn balance reports you can alter the-report mode with '--change'/'--cumulative'/'--historical'.-- This command also supports output destination and output format-selection.---File: hledger.info, Node: prices, Next: print, Prev: incomestatement, Up: COMMANDS--4.15 prices-===========--prices-Print market price directives from the journal. With -costs, also print-synthetic market prices based on transaction prices. With--inverted-costs, also print inverse prices based on transaction prices.-Prices (and postings providing prices) can be filtered by a query.---File: hledger.info, Node: print, Next: print-unique, Prev: prices, Up: COMMANDS--4.16 print-==========--print, txns, p-Show transaction journal entries, sorted by date.-- The print command displays full journal entries (transactions) from-the journal file in date order, tidily formatted. With -date2,-transactions are sorted by secondary date instead.-- print's output is always a valid hledger journal.-It preserves all transaction information, but it does not preserve-directives or inter-transaction comments--$ hledger print-2008/01/01 income- assets:bank:checking $1- income:salary $-1--2008/06/01 gift- assets:bank:checking $1- income:gifts $-1--2008/06/02 save- assets:bank:saving $1- assets:bank:checking $-1--2008/06/03 * eat & shop- expenses:food $1- expenses:supplies $1- assets:cash $-2--2008/12/31 * pay off- liabilities:debts $1- assets:bank:checking $-1-- Normally, the journal entry's explicit or implicit amount style is-preserved. Ie when an amount is omitted in the journal, it will be-omitted in the output. You can use the '-x'/'--explicit' flag to make-all amounts explicit, which can be useful for troubleshooting or for-making your journal more readable and robust against data entry errors.-Note, '-x' will cause postings with a multi-commodity amount (these can-arise when a multi-commodity transaction has an implicit amount) will be-split into multiple single-commodity postings, for valid journal output.-- With '-B'/'--cost', amounts with transaction prices are converted to-cost using that price. This can be used for troubleshooting.-- With '-m'/'--match' and a STR argument, print will show at most one-transaction: the one one whose description is most similar to STR, and-is most recent. STR should contain at least two characters. If there-is no similar-enough match, no transaction will be shown.-- With '--new', for each FILE being read, hledger reads (and writes) a-special state file ('.latest.FILE' in the same directory), containing-the latest transaction date(s) that were seen last time FILE was read.-When this file is found, only transactions 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:--$ hledger -f bank1.csv print --new-# shows transactions added since last print --new on this file-- This assumes that transactions added to FILE always have same or-increasing dates, and that transactions on the same day do not get-reordered. See also the import command.-- This command also supports output destination and output format-selection. Here's an example of print's CSV output:--$ hledger print -Ocsv-"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"-"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""-"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""-"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""-"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""-"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""-"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""-"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""-"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""-"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""-"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""-"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""-- * There is one CSV record per posting, with the parent transaction's- fields repeated.- * The "txnidx" (transaction index) field shows which postings belong- to the same transaction. (This number might change if transactions- are reordered within the file, files are parsed/included in a- different order, etc.)- * The amount is separated into "commodity" (the symbol) and "amount"- (numeric quantity) fields.- * The numeric amount is repeated in either the "credit" or "debit"- column, for convenience. (Those names are not accurate in the- accounting sense; it just puts negative amounts under credit and- zero or greater amounts under debit.)---File: hledger.info, Node: print-unique, Next: register, Prev: print, Up: COMMANDS--4.17 print-unique-=================--print-unique-Print transactions which do not reuse an already-seen description.-- Example:--$ cat unique.journal-1/1 test- (acct:one) 1-2/2 test- (acct:two) 2-$ LEDGER_FILE=unique.journal hledger print-unique-(-f option not supported)-2015/01/01 test- (acct:one) 1---File: hledger.info, Node: register, Next: register-match, Prev: print-unique, Up: COMMANDS--4.18 register-=============--register, reg, r-Show postings and their running total.-- The register command displays postings in date order, one per line,-and their running total. This is typically used with a query selecting-a particular account, to see that account's activity:--$ hledger register checking-2008/01/01 income assets:bank:checking $1 $1-2008/06/01 gift assets:bank:checking $1 $2-2008/06/02 save assets:bank:checking $-1 $1-2008/12/31 pay off assets:bank:checking $-1 0-- With -date2, it shows and sorts by secondary date instead.-- The '--historical'/'-H' flag adds the balance from any undisplayed-prior postings to the running total. This is useful when you want to-see only recent activity, with a historically accurate running balance:--$ hledger register checking -b 2008/6 --historical-2008/06/01 gift assets:bank:checking $1 $2-2008/06/02 save assets:bank:checking $-1 $1-2008/12/31 pay off assets:bank:checking $-1 0-- The '--depth' option limits the amount of sub-account detail-displayed.-- The '--average'/'-A' flag shows the running average posting amount-instead of the running total (so, the final number displayed is the-average for the whole report period). This flag implies '--empty' (see-below). It is affected by '--historical'. It works best when showing-just one account and one commodity.-- The '--related'/'-r' flag shows the _other_ postings in the-transactions of the postings which would normally be shown.-- The '--invert' flag negates all amounts. For example, it can be used-on an income account where amounts are normally displayed as negative-numbers. It's also useful to show postings on the checking account-together with the related account:--$ hledger register --related --invert assets:checking-- With a reporting interval, register shows summary postings, one per-interval, aggregating the postings to each account:--$ hledger register --monthly income-2008/01 income:salary $-1 $-1-2008/06 income:gifts $-1 $-2-- Periods with no activity, and summary postings with a zero amount,-are not shown by default; use the '--empty'/'-E' flag to see them:--$ hledger register --monthly income -E-2008/01 income:salary $-1 $-1-2008/02 0 $-1-2008/03 0 $-1-2008/04 0 $-1-2008/05 0 $-1-2008/06 income:gifts $-1 $-2-2008/07 0 $-2-2008/08 0 $-2-2008/09 0 $-2-2008/10 0 $-2-2008/11 0 $-2-2008/12 0 $-2-- Often, you'll want to see just one line per interval. The '--depth'-option helps with this, causing subaccounts to be aggregated:--$ hledger register --monthly assets --depth 1h-2008/01 assets $1 $1-2008/06 assets $-1 0-2008/12 assets $-1 $-1-- Note when using report intervals, if you specify start/end dates-these will be adjusted outward if necessary to contain a whole number of-intervals. This ensures that the first and last intervals are full-length and comparable to the others in the report.-* Menu:--* Custom register output::---File: hledger.info, Node: Custom register output, Up: register--4.18.1 Custom register output--------------------------------register uses the full terminal width by default, except on windows.-You can override this by setting the 'COLUMNS' environment variable (not-a bash shell variable) or by using the '--width'/'-w' option.-- The description and account columns normally share the space equally-(about half of (width - 40) each). You can adjust this by adding a-description width as part of -width's argument, comma-separated:-'--width W,D' . Here's a diagram (won't display correctly in -help):--<--------------------------------- width (W) ---------------------------------->-date (10) description (D) account (W-41-D) amount (12) balance (12)-DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA-- and some examples:--$ hledger reg # use terminal width (or 80 on windows)-$ hledger reg -w 100 # use width 100-$ COLUMNS=100 hledger reg # set with one-time environment variable-$ export COLUMNS=100; hledger reg # set till session end (or window resize)-$ hledger reg -w 100,40 # set overall width 100, description width 40-$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40-- This command also supports output destination and output format-selection.---File: hledger.info, Node: register-match, Next: rewrite, Prev: register, Up: COMMANDS--4.19 register-match-===================--register-match-Print the one posting whose transaction description is closest to DESC,-in the style of the register command. If there are multiple equally-good matches, it shows the most recent. Query options (options, not-arguments) can be used to restrict the search space. Helps-ledger-autosync detect already-seen transactions when importing.---File: hledger.info, Node: rewrite, Next: roi, Prev: register-match, Up: COMMANDS--4.20 rewrite-============--rewrite-Print all transactions, rewriting the postings of matched transactions.-For now the only rewrite available is adding new postings, like print--auto.-- This is a start at a generic rewriter of transaction entries. It-reads the default journal and prints the transactions, like print, 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-- rewrites.hledger may consist of entries like:--= ^income amt:<0 date:2017- (liabilities:tax) *0.33 ; tax on income- (reserve:grocery) *0.25 ; reserve 25% for grocery- (reserve:) *0.25 ; reserve 25% for grocery-- Note the single quotes to protect the dollar sign from bash, and the-two spaces between account and amount.-- More:--$ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...-$ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'-$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'-$ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'-- Argument for '--add-posting' option is a usual posting of transaction-with an exception for amount specification. More precisely, you can use-''*'' (star symbol) before the amount to indicate that that this is a-factor for an amount of original matched posting. If the amount-includes a commodity name, the new posting amount will be in the new-commodity; otherwise, it will be in the matched posting amount's-commodity.--* Menu:--* Re-write rules in a file::---File: hledger.info, Node: Re-write rules in a file, Up: rewrite--4.20.1 Re-write rules in a file----------------------------------During the run this tool will execute so called "Automated Transactions"-found in any journal it process. I.e instead of specifying this-operations in command line you can put them in a journal file.--$ rewrite-rules.journal-- Make contents look like this:--= ^income- (liabilities:tax) *.33--= expenses:gifts- budget:gifts *-1- assets:budget *1-- Note that ''='' (equality symbol) that is used instead of date in-transactions you usually write. It indicates the query by which you-want to match the posting to add new ones.--$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal-- This is something similar to the commands pipeline:--$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \- | hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \- --add-posting 'assets:budget *1' \- > rewritten-tidy-output.journal-- It is important to understand that relative order of such entries in-journal is important. You can re-use result of previously added-postings.--* Menu:--* Diff output format::-* rewrite vs print --auto::---File: hledger.info, Node: Diff output format, Next: rewrite vs print --auto, Up: Re-write rules in a file--4.20.1.1 Diff output format-...........................--To use this tool for batch modification of your journal files you may-find useful output in form of unified diff.--$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33'-- Output might look like:----- /tmp/examples/sample.journal-+++ /tmp/examples/sample.journal-@@ -18,3 +18,4 @@- 2008/01/01 income-- assets:bank:checking $1-+ assets:bank:checking $1- income:salary-+ (liabilities:tax) 0-@@ -22,3 +23,4 @@- 2008/06/01 gift-- assets:bank:checking $1-+ assets:bank:checking $1- income:gifts-+ (liabilities:tax) 0-- If you'll pass this through 'patch' tool you'll get transactions-containing the posting that matches your query be updated. Note that-multiple files might be update according to list of input files-specified via '--file' options and 'include' directives inside of these-files.-- Be careful. Whole transaction being re-formatted in a style of-output from 'hledger print'.-- See also:-- https://github.com/simonmichael/hledger/issues/99---File: hledger.info, Node: rewrite vs print --auto, Prev: Diff output format, Up: Re-write rules in a file--4.20.1.2 rewrite vs. print -auto-................................--This command predates print -auto, and currently does much the same-thing, but with these differences:-- * with multiple files, rewrite lets rules in any file affect all- other files. print -auto uses standard directive scoping; rules- affect only child files.-- * rewrite's query limits which transactions can be rewritten; all are- printed. print -auto's query limits which transactions are- printed.-- * rewrite applies rules specified on command line or in the journal.- print -auto applies rules specified in the journal.---File: hledger.info, Node: roi, Next: stats, Prev: rewrite, Up: COMMANDS--4.21 roi-========--roi-Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on-your investments.-- This command assumes that you have account(s) that hold nothing but-your investments and whenever you record current appraisal/valuation of-these investments you offset unrealized profit and loss into account(s)-that, again, hold nothing but unrealized profit and loss.-- Any transactions affecting balance of investment account(s) and not-originating from unrealized profit and loss account(s) are assumed to be-your investments or withdrawals.-- At a minimum, you need to supply a query (which could be just an-account name) to select your investments with '--inv', and another query-to identify your profit and loss transactions with '--pnl'.-- It will compute and display the internalized rate of return (IRR) and-time-weighted rate of return (TWR) for your investments for the time-period requested. Both rates of return are annualized before display,-regardless of the length of reporting interval.---File: hledger.info, Node: stats, Next: tags, Prev: roi, Up: COMMANDS--4.22 stats-==========--stats-Show some journal statistics.-- The stats command displays summary information for the whole journal,-or a matched part of it. With a reporting interval, it shows a report-for each report period.-- Example:--$ hledger stats-Main journal file : /src/hledger/examples/sample.journal-Included journal files : -Transactions span : 2008-01-01 to 2009-01-01 (366 days)-Last transaction : 2008-12-31 (2333 days ago)-Transactions : 5 (0.0 per day)-Transactions last 30 days: 0 (0.0 per day)-Transactions last 7 days : 0 (0.0 per day)-Payees/descriptions : 5-Accounts : 8 (depth 3)-Commodities : 1 ($)-- This command also supports output destination and output format-selection.---File: hledger.info, Node: tags, Next: test, Prev: stats, Up: COMMANDS--4.23 tags-=========--tags-List all the tag names used in the journal. With a TAGREGEX argument,-only tag names matching the regular expression (case insensitive) are-shown. With QUERY arguments, only transactions matching the query are-considered.---File: hledger.info, Node: test, Prev: tags, Up: COMMANDS--4.24 test-=========--test-Run built-in unit tests.-- This command runs the unit tests built in to hledger-lib and hledger,-printing test names and results on stdout. If any test fails, the exit-code will be non-zero.-- Test names include a group prefix. If a (exact, case sensitive)-group prefix, or a full test name is provided as the first argument,-only that group or test is run.-- If a numeric second argument is provided, it will set the randomness-seed, for repeatable results from tests using randomness (currently none-of them).-- This is mainly used by developers, but it's nice to be able to-sanity-check your installed hledger executable at any time. All tests-are expected to pass - if you ever see otherwise, something has gone-wrong, please report a bug!---File: hledger.info, Node: ADD-ON COMMANDS, Prev: COMMANDS, Up: Top--5 ADD-ON COMMANDS-*****************--hledger also searches for external add-on commands, and will include-these in the commands list. These are programs or scripts in your PATH-whose name starts with 'hledger-' and ends with a recognised file-extension (currently: no extension, 'bat','com','exe',-'hs','lhs','pl','py','rb','rkt','sh').-- Add-ons can be invoked like any hledger command, but there are a few-things to be aware of. Eg if the 'hledger-web' add-on is installed,-- * 'hledger -h web' shows hledger's help, while 'hledger web -h' shows- hledger-web's help.-- * Flags specific to the add-on must have a preceding '--' to hide- them from hledger. So 'hledger web --serve --port 9000' will be- rejected; you must use 'hledger web -- --serve --port 9000'.-- * You can always run add-ons directly if preferred: 'hledger-web- --serve --port 9000'.-- Add-ons are a relatively easy way to add local features or experiment-with new ideas. They can be written in any language, but haskell-scripts have a big advantage: they can use the same hledger (and-haskell) library functions that built-in commands do, for command-line-options, journal parsing, reporting, etc.-- Here are some hledger add-ons available:-* Menu:--* Official add-ons::-* Third party add-ons::-* Experimental add-ons::---File: hledger.info, Node: Official add-ons, Next: Third party add-ons, Up: ADD-ON COMMANDS--5.1 Official add-ons-====================--These are maintained and released along with hledger.-* Menu:--* api::-* ui::-* web::---File: hledger.info, Node: api, Next: ui, Up: Official add-ons--5.1.1 api------------hledger-api serves hledger data as a JSON web API.---File: hledger.info, Node: ui, Next: web, Prev: api, Up: Official add-ons--5.1.2 ui-----------hledger-ui provides an efficient curses-style interface.---File: hledger.info, Node: web, Prev: ui, Up: Official add-ons--5.1.3 web------------hledger-web provides a simple web interface.---File: hledger.info, Node: Third party add-ons, Next: Experimental add-ons, Prev: Official add-ons, Up: ADD-ON COMMANDS--5.2 Third party add-ons-=======================--These are maintained separately, and usually updated shortly after a-hledger release.-* Menu:--* diff::-* iadd::-* interest::-* irr::---File: hledger.info, Node: diff, Next: iadd, Up: Third party add-ons--5.2.1 diff-------------hledger-diff shows differences in an account's transactions between one-journal file and another.---File: hledger.info, Node: iadd, Next: interest, Prev: diff, Up: Third party add-ons--5.2.2 iadd-------------hledger-iadd is a curses-style, more interactive replacement for the add-command.---File: hledger.info, Node: interest, Next: irr, Prev: iadd, Up: Third party add-ons--5.2.3 interest-----------------hledger-interest generates interest transactions for an account-according to various schemes.---File: hledger.info, Node: irr, Prev: interest, Up: Third party add-ons--5.2.4 irr------------hledger-irr calculates the internal rate of return of an investment-account, but it's superseded now by the built-in roi command.---File: hledger.info, Node: Experimental add-ons, Prev: Third party add-ons, Up: ADD-ON COMMANDS--5.3 Experimental add-ons-========================--These are available in source form in the hledger repo's bin/ directory;-installing them is pretty easy. They may be less mature and documented-than built-in commands. Reading and tweaking these is a good way to-start making your own!-* Menu:--* autosync::-* chart::-* check::---File: hledger.info, Node: autosync, Next: chart, Up: Experimental add-ons--5.3.1 autosync-----------------hledger-autosync is a symbolic link for easily running ledger-autosync,-if installed. ledger-autosync does deduplicating conversion of OFX data-and some CSV formats, and can also download the data if your bank offers-OFX Direct Connect.---File: hledger.info, Node: chart, Next: check, Prev: autosync, Up: Experimental add-ons--5.3.2 chart--------------hledger-chart.hs is an old pie chart generator, in need of some love.---File: hledger.info, Node: check, Prev: chart, Up: Experimental add-ons--5.3.3 check--------------hledger-check.hs checks more powerful account balance assertions.---Tag Table:-Node: Top68-Node: EXAMPLES1884-Ref: #examples1984-Node: OPTIONS3630-Ref: #options3732-Node: General options4167-Ref: #general-options4292-Node: Command options6974-Ref: #command-options7125-Node: Command arguments7523-Ref: #command-arguments7677-Node: Argument files7798-Ref: #argument-files7974-Node: Special characters in arguments and queries8240-Ref: #special-characters-in-arguments-and-queries8474-Node: More escaping8924-Ref: #more-escaping9086-Node: Even more escaping9382-Ref: #even-more-escaping9576-Node: Less escaping10247-Ref: #less-escaping10409-Node: Command line tips10654-Ref: #command-line-tips10840-Node: Unicode characters11217-Ref: #unicode-characters11373-Node: Input files12098-Ref: #input-files12234-Node: Smart dates14204-Ref: #smart-dates14345-Node: Report start & end date15751-Ref: #report-start-end-date15923-Node: Report intervals16989-Ref: #report-intervals17154-Node: Period expressions17555-Ref: #period-expressions17715-Node: Depth limiting21672-Ref: #depth-limiting21816-Node: Pivoting22158-Ref: #pivoting22276-Node: Cost23952-Ref: #cost24060-Node: Market value24178-Ref: #market-value24313-Node: Combining -B and -V25679-Ref: #combining--b-and--v25842-Node: Output destination25989-Ref: #output-destination26151-Node: Output format26434-Ref: #output-format26586-Node: Regular expressions26971-Ref: #regular-expressions27108-Node: QUERIES28469-Ref: #queries28571-Node: COMMANDS32533-Ref: #commands32645-Node: accounts33645-Ref: #accounts33743-Node: activity34442-Ref: #activity34552-Node: add34935-Ref: #add35034-Node: balance37621-Ref: #balance37732-Node: Classic balance report39173-Ref: #classic-balance-report39346-Node: Customising the classic balance report40715-Ref: #customising-the-classic-balance-report40943-Node: Colour support43017-Ref: #colour-support43184-Node: Flat mode43357-Ref: #flat-mode43505-Node: Depth limited balance reports43918-Ref: #depth-limited-balance-reports44118-Node: Multicolumn balance report44574-Ref: #multicolumn-balance-report44772-Node: Budget report49952-Ref: #budget-report50095-Node: Nested budgets55296-Ref: #nested-budgets55408-Ref: #output-format-158888-Node: balancesheet58966-Ref: #balancesheet59102-Node: balancesheetequity60336-Ref: #balancesheetequity60485-Node: cashflow61046-Ref: #cashflow61174-Node: check-dates62202-Ref: #check-dates62329-Node: check-dupes62608-Ref: #check-dupes62732-Node: close63025-Ref: #close63133-Node: files66546-Ref: #files66647-Node: help66794-Ref: #help66894-Node: import67987-Ref: #import68101-Node: incomestatement68845-Ref: #incomestatement68979-Node: prices70315-Ref: #prices70430-Node: print70709-Ref: #print70819-Node: print-unique75312-Ref: #print-unique75438-Node: register75723-Ref: #register75850-Node: Custom register output80021-Ref: #custom-register-output80150-Node: register-match81412-Ref: #register-match81546-Node: rewrite81897-Ref: #rewrite82012-Node: Re-write rules in a file83861-Ref: #re-write-rules-in-a-file83995-Node: Diff output format85205-Ref: #diff-output-format85374-Node: rewrite vs print --auto86466-Ref: #rewrite-vs.-print---auto86645-Node: roi87201-Ref: #roi87299-Node: stats88311-Ref: #stats88410-Node: tags89164-Ref: #tags89262-Node: test89492-Ref: #test89576-Node: ADD-ON COMMANDS90337-Ref: #add-on-commands90447-Node: Official add-ons91734-Ref: #official-add-ons91874-Node: api91961-Ref: #api92050-Node: ui92102-Ref: #ui92201-Node: web92259-Ref: #web92348-Node: Third party add-ons92394-Ref: #third-party-add-ons92569-Node: diff92704-Ref: #diff92801-Node: iadd92900-Ref: #iadd93014-Node: interest93097-Ref: #interest93218-Node: irr93313-Ref: #irr93411-Node: Experimental add-ons93542-Ref: #experimental-add-ons93694-Node: autosync93974-Ref: #autosync94085-Node: chart94324-Ref: #chart94443-Node: check94514-Ref: #check94616--End Tag Table+This is hledger.info, produced by makeinfo version 7.3 from stdin.++INFO-DIR-SECTION User Applications+START-INFO-DIR-ENTRY+* hledger: (hledger). Command-line plain text accounting tool.+END-INFO-DIR-ENTRY+++File: hledger.info, Node: Top, Next: PART 1 USER INTERFACE, Up: (dir)++hledger(1)+**********++hledger - a robust, friendly plain text accounting app (command line+version).++ 'hledger'+or+'hledger COMMAND [OPTS] [ARGS]'++ hledger is a robust, user-friendly, cross-platform set of programs+for tracking money, time, or any other commodity, using double-entry+accounting and a simple, editable file format. hledger is inspired by+and largely compatible with ledger(1), and largely interconvertible with+beancount(1).++ This manual is for hledger's command line interface, version 1.52.+It also describes the common options, file formats and concepts used by+all hledger programs. It might accidentally teach you some+bookkeeping/accounting as well! You don't need to know everything in+here to use hledger productively, but when you have a question about+functionality, this doc should answer it. It is detailed, so do skip+ahead or skim when needed. You can read it on hledger.org, or as an+info manual or man page on your system. You can also open a built-in+copy, at a point of interest, by running+'hledger --man [CMD]', 'hledger --info [CMD]' or 'hledger help [TOPIC]'.++ (And for shorter help, try 'hledger --tldr [CMD]'.)++ The main function of the hledger CLI is to read plain text files+describing financial transactions, crunch the numbers, and print a+useful report on the terminal (or save it as HTML, CSV, JSON or SQL).+Many reports are available, as subcommands. hledger will also detect+other 'hledger-*' executables as extra subcommands.++ hledger usually reads from (and appends to) a journal file specified+by the 'LEDGER_FILE' environment variable (defaulting to+'$HOME/.hledger.journal'); or you can specify files with '-f' options.+It can also read timeclock files, timedot files, or any CSV/SSV/TSV file+with a date field.++ Here is a small journal file describing one transaction:++2015-10-16 bought food+ expenses:food $10+ assets:cash++ Transactions are dated movements of money (etc.) between two or more+_accounts_: bank accounts, your wallet, revenue/expense categories,+people, etc. You can choose any account names you wish, using ':' to+indicate subaccounts. There must be at least two spaces between account+name and amount. Positive amounts are inflow to that account (_debit_),+negatives are outflow from it (_credit_). (Some reports show revenue,+liability and equity account balances as negative numbers as a result;+this is normal.)++ hledger's add command can help you add transactions, or you can+install other data entry UIs like hledger-web or hledger-iadd. For more+extensive/efficient changes, use a text editor: Emacs + ledger-mode, VIM++ vim-ledger, or VS Code + hledger-vscode are some good choices (see+https://hledger.org/editors.html).++ To get started, run 'hledger add' and follow the prompts, or save+some entries like the above in '$HOME/.hledger.journal', then try+commands like:++$ hledger print -x+$ hledger aregister assets+$ hledger balance+$ hledger balancesheet+$ hledger incomestatement++ Run 'hledger' to list the commands. See also the "Starting a journal+file" and "Setting opening balances" sections in PART 5: COMMON TASKS.++* Menu:++* PART 1 USER INTERFACE::+* Input::+* Commands::+* Options::+* Output::+* Environment::+* PART 2 DATA FORMATS::+* Journal::+* CSV::+* Timeclock::+* Timedot::+* PART 3 REPORTING CONCEPTS::+* Time periods::+* Depth::+* Queries::+* Pivoting::+* Generating data::+* Forecasting::+* Budgeting::+* Amount formatting::+* Cost reporting::+* Value reporting::+* PART 4 COMMANDS::+* Help commands::+* User interface commands::+* Data entry commands::+* Basic report commands::+* Standard report commands::+* Advanced report commands::+* Chart commands::+* Data generation commands::+* Maintenance commands::+* PART 5 COMMON TASKS::+* BUGS::+++File: hledger.info, Node: PART 1 USER INTERFACE, Next: Input, Prev: Top, Up: Top++1 PART 1: USER INTERFACE+************************+++File: hledger.info, Node: Input, Next: Commands, Prev: PART 1 USER INTERFACE, Up: Top++2 Input+*******++hledger reads one or more data files, each time you run it. You can+specify a file with '-f', like so++$ hledger -f FILE [-f FILE2 ...] print++ Files are most often in hledger's journal format, with the '.journal'+file extension ('.hledger' or '.j' also work); these files describe+transactions, like an accounting general journal.++ When no file is specified, hledger looks for '.hledger.journal' in+your home directory.++ But most people prefer to keep financial files in a dedicated folder,+perhaps with version control. Also, starting a new journal file each+year is common (it's not required, but helps keep things fast and+organised). So we usually configure a different journal file, by+setting the 'LEDGER_FILE' environment variable, to something like+'~/finance/2023.journal'. For more about how to do that on your system,+see Common tasks > Setting LEDGER_FILE.++* Menu:++* Text encoding::+* Data formats::+* Standard input::+* Multiple files::+* Strict mode::+++File: hledger.info, Node: Text encoding, Next: Data formats, Up: Input++2.1 Text encoding+=================++hledger expects non-ascii input to be decodable with the system locale's+text encoding. (For CSV/SSV/TSV files, this can be overridden by the+'encoding' CSV rule.)++ So, trying to read non-ascii files which have the wrong text+encoding, or when no system locale is configured, will fail. To fix+this, configure your system locale appropriately, and/or convert the+files to your system's text encoding (using 'iconv' on unix, or+powershell or notepad on Windows). See Install: Text encoding for more+tips.++ hledger's output will use the system locale's encoding.++ hledger's docs and example files mostly use UTF-8 encoding.+++File: hledger.info, Node: Data formats, Next: Standard input, Prev: Text encoding, Up: Input++2.2 Data formats+================++Usually the data file is in hledger's journal format, but it can be in+any of the supported file formats, which currently are:++Reader: Reads: Automatically used for+ files with extensions:+---------------------------------------------------------------------------+'journal' hledger journal files and some '.journal' '.j'+ Ledger journals, for '.hledger' '.ledger'+ transactions+'timeclock' timeclock files, for precise '.timeclock'+ time logging+'timedot' timedot files, for approximate '.timedot'+ time logging+'csv' Comma- or other '.csv'+ delimiter-separated values, for+ data import+'ssv' Semicolon separated values '.ssv'+'tsv' Tab separated values '.tsv'+'rules' CSV/SSV/TSV/other separated '.rules'+ values, alternate way++ These formats are described in more detail below.++ hledger detects the format automatically based on the file extensions+shown above. If it can't recognise the file extension, it assumes+'journal' format. So for non-journal files, it's important to use a+recognised file extension, so as to either read successfully or to show+relevant error messages.++ You can also force a specific reader/format by prefixing the file+path with the format and a colon. Eg, to read a .dat file containing+tab separated values:++$ hledger -f tsv:/some/file.dat stats+++File: hledger.info, Node: Standard input, Next: Multiple files, Prev: Data formats, Up: Input++2.3 Standard input+==================++The file name '-' means standard input:++$ cat FILE | hledger -f- print++ If reading non-journal data in this way, you'll need to write the+format as a prefix, like 'timeclock:' here:++$ echo 'i 2009/13/1 08:00:00' | hledger print -f timeclock:-+++File: hledger.info, Node: Multiple files, Next: Strict mode, Prev: Standard input, Up: Input++2.4 Multiple files+==================++You can specify multiple '-f' options, to read multiple files as one big+journal. When doing this, note that certain features (described below)+will be affected:++ * Balance assertions will not see the effect of transactions in+ previous files. (Usually this doesn't matter as each file will set+ the corresponding opening balances.)+ * Some directives will not affect previous or subsequent files.++ If needed, you can work around these by using a single parent file+which includes the others, or concatenating the files into one, eg: 'cat+a.journal b.journal | hledger -f- CMD'.+++File: hledger.info, Node: Strict mode, Prev: Multiple files, Up: Input++2.5 Strict mode+===============++hledger checks input files for valid data. By default, the most+important errors are detected, while still accepting easy journal files+without a lot of declarations:++ * Are the input files parseable, with valid syntax ?+ * Are all transactions balanced ?+ * Do all balance assertions pass ?++ With the '-s'/'--strict' flag, additional checks are performed:++ * Are all accounts posted to, declared with an 'account' directive ?+ (Account error checking)+ * Are all commodities declared with a 'commodity' directive ?+ (Commodity error checking)+ * Are all commodity conversions declared explicitly ?++ You can use the check command to run individual checks - the ones+listed above and some more.+++File: hledger.info, Node: Commands, Next: Options, Prev: Input, Up: Top++3 Commands+**********++hledger provides various subcommands for getting things done. Most of+these commands do not change the journal file; they just read it and+output a report. A few commands assist with adding data and file+management. Some often-used commands are 'add', 'print', 'register',+'balancesheet' and 'incomestatement'.++ To show a summary of commands, run 'hledger' with no arguments. You+can see the same commands summary at the start of PART 4: COMMANDS+below.++ To use a particular command, run 'hledger CMD [CMDOPTS] [CMDARGS]',++ * CMD is the full command name, or its standard abbreviation shown in+ the commands list, or any unambiguous prefix of the name.++ * CMDOPTS are command-specific options, if any. Command-specific+ options must be written after the command name. Eg: 'hledger print+ -x'.++ * CMDARGS are additional arguments to the command, if any. Most+ hledger commands accept arguments representing a query, to limit+ the data in some way. Eg: 'hledger reg assets:checking'.++ To list a command's options, arguments, and documentation in the+terminal, run 'hledger CMD -h'. Eg: 'hledger bal -h'.++* Menu:++* Add-on commands::+++File: hledger.info, Node: Add-on commands, Up: Commands++3.1 Add-on commands+===================++In addition to the built-in commands, you can install _add-on commands_,+which will also appear in hledger's commands list. Some of these can be+installed as separate packages; others can be found in hledger's bin/+directory, documented at https://hledger.org/scripts.html.++ Add-on commands are programs or scripts in your shell's PATH, whose+name starts with "hledger-" and ends with no extension or a recognised+extension (".bat", ".com", ".exe", ".hs", ".js", ".lhs", ".lua", ".php",+".pl", ".py", ".rb", ".rkt", or ".sh"), and (on unix and mac) which has+executable permission for the current user.++ You can run add-on commands directly: 'hledger-ui --watch'.++ Or you can run them with hledger, like built-in commands: 'hledger ui+--watch'. In this case hledger's config file will be used, so you can+set custom options for the addon there. (Before hledger 1.50, an '--'+argument was needed before addon options, but not any more.)+++File: hledger.info, Node: Options, Next: Output, Prev: Commands, Up: Top++4 Options+*********++Run 'hledger -h' to see general command line help. Options can be+written either before or after the command name. These options are+specific to the 'hledger' CLI:++Flags:+ --conf=CONFFILE Use extra options defined in this config file. If+ not specified, searches upward and in XDG config+ dir for hledger.conf (or .hledger.conf in $HOME).+ -n --no-conf ignore any config file++ And the following general options are common to most hledger+commands:++General input/data transformation flags:+ -f --file=[FMT:]FILE Read data from FILE, or from stdin if FILE is -,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ --rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ --alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ --auto generate extra postings by applying auto posting+ rules ("=") to all transactions+ --forecast[=PERIOD] Generate extra transactions from periodic rules+ ("~"), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger-ui, also make future-dated transactions+ visible at startup.+ -I --ignore-assertions don't check balance assertions by default+ --txn-balancing=... how to check that transactions are balanced:+ 'old': use global display precision+ 'exact': use transaction precision (default)+ --infer-costs infer conversion equity postings from costs+ --infer-equity infer costs from conversion equity postings+ --infer-market-prices infer market prices from costs+ --pivot=TAGNAME use a different field or tag as account names+ -s --strict do extra error checks (and override -I)+ --verbose-tags add tags indicating generated/modified data++General output/reporting flags (supported by some commands):+ -b --begin=DATE include postings/transactions on/after this date+ -e --end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ -D --daily multiperiod report with 1 day interval+ -W --weekly multiperiod report with 1 week interval+ -M --monthly multiperiod report with 1 month interval+ -Q --quarterly multiperiod report with 1 quarter interval+ -Y --yearly multiperiod report with 1 year interval+ -p --period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ --today=DATE override today's date (affects relative dates)+ --date2 match/use secondary dates instead (deprecated)+ -U --unmarked include only unmarked postings/transactions+ -P --pending include only pending postings/transactions+ -C --cleared include only cleared postings/transactions+ (-U/-P/-C can be combined)+ -R --real include only non-virtual postings+ -E --empty Show zero items, which are normally hidden.+ In hledger-ui & hledger-web, do the opposite.+ --depth=DEPTHEXP if a number (or -NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ -B --cost show amounts converted to their cost/sale amount+ -V --market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to --value=end.+ -X --exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to --value=end,COMM.+ --value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ 'then': value on transaction dates+ 'end': value at period end(s)+ 'now': value today+ YYYY-MM-DD: value on given date+ -c --commodity-style=S Override a commodity's display style.+ Eg: -c '.' or -c '1.000,00 EUR'+ --pretty[=YN] Use box-drawing characters in text output? Can be+ 'y'/'yes' or 'n'/'no'.+ If YN is specified, the equals is required.++General help flags:+ -h --help show command line help+ --tldr show command examples with tldr+ --info show the manual with info+ --man show the manual with man+ --version show version information+ --debug=[1-9] show this much debug output (default: 1)+ --pager=YN use a pager when needed ? y/yes (default) or n/no+ --color=YNA --colour use ANSI color ? y/yes, n/no, or auto (default)++ Usually hledger accepts any unambiguous flag prefix, eg you can write+'--tl' instead of '--tldr' or '--dry' instead of '--dry-run'.++ You can combine short flags which don't take arguments, eg you can+write '-MAST' instead of '-M -A -S -T'. Flags requiring an argument+can't be combined in this way ('-If FILE' won't work).++ If the same option appears more than once in a command line, usually+the last (right-most) wins. Similarly, if mutually exclusive flags are+used together, the right-most wins. (When flags are mutually exclusive,+they'll usually have a group prefix in -help.)++ With most commands, arguments are interpreted as a hledger query+which filter the data. Some queries can be expressed either with+options or with arguments.++ Below are more tips for using the command line interface - feel free+to skip these until you need them.++* Menu:++* Special characters::+* Unicode characters::+* Regular expressions::+* Argument files::+* Config files::+* Shell completions::+++File: hledger.info, Node: Special characters, Next: Unicode characters, Up: Options++4.1 Special characters+======================++In commands you type at the command line, certain characters have+special meaning and sometimes need to be "escaped" or "quoted", by+prefixing backslashes or enclosing in quotes.++ If you are able to minimise the use of special characters in your+data, you won't have to deal with this as much. For example, you could+use hyphen '-' or underscore '_' instead of spaces in account names, and+you could use the 'USD' currency code instead of the '$' currency symbol+in amounts.++ But if you prefer to use spaced account names and '$', it's fine.+Just be aware of this topic so you can check this doc when needed.+(These examples are mostly tested on unix; some details might need to be+adapted if you're on Windows.)++* Menu:++* Escaping shell special characters::+* Escaping regular expression special characters::+* Escaping in other situations::+++File: hledger.info, Node: Escaping shell special characters, Next: Escaping regular expression special characters, Up: Special characters++4.1.1 Escaping shell special characters+---------------------------------------++These are some characters which may have special meaning to your shell+(the program which interprets command lines):++ * SPACE, '<', '>', '(', ')', '|', '\', '%'+ * '$' if followed by a word character++ So for example, to match an account name containing spaces, like+"credit card", don't write:++$ hledger register credit card++ Instead, enclose the name in single quotes:++$ hledger register 'credit card'++ On unix or in Windows powershell, if you use double quotes your shell+will silently treat '$' as variable interpolation. So you should+probably avoid double quotes, unless you want that behaviour, eg in a+script:++$ hledger register "assets:$SOMEACCT"++ But in an older Windows CMD.EXE window, you must use double quotes:++C:\Users\Me> hledger register "credit card"++ On unix or in Windows powershell, as an alternative to quotes you can+write a backslash before each special character:++$ hledger register credit\ card++ Finally, since hledger's query arguments are regular expressions+(described below), you could also fill that gap with '.' which matches+any character:++$ hledger register credit.card+++File: hledger.info, Node: Escaping regular expression special characters, Next: Escaping in other situations, Prev: Escaping shell special characters, Up: Special characters++4.1.2 Escaping regular expression special characters+----------------------------------------------------++Some characters also have special meaning in regular expressions, which+hledger's arguments often are. Those include:++ * '.', '^', '$', '[', ']', '(', ')', '|', '\'++ To escape one of these, write '\' before it. But note this is in+addition to the shell escaping above. So for characters which are+special to both shell and regular expressions, like '\' and '$', you+will sometimes need two levels of escaping.++ For example, a balance report that uses a 'cur:' query restricting it+to just the $ currency, should be written like this:++$ hledger balance cur:\\$++ Explanation:++ 1. Add a backslash '\' before the dollar sign '$' to protect it from+ regular expressions (so it will be matched literally with no+ special meaning).+ 2. Add another backslash before that backslash, to protect it from the+ shell (so the shell won't consume it).+ 3. '$' doesn't need to be protected from the shell in this case,+ because it's not followed by a word character; but it would be+ harmless to do so.++ But here's another way to write that, which tends to be easier: add+backslashes to escape from regular expressions, then enclose with quotes+to escape from the shell:++$ hledger balance cur:'\$'+++File: hledger.info, Node: Escaping in other situations, Prev: Escaping regular expression special characters, Up: Special characters++4.1.3 Escaping in other situations+----------------------------------++hledger options and arguments are sometimes used in places other than+the command line, where the escaping/quoting rules are different. For+example, backslash-quoting may not be available. Here's a quick+reference:++In unix shell Use single quotes and/or backslash (or double quotes+ for variable interpolation)+In Windows Use single quotes (or double quotes for variable+'powershell' interpolation)+In Windows 'cmd' Use double quotes+In hledger-ui's Use single or double quotes+filter prompt+In hledger-web's Use single or double quotes+search form+In an argument Don't use spaces, don't shell-escape, do+file regex-escape, write one argument/option per line+In a config file Use single or double quotes, and enclose the whole+ argument (''desc:a b'' not 'desc:'a b'')+In 'ghci' (the Use double quotes, and enclose the whole argument+Haskell REPL)+++File: hledger.info, Node: Unicode characters, Next: Regular expressions, Prev: Special characters, Up: Options++4.2 Unicode characters+======================++hledger is expected to handle non-ascii characters correctly:++ * they should be parsed correctly in input files and on the command+ line, by all hledger tools (add, iadd, hledger-web's+ search/add/edit forms, etc.)++ * they should be displayed correctly by all hledger tools, and+ on-screen alignment should be preserved.++ This requires a well-configured environment. Here are some tips:++ * A system locale must be configured, which can decode the characters+ being used. This is essential - see Text encoding and Install:+ Text encoding.++ * Your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..)+ must support unicode. On Windows, you may need to use Windows+ Terminal.++ * The terminal must be using a font which includes the required+ unicode glyphs.++ * The terminal should be configured to display wide characters as+ double width (for report alignment).++ * On Windows, for best results you should run hledger in the same+ kind of environment in which it was built. Eg hledger built in the+ standard CMD.EXE environment (like the binaries on our download+ page) might show display problems when run in a cygwin or msys+ terminal, and vice versa. (See eg #961).+++File: hledger.info, Node: Regular expressions, Next: Argument files, Prev: Unicode characters, Up: Options++4.3 Regular expressions+=======================++A regular expression (regexp) is a small piece of text where certain+characters (like '.', '^', '$', '+', '*', '()', '|', '[]', '\') have+special meanings, forming a tiny language for matching text precisely -+very useful in hledger and elsewhere. To learn all about them, visit+regular-expressions.info.++ hledger supports regexps whenever you are entering a pattern to match+something, eg in query arguments, account aliases, CSV if rules,+hledger-web's search form, hledger-ui's '/' search, etc. You may need+to wrap them in quotes, especially at the command line (see Special+characters above). Here are some examples:++ Account name queries (quoted for command line use):++Regular expression: Matches:+------------------- ------------------------------------------------------------+bank assets:bank, assets:bank:savings, expenses:art:banksy, ...+:bank assets:bank:savings, expenses:art:banksy+:bank: assets:bank:savings+'^bank' none of those ( ^ matches beginning of text )+'bank$' assets:bank ( $ matches end of text )+'big \$ bank' big $ bank ( \ disables following character's special meaning )+'\bbank\b' assets:bank, assets:bank:savings ( \b matches word boundaries )+'(sav|check)ing' saving or checking ( (|) matches either alternative )+'saving|checking' saving or checking ( outer parentheses are not needed )+'savings?' saving or savings ( ? matches 0 or 1 of the preceding thing )+'my +bank' my bank, my bank, ... ( + matches 1 or more of the preceding thing )+'my *bank' mybank, my bank, my bank, ... ( * matches 0 or more of the preceding thing )+'b.nk' bank, bonk, b nk, ... ( . matches any character )++ Some other queries:++desc:'amazon|amzn|audible' Amazon transactions+cur:EUR amounts with commodity symbol containing EUR+cur:'\$' amounts with commodity symbol containing $+cur:'^\$$' only $ amounts, not eg AU$ or CA$+cur:....? amounts with 4-or-more-character symbols+tag:.=202[1-3] things with any tag whose value contains 2021, 2022 or 2023++ Account name aliases: accept '.' instead of ':' as account separator:++alias /\./=: replaces all periods in account names with colons++ Show multiple top-level accounts combined as one:++--alias='/^[^:]+/=combined' ( [^:] matches any character other than : )++ Show accounts with the second-level part removed:++--alias '/^([^:]+):[^:]+/ = \1'+ match a top-level account and a second-level account+ and replace those with just the top-level account+ ( \1 in the replacement text means "whatever was matched+ by the first parenthesised part of the regexp"++ CSV rules: match CSV records containing dining-related MCC codes:++if \?MCC581[124]++ Match CSV records with a specific amount around the end/start of+month:++if %amount \b3\.99+& %date (29|30|31|01|02|03)$++* Menu:++* hledger's regular expressions::+++File: hledger.info, Node: hledger's regular expressions, Up: Regular expressions++4.3.1 hledger's regular expressions+-----------------------------------++hledger's regular expressions come from the regex-tdfa library. If+they're not doing what you expect, it's important to know exactly what+they support:++ 1. they are case insensitive+ 2. they are infix matching (they do not need to match the entire thing+ being matched)+ 3. they are POSIX ERE (extended regular expressions)+ 4. they also support GNU word boundaries ('\b', '\B', '\<', '\>')+ 5. backreferences are supported when doing text replacement in account+ aliases or CSV rules, where backreferences can be used in the+ replacement string to reference capturing groups in the search+ regexp. Otherwise, if you write '\1', it will match the digit '1'.+ 6. they do not support lazy quantifiers ('*?'), mode modifiers+ ('(?s)'), character classes ('\w', '\d'), or anything else not+ mentioned above.+ 7. they may not (I'm guessing not) properly support right-to-left or+ bidirectional text.++ Some things to note:++ * In the 'alias' directive and '--alias' option, regular expressions+ must be enclosed in forward slashes ('/REGEX/'). Elsewhere in+ hledger, these are not required.++ * In queries, to match a regular expression metacharacter like '$' as+ a literal character, prepend a backslash. Eg to search for amounts+ with the dollar sign in hledger-web, write 'cur:\$'.++ * On the command line, some metacharacters like '$' have a special+ meaning to the shell and so must be escaped at least once more.+ See Special characters.+++File: hledger.info, Node: Argument files, Next: Config files, Prev: Regular expressions, Up: Options++4.4 Argument files+==================++You can save a set of command line options and arguments in a file, and+then use them by writing '@FILE.args' as a hledger command argument.+The '.args' file extension is conventional, but not required. In an+argument file,++ * Each line can contain one argument, flag, or option.+ * Blank lines or lines beginning with '#' are ignored.+ * An option's flag and value should be joined by '='.+ * An option value or an argument may contain spaces. Don't use+ single or double quotes.+ * And generally, use one less level of quoting/escaping than at the+ command line. Eg 'cur:\$', not 'cur:\\$' as on the command line.++ For example:++# cash.args++assets:cash+assets:charles schwab:sweep+cur:\$+-c=$1.++$ hledger bal @cash.args+++File: hledger.info, Node: Config files, Next: Shell completions, Prev: Argument files, Up: Options++4.5 Config files+================++With hledger 1.40+, you can save extra command line options and+arguments in a more featureful hledger config file. Here's a small+example:++# General options are listed first, and used with hledger commands that support them.+--pretty++# Options following a `[COMMAND]` heading are used with that hledger command only.+[print]+--explicit --infer-costs++ To use a config file, specify it with the '--conf' option. Its+options will be inserted near the start of your command line, so you can+override them with command line options if needed.++ Or, you can set up an automatic config file that is used whenever you+run hledger, by creating 'hledger.conf' in the current directory or+above, or '.hledger.conf' in your home directory ('~/.hledger.conf'), or+'hledger.conf' in your XDG config directory+('~/.config/hledger/hledger.conf').++ Here is another example config you could start with:+https://github.com/simonmichael/hledger/blob/master/hledger.conf.sample++ You can put not only options, but also arguments in a config file.+If the first word in a config file's top (general) section does not+begin with a dash (eg: 'print'), it is treated as the command argument+(overriding any argument on the command line).++ On unix machines, you can add a shebang line at the top of a config+file, set executable permission on the file, and use it like a script.+Eg (the '-S' is needed on some operating systems):++#!/usr/bin/env -S hledger --conf++ You can ignore config files by adding the '-n'/'--no-conf' flag to+the command line. This is useful when using hledger in scripts, or when+troubleshooting. When both '--conf' and '--no-conf' options are used,+the right-most wins.++ To inspect the processing of config files, use '--debug' or+'--debug=8'. Or, run the 'setup' command, which will display any active+config files. ('setup' is not affected by config files itself, unlike+other commands.)++ *Warning!*++ There aren't many hledger features that need a warning, but this is+one!++ Automatic config files, while convenient, also make hledger less+predictable and dependable. It's easy to make a config file that+changes a report's behaviour, or breaks your hledger-using+scripts/applications, in ways that will surprise you later.++ If you don't want this,++ 1. Just don't create a hledger.conf file on your machine.+ 2. Also be alert to downloaded directories which may contain a+ hledger.conf file.+ 3. Also if you are sharing scripts or examples or support, consider+ that others may have a hledger.conf file.++ Conversely, once you decide to use this feature, try to remember:++ 1. Whenever a hledger command does not work as expected, try it again+ with '-n' ('--no-conf') to see if a config file was to blame.+ 2. Whenever you call hledger from a script, consider whether that call+ should use '-n' or not.+ 3. Be conservative about what you put in your config file; try to+ consider the effect on all your reports.+ 4. To troubleshoot the effect of config files, run with '--debug' or+ '--debug 8'.++ The config file feature was added in hledger 1.40.+++File: hledger.info, Node: Shell completions, Prev: Config files, Up: Options++4.6 Shell completions+=====================++If you use the bash or zsh shells, you can optionally set up+context-sensitive autocompletion for hledger command lines. Try+pressing 'hledger<SPACE><TAB><TAB>' (should list all hledger commands)+or 'hledger reg acct:<TAB><TAB>' (should list your top-level account+names). If completions aren't working, or for more details, see Install+> Shell completions.+++File: hledger.info, Node: Output, Next: Environment, Prev: Options, Up: Top++5 Output+********++* Menu:++* Output destination::+* Output format::+* Commodity styles::+* Debug output::+++File: hledger.info, Node: Output destination, Next: Output format, Up: Output++5.1 Output destination+======================++hledger commands send their output to the terminal by default. You can+of course redirect this, eg into a file, using standard shell syntax:++$ hledger print > foo.txt++ Some commands (print, register, stats, the balance commands) also+provide the '-o'/'--output-file' option, which does the same thing+without needing the shell. Eg:++$ hledger print -o foo.txt+$ hledger print -o - # write to stdout (the default)+++File: hledger.info, Node: Output format, Next: Commodity styles, Prev: Output destination, Up: Output++5.2 Output format+=================++Some commands offer other kinds of output, not just text on the+terminal. Here are those commands and the formats currently supported:++command txt html csv/tsv fods beancount sql json+------------------------------------------------------------------------------+aregister Y Y Y Y Y+balance Y Y Y Y Y+balancesheet Y Y Y Y Y+balancesheetequity Y Y Y Y Y+cashflow Y Y Y Y Y+incomestatement Y Y Y Y Y+print Y Y Y Y Y Y Y+register Y Y Y Y Y++ You can also see which output formats a command supports by running+'hledger CMD -h' and looking for the '-O'/'--output-format=FMT' option,++ You can select the output format by using that option:++$ hledger print -O csv # print CSV to standard output++ or by choosing a suitable filename extension with the+'-o'/'--output-file=FILE.FMT' option:++$ 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:++$ hledger balancesheet -o foo.txt -O csv # write CSV to foo.txt++ Here are some notes about the various output formats.++* Menu:++* Text output::+* HTML output::+* CSV / TSV output::+* FODS output::+* Beancount output::+* SQL output::+* JSON output::+++File: hledger.info, Node: Text output, Next: HTML output, Up: Output format++5.2.1 Text output+-----------------++This is the default: human readable, plain text report output, suitable+for viewing with a monospace font in a terminal. If your data contains+unicode or wide characters, you'll need a terminal and font that render+those correctly. (This can be challenging on MS Windows.)++ Some reports ('register', 'aregister') will normally use the full+window width. If this isn't working or you want to override it, you can+use the '-w'/'--width' option.++ Balance reports ('balance', 'balancesheet', 'incomestatement'...)+use whatever width they need. Multi-period multi-currency reports can+often be wider than the window. Besides using a pager, helpful+techniques for this situation include '--layout=bare', '-X COMM',+'cur:', '--transpose', '--tree', '--depth', '--drop', switching to html+output, etc.++* Menu:++* Box-drawing characters::+* Colour::+* Paging::+++File: hledger.info, Node: Box-drawing characters, Next: Colour, Up: Text output++5.2.1.1 Box-drawing characters+..............................++hledger draws simple table borders by default, to minimise the risk of+display problems caused by a terminal/font not supporting box-drawing+characters.++ But your terminal and font probably do support them, so we recommend+using the '--pretty' flag to show prettier tables in the terminal. This+is a good flag to add to your hledger config file.+++File: hledger.info, Node: Colour, Next: Paging, Prev: Box-drawing characters, Up: Text output++5.2.1.2 Colour+..............++hledger tries to automatically detect ANSI colour and text styling+support and use it when appropriate. (Currently, it is used rather+minimally: some reports show negative numbers in red, and help output+uses bold text for emphasis.)++ You can override this by setting the 'NO_COLOR' environment variable+to disable it, or by using the '--color/--colour' option, perhaps in+your config file, with a 'y'/'yes' or 'n'/'no' value to force it on or+off.+++File: hledger.info, Node: Paging, Prev: Colour, Up: Text output++5.2.1.3 Paging+..............++In unix-like environments, when displaying large output (in any output+format) in the terminal, hledger tries to use a pager when appropriate.+(You can disable this with the '--pager=no' option, perhaps in your+config file.)++ The pager shows one page of text at a time, and lets you scroll+around to see more. While it is active, usually 'SPACE' shows the next+page, 'h' shows help, and 'q' quits. The home/end/page up/page+down/cursor keys, and mouse scrolling, may also work.++ hledger will use the pager specified by the 'PAGER' environment+variable, otherwise 'less' if available, otherwise 'more' if available.+(With one exception: 'hledger help -p TOPIC' will always use 'less', so+that it can scroll to the topic.)++ The pager is expected to display hledger's ANSI colour and text+styling. If you see junk characters, you might need to configure your+pager to handle ANSI codes. Or you could disable colour as described+above.++ If you are using the 'less' pager, hledger tries to provide a+consistently pleasant experience by running it with some extra options+added to your 'LESS' environment variable:++ -chop-long-lines -hilite-unread -ignore-case -no-init+-quit-if-one-screen -shift=8 -squeeze-blank-lines -use-backslash++ and when colour output is enabled:++ -RAW-CONTROL-CHARS++ You can prevent this by setting your preferred options in the+'HLEDGER_LESS' variable, which will be used instead of 'LESS'.+++File: hledger.info, Node: HTML output, Next: CSV / TSV output, Prev: Text output, Up: Output format++5.2.2 HTML output+-----------------++HTML output can be styled by an optional 'hledger.css' file in the same+directory.++ HTML output will be a HTML fragment, not a complete HTML document.+Like other hledger output, for non-ascii characters it will use the+system locale's text encoding (see Text encoding).+++File: hledger.info, Node: CSV / TSV output, Next: FODS output, Prev: HTML output, Up: Output format++5.2.3 CSV / TSV output+----------------------++In CSV or TSV output, digit group marks (such as thousands separators)+are disabled automatically.+++File: hledger.info, Node: FODS output, Next: Beancount output, Prev: CSV / TSV output, Up: Output format++5.2.4 FODS output+-----------------++FODS is the OpenDocument Spreadsheet format as plain XML, as accepted by+LibreOffice and OpenOffice. If you use their spreadsheet applications,+this is better than CSV because it works across locales (decimal point+vs. decimal comma, character encoding stored in XML header, thus no+problems with umlauts), it supports fixed header rows and columns, cell+types (string vs. number vs. date), separation of number and currency+(currency is displayed but the cell type is still a number accessible+for computation), styles (bold), borders. Btw. you can still extract+CSV from FODS/ODS using various utilities like 'libreoffice --headless'+or ods2csv.+++File: hledger.info, Node: Beancount output, Next: SQL output, Prev: FODS output, Up: Output format++5.2.5 Beancount output+----------------------++This is Beancount's journal format. You can use this to export your+hledger data to Beancount, eg to use the Fava web app.++ hledger will try to adjust your data to suit Beancount,+automatically. Be cautious and check the conversion until you are+confident it is good. If you plan to export to Beancount often, you may+want to follow its conventions, for a cleaner conversion:++ * use Beancount-friendly account names+ * use currency codes instead of currency symbols+ * use cost notation instead of equity conversion postings+ * avoid virtual postings, balance assignments, and secondary dates.++ There is one big adjustment you must handle yourself: for Beancount,+the top level account names must be 'Assets', 'Liabilities', 'Equity',+'Income', and/or 'Expenses'. You can use account aliases to rewrite+your account names temporarily, if needed, as in this+hledger2beancount.conf config file.++ 2024-12-20: Some more things not yet handled for you:++ * P directives are not converted automatically - convert those+ yourself.+ * Balance assignments are not converted (Beancount doesn't support+ them) - replace those with explicit amounts.++* Menu:++* Beancount account names::+* Beancount commodity names::+* Beancount virtual postings::+* Beancount metadata::+* Beancount costs::+* Beancount operating currency::+++File: hledger.info, Node: Beancount account names, Next: Beancount commodity names, Up: Beancount output++5.2.5.1 Beancount account names+...............................++Aside from the top-level names, hledger will adjust your account names+to make valid Beancount account names, by capitalising each part,+replacing spaces with '-', replacing other unsupported characters with+'C<HEXBYTES>', prepending 'A' to account name parts which don't begin+with a letter or digit, and appending ':A' to account names which have+only one part.+++File: hledger.info, Node: Beancount commodity names, Next: Beancount virtual postings, Prev: Beancount account names, Up: Beancount output++5.2.5.2 Beancount commodity names+.................................++hledger will adjust your commodity names to make valid Beancount+commodity/currency names, which must be 2-24 uppercase letters, digits,+or ''', '.', '_', '-', beginning with a letter and ending with a letter+or digit. hledger will convert known currency symbols to ISO 4217+currency codes, capitalise letters, replace spaces with '-', replace+other unsupported characters with 'C<HEXBYTES>', and prepend or append+'C' if needed.+++File: hledger.info, Node: Beancount virtual postings, Next: Beancount metadata, Prev: Beancount commodity names, Up: Beancount output++5.2.5.3 Beancount virtual postings+..................................++Beancount doesn't allow virtual postings; if you have any, they will be+omitted from beancount output.+++File: hledger.info, Node: Beancount metadata, Next: Beancount costs, Prev: Beancount virtual postings, Up: Beancount output++5.2.5.4 Beancount metadata+..........................++hledger tags will be converted to Beancount metadata (except for tags+whose name begins with '_'). Metadata names will be adjusted to be+Beancount-compatible: beginning with a lowercase letter, at least two+characters long, and with unsupported characters encoded. Metadata+values will use Beancount's string type.++ In hledger, objects can have the same tag repeated with multiple+values. Eg an 'assets:cash' account might have both 'type:Asset' and+'type:Cash' tags. For Beancount these will be combined into one, with+the values combined, comma separated. Eg: 'type: "Asset, Cash"'.+++File: hledger.info, Node: Beancount costs, Next: Beancount operating currency, Prev: Beancount metadata, Up: Beancount output++5.2.5.5 Beancount costs+.......................++Beancount doesn't allow redundant costs and conversion postings as+hledger does. If you have any of these, the conversion postings will be+omitted. Currently we support at most one cost + conversion postings+group per transaction.+++File: hledger.info, Node: Beancount operating currency, Prev: Beancount costs, Up: Beancount output++5.2.5.6 Beancount operating currency+....................................++Declaring an operating currency (or several) improves Beancount and Fava+reports. Currently hledger will declare each currency used in cost+amounts as an operating currency. If needed, replace these with your+own declaration, like++option "operating_currency" "USD"+++File: hledger.info, Node: SQL output, Next: JSON output, Prev: Beancount output, Up: Output format++5.2.6 SQL output+----------------++SQL output is expected to work at least with SQLite, MySQL and Postgres.++ The SQL statements are expected to be executed in the empty database.+If you already have tables created via SQL output of hledger, you would+probably want to either clear data from these (via 'delete' or+'truncate' SQL statements) or 'drop' the tables completely before+import; otherwise your postings would be duplicated.++ For SQLite, it is more useful if you modify the generated 'id' field+to be a PRIMARY KEY. Eg:++$ hledger print -O sql | sed 's/id serial/id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL/g' | ...++ This is not yet much used; feedback is welcome.+++File: hledger.info, Node: JSON output, Prev: SQL output, Up: Output format++5.2.7 JSON output+-----------------++Our JSON is rather large and verbose, since it is a faithful+representation of hledger's internal data types. To understand its+structure, read the Haskell type definitions, which are mostly in+https://github.com/simonmichael/hledger/blob/master/hledger-lib/Hledger/Data/Types.hs.+hledger-web's OpenAPI specification may also be relevant.++ hledger stores numbers with sometimes up to 255 significant digits.+This is too many digits for most JSON consumers, so in JSON output we+round numbers to at most 10 decimal places. (We don't limit the number+of integer digits.) If you find this causing problems, please let us+know. Related: #1195++ This is not yet much used; feedback is welcome.+++File: hledger.info, Node: Commodity styles, Next: Debug output, Prev: Output format, Up: Output++5.3 Commodity styles+====================++When displaying amounts, hledger infers a standard display style for+each commodity/currency, as described below in Commodity display style.++ If needed, this can be overridden by a '-c/--commodity-style' option+(except for cost amounts and amounts displayed by the 'print' command,+which are always displayed with all decimal digits). For example, the+following will force dollar amounts to be displayed as shown:++$ hledger print -c '$1.000,0'++ This option can be repeated to set the display style for multiple+commodities/currencies. Its argument is as described in the commodity+directive. Note that omitting the commodity symbol will set the display+style for just the no-symbol commodity, not all commodities.++ In some cases hledger will adjust number formatting to improve their+parseability (such as adding trailing decimal marks when needed).+++File: hledger.info, Node: Debug output, Prev: Commodity styles, Up: Output++5.4 Debug output+================++We intend hledger to be relatively easy to troubleshoot, introspect and+develop. You can add '--debug[=N]' to any hledger command line to see+additional debug output. N ranges from 1 (least output, the default) to+9 (maximum output). 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:++hledger bal --debug=3 2>hledger.log++ (This option doesn't work in a config file yet.)+++File: hledger.info, Node: Environment, Next: PART 2 DATA FORMATS, Prev: Output, Up: Top++6 Environment+*************++These environment variables affect hledger:++ *HLEDGER_LESS* If 'less' is your pager, this variable specifies the+'less' options hledger should use. (Otherwise, 'LESS' + custom options+are used.)++ *LEDGER_FILE* The default journal file, to be used when no+'-f/--file' option is provided. For example, it could be+'~/finance/main.journal'. This can also be a glob pattern, eg+'./2???.journal'. (If the glob matches multiple files, only the+alphanumerically first one is used.) If LEDGER_FILE points to a+non-existent file, an error will be raised. If the value is the empty+string, it is ignored.++ If LEDGER_FILE is not set and '-f' is not provided, the default+journal file is '$HOME/.hledger.journal' (or if a home directory can't+be detected, './.hledger.journal').++ See also Common tasks > Setting LEDGER_FILE.++ *NO_COLOR* If this environment variable exists (with any value,+including empty), hledger will not use ANSI color codes in terminal+output, unless overridden by an explicit '--color=y' or '--colour=y'+option.+++File: hledger.info, Node: PART 2 DATA FORMATS, Next: Journal, Prev: Environment, Up: Top++7 PART 2: DATA FORMATS+**********************+++File: hledger.info, Node: Journal, Next: CSV, Prev: PART 2 DATA FORMATS, Up: Top++8 Journal+*********++hledger's usual data source is a plain text file containing journal+entries in hledger 'journal' format. If you're looking for a quick+reference, jump ahead to the journal cheatsheet (or use the table of+contents at https://hledger.org/hledger.html).++ This file represents an accounting General Journal. The '.journal'+file extension is most often used, though not strictly required. The+journal file contains a number of transaction entries, each describing a+transfer of money (or any commodity) between two or more named accounts,+in a simple format readable by both hledger and humans.++ hledger's journal format is compatible with most of Ledger's journal+format, but not all of it. The differences and interoperation tips are+described at hledger and Ledger. With some care, and by avoiding+incompatible features, you can keep your hledger journal readable by+Ledger and vice versa. This can useful eg for comparing the behaviour+of one app against the other.++ You can use hledger without learning any more about this file; just+use the add or web or import commands to create and update it.++ Many users, though, edit the journal file with a text editor, and+track changes with a version control system such as git. Editor add-ons+such as ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, and+hledger-vscode for Visual Studio Code, make this easier, adding colour,+formatting, tab completion, and useful commands. See Editors at+hledger.org for the full list.++ A hledger journal file can contain three kinds of thing: comment+lines, transactions, and/or directives (including periodic transaction+rules and auto posting rules). Understanding the journal file format+will also give you a good understanding of hledger's data model. Here's+a quick cheatsheet/overview, followed by detailed descriptions of each+part.++* Menu:++* Journal cheatsheet::+* Comments::+* Transactions::+* Dates::+* Status::+* Code::+* Description::+* Transaction comments::+* Postings::+* Account names::+* Amounts::+* Costs::+* Cost basis / lot syntax::+* Balance assertions::+* Posting comments::+* Transaction balancing::+* Tags::+* Directives::+* account directive::+* alias directive::+* commodity directive::+* decimal-mark directive::+* include directive::+* P directive::+* payee directive::+* tag directive::+* Periodic transactions::+* Auto postings::+* Other syntax::+++File: hledger.info, Node: Journal cheatsheet, Next: Comments, Up: Journal++8.1 Journal cheatsheet+======================++# Here is the main syntax of hledger's journal format+# (omitting extra Ledger compatibility syntax).++###############################################################################++# 1. These are comment lines, for notes or temporarily disabling things.+; They begin with # or ;++comment+Or, lines can be enclosed within "comment" / "end comment".+This is a block of +commented lines.+end comment++# Some journal entries can have semicolon comments at end of line ; like this+# Some of them require 2 or more spaces before the semicolon.++###############################################################################++# 2. Directives customise processing or output in some way.+# You don't need any directives to get started.+# But they can add more error checking, or change how things are displayed.+# They begin with a word, letter, or symbol. +# They are most often placed at the top, before transactions.++account assets ; Declare valid account names and display order.+account assets:savings ; A subaccount. This one represents a bank account.+account assets:checking ; Another. Note, 2+ spaces after the account name.+account assets:receivable ; Accounting type is inferred from english names,+account passifs ; or declared with a "type" tag, type:L+account expenses ; type:X+ ; A follow-on comment line, indented.+account expenses:rent ; Expense and revenue categories are also accounts.+ ; Subaccounts inherit their parent's type.++commodity $0.00 ; Declare valid commodities and their display styles.+commodity 1.000,00 EUR++decimal-mark . ; The decimal mark used in this file (if ambiguous).++payee Whole Foods ; Declare a valid payee name.++tag trip ; Declare a valid tag name.++P 2024-03-01 AAPL $179 ; Declare a market price for AAPL in $ on this date.++include other.journal ; Include another journal file here.++# Declare a recurring "periodic transaction", for budget/forecast reports+~ monthly set budget goals ; <- Note, 2+ spaces before the description.+ (expenses:rent) $1000+ (expenses:food) $500++# Declare an auto posting rule, to modify existing transactions in reports+= revenues:consulting+ liabilities:tax:2024:us *0.25 ; Add a tax liability & expense+ expenses:tax:2024:us *-0.25 ; for 25% of the revenue.++###############################################################################++# 3. Transactions are what it's all about.+# They are dated events, usually movements of money between 2 or more accounts.+# They begin with a numeric date.+# Here is their basic shape:+#+# DATE DESCRIPTION ; The transaction's date and optional description.+# ACCOUNT1 AMOUNT ; A posting of an amount to/from this account, indented.+# ACCOUNT2 AMOUNT ; A second posting, balancing the first.+# ... ; More if needed. Amounts must sum to zero.+# ; Note, 2+ spaces between account names and amounts.++2024-01-01 opening balances ; At the start, declare pre-existing balances this way.+ assets:savings $10000 ; Account names can be anything. lower case is easy to type.+ assets:checking $1000 ; assets, liabilities, equity, revenues, expenses are common.+ liabilities:credit card $-500 ; liabilities, equity, revenues balances are usually negative.+ equity:start ; One amount can be left blank. $-10500 is inferred here.+ ; Some of these accounts we didn't declare above,+ ; so -s/--strict would complain.++2024-01-03 ! (12345) pay rent+ ; Additional transaction comment lines, indented.+ ; There can be a ! or * after the date meaning "pending" or "cleared".+ ; There can be a parenthesised (code) after the date/status.+ ; Amounts' sign shows direction of flow.+ assets:checking $-500 ; Minus means removed from this account (credit).+ expenses:rent $500 ; Plus means added to this account (debit).++; Keeping transactions in date order is optional (but helps error checking).++2024-01-02 Gringott's Bank | withdrawal ; Description can be PAYEE | NOTE+ assets:bank:gold -10 gold+ assets:pouch 10 gold++2024-01-02 shopping+ expenses:clothing 1 gold+ expenses:wands 5 gold+ assets:pouch -6 gold++2024-01-02 receive gift+ revenues:gifts -3 "Chocolate Frogs" ; Complex commodity symbols+ assets:pouch 3 "Chocolate Frogs" ; must be in double quotes.++2024-01-15 buy some shares, in two lots ; Cost can be noted.+ assets:investments:2024-01-15 2.0 AAAA @ $1.50 ; @ means per-unit cost+ assets:investments:2024-01-15-02 3.0 AAAA @@ $4 ; @@ means total cost+ ; ^ Per-lot subaccounts are sometimes useful.+ assets:checking $-7++2024-01-15 assert some account balances on this date+ ; Balances can be asserted in any transaction, with =, for extra error checking.+ ; Assertion txns like this one can be made with hledger close --assert --show-costs+ ;+ assets:savings $0 = $10000+ assets:checking $0 = $493+ assets:bank:gold 0 gold = -10 gold+ assets:pouch 0 gold = 4 gold+ assets:pouch 0 "Chocolate Frogs" = 3 "Chocolate Frogs"+ assets:investments:2024-01-15 0.0 AAAA = 2.0 AAAA @ $1.50+ assets:investments:2024-01-15-02 0.0 AAAA = 3.0 AAAA @@ $4+ liabilities:credit card $0 = $-500++2024-02-01 note some event, or a transaction not yet fully entered, on this date+ ; Postings are not required.++# Consistent YYYY-MM-DD date format is recommended,+# but you can use . or / and omit leading zeros if you prefer.+2024.01.01+2024/1/1+++File: hledger.info, Node: Comments, Next: Transactions, Prev: Journal cheatsheet, Up: Journal++8.2 Comments+============++Lines in the journal will be ignored if they begin with a hash ('#') or+a semicolon (';'). (See also Other syntax.) hledger will also ignore+regions beginning with a 'comment' line and ending with an 'end comment'+line (or file end). Here's a suggestion for choosing between them:++ * '#' for top-level notes+ * ';' for commenting out things temporarily+ * 'comment' for quickly commenting large regions (remember it's+ there, or you might get confused)++ Eg:++# a comment line+; another commentline+comment+A multi-line comment block,+continuing until "end comment" directive+or the end of the current file.+end comment++ Some hledger entries can have same-line comments attached to them,+from ; (semicolon) to end of line. See Transaction comments, Posting+comments, and Account comments below.+++File: hledger.info, Node: Transactions, Next: Dates, Prev: Comments, Up: Journal++8.3 Transactions+================++Transactions are the main unit of information in a journal file. They+represent events, typically a movement of some quantity of commodities+between two or more named accounts.++ Each transaction is recorded as a journal entry, beginning with a+simple date in column 0. This can be followed by any of the following+optional fields, separated by spaces:++ * a status character (empty, '!', or '*')+ * a code (any short number or text, enclosed in parentheses)+ * a description (any remaining text until end of line or a semicolon)+ * a comment (any remaining text following a semicolon until end of+ line, and any following indented lines beginning with a semicolon)+ * 0 or more indented _posting_ lines, describing what was transferred+ and the accounts involved (indented comment lines are also allowed,+ but not blank lines or non-indented lines).++ Here's a simple journal file containing one transaction:++2008/01/01 income+ assets:bank:checking $1+ income:salary $-1+++File: hledger.info, Node: Dates, Next: Status, Prev: Transactions, Up: Journal++8.4 Dates+=========++* Menu:++* Simple dates::+* Posting dates::+++File: hledger.info, Node: Simple dates, Next: Posting dates, Up: Dates++8.4.1 Simple dates+------------------++Dates in the journal file use _simple dates_ format: 'YYYY-MM-DD' or+'YYYY/MM/DD' or 'YYYY.MM.DD', with leading zeros optional. The year may+be omitted, in which case it will be inferred from the context: the+current transaction, the default year set with a 'Y' directive, or the+current date when the command is run. Some examples: '2010-01-31',+'2010/01/31', '2010.1.31', '1/31'.++ (The UI also accepts simple dates, as well as the more flexible smart+dates documented in the hledger manual.)+++File: hledger.info, Node: Posting dates, Prev: Simple dates, Up: Dates++8.4.2 Posting dates+-------------------++You can give individual postings a different date from their parent+transaction, by adding a posting comment containing a tag (see below)+like '; date:DATE'. (There's also a Ledger-compatible syntax, ';+[DATE]', which can be convenient.)++ This is probably the best way to control posting dates precisely. Eg+in this example the expense should appear in May reports, and the+deduction from checking should be reported on 6/1 for easy bank+reconciliation:++2015/5/30+ expenses:food $10 ; food purchased on saturday 5/30+ assets:checking ; bank cleared it on monday, date:6/1++$ hledger -f t.j register food+2015-05-30 expenses:food $10 $10++$ hledger -f t.j register checking+2015-06-01 assets:checking $-10 $-10++ DATE should be a simple date; if the year is not specified it will+use the year of the transaction's date.+The 'date:' tag must have a valid simple date value if it is present, eg+a 'date:' tag with no value is not allowed.+++File: hledger.info, Node: Status, Next: Code, Prev: Dates, Up: Journal++8.5 Status+==========++Transactions (or individual postings within a transaction) can have a+status mark, which is a single character before the transaction+description (or posting account name), separated from it by a space,+indicating one of three statuses:++mark status+ +-----------------+ unmarked+'!' pending+'*' cleared++ When reporting, you can filter by status with the '-U/--unmarked',+'-P/--pending', and '-C/--cleared' flags (and you can combine these, eg+'-UP' to match all except cleared things). Or you can use the+'status:', 'status:!', and 'status:*' queries, or the U, P, C keys in+hledger-ui.++ (Note: in Ledger the "unmarked" state is called "uncleared"; in+hledger we renamed it to "unmarked" for semantic clarity.)++ Status marks are optional, but can be helpful eg for reconciling with+real-world accounts. Some editor modes provide highlighting and+shortcuts for working with status. Eg in Emacs ledger-mode, you can+toggle transaction status with C-c C-e, or posting status with C-c C-c.++ What "uncleared", "pending", and "cleared" actually mean is up to+you. Here's one suggestion:++status meaning+--------------------------------------------------------------------------+uncleared recorded but not yet reconciled; needs review+pending tentatively reconciled (if needed, eg during a big+ reconciliation)+cleared complete, reconciled as far as possible, and considered+ correct++ With this scheme, you would use '-PC' to see the current balance at+your bank, '-U' to see things which will probably hit your bank soon+(like uncashed checks), and no flags to see the most up-to-date state of+your finances.+++File: hledger.info, Node: Code, Next: Description, Prev: Status, Up: Journal++8.6 Code+========++After the status mark, but before the description, you can optionally+write a transaction "code", such as a check number or transaction id,+enclosed in parentheses,++ This has a few limitations: The code must not contain a closing+parenthesis (or it will be truncated). Codes tend to disrupt alignment+of the register report, making it harder to scan visually. And you+can't store more than one value there per transaction. For these+reasons you might want to avoid the code field and use tags(#tags]+instead.+++File: hledger.info, Node: Description, Next: Transaction comments, Prev: Code, Up: Journal++8.7 Description+===============++After the date, status mark and/or code fields, the rest of the line (or+until a comment is begun with ';') is the transaction's description.+Here you can describe the transaction (called the "narration" in+traditional bookkeeping), or you can record a payee/payer name, or you+can leave it empty.++ Transaction descriptions show up in print output and in register+reports, and can be listed with the descriptions command.++ You can query by description with 'desc:DESCREGEX', or pivot on+description with '--pivot desc'.++* Menu:++* Payee and note::+++File: hledger.info, Node: Payee and note, Up: Description++8.7.1 Payee and note+--------------------++Sometimes people want a dedicated payee/payer field that can be queried+and checked more strictly. If you want that, you can write a '|' (pipe)+character in the description. This divides it into a "payee" field on+the left, and a "note" field on the right. (Either can be empty.)++ You can query these with 'payee:PAYEEREGEX' and 'note:NOTEREGEX',+list their values with the payees and notes commands, or pivot on+'payee' or 'note'.++ Note: in transactions with no '|' character, description, payee, and+note all have the same value. Once a '|' is added, they become+distinct. (If you'd like to change this behaviour, please propose it on+the mail list.)++ If you want more strict error checking, you can declare the valid+payee names with payee directives, and then enforce these with hledger+check payees. (Note: because of the above, for this you'll need to+ensure every transaction description contains a '|' and therefore a+checkable payee name, even if it's empty.)+++File: hledger.info, Node: Transaction comments, Next: Postings, Prev: Description, Up: Journal++8.8 Transaction comments+========================++Text following ';', after a transaction description, and/or on indented+lines immediately below it, form comments for that transaction. They+are reproduced by 'print' but otherwise ignored, except they may contain+tags, which are not ignored.++2012-01-01 something ; a transaction comment+ ; a second line of transaction comment+ expenses 1+ assets+++File: hledger.info, Node: Postings, Next: Account names, Prev: Transaction comments, Up: Journal++8.9 Postings+============++A posting is an addition of some amount to, or removal of some amount+from, an account. Each posting line begins with at least one space or+tab (2 or 4 spaces is common), followed by:++ * (optional) a status character (empty, '!', or '*'), followed by a+ space+ * (required) an account name (any text, optionally including single+ spaces. If anything follows the account name on the same line, the+ account name must be ended by *two or more spaces*.)+ * (optional) an amount+ * (optional) a same-line posting comment, beginning with a semicolon+ (';').++ If the amount is positive, it is being added to the account; if+negative, it is being removed from the account.++ The posting amounts in a transaction must sum up to zero, indicating+that the inflows and outflows are equal. We call this a balanced+transaction. (You can read more about the details of transaction+balancing below.)++ If no amount is written, it will be calculated automatically from the+other postings in the transaction, so as to balance the transaction. In+other words, in any transaction you can leave one posting amountless to+save typing.++* Menu:++* Debits and credits::+++File: hledger.info, Node: Debits and credits, Up: Postings++8.9.1 Debits and credits+------------------------++The traditional accounting concepts of debit and credit of course exist+in hledger, but we represent them with numeric sign. Positive and+negative posting amounts represent debits and credits respectively.++ You don't need to remember that, but if you would like to - eg for+helping newcomers or for talking with your accountant - here's a handy+mnemonic:++ _'debit / plus / left / short words'_+_'credit / minus / right / longer words'_+++File: hledger.info, Node: Account names, Next: Amounts, Prev: Postings, Up: Journal++8.10 Account names+==================++Accounts are the main way of categorising things in hledger. As in+Double Entry Bookkeeping, they can represent real world accounts (such+as a bank account), or more abstract categories such as "money spent on+food" or "money borrowed from Frank".++ Account names are flexible. They may be capitalised or not; they may+contain letters, numbers, punctuation, symbols, or single spaces; they+may be in any language.++ Typically we use the five traditional accounting categories as the+starting point for account names. In english they are:++ 'assets', 'liabilities', 'equity', 'revenues', 'expenses'++ These will be discussed more in Account types below. In hledger docs+you may see them referred to as A, L, E, R, X for short.++* Menu:++* Two space delimiter::+* Account hierarchy::+* Other account name features::+++File: hledger.info, Node: Two space delimiter, Next: Account hierarchy, Up: Account names++8.10.1 Two space delimiter+--------------------------++Note the *two or more spaces* delimiter that's sometimes required after+account names. hledger's account names, inherited from Ledger, are very+permissive; they may contain pretty much any kind of text, including+single spaces and semicolons. Because of this, they must be terminated+by *two or more spaces* if there is anything following them on the same+line. For example, if an amount, balance assignment, or same-line+comment follows an account name, they must be preceded by two or more+spaces, else they would be considered part of the account name:++bad: assets:accounts receivable $10 ; <- too close!+good: assets:accounts receivable $10++bad: assets:accounts receivable =$1000 ; <- too close!+good: assets:accounts receivable =$1000++bad: assets:accounts receivable ; comment. <- too close!+good: assets:accounts receivable ; comment++ This two-space delimiter appears in a few places in hledger, such as+after account names in postings or account directives; also after the+period expression in periodic transaction rules. When you are starting+out, expect it to catch you out at least once. It's annoying sometimes,+but it lets us use expressive account names while still keeping the+syntax light.+++File: hledger.info, Node: Account hierarchy, Next: Other account name features, Prev: Two space delimiter, Up: Account names++8.10.2 Account hierarchy+------------------------++For more precise reporting, we usually divide accounts into more+detailed subaccounts, subsubaccounts, and so on, by writing a full colon+between account name parts. For example, instead of writing 'assets'+and 'expenses', we might write 'assets:bank:checking' and+'expenses:food'. From these names hledger will infer this hierarchy of+five accounts:++assets+assets:bank+assets:bank:checking+expenses+expenses:food++ Or as an outline:++assets+ bank+ checking+expenses+ food++ hledger reports can summarise the account tree to any depth, so you+can make your subcategories as detailed as you like. But don't go+overboard, especially when getting started; simpler categories can be+less work.+++File: hledger.info, Node: Other account name features, Prev: Account hierarchy, Up: Account names++8.10.3 Other account name features+----------------------------------++Enclosing the account name in parentheses or brackets, like+'(expenses:food)', enables a non-standard bookkeeping feature: virtual+postings.++ Account names can be rewritten and restructured, temporarily or+permanently, by account aliases.+++File: hledger.info, Node: Amounts, Next: Costs, Prev: Account names, Up: Journal++8.11 Amounts+============++After the account name, there is usually an amount. (Remember: between+account name and amount, there must be two or more spaces.)++ hledger's amount format is flexible, supporting several international+formats. Here are some examples. Amounts have a number (the+"quantity"):++1++ ..and usually a currency symbol or commodity name (more on this+below), to the left or right of the quantity, with or without a+separating space:++$1+4000 AAPL+3 "green apples"++ Amounts can be preceded by a minus sign (or a plus sign, though plus+is the default), The sign can be written before or after a left-side+commodity symbol:++-$1+$-1++ One or more spaces between the sign and the number are acceptable+when parsing (but they won't be displayed in output):+++ $1+$- 1++ Scientific E notation is allowed:++1E-6+EUR 1E3++* Menu:++* Decimal marks::+* Digit group marks::+* Commodity::+++File: hledger.info, Node: Decimal marks, Next: Digit group marks, Up: Amounts++8.11.1 Decimal marks+--------------------++A _decimal mark_ can be written as a period or a comma:++1.23+1,23++ Both of these are common in international number formats, so hledger+is not biased towards one or the other. Because hledger also supports+digit group marks (eg thousands separators), this means that a number+like '1,000' or '1.000' containing just one period or comma is+ambiguous. In such cases, hledger by default assumes it is a decimal+mark, and will parse both of those as 1.++ To help hledger parse such ambiguous numbers more accurately, if you+use digit group marks, we recommend declaring the decimal mark+explicitly. The best way is to add a 'decimal-mark' directive at the+top of each data file, like this:++decimal-mark .++ Or you can declare it per commodity with 'commodity' directives,+described below.++ hledger also accepts numbers like '10.' with no digits after the+decimal mark (and will sometimes display numbers that way to+disambiguate them - see Trailing decimal marks).+++File: hledger.info, Node: Digit group marks, Next: Commodity, Prev: Decimal marks, Up: Amounts++8.11.2 Digit group marks+------------------------++In the integer part of the amount quantity (left of the decimal mark),+groups of digits can optionally be separated by a _digit group mark_ - a+comma or period (whichever is not used as decimal mark), or a space+(several Unicode space variants, like no-break space, are also+accepted). So these are all valid amounts in a journal file:++ $1,000,000.00+ EUR 2.000.000,00+INR 9,99,99,999.00+ 1 000 000.00 ; <- ordinary space + 1 000 000.00 ; <- no-break space+++File: hledger.info, Node: Commodity, Prev: Digit group marks, Up: Amounts++8.11.3 Commodity+----------------++Amounts in hledger have both a "quantity", which is a signed decimal+number, and a "commodity", which is a currency symbol, stock ticker, or+any word or phrase describing something you are tracking.++ If the commodity name contains non-letters (spaces, numbers, or+punctuation), you must always write it inside double quotes ('"green+apples"', '"ABC123"').++ If you write just a bare number, that too will have a commodity, with+name '""'; we call that the "no-symbol commodity".++ Actually, hledger combines these single-commodity amounts into more+powerful multi-commodity amounts, which are what it works with most of+the time. A multi-commodity amount could be, eg: '1 USD, 2 EUR, 3.456+TSLA'. In practice, you will only see multi-commodity amounts in+hledger's output; you can't write them directly in the journal file.++ By default, the format of amounts in the journal influences how+hledger displays them in output. This is explained in Commodity display+style below.+++File: hledger.info, Node: Costs, Next: Cost basis / lot syntax, Prev: Amounts, Up: Journal++8.12 Costs+==========++In traditional double entry bookkeeping, to record a transaction where+one commodity is exchanged for another, you add extra equity postings to+balance the two commodities. Eg:++2026-01-01 buy euros+ assets:dollars $-123+ equity:conversion $123+ equity:conversion €-100+ assets:euros €100++ hledger offers a more convenient @/@@ "cost notation" as an+alternative: instead of equity postings, you can write the "conversion+rate" or "transacted price" after a posting amount. hledger docs+generically call this "cost", whether buying or selling. It can be+written as either '@ UNITPRICE' or '@@ TOTALPRICE'. Eg you could write+the above as:++2026-01-01 buy euros+ assets:dollars $-123+ assets:euros €100 @ $1.23 ; unit cost (exchange rate)++ or:++2026-01-01 buy euros+ assets:dollars $-123+ assets:euros €100 @@ $123 ; total cost++ The cost should normally be a positive amount. Negative costs are+supported, but can be confusing, as discussed at -infer-market-prices:+market prices from transactions.++ Costs participate in transaction balancing. Amounts are converted to+their cost before checking if the transaction is balanced. You could+also write the above less redundantly, like so:++2026-01-01 buy euros+ assets:dollars ; $-123 is inferred+ assets:euros €100 @ $1.23++ or:++2026-01-01 buy euros+ assets:dollars ; $-123 is inferred+ assets:euros €100 @@ $123++ or even:++2026-01-01 buy euros+ assets:euros €100 ; @@ $123 is inferred+ assets:dollars $-123++ This last form works for transactions involving exactly two+commodities, with neither cost notation nor equity postings. Note, the+order of postings is significant: the cost will be attached to the first+(top) posting. So we had to switch the order of postings, to get the+same meaning as above. Also, this form is the easiest to make+undetected errors with; so it is rejected by 'hledger check balanced',+and by strict mode.++ Advantages of cost notation:++ 1. it's more compact and easier to read and write+ 2. hledger reports can show such amounts converted to their cost, when+ you add the '-B/--cost' flag (see Cost reporting).++ Advantages of equity postings++ 1. they help to keep the accounting equation balanced (if you care+ about that)+ 2. they translate easily to any other double entry accounting system.++ Most hledger users use cost notation and don't use equity postings.++ But you can always convert cost notation to equity postings by adding+'--infer-equity'. Eg try 'hledger print -x --infer-equity'.++ And you can usually convert equity postings to cost notation by+adding '--infer-costs' (see Requirements for detecting equity conversion+postings). Eg try 'hledger print -x --infer-costs'.++ Finally: using both equity postings and cost notation at the same+time is allowed, as long as the journal entry is well formed such that+the equity postings / cost equivalences can be detected. (Otherwise+you'll get an error message saying that the transaction is unbalanced.):++2026-01-01 buy euros+ assets:dollars $-123+ equity:conversion $123+ equity:conversion €-100+ assets:euros €100 @ $1.23++ So in principle you could enable both '--infer-equity' and+'--infer-costs' in your config file, and your reports would have the+advantages of both.+++File: hledger.info, Node: Cost basis / lot syntax, Next: Balance assertions, Prev: Costs, Up: Journal++8.13 Cost basis / lot syntax+============================++If you are buying some commodity to hold as an investment, it may be+important to keep track of++ 1. its original acquisition cost+ 2. its original acquisition date+ 3. and a sequence number or label, if needed, to disambiguate multiple+ acquisitions on the same day, or to serve as a mnemonic for easy+ reference.++ In hledger we call these three the "cost basis"; and if an amount+being acquired has a cost basis, we call it a "lot". Tax authorities+often require that lots are tracked carefully and disposed of (sold) in+a certain order.++ Note, though "cost basis" sounds similar to the "cost" (transacted+price) discussed above, they are distinct concepts. In some+transactions the transacted price and basis cost are the same, but in+others they are not.++ So cost basis has its own syntax, also called "lot syntax".+hledger's lot syntax is like Ledger's: one or more of the following+annotations, following the main amount:++ * '{LOTUNITCOST}' or '{{LOTTOTALCOST}}' (see lot price)+ * '[LOTDATE]' (see lot date)+ * '(LOTLABEL)' (see lot note)++ hledger does not yet do anything with this lot syntax, except to+preserve it and show it in 'print''s 'txt', 'beancount', and 'json'+output. This means you can use this syntax in your hledger journals+(plus an amountless extra posting to help transactions balance, if+needed), then use the 'print' command to export to Ledger or Beancount+or rustledger, to use their lots/gains reports (see Export Lots+workflow).+++File: hledger.info, Node: Balance assertions, Next: Posting comments, Prev: Cost basis / lot syntax, Up: Journal++8.14 Balance assertions+=======================++hledger supports Ledger-style balance assertions in journal files.+These look like, for example, '= EXPECTEDBALANCE' following a posting's+amount. Eg here we assert the expected dollar balance in accounts a and+b after each posting:++2013/1/1+ a $1 = $1+ b = $-1++2013/1/2+ a $1 = $2+ b $-1 = $-2++ After reading a journal file, hledger will check all balance+assertions and report an error if any of them fail. Balance assertions+can protect you from, eg, inadvertently disrupting reconciled balances+while cleaning up old entries. You can disable them temporarily with+the '-I/--ignore-assertions' flag, which can be useful for+troubleshooting or for reading Ledger files. (Note: this flag currently+does not disable balance assignments, described below).++* Menu:++* Assertions and ordering::+* Assertions and multiple files::+* Assertions and costs::+* Assertions and commodities::+* Assertions and subaccounts::+* Assertions and status::+* Assertions and virtual postings::+* Assertions and auto postings::+* Assertions and precision::+* Assertions and hledger add::+++File: hledger.info, Node: Assertions and ordering, Next: Assertions and multiple files, Up: Balance assertions++8.14.1 Assertions and ordering+------------------------------++hledger calculates and checks an account's balance assertions in date+order (and when there are multiple assertions on the same day, in parse+order). Note this is different from Ledger, which checks assertions+always in parse order, ignoring dates.++ This means in hledger you can freely reorder transactions, postings,+or files, and balance assertions will usually keep working. The+exception is when you reorder multiple postings on the same day, to the+same account, which have balance assertions; those will likely need+updating.+++File: hledger.info, Node: Assertions and multiple files, Next: Assertions and costs, Prev: Assertions and ordering, Up: Balance assertions++8.14.2 Assertions and multiple files+------------------------------------++If an account has transactions appearing in multiple files, balance+assertions can still work - but _only if those files are part of a+hierarchy made by include directives_.++ If the same files are specified with two '-f' options on the command+line, the assertions in the second will not see the balances from the+first.++ To work around this, arrange your files in a hierarchy with+'include'. Or, you could concatenate the files temporarily, and process+them like one big file.++ Why does it work this way ? It might be related to hledger's goal of+stable predictable reports. File hierarchy is considered "permanent",+part of your data, while the order of command line options/arguments is+not. We don't want transient changes to be able to change the meaning+of the data. Eg it would be frustrating if tomorrow all your balance+assertions broke because you wrote command line arguments in a different+order. (Discussion welcome.)+++File: hledger.info, Node: Assertions and costs, Next: Assertions and commodities, Prev: Assertions and multiple files, Up: Balance assertions++8.14.3 Assertions and costs+---------------------------++Balance assertions ignore costs, and should normally be written without+one:++2019/1/1+ (a) $1 @ €1 = $1++ We do allow costs to be written in balance assertion amounts,+however, and print shows them, but they don't affect whether the+assertion passes or fails. This is for backward compatibility+(hledger's close command used to generate balance assertions with+costs), and because balance _assignments_ do use costs (see below).+++File: hledger.info, Node: Assertions and commodities, Next: Assertions and subaccounts, Prev: Assertions and costs, Up: Balance assertions++8.14.4 Assertions and commodities+---------------------------------++The balance assertions described so far are "*single commodity balance+assertions*": they assert and check the balance in one commodity,+ignoring any others that may be present. This is how balance assertions+work in Ledger also.++ If an account contains multiple commodities, you can assert their+balances by writing multiple postings with balance assertions, one for+each commodity:++2013/1/1+ usd $-1+ eur €-1+ both++2013/1/2+ both 0 = $1+ both 0 = €1++ In hledger you can make a stronger "*sole commodity balance+assertion*" by writing two equals signs ('== EXPECTEDBALANCE'). This+also asserts that there are no other commodities in the account besides+the asserted one (or at least, that their current balance is zero):++2013/1/1+ usd $-1 == $-1 ; these sole commodity assertions succeed+ eur €-1 == €-1+ both ;== $1 ; this one would fail because 'both' contains $ and €++ It's less easy to make a "*sole commodities balance assertion*" (note+the plural) - ie, asserting that an account contains two or more+specified commodities and no others. It can be done by++ 1. isolating each commodity in a subaccount, and asserting those+ 2. and also asserting there are no commodities in the parent account+ itself:++2013/1/1+ usd $-1+ eur €-1+ both 0 == 0 ; nothing up my sleeve+ both:usd $1 == $1 ; a dollar here+ both:eur €1 == €1 ; a euro there+++File: hledger.info, Node: Assertions and subaccounts, Next: Assertions and status, Prev: Assertions and commodities, Up: Balance assertions++8.14.5 Assertions and subaccounts+---------------------------------++All of the balance assertions above (both '=' and '==') are+"*subaccount-exclusive balance assertions*"; they ignore any balances+that exist in deeper subaccounts.++ In hledger you can make "*subaccount-inclusive balance assertions*"+by adding a star after the equals ('=*' or '==*'):++2019/1/1+ equity:start+ assets:checking $10+ assets:savings $10+ assets $0 ==* $20 ; assets + subaccounts contains $20 and nothing else+++File: hledger.info, Node: Assertions and status, Next: Assertions and virtual postings, Prev: Assertions and subaccounts, Up: Balance assertions++8.14.6 Assertions and status+----------------------------++Balance assertions always consider postings of all statuses (unmarked,+pending, or cleared); they are not affected by the '-U'/'--unmarked' /+'-P'/'--pending' / '-C'/'--cleared' flags or the 'status:' query.+++File: hledger.info, Node: Assertions and virtual postings, Next: Assertions and auto postings, Prev: Assertions and status, Up: Balance assertions++8.14.7 Assertions and virtual postings+--------------------------------------++Balance assertions always consider both real and virtual postings; they+are not affected by the '--real/-R' flag or 'real:' query.+++File: hledger.info, Node: Assertions and auto postings, Next: Assertions and precision, Prev: Assertions and virtual postings, Up: Balance assertions++8.14.8 Assertions and auto postings+-----------------------------------++Balance assertions _are_ affected by the '--auto' flag, which generates+auto postings, which can alter account balances. Because auto postings+are optional in hledger, accounts affected by them effectively have two+balances. But balance assertions can only test one or the other of+these. So to avoid making fragile assertions, either:++ * assert the balance calculated with '--auto', and always use+ '--auto' with that file+ * or assert the balance calculated without '--auto', and never use+ '--auto' with that file+ * or avoid balance assertions on accounts affected by auto postings+ (or avoid auto postings entirely).+++File: hledger.info, Node: Assertions and precision, Next: Assertions and hledger add, Prev: Assertions and auto postings, Up: Balance assertions++8.14.9 Assertions and precision+-------------------------------++Balance assertions compare the exactly calculated amounts, which are not+always what is shown by reports. Eg a commodity directive may limit the+display precision, but this will not affect balance assertions. Balance+assertion failure messages show exact amounts.+++File: hledger.info, Node: Assertions and hledger add, Prev: Assertions and precision, Up: Balance assertions++8.14.10 Assertions and hledger add+----------------------------------++Balance assertions can be included in the amounts given in 'add'. All+types of assertions are supported, and assertions can be used as in a+normal journal file.++ All transactions, not just those that have an explicit assertion, are+validated against the existing assertions in the journal. This means it+is possible for an added transaction to fail even if its assertions are+correct as of the transaction date.++ If this assertion checking is not desired, then it can be disabled+with '-I'.++ However, balance assignments are currently not supported.+++File: hledger.info, Node: Posting comments, Next: Transaction balancing, Prev: Balance assertions, Up: Journal++8.15 Posting comments+=====================++Text following ';', at the end of a posting line, and/or on indented+lines immediately below it, form comments for that posting. They are+reproduced by 'print' but otherwise ignored, except they may contain+tags, which are not ignored.++2012-01-01+ expenses 1 ; a comment for posting 1+ assets+ ; a comment for posting 2+ ; a second comment line for posting 2+++File: hledger.info, Node: Transaction balancing, Next: Tags, Prev: Posting comments, Up: Journal++8.16 Transaction balancing+==========================++How exactly does hledger decide when a transaction is balanced ?+Especially when it involves costs, which often are not exact, because of+repeating decimals, or imperfect data from financial institutions ? In+each commodity, hledger sums the transaction's posting amounts, after+converting any with costs; then it checks if that sum is zero, when+rounded to a suitable number of decimal digits - which we call the+_balancing precision_.++ Since version 1.50, hledger infers balancing precision in each+transaction from the amounts in that transaction's journal entry (like+Ledger). Ie, when checking the balance of commodity A, it uses the+highest decimal precision seen for A in the journal entry (excluding+cost amounts). This makes transaction balancing robust; any imbalances+must be visibly accounted for in the journal entry, display precision+can be freely increased with '-c', and compatibility with Ledger and+Beancount journals is good.++ Note that hledger versions before 1.50 worked differently: they+allowed display precision to override the balancing precision. This+masked small imbalances and caused fragility (see issue #2402). As a+result, some journal entries (or CSV rules) that worked with hledger+<1.50, are now rejected with an "unbalanced transaction" error. If you+hit this problem, it's easy to fix:++ * You can restore the old behaviour, by adding '--txn-balancing=old'+ to the command or to your '~/.hledger.conf' file. This lets you+ keep using old journals unchanged, though without the above+ benefits.++ * Or you can fix the problem entries (recommended). There are three+ ways, use whichever seems best:++ 1. make cost amounts more precise (add more/better decimal+ digits)+ 2. or make non-cost amounts less precise (remove unnecessary+ decimal digits that are raising the precision)+ 3. or add a posting to absorb the imbalance (eg+ "expenses:rounding". Remember that one posting may omit the+ amount; that's convenient here.)+++File: hledger.info, Node: Tags, Next: Directives, Prev: Transaction balancing, Up: Journal++8.17 Tags+=========++Tags are a way to add extra labels or data fields to transactions,+postings, or accounts, which you can match with a 'tag:' query in+reports. (See queries below.)++ Tags are a single word or hyphenated word, immediately followed by a+full colon, written within a comment. (Yes, storing data in comments is+slightly weird.) Here's a transaction with a tag:++2025-01-01 groceries ; some-tag:+ assets:checking+ expenses:food $1++ A tag can have a value, a single line of text written after the+colon. Tag values can't contain newlines.:++2025-01-01 groceries ; tag1: this is tag1's value++ Multiple tags can be separated by comma. Tag values can't contain+commas.:++2025-01-01 groceries ; tag1:value 1, tag2:value 2, comment text++ A tag can have multiple values:++2025-01-01 groceries ; tag1:value 1, tag1:value 2++ You can write each tag on its own line of you prefer (but they still+can't contain commas):++2025-01-01 groceries+ ; tag1: value 1+ ; tag2: value 2++ Tags can be attached to individual postings, rather than the overall+transaction:++2025-01-01 rent+ assets:checking+ expenses:rent $1000 ; postingtag:++ Tags can be attached to accounts, in their account directive:++account assets:checking ; acct-number: 123-45-6789++* Menu:++* Tag propagation::+* Displaying tags::+* When to use tags ?::+* Tag names::+++File: hledger.info, Node: Tag propagation, Next: Displaying tags, Up: Tags++8.17.1 Tag propagation+----------------------++In addition to what they are attached to, tags also affect related data+in a few ways, allowing more powerful queries:++ 1. Accounts -> postings. Postings inherit tags from their account.+ 2. Transactions -> postings. Postings inherit tags from their+ transaction.+ 3. Postings -> transactions. Transactions also acquire the tags of+ their postings.++ So when you use a 'tag:' query to match whole transactions,+individual postings, or accounts, it's good to understand how tags+behave. Here's an example showing all three kinds of propagation:++account assets:checking+account expenses:food ; atag:++2025-01-01 groceries ; ttag:+ assets:checking ; p1tag:+ expenses:food $1 ; p2tag:++data part has tags explanation+---------------------------------------------------------------------------+assets:checking account no tags attached+expenses:food atag atag: in comment+account+assets:checkingp1tag, ttag p1tag: in comment, ttag acquired from+posting transaction+expenses:food p2tag, atag, p2tag: in comment, atag from account, ttag+posting ttag from transaction+groceries ttag, p1tag, ttag: in comment, p1tag from first+transaction p2tag, atag posting, p2tag and atag from second+ posting+++File: hledger.info, Node: Displaying tags, Next: When to use tags ?, Prev: Tag propagation, Up: Tags++8.17.2 Displaying tags+----------------------++You can use the 'tags' command to list tag names or values.++ The 'print' command also shows tags.++ You can use -pivot to display tag values in other reports, in various+ways (eg appended to account names, like pseudo subaccounts).+++File: hledger.info, Node: When to use tags ?, Next: Tag names, Prev: Displaying tags, Up: Tags++8.17.3 When to use tags ?+-------------------------++Tags provide more dimensions of categorisation, complementing accounts+and transaction descriptions. When to use each of these is somewhat a+matter of taste. Accounts have the most built-in support, and regex+queries on descriptions are also quite powerful. So you may not need+tags at all. But if you want to track multiple cross-cutting+categories, they can be a good fit. For example, you could tag+trip-related transactions with 'trip: YEAR:PLACE', without disturbing+your usual account categories.+++File: hledger.info, Node: Tag names, Prev: When to use tags ?, Up: Tags++8.17.4 Tag names+----------------++What is allowed in a tag name ? Most non-whitespace characters. Eg '😀+:' is a valid tag.++ For extra error checking, you can declare valid tag names with the+'tag' directive, and then enforce these with the 'check' command. But+note that tags are detected quite loosely at present, sometimes where+you didn't intend them. Eg a comment like '; see https://foo.com' adds+a 'https' tag.++ There are several tag names which have special significance to+hledger. They are explained elsewhere, but here's a quick reference:++ type -- declares an account's type+ date -- overrides a posting's date+ date2 -- overrides a posting's secondary date+ assert -- appears on txns generated by close --assert+ retain -- appears on txns generated by close --retain+ start -- appears on txns generated by close --migrate/--close/--open/--assign+ t -- appears on postings generated from timedot letters++ generated-transaction -- appears on txns generated by a periodic rule+ modified-transaction -- appears on txns which have had auto postings added+ generated-posting -- appears on generated postings+ cost-posting -- appears on postings which have (or could have) a cost,+ and which have equivalent conversion postings in the transaction+ conversion-posting -- appears on postings which are to a V/Conversion account+ and which have an equivalent cost posting in the transaction++ The second group above (generated-transaction, etc.) are normally+hidden, with a '_' prefix added. This means 'print' doesn't show them+by default; but you can still use them in queries. You can add the+'--verbose-tags' flag to make them visible in 'print' output, which can+be useful for troubleshooting.+++File: hledger.info, Node: Directives, Next: account directive, Prev: Tags, Up: Journal++8.18 Directives+===============++Besides transactions, there is something else you can put in a 'journal'+file: directives. These are declarations, beginning with a keyword,+that modify hledger's behaviour. Some directives can have more specific+subdirectives, indented below them. hledger's directives are similar to+Ledger's in many cases, but there are also many differences. Directives+are not required, but can be useful. Here are the main directives:++purpose directive+--------------------------------------------------------------------------+*READING DATA:*+Rewrite account names 'alias'+Comment out sections of the file 'comment'+Declare file's decimal mark, to help 'decimal-mark'+parse amounts accurately+Include other data files 'include'+*GENERATING DATA:*+Generate recurring transactions or '~'+budget goals+Generate extra postings on existing '='+transactions+*CHECKING FOR ERRORS:*+Define valid entities to provide more 'account', 'commodity',+error checking 'payee', 'tag'+*REPORTING:*+Declare accounts' type and display 'account'+order+Declare commodity display styles 'commodity'+Declare market prices 'P'++* Menu:++* Directives and multiple files::+* Directive effects::+++File: hledger.info, Node: Directives and multiple files, Next: Directive effects, Up: Directives++8.18.1 Directives and multiple files+------------------------------------++Directives vary in their scope, ie which journal entries and which input+files they affect. Most often, a directive will affect the following+entries and included files if any, until the end of the current file -+and no further. You might find this inconvenient! For example, 'alias'+directives do not affect parent or sibling files. But there are usually+workarounds; for example, put 'alias' directives in your top-most file,+before including other files.++ The restriction, though it may be annoying at first, is in a good+cause; it allows reports to be stable and deterministic, independent of+the order of input. Without it, reports could show different numbers+depending on the order of -f options, or the positions of include+directives in your files.+++File: hledger.info, Node: Directive effects, Prev: Directives and multiple files, Up: Directives++8.18.2 Directive effects+------------------------++Here are all hledger's directives, with their effects and scope+summarised - nine main directives, plus four others which we consider+non-essential:++directivewhat it does ends+ at+ file+ end?+---------------------------------------------------------------------------+*'account'*Declares an account, for checking all entries in all files; andN+ its display order and type. Subdirectives: any text, ignored.+*'alias'*Rewrites account names, in following entries until end of Y+ current file or 'end aliases'. Command line equivalent:+ '--alias'+*'comment'*Ignores part of the journal file, until end of current file orY+ 'end comment'.+*'commodity'*Declares up to four things: 1. a commodity symbol, for checkingN,N,Y,Y+ all amounts in all files 2. the display style for all amounts+ of this commodity 3. the decimal mark for parsing amounts of+ this commodity, in the rest of this file and its children, if+ there is no 'decimal-mark' directive 4. the precision to use+ for balanced-transaction checking in this commodity, in this+ file and its children. Takes precedence over 'D'.+ Subdirectives: 'format' (ignored). Command line equivalent:+ '-c/--commodity-style'+*'decimal-mark'*Declares the decimal mark, for parsing amounts of all Y+ commodities in following entries until next 'decimal-mark' or+ end of current file. Included files can override. Takes+ precedence over 'commodity' and 'D'.+*'include'*Includes entries and directives from another file, as if theyN+ were written inline. Command line alternative: multiple+ '-f/--file'+*'payee'*Declares a payee name, for checking all entries in all files. N+*'P'*Declares the market price of a commodity on some date, for value N+ reports.+*'~'*Declares a periodic transaction rule that generates future N+(tilde)transactions with '--forecast' and budget goals with 'balance+ --budget'.+Other+syntax:+*'applyPrepends a common parent account to all account names, in Y+account'*following entries until end of current file or 'end apply+ account'.+*'D'*Sets a default commodity to use for no-symbol amounts;and, if Y,Y,N,N+ there is no 'commodity' directive for this commodity: its+ decimal mark, balancing precision, and display style, as above.+*'Y'*Sets a default year to use for any yearless dates, in following Y+ entries until end of current file.+*'='*Declares an auto posting rule that generates extra postings on partly+(equals)matched transactions with '--auto', in current, parent, and+ child files (but not sibling files, see #1212).+*OtherOther directives from Ledger's file format are accepted but+Ledgerignored.+directives*+++File: hledger.info, Node: account directive, Next: alias directive, Prev: Directives, Up: Journal++8.19 'account' directive+========================++'account' directives can be used to declare accounts (ie, the places+that amounts are transferred from and to). Though not required, these+declarations can provide several benefits:++ * They can document your intended chart of accounts, providing a+ reference.+ * They can store additional account information as comments, or as+ tags which can be used to filter or pivot reports.+ * They can restrict which accounts may be posted to by transactions,+ eg in strict mode, which helps prevent errors.+ * They influence account display order in reports, allowing+ non-alphabetic sorting (eg Revenues to appear above Expenses).+ * They can help hledger know your accounts' types (asset, liability,+ equity, revenue, expense), enabling reports like balancesheet and+ incomestatement.+ * They help with account name completion (in hledger add,+ hledger-web, hledger-iadd, ledger-mode, etc.)++ They are written as the word 'account' followed by a hledger-style+account name. Eg:++account assets:bank:checking++ Ledger-style indented subdirectives are also accepted, but ignored:++account assets:bank:checking+ format subdirective ; currently ignored++* Menu:++* Account comments::+* Account tags::+* Account error checking::+* Account display order::+* Account types::+++File: hledger.info, Node: Account comments, Next: Account tags, Up: account directive++8.19.1 Account comments+-----------------------++Text following *two or more spaces* and ';' at the end of an account+directive line, and/or following ';' on indented lines immediately below+it, form comments for that account.++ Same-line account comments require two+ spaces before ';' because+that character can appear in account names.++account assets:bank:checking ; same-line comment, at least 2 spaces before the semicolon+ ; next-line comment+ ; some tags - type:A, acctnum:12345+++File: hledger.info, Node: Account tags, Next: Account error checking, Prev: Account comments, Up: account directive++8.19.2 Account tags+-------------------++An account directive's comment may contain tags. These will be+propagated to all postings using that account, as hidden but queryable+posting tags, except where the posting already a tag of the same name.+(Posting tags override account tags.)+++File: hledger.info, Node: Account error checking, Next: Account display order, Prev: Account tags, Up: account directive++8.19.3 Account error checking+-----------------------------++By default, accounts need not be declared; they come into existence when+a posting references them. This is convenient, but it means hledger+can't warn you when you mis-spell an account name in the journal.+Usually you'll find that error later, as an extra account in balance+reports, or an incorrect balance when reconciling.++ In strict mode, enabled with the '-s'/'--strict' flag, or when you+run 'hledger check accounts', hledger will report an error if any+transaction uses an account name that has not been declared by an+account directive. Some notes:++ * The declaration is case-sensitive; transactions must use the+ correct account name capitalisation.+ * The account directive's scope is "whole file and below" (see+ directives). This means it affects all of the current file, and+ any files it includes, but not parent or sibling files. The+ position of account directives within the file does not matter,+ though it's usual to put them at the top.+ * Accounts can only be declared in 'journal' files, but will affect+ included files of all types.+ * It's currently not possible to declare "all possible subaccounts"+ with a wildcard; every account posted to must be declared.+ * If you use the -infer-equity flag, you will also need declarations+ for the account names it generates.+++File: hledger.info, Node: Account display order, Next: Account types, Prev: Account error checking, Up: account directive++8.19.4 Account display order+----------------------------++Account directives also cause hledger to display accounts in a+particular order, not just alphabetically. Eg, here is a conventional+ordering for the top-level accounts:++account assets+account liabilities+account equity+account revenues+account expenses++ Now hledger displays them in that order:++$ hledger accounts+assets+liabilities+equity+revenues+expenses++ If there are undeclared accounts, those will be displayed last, in+alphabetical order.++ Sorting is done within each group of sibling accounts, at each level+of the account tree. Eg, a declaration like 'account parent:child'+influences 'child''s position among its siblings.++ Note, it does not affect 'parent''s position; for that, you need an+'account parent' declaration.++ Sibling accounts are always displayed together; hledger won't display+'x:y' in between 'a:b' and 'a:c'.++ An account directive both declares an account as a valid posting+target, and declares its display order; you can't easily do one without+the other.+++File: hledger.info, Node: Account types, Prev: Account display order, Up: account directive++8.19.5 Account types+--------------------++hledger knows that in accounting there are three main account types:++'Asset' 'A' things you own+'Liability' 'L' things you owe+'Equity' 'E' owner's investment, balances the two above++ and two more representing changes in these:++'Revenue' 'R' inflows (also known as 'Income')+'Expense' 'X' outflows++ hledger also uses a few subtypes:++'Cash' 'C' liquid assets (subtype+ of Asset)+'Conversion' 'V' commodity conversions+ equity (subtype of+ Equity)+'Gain' 'G' capital gains/losses+ (subtype of Revenue)++ As a convenience, hledger will detect most of these types+automatically from english account names. But it's better to declare+them explicitly by adding a 'type:' tag in the account directives. The+tag's value can be any of the types or one-letter abbreviations above.++ Here is a typical set of account type declarations. Subaccounts will+inherit their parent's type, or can override it:++account assets ; type: A+account liabilities ; type: L+account equity ; type: E+account revenues ; type: R+account expenses ; type: X++account assets:bank ; type: C+account assets:cash ; type: C++account equity:conversion ; type: V++account revenues:capital ; type: G++ This enables the easy balancesheet, balancesheetequity, cashflow and+incomestatement reports, and querying by type:.++ Tips:++ * You can list accounts and their types, for troubleshooting:++ $ hledger accounts --types [ACCTPAT] [type:TYPECODES] [-DEPTH] [--locations]++ * It's a good idea to declare at least one account for each account+ type. Having some types declared and some inferred can disrupt+ certain reports.++ * The rules for inferring types from account names are as follows+ (using Regular expressions).+ If they don't work for you, just ignore them and declare your types+ with 'type:' tags.++ If account's name contains this case insensitive regular expression | its type is+ --------------------------------------------------------------------|-------------+ ^assets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|current)(:|$) | Cash+ ^assets?(:|$) | Asset+ ^(debts?|liabilit(y|ies))(:|$) | Liability+ ^equity:(trad(e|ing)|conversion)s?(:|$) | Conversion+ ^equity(:|$) | Equity+ ^(income|revenue)s?(:|$) | Revenue+ ^expenses?(:|$) | Expense++ * As mentioned above, subaccounts will inherit a type from their+ parent account. To be precise, an account's type is decided by the+ first of these that exists:++ 1. A 'type:' declaration for this account.+ 2. A 'type:' declaration in the parent accounts above it,+ preferring the nearest.+ 3. An account type inferred from this account's name.+ 4. An account type inferred from a parent account's name,+ preferring the nearest parent.+ 5. Otherwise, it will have no type.++ * Account aliases can disrupt account types.+++File: hledger.info, Node: alias directive, Next: commodity directive, Prev: account directive, Up: Journal++8.20 'alias' directive+======================++You can define account alias rules which rewrite your account names, or+parts of them, before generating reports. This can be useful for:++ * expanding shorthand account names to their full form, allowing+ easier data entry and a less verbose journal+ * adapting old journals to your current chart of accounts+ * experimenting with new account organisations, like a new hierarchy+ * combining two accounts into one, eg to see their sum or difference+ on one line+ * customising reports++ Account aliases also rewrite account names in account directives.+They do not affect account names being entered via hledger add or+hledger-web.++ Account aliases are very powerful. They are generally easy to use+correctly, but you can also generate invalid account names with them;+more on this below.++ See also Rewrite account names.++* Menu:++* Basic aliases::+* Regex aliases::+* Combining aliases::+* Aliases and multiple files::+* end aliases directive::+* Aliases can generate bad account names::+* Aliases and account types::+++File: hledger.info, Node: Basic aliases, Next: Regex aliases, Up: alias directive++8.20.1 Basic aliases+--------------------++To set an account alias, use the 'alias' directive in your journal file.+This affects all subsequent journal entries in the current file or its+included files (but note: not sibling or parent files). The spaces+around the = are optional:++alias OLD = NEW++ Or, you can use the '--alias 'OLD=NEW'' option on the command line.+This affects all entries. It's useful for trying out aliases+interactively.++ OLD and NEW are case sensitive full account names. hledger will+replace any occurrence of the old account name with the new one.+Subaccounts are also affected. Eg:++alias checking = assets:bank:wells fargo:checking+; rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"+++File: hledger.info, Node: Regex aliases, Next: Combining aliases, Prev: Basic aliases, Up: alias directive++8.20.2 Regex aliases+--------------------++There is also a more powerful variant that uses a regular expression,+indicated by wrapping the pattern in forward slashes. (This is the only+place where hledger requires forward slashes around a regular+expression.)++ Eg:++alias /REGEX/ = REPLACEMENT++ or:++$ hledger --alias '/REGEX/=REPLACEMENT' ...++ Any part of an account name matched by REGEX will be replaced by+REPLACEMENT. REGEX is case-insensitive as usual.++ If you need to match a forward slash, escape it with a backslash, eg+'/\/=:'.++ If REGEX contains parenthesised match groups, these can be referenced+by the usual backslash and number in REPLACEMENT:++alias /^(.+):bank:([^:]+):(.*)/ = \1:\2 \3+; rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"++ REPLACEMENT continues to the end of line (or on command line, to end+of option argument), so it can contain trailing whitespace.+++File: hledger.info, Node: Combining aliases, Next: Aliases and multiple files, Prev: Regex aliases, Up: alias directive++8.20.3 Combining aliases+------------------------++You can define as many aliases as you like, using journal directives+and/or command line options.++ Recursive aliases - where an account name is rewritten by one alias,+then by another alias, and so on - are allowed. Each alias sees the+effect of previously applied aliases.++ In such cases it can be important to understand which aliases will be+applied and in which order. For (each account name in) each journal+entry, we apply:++ 1. 'alias' directives preceding the journal entry, most recently+ parsed first (ie, reading upward from the journal entry, bottom to+ top)+ 2. '--alias' options, in the order they appeared on the command line+ (left to right).++ In other words, for (an account name in) a given journal entry:++ * the nearest alias declaration before/above the entry is applied+ first+ * the next alias before/above that will be be applied next, and so on+ * aliases defined after/below the entry do not affect it.++ This gives nearby aliases precedence over distant ones, and helps+provide semantic stability - aliases will keep working the same way+independent of which files are being read and in which order.++ In case of trouble, adding '--debug=6' to the command line will show+which aliases are being applied when.+++File: hledger.info, Node: Aliases and multiple files, Next: end aliases directive, Prev: Combining aliases, Up: alias directive++8.20.4 Aliases and multiple files+---------------------------------++As explained at Directives and multiple files, 'alias' directives do not+affect parent or sibling files. Eg in this command,++hledger -f a.aliases -f b.journal++ account aliases defined in a.aliases will not affect b.journal.+Including the aliases doesn't work either:++include a.aliases++2023-01-01 ; not affected by a.aliases+ foo 1+ bar++ This means that account aliases should usually be declared at the+start of your top-most file, like this:++alias foo=Foo+alias bar=Bar++2023-01-01 ; affected by aliases above+ foo 1+ bar++include c.journal ; also affected+++File: hledger.info, Node: end aliases directive, Next: Aliases can generate bad account names, Prev: Aliases and multiple files, Up: alias directive++8.20.5 'end aliases' directive+------------------------------++You can clear (forget) all currently defined aliases (seen in the+journal so far, or defined on the command line) with this directive:++end aliases+++File: hledger.info, Node: Aliases can generate bad account names, Next: Aliases and account types, Prev: end aliases directive, Up: alias directive++8.20.6 Aliases can generate bad account names+---------------------------------------------++Be aware that account aliases can produce malformed account names, which+could cause confusing reports or invalid 'print' output. For example,+you could erase all account names:++2021-01-01+ a:aa 1+ b++$ hledger print --alias '/.*/='+2021-01-01+ 1++ The above 'print' output is not a valid journal. Or you could insert+an illegal double space, causing 'print' output that would give a+different journal when reparsed:++2021-01-01+ old 1+ other++$ hledger print --alias old="new USD" | hledger -f- print+2021-01-01+ new USD 1+ other+++File: hledger.info, Node: Aliases and account types, Prev: Aliases can generate bad account names, Up: alias directive++8.20.7 Aliases and account types+--------------------------------++If an account with a type declaration (see Declaring accounts > Account+types) is renamed by an alias, normally the account type remains in+effect.++ However, renaming in a way that reshapes the account tree (eg+renaming parent accounts but not their children, or vice versa) could+prevent child accounts from inheriting the account type of their+parents.++ Secondly, if an account's type is being inferred from its name,+renaming it by an alias could prevent or alter that.++ If you are using account aliases and the 'type:' query is not+matching accounts as you expect, try troubleshooting with the accounts+command, eg something like:++$ hledger accounts --types -1 --alias assets=bassetts+++File: hledger.info, Node: commodity directive, Next: decimal-mark directive, Prev: alias directive, Up: Journal++8.21 'commodity' directive+==========================++The 'commodity' directive performs several functions:++ 1. It declares which commodity symbols may be used in the journal,+ enabling useful error checking with strict mode or the check+ command. See Commodity error checking below.++ 2. It declares how all amounts in this commodity should be displayed,+ eg how many decimals to show. See Commodity display style above.++ 3. (If no 'decimal-mark' directive is in effect:) It sets the decimal+ mark to expect (period or comma) when parsing amounts in this+ commodity, in this file and files it includes, from the directive+ until end of current file. See Decimal marks above.++ 4. It declares the precision with which this commodity's amounts+ should be compared when checking for balanced transactions,+ anywhere in this file and files it includes, until end of current+ file.++ Declaring commodities solves several common parsing/display problems,+so we recommend it.++ Note that effects 3 and 4 above end at the end of the directive's+file, and will not affect sibling or parent files. So if you are+relying on them (especially 4) and using multiple files, placing your+commodity directives in a top-level parent file might be important. Or,+keep your decimal marks unambiguous and your entries well balanced and+precise.++ Omitting the commodity symbol will set the display style for just the+no-symbol commodity, not all commodities.++ Commodity styles can be overridden by the '-c/--commodity-style'+command line option.++ (Related: #793)++* Menu:++* Commodity directive syntax::+* Commodity tags::+* Commodity error checking::+++File: hledger.info, Node: Commodity directive syntax, Next: Commodity tags, Up: commodity directive++8.21.1 Commodity directive syntax+---------------------------------++A commodity directive is normally the word 'commodity' followed by a+sample amount, and optionally a comment. Only the amount's symbol and+the number's format is significant. Eg:++commodity $1000.00+commodity 1.000,00 EUR+commodity 1 000 000.0000 ; the no-symbol commodity++ A commodity directive's sample amount must always include a period or+comma decimal mark (this rule helps disambiguate decimal marks and digit+group marks). If you don't want to show any decimal digits, write the+decimal mark at the end:++commodity 1000. AAAA ; show AAAA with no decimals++ Commodity symbols containing spaces, numbers, or punctuation must be+enclosed in double quotes, as usual:++commodity 1.0000 "AAAA 2023"++ Commodity directives normally include a sample amount, but can+declare only a symbol (ie, just function 1 above):++commodity $+commodity INR+commodity "AAAA 2023"+commodity "" ; the no-symbol commodity++ Commodity directives may also be written with an indented 'format'+subdirective, as in Ledger. The symbol is repeated and must be the same+in both places. Other subdirectives are currently ignored:++; display indian rupees with currency name on the left,+; thousands, lakhs and crores comma-separated,+; period as decimal point, and two decimal places.+commodity INR+ format INR 1,00,00,000.00+ an unsupported subdirective ; ignored by hledger+++File: hledger.info, Node: Commodity tags, Next: Commodity error checking, Prev: Commodity directive syntax, Up: commodity directive++8.21.2 Commodity tags+---------------------++A commodity directive's comment may contain tags. These will be+propagated to all postings using that commodity in their main amount, as+hidden but queryable posting tags, except where the posting already a+tag of the same name. (Posting tags override account tags override+commodity tags.)+++File: hledger.info, Node: Commodity error checking, Prev: Commodity tags, Up: commodity directive++8.21.3 Commodity error checking+-------------------------------++In strict mode ('-s'/'--strict') (or when you run 'hledger check+commodities'), hledger will report an error if an undeclared commodity+symbol is used. (With one exception: zero amounts are always allowed to+have no commodity symbol.) It works like account error checking+(described above).+++File: hledger.info, Node: decimal-mark directive, Next: include directive, Prev: commodity directive, Up: Journal++8.22 'decimal-mark' directive+=============================++You can use a 'decimal-mark' directive - usually one per file, at the+top of the file - to declare which character represents a decimal mark+when parsing amounts in this file. It can look like++decimal-mark .++ or++decimal-mark ,++ This prevents any ambiguity when parsing numbers in the file, so we+recommend it, especially if the file contains digit group marks (eg+thousands separators).+++File: hledger.info, Node: include directive, Next: P directive, Prev: decimal-mark directive, Up: Journal++8.23 'include' directive+========================++You can pull in the content of additional files by writing an include+directive, like this:++include SOMEFILE++ This has the same effect as if SOMEFILE's content was inlined at this+point. (With any include directives in SOMEFILE processed similarly,+recursively.)++ Only journal files can include other files. They can include+journal, timeclock or timedot files, but not CSV files.++ If the file path begins with a tilde, that means your home directory:+'include ~/main.journal'.++ If it begins with a slash, it is an absolute path: 'include+/home/user/main.journal'. Otherwise it is relative to the including+file's folder: 'include ../finances/main.journal'.++ Also, the path may have a file type prefix to force a specific file+format, overriding the file extension(s) (as described in Data formats):+'include timedot:notes/2023.md'.++ The path may contain glob patterns to match multiple files.+hledger's globs are similar to zsh's: '?' to match any character;+'[a-z]' to match any character in a range; '*' to match zero or more+characters that aren't a path separator (like '/'); '**' to match zero+or more subdirectories and/or zero or more characters at the start of a+file name; etc. For convenience, 'include' always excludes the current+file. So, you can do++ * 'include *.journal' to include all other journal files in the+ current directory (excluding dot files)+ * 'include **.journal' to include all other journal files in this+ directory and below (excluding dot files and top-level dot+ directories)+ * 'include timelogs/2???.timedot' to include all timedot files named+ like a year number.++ Note '*' and '**' usually won't match dot files or dot directories,+with one exception: '**' does search non-top-level dot directories. If+this causes problems, make your glob pattern more specific (eg+'**.journal' instead of '**').++ If you are using many, or deeply nested, include files, and have an+error that's hard to pinpoint: a good troubleshooting command is+'hledger files --debug=6' (or 7).+++File: hledger.info, Node: P directive, Next: payee directive, Prev: include directive, Up: Journal++8.24 'P' directive+==================++The 'P' directive declares a market price, which is a conversion rate+between two commodities on a certain date. This allows value reports to+convert amounts of one commodity to their value in another, on or after+that date. These prices are often obtained from a stock exchange,+cryptocurrency exchange, or the foreign exchange market.++ The format is:++P DATE COMMODITY1SYMBOL COMMODITY2AMOUNT++ DATE is a simple date, COMMODITY1SYMBOL is the symbol of the+commodity being priced, and COMMODITY2AMOUNT is the amount (symbol and+quantity) of commodity 2 that one unit of commodity 1 is worth on this+date. Examples:++# one euro was worth $1.35 from 2009-01-01 onward:+P 2009-01-01 € $1.35++# and $1.40 from 2010-01-01 onward:+P 2010-01-01 € $1.40++ The '-V', '-X' and '--value' flags use these market prices to show+amount values in another commodity. See Value reporting.+++File: hledger.info, Node: payee directive, Next: tag directive, Prev: P directive, Up: Journal++8.25 'payee' directive+======================++ payee PAYEE NAME++ This directive can be used to declare a limited set of payees which+may appear in transaction descriptions. The "payees" check will report+an error if any transaction refers to a payee that has not been+declared. Eg:++payee Whole Foods ; a comment++ Payees do not have tags (tags in the comment will be ignored).++ To declare the empty payee name, use '""'.++payee ""++ Ledger-style indented subdirectives, if any, are currently ignored.+++File: hledger.info, Node: tag directive, Next: Periodic transactions, Prev: payee directive, Up: Journal++8.26 'tag' directive+====================++ tag TAGNAME++ This directive can be used to declare a limited set of tag names+allowed in tags. TAGNAME should be a valid tag name (no spaces). Eg:++tag item-id++ Any indented subdirectives are currently ignored.++ The "tags" check will report an error if any undeclared tag name is+used. It is quite easy to accidentally create a tag through normal use+of colons in comments; if you want to prevent this, you can declare and+check your tags .+++File: hledger.info, Node: Periodic transactions, Next: Auto postings, Prev: tag directive, Up: Journal++8.27 Periodic transactions+==========================++The '~' directive declares a "periodic rule" which generates temporary+extra transactions, usually recurring at some interval, when hledger is+run with the '--forecast' flag. These "forecast transactions" are+useful for forecasting future activity. They exist only for the+duration of the report, and only when '--forecast' is used; they are not+saved in the journal file by hledger.++ Periodic rules also have a second use: with the '--budget' flag they+set budget goals for budgeting.++ Periodic rules can be a little tricky, so before you use them, read+this whole section, or at least the following tips:++ 1. Two spaces accidentally added or omitted will cause you trouble -+ read about this below.+ 2. For troubleshooting, show the generated transactions with 'hledger+ print --forecast tag:generated' or 'hledger register --forecast+ tag:generated'.+ 3. Forecasted transactions will begin only after the last+ non-forecasted transaction's date.+ 4. Forecasted transactions will end 6 months from today, by default.+ See below for the exact start/end rules.+ 5. period expressions can be tricky. Their documentation needs+ improvement, but is worth studying.+ 6. Some period expressions with a repeating interval must begin on a+ natural boundary of that interval. Eg in 'weekly from DATE', DATE+ must be a monday. '~ weekly from 2019/10/1' (a tuesday) will give+ an error.+ 7. Other period expressions with an interval are automatically+ expanded to cover a whole number of that interval. (This is done+ to improve reports, but it also affects periodic transactions.+ Yes, it's a bit inconsistent with the above.) Eg: '~ every 10th+ day of month from 2023/01', which is equivalent to '~ every 10th+ day of month from 2023/01/01', will be adjusted to start on+ 2019/12/10.++* Menu:++* Periodic rule syntax::+* Periodic rules and relative dates::+* Two spaces between period expression and description!::+++File: hledger.info, Node: Periodic rule syntax, Next: Periodic rules and relative dates, Up: Periodic transactions++8.27.1 Periodic rule syntax+---------------------------++A periodic transaction rule looks like a normal journal entry, with the+date replaced by a tilde ('~') followed by a period expression+(mnemonic: '~' looks like a recurring sine wave.):++# every first of month+~ monthly+ expenses:rent $2000+ assets:bank:checking++# every 15th of month in 2023's first quarter:+~ monthly from 2023-04-15 to 2023-06-16+ expenses:utilities $400+ assets:bank:checking++ The period expression is the same syntax used for specifying+multi-period reports, just interpreted differently; there, it specifies+report periods; here it specifies recurrence dates (the periods' start+dates).+++File: hledger.info, Node: Periodic rules and relative dates, Next: Two spaces between period expression and description!, Prev: Periodic rule syntax, Up: Periodic transactions++8.27.2 Periodic rules and relative dates+----------------------------------------++Partial or relative dates (like '12/31', '25', 'tomorrow', 'last week',+'next quarter') are usually not recommended in periodic rules, since the+results will change as time passes. If used, they will be interpreted+relative to, in order of preference:++ 1. the first day of the default year specified by a recent 'Y'+ directive+ 2. or the date specified with '--today'+ 3. or the date on which you are running the report.++ They will not be affected at all by report period or forecast period+dates.+++File: hledger.info, Node: Two spaces between period expression and description!, Prev: Periodic rules and relative dates, Up: Periodic transactions++8.27.3 Two spaces between period expression and description!+------------------------------------------------------------++If the period expression is followed by a transaction description, these+must be separated by *two or more spaces*. This helps hledger know+where the period expression ends, so that descriptions can not+accidentally alter their meaning, as in this example:++; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2023"+; ||+; vv+~ every 2 months in 2023, we will review+ assets:bank:checking $1500+ income:acme inc++ So,++ * Do write two spaces between your period expression and your+ transaction description, if any.+ * Don't accidentally write two spaces in the middle of your period+ expression.+++File: hledger.info, Node: Auto postings, Next: Other syntax, Prev: Periodic transactions, Up: Journal++8.28 Auto postings+==================++The '=' directive declares an "auto posting rule", which adds extra+postings to existing transactions. (Remember, postings are the account+name & amount lines below a transaction's date & description.)++ In the journal, an auto posting rule looks quite like a transaction,+but instead of date and description it has '=' (mnemonic: "match") and a+query, like this:++= QUERY+ ACCOUNT AMOUNT+ ...++ Queries are just like command line queries; an account name substring+is most common. Query terms containing spaces should be enclosed in+single or double quotes.++ Each '=' rule works like this: when hledger is run with the '--auto'+flag, wherever the QUERY matches a posting in the journal, the rule's+postings are added to that transaction, immediately below the matched+posting. Note these generated postings are temporary, existing only for+the duration of the report, and only when '--auto' is used; they are not+saved in the journal file by hledger.++ The postings can contain the special string '%account' which will be+expanded to the account name of the matched account.++ Generated postings' amounts can depend on the matched posting's+amount. So auto postings can be useful for, eg, adding tax postings+with a standard percentage. AMOUNT can be:++ * a number with no commodity symbol, like '2'. The matched posting's+ commodity symbol will be added to this.++ * a normal amount with a commodity symbol, like '$2'. This will be+ used as-is.++ * an asterisk followed by a number, like '*2'. This will multiply+ the matched posting's amount (and total price, if any) by the+ number.++ * an asterisk followed by an amount with commodity symbol, like+ '*$2'. This multiplies and also replaces the commodity symbol with+ this new one.++ Some examples:++; every time I buy food, schedule a dollar donation+= expenses:food+ (liabilities:charity) $-1++; when I buy a gift, also deduct that amount from a budget envelope subaccount+= expenses:gifts+ assets:checking:gifts *-1+ assets:checking *1++2017/12/1+ expenses:food $10+ assets:checking++2017/12/14+ expenses:gifts $20+ assets:checking++$ hledger print --auto+2017-12-01+ expenses:food $10+ assets:checking+ (liabilities:charity) $-1++2017-12-14+ expenses:gifts $20+ assets:checking+ assets:checking:gifts -$20+ assets:checking $20++ Note that depending fully on generated data such as this has some+drawbacks - it's less portable, less future-proof, less auditable by+others, and less robust (eg your balance assertions will depend on+whether you use or don't use '--auto'). An alternative is to use auto+postings in "one time" fashion - use them to help build a complex+journal entry, view it with 'hledger print --auto', and then copy that+output into the journal file to make it permanent.++* Menu:++* Auto postings and multiple files::+* Auto postings and dates::+* Auto postings and transaction balancing / inferred amounts / balance assertions::+* Auto posting tags::+* Auto postings on forecast transactions only::+++File: hledger.info, Node: Auto postings and multiple files, Next: Auto postings and dates, Up: Auto postings++8.28.1 Auto postings and multiple files+---------------------------------------++An auto posting rule can affect any transaction in the current file, or+in any parent file or child file. Note, currently it will not affect+sibling files (when multiple '-f'/'--file' are used - see #1212).+++File: hledger.info, Node: Auto postings and dates, Next: Auto postings and transaction balancing / inferred amounts / balance assertions, Prev: Auto postings and multiple files, Up: Auto postings++8.28.2 Auto postings and dates+------------------------------++A posting date (or secondary date) in the matched posting, or (taking+precedence) a posting date in the auto posting rule itself, will also be+used in the generated posting.+++File: hledger.info, Node: Auto postings and transaction balancing / inferred amounts / balance assertions, Next: Auto posting tags, Prev: Auto postings and dates, Up: Auto postings++8.28.3 Auto postings and transaction balancing / inferred amounts /+-------------------------------------------------------------------++balance assertions Currently, auto postings are added:++ * after missing amounts are inferred, and transactions are checked+ for balancedness,+ * but before balance assertions are checked.++ Note this means that journal entries must be balanced both before and+after auto postings are added. This changed in hledger 1.12+; see #893+for background.++ This also means that you cannot have more than one auto-posting with+a missing amount applied to a given transaction, as it will be unable to+infer amounts.+++File: hledger.info, Node: Auto posting tags, Next: Auto postings on forecast transactions only, Prev: Auto postings and transaction balancing / inferred amounts / balance assertions, Up: Auto postings++8.28.4 Auto posting tags+------------------------++Automated postings will have some extra tags:++ * 'generated-posting:= QUERY' - shows this was generated by an auto+ posting rule, and the query+ * '_generated-posting:= QUERY' - a hidden tag, which does not appear+ in hledger's output. This can be used to match postings generated+ "just now", rather than generated in the past and saved to the+ journal.++ Also, any transaction that has been changed by auto posting rules+will have these tags added:++ * 'modified:' - this transaction was modified+ * '_modified:' - a hidden tag not appearing in the comment; this+ transaction was modified "just now".+++File: hledger.info, Node: Auto postings on forecast transactions only, Prev: Auto posting tags, Up: Auto postings++8.28.5 Auto postings on forecast transactions only+--------------------------------------------------++Tip: you can can make auto postings that will apply to forecast+transactions but not recorded transactions, by adding+'tag:_generated-transaction' to their QUERY. This can be useful when+generating new journal entries to be saved in the journal.+++File: hledger.info, Node: Other syntax, Prev: Auto postings, Up: Journal++8.29 Other syntax+=================++hledger journal format supports quite a few other features, mainly to+make interoperating with or converting from Ledger easier. Note some of+the features below are powerful and can be useful in special cases, but+in general, features in this section are considered less important or+even not recommended for most users. Downsides are mentioned to help+you decide if you want to use them.++* Menu:++* Balance assignments::+* Bracketed posting dates::+* D directive::+* apply account directive::+* Y directive::+* Secondary dates::+* Star comments::+* Valuation expressions::+* Virtual postings::+* Other Ledger directives::+* Ledger virtual costs::+* Ledger lot syntax::+* Ledger fixed lot costs::+++File: hledger.info, Node: Balance assignments, Next: Bracketed posting dates, Up: Other syntax++8.29.1 Balance assignments+--------------------------++Ledger-style balance assignments are also supported. These are like+balance assertions, but with no posting amount on the left side of the+equals sign; instead it is calculated automatically so as to satisfy the+assertion. This can be a convenience during data entry, eg when setting+opening balances:++; starting a new journal, set asset account balances+2016/1/1 opening balances+ assets:checking = $409.32+ assets:savings = $735.24+ assets:cash = $42+ equity:opening balances++ or when adjusting a balance to reality:++; no cash left; update balance, record any untracked spending as a generic expense+2016/1/15+ assets:cash = $0+ expenses:misc++ The calculated amount depends on the account's balance in the+commodity at that point (which depends on the previously-dated postings+of the commodity to that account since the last balance assertion or+assignment).++ Downsides: using balance assignments makes your journal less+explicit; to know the exact amount posted, you have to run hledger or do+the calculations yourself, instead of just reading it. Also balance+assignments' forcing of balances can hide errors. These things make+your financial data less portable, less future-proof, and less+trustworthy in an audit.++* Menu:++* Balance assignments and costs::+* Balance assignments and multiple files::+++File: hledger.info, Node: Balance assignments and costs, Next: Balance assignments and multiple files, Up: Balance assignments++8.29.1.1 Balance assignments and costs+......................................++A cost in a balance assignment will cause the calculated amount to have+that cost attached:++2019/1/1+ (a) = $1 @ €2++$ hledger print --explicit+2019-01-01+ (a) $1 @ €2 = $1 @ €2+++File: hledger.info, Node: Balance assignments and multiple files, Prev: Balance assignments and costs, Up: Balance assignments++8.29.1.2 Balance assignments and multiple files+...............................................++Balance assignments handle multiple files like balance assertions. They+see balance from other files previously included from the current file,+but not from previous sibling or parent files.+++File: hledger.info, Node: Bracketed posting dates, Next: D directive, Prev: Balance assignments, Up: Other syntax++8.29.2 Bracketed posting dates+------------------------------++For setting posting dates and secondary posting dates, Ledger's+bracketed date syntax is also supported: '[DATE]', '[DATE=DATE2]' or+'[=DATE2]' in posting comments. hledger will attempt to parse any+square-bracketed sequence of the '0123456789/-.=' characters in this+way. With this syntax, DATE infers its year from the transaction and+DATE2 infers its year from DATE.++ Downsides: another syntax to learn, redundant with hledger's+'date:'/'date2:' tags, and confusingly similar to Ledger's lot date+syntax.+++File: hledger.info, Node: D directive, Next: apply account directive, Prev: Bracketed posting dates, Up: Other syntax++8.29.3 'D' directive+--------------------++ D AMOUNT++ This directive sets a default commodity, to be used for any+subsequent commodityless amounts (ie, plain numbers) seen while parsing+the journal. This effect lasts until the next 'D' directive, or the end+of the current file.++ For compatibility/historical reasons, 'D' also acts like a+'commodity' directive (setting the commodity's decimal mark for parsing+and display style for output). So its argument is not just a commodity+symbol, but a full amount demonstrating the style. The amount must+include a decimal mark (either period or comma). Eg:++; commodity-less amounts should be treated as dollars+; (and displayed with the dollar sign on the left, thousands separators and two decimal places)+D $1,000.00++1/1+ a 5 ; <- commodity-less amount, parsed as $5 and displayed as $5.00+ b++ Interactions with other directives:++ For setting a commodity's display style, a 'commodity' directive has+highest priority, then a 'D' directive.++ For detecting a commodity's decimal mark during parsing,+'decimal-mark' has highest priority, then 'commodity', then 'D'.++ For checking commodity symbols with the check command, a 'commodity'+directive is required ('hledger check commodities' ignores 'D'+directives).++ Downsides: omitting commodity symbols makes your financial data less+explicit, less portable, and less trustworthy in an audit. It is+usually an unsustainable shortcut; sooner or later you will want to+track multiple commodities. D is overloaded with functions redundant+with 'commodity' and 'decimal-mark'. And it works differently from+Ledger's 'D'.+++File: hledger.info, Node: apply account directive, Next: Y directive, Prev: D directive, Up: Other syntax++8.29.4 'apply account' directive+--------------------------------++This directive sets a default parent account, which will be prepended to+all accounts in following entries, until an 'end apply account'+directive or end of current file. Eg:++apply account home++2010/1/1+ food $10+ cash++end apply account++ is equivalent to:++2010/01/01+ home:food $10+ home:cash $-10++ 'account' directives are also affected, and so is any 'include'd+content.++ Account names entered via hledger add or hledger-web are not+affected.++ Account aliases, if any, are applied after the parent account is+prepended.++ Downsides: this can make your financial data less explicit, less+portable, and less trustworthy in an audit.+++File: hledger.info, Node: Y directive, Next: Secondary dates, Prev: apply account directive, Up: Other syntax++8.29.5 'Y' directive+--------------------++ Y YEAR++ or (deprecated backward-compatible forms):++ 'year YEAR' 'apply year YEAR'++ The space is optional. This sets a default year to be used for+subsequent dates which don't specify a year. Eg:++Y2009 ; set default year to 2009++12/15 ; equivalent to 2009/12/15+ expenses 1+ assets++year 2010 ; change default year to 2010++2009/1/30 ; specifies the year, not affected+ expenses 1+ assets++1/31 ; equivalent to 2010/1/31+ expenses 1+ assets++ Downsides: omitting the year (from primary transaction dates, at+least) makes your financial data less explicit, less portable, and less+trustworthy in an audit. Such dates can get separated from their+corresponding Y directive, eg when evaluating a region of the journal in+your editor. A missing Y directive makes reports dependent on today's+date.+++File: hledger.info, Node: Secondary dates, Next: Star comments, Prev: Y directive, Up: Other syntax++8.29.6 Secondary dates+----------------------++A secondary date is written after the primary date, following an equals+sign: 'DATE1=DATE2'. If the year is omitted, the primary date's year is+assumed. When running reports, the primary (left side) date is used by+default, but with the '--date2' flag ('--aux-date' or'--effective' also+work, for Ledger users), the secondary (right side) date will be used+instead.++ The meaning of secondary dates is up to you. Eg it could be "primary+is the bank's clearing date, secondary is the date the transaction was+initiated, if different".++ In practice, this feature usually adds confusion:++ * You have to remember the primary and secondary dates' meaning, and+ follow that consistently.+ * It splits your bookkeeping into two modes, and you have to remember+ which mode is appropriate for a given report.+ * Usually your balance assertions will work with only one of these+ modes.+ * It makes your financial data more complicated, less portable, and+ less clear in an audit.+ * It interacts with every feature, creating an ongoing cost for+ implementors.+ * It distracts new users and supporters.+ * Posting dates are simpler and work better.++ So secondary dates are officially deprecated in hledger, remaining+only as a Ledger compatibility aid; we recommend using posting dates+instead.+++File: hledger.info, Node: Star comments, Next: Valuation expressions, Prev: Secondary dates, Up: Other syntax++8.29.7 Star comments+--------------------++Lines beginning with '*' (star/asterisk) are also comment lines. This+feature allows Emacs users to insert org headings in their journal,+allowing them to fold/unfold/navigate it like an outline when viewed+with org mode.++ Downsides: another, unconventional comment syntax to learn.+Decreases your journal's portability. And switching to Emacs org mode+just for folding/unfolding meant losing the benefits of ledger mode;+nowadays you can add outshine mode to ledger mode to get folding without+losing ledger mode's features.+++File: hledger.info, Node: Valuation expressions, Next: Virtual postings, Prev: Star comments, Up: Other syntax++8.29.8 Valuation expressions+----------------------------++Ledger allows a valuation function or value to be written in double+parentheses after an amount. hledger ignores these.+++File: hledger.info, Node: Virtual postings, Next: Other Ledger directives, Prev: Valuation expressions, Up: Other syntax++8.29.9 Virtual postings+-----------------------++A posting with parentheses around the account name, like '(some:account)+10', is called an _unbalanced virtual posting_. These postings do not+participate in transaction balancing. (And if you write them without an+amount, a zero amount is always inferred.) These can occasionally be+convenient for special circumstances, but they violate double entry+bookkeeping and make your data less portable across applications, so+many people avoid using them at all.++ A posting with brackets around the account name ('[some:account]') is+called a _balanced virtual posting_. The balanced virtual postings in a+transaction must add up to zero, just like ordinary postings, but+separately from them. These are not part of double entry bookkeeping+either, but they are at least balanced. An example:++2022-01-01 buy food with cash, update budget envelope subaccounts, & something else+ assets:cash $-10 ; <- these balance each other+ expenses:food $7 ; <-+ expenses:food $3 ; <-+ [assets:checking:budget:food] $-10 ; <- and these balance each other+ [assets:checking:available] $10 ; <-+ (something:else) $5 ; <- this is not required to balance++ Ordinary postings, whose account names are neither parenthesised nor+bracketed, are called _real postings_. You can exclude virtual postings+from reports with the '-R/--real' flag or a 'real:1' query.+++File: hledger.info, Node: Other Ledger directives, Next: Ledger virtual costs, Prev: Virtual postings, Up: Other syntax++8.29.10 Other Ledger directives+-------------------------------++These other Ledger directives are currently accepted but ignored. This+allows hledger to read more Ledger files, but be aware that hledger's+reports may differ from Ledger's if you use these.++apply fixed COMM AMT+apply tag TAG+assert EXPR+bucket / A ACCT+capture ACCT REGEX+check EXPR+define VAR=EXPR+end apply fixed+end apply tag+end apply year+end tag+eval / expr EXPR+python+ PYTHONCODE+tag NAME+value EXPR+--command-line-flags++ See also https://hledger.org/ledger.html for a detailed+hledger/Ledger syntax comparison.+++File: hledger.info, Node: Ledger virtual costs, Next: Ledger lot syntax, Prev: Other Ledger directives, Up: Other syntax++8.29.11 Ledger virtual costs+----------------------------++In Ledger, '(@) UNITCOST' and '(@@) TOTALCOST' are virtual costs, which+do not generate market prices. In hledger, these are equivalent to '@'+and '@@'.+++File: hledger.info, Node: Ledger lot syntax, Next: Ledger fixed lot costs, Prev: Ledger virtual costs, Up: Other syntax++8.29.12 Ledger lot syntax+-------------------------++In Ledger, these optional annotations after an amount help specify the+cost basis of a newly acquired lot, or select existing lot(s) to dispose+of:++ * '{LOTUNITCOST}' and '{{LOTTOTALCOST}}' (lot price)+ * '[LOTDATE]' (lot date)+ * '(LOTNOTE)' (lot note)++ hledger does not yet calculate lots itself, but it accepts these+annotations and will show them in 'print''s 'txt', 'beancount', and+'json' output formats. This means you can use this syntax in your+hledger journals (with an amountless extra posting to help transactions+balance, when needed), and use the 'print' command to export to Ledger+or Beancount when you want to calculate lots and capital gains.+++File: hledger.info, Node: Ledger fixed lot costs, Prev: Ledger lot syntax, Up: Other syntax++8.29.13 Ledger fixed lot costs+------------------------------++ * '{=UNITCOST}' and '{{=TOTALCOST}}' (fixed price)+ * when buying, means "this cost is also the fixed value, don't+ let it fluctuate in value reports"++ Probably equivalent to '@'/'@@', I'm not sure.++ *Beancount* has simpler notation and different behaviour:++ * '@ UNITCOST' and '@@ TOTALCOST'+ * expresses a cost without creating a lot, as in hledger+ * when buying (acquiring) or selling (disposing of) a lot, and+ combined with '{...}': is not used except to document the+ cost/selling price++ * '{UNITCOST}' and '{{TOTALCOST}}'+ * when buying, expresses the cost for transaction balancing, and+ also creates a lot with this cost basis attached+ * when selling,+ * selects a lot by its cost basis+ * raises an error if that lot is not present or can not be+ selected unambiguously (depending on booking method+ configured)+ * expresses the selling price for transaction balancing++ * '{}', '{YYYY-MM-DD}', '{"LABEL"}', '{UNITCOST, "LABEL"}',+ '{UNITCOST, YYYY-MM-DD, "LABEL"}'+ * when selling, other combinations of date/cost/label, like the+ above, are accepted for selecting the lot.++ Currently, hledger++ * supports '@' and '@@'+ * accepts the '{UNITCOST}'/'{{TOTALCOST}}' notation, but ignores it+ * and rejects the rest.+++File: hledger.info, Node: CSV, Next: Timeclock, Prev: Journal, Up: Top++9 CSV+*****++hledger can read transactions from CSV (comma-separated values) files.+More precisely, it can read DSV (delimiter-separated values), from a+file or standard input. Comma-separated, semicolon-separated and+tab-separated are the most common variants, and hledger will recognise+these three automatically based on a '.csv', '.ssv' or '.tsv' file name+extension or a 'csv:', 'ssv:' or 'tsv:' file path prefix.++ (To learn about producing CSV or TSV _output_, see Output format.)++ Each CSV file must be described by a corresponding _rules file_.+This contains rules describing the CSV data (header line, fields layout,+date format etc.), how to construct hledger transactions from it, and+how to categorise transactions based on description or other attributes.++ By default, hledger expects this rules file to be named like the CSV+file, with an extra '.rules' extension added, in the same directory. Eg+when asked to read 'foo/FILE.csv', hledger looks for+'foo/FILE.csv.rules'. You can specify a different rules file with the+'--rules' option.++ At minimum, the rules file must identify the date and amount fields,+and often it also specifies the date format and how many header lines+there are. Here's a simple CSV file and a rules file for it:++Date, Description, Id, Amount+12/11/2019, Foo, 123, 10.23++# basic.csv.rules+skip 1+fields date, description, , amount+date-format %d/%m/%Y++$ hledger print -f basic.csv+2019-11-12 Foo+ expenses:unknown 10.23+ income:unknown -10.23++ There's an introductory Tutorial: Import CSV data on hledger.org, and+more CSV rules examples below, and a larger collection at+https://github.com/simonmichael/hledger/tree/master/examples/csv.++* Menu:++* CSV rules cheatsheet::+* source::+* archive::+* encoding::+* separator::+* skip::+* date-format::+* timezone::+* newest-first::+* intra-day-reversed::+* decimal-mark::+* CSV fields and hledger fields::+* fields list::+* Field assignment::+* Field names::+* if block::+* Matchers::+* if table::+* balance-type::+* include::+* Working with CSV::+* CSV rules examples::+++File: hledger.info, Node: CSV rules cheatsheet, Next: source, Up: CSV++9.1 CSV rules cheatsheet+========================++The following kinds of rule can appear in the rules file, in any order.+(Blank lines and lines beginning with '#' or ';' or '*' are ignored.)++*'source'* optionally declare which file to read data+ from+*'archive'* optionally enable an archive of imported files+*'encoding'* optionally declare which text encoding the+ data has+*'separator'* declare the field separator, instead of+ relying on file extension+*'decimal-mark'* declare the decimal mark used in CSV amounts,+ when ambiguous+*'date-format'* declare how to parse CSV dates/date-times+*'timezone'* declare the time zone of ambiguous CSV+ date-times+*'newest-first'* improve txn order when: there are multiple+ records, newest first, all with the same date+*'intra-day-reversed'* improve txn order when: same-day txns are in+ opposite order to the overall file+*'skip'* (at top level) skip header line(s) at start of+ file+*'fields' list* name CSV fields for easy reference, and+ optionally assign their values to hledger+ fields+*Field assignment* assign a CSV value or interpolated text value+ to a hledger field+*'if' block* conditionally assign values to hledger fields,+ or 'skip' a record or 'end' (skip rest of+ file)+*'if' table* conditionally assign values to hledger fields,+ using compact syntax+*'skip'* (inside an 'if' rule) skip current record(s)+*'end'* (inside an 'if' rule) skip all remaining+ records+*'balance-type'* select which type of balance+ assertions/assignments to generate+*'include'* inline another CSV rules file++ Working with CSV tips can be found below, including How CSV rules are+evaluated.+++File: hledger.info, Node: source, Next: archive, Prev: CSV rules cheatsheet, Up: CSV++9.2 'source'+============++If you tell hledger to read a csv file with '-f foo.csv', it will look+for rules in 'foo.csv.rules'. Or, you can tell it to read the rules+file, with '-f foo.csv.rules', and it will look for data in 'foo.csv'+(since 1.30). These are mostly equivalent, but the second method+provides some extra features. For one, the data file can be missing,+without causing an error; it is just considered empty.++ For more flexibility, add a 'source' rule, which lets you specify a+different data file:++source ./Checking1.csv++ If the file does not exist, it is just considered empty, without+raising an error.++ If you specify just a file name with no path, hledger will look for+it in the '~/Downloads' folder:++source Checking1.csv++ You can use a glob pattern, to avoid specifying the file name+exactly:++source Checking1*.csv++ This has another benefit: if the pattern matches multiple files,+hledger will read the newest (most recently modified) one. This avoids+problems if you have downloaded a file multiple times without cleaning+up.++ All this enables a convenient workflow where can you just download+CSV files, then run 'hledger import rules/*'.++ See also "Working with CSV > Reading files specified by rule".++* Menu:++* Data cleaning / data generating commands::+++File: hledger.info, Node: Data cleaning / data generating commands, Up: source++9.2.1 Data cleaning / data generating commands+----------------------------------------------++After 'source''s file pattern, you can write '|' (pipe) and a data+cleaning command (or command pipeline). If hledger's CSV rules aren't+enough, you can pre-process the downloaded data here with a shell+command or script, to make it more suitable for conversion. The command+will be executed by your default shell, in the directory of the rules+file, will receive the data file's content as standard input, and should+output zero or more lines of character-separated-values, suitable for+conversion by the CSV rules.++ Examples:++source ./paypal.json | paypalcsv+source data/simplefin.json | simplefincsv - 'chase.*card'+source OfxDownload*.csv | grep -vE '^(([^,]*,){6}[^,]*|)$' | sort -t, -n +2+source History_for_Account_Z20144832*.csv # | grep -E '^([^,]*,){12}[^,]*$' | sed -E -e 's/^ //' -e 's/\.([0-9]),/.\10,/g' -e 's/,([0-9]+),/,\1.00,/g'++ Or, after 'source' you can write '|' and a data generating command+(with no file pattern before the '|'). This command receives no input,+and should output zero or more lines of character-separated values,+suitable for conversion by the CSV rules.++ Examples:++source | paypaljson | paypalcsv+source | paypalcsv data/paypal.json +source | simplefinjson >data/simplefin.json && simplefincsv data/simplefin.json 'chase.*card'+source | simplefincsv data/simplefin.json 'unify.*checking'++ ('paypal*' and 'simplefin*' scripts are in bin/)++ Whenever hledger runs one of these commands, it will echo the command+on stderr. If the command produces error output, but exits+successfully, hledger will show the error output as a warning. If the+command fails, hledger will fail and show the error output in the error+message.++ _Added in 1.50; experimental._+++File: hledger.info, Node: archive, Next: encoding, Prev: source, Up: CSV++9.3 'archive'+=============++With 'archive' added to a rules file, the 'import' command will archive+each successfully processed data file or data command output in a nearby+'data/' directory. The archive file name will be based on the rules+file and the data file's modification date and extension (or for a+data-generating command, the current date and the ".csv" extension).+The original data file, if any, will be removed.++ Also, in this mode 'import' will prefer the oldest file matched by+the 'source' rule's glob pattern, not the newest. (So if there are+multiple downloads, they will be imported and archived oldest first.)++ Archiving is optional, but it can be useful for troubleshooting your+CSV rules, regenerating entries with improved rules, checking for+variations in your bank's CSV, etc.++ _Added in 1.50; experimental._+++File: hledger.info, Node: encoding, Next: separator, Prev: archive, Up: CSV++9.4 'encoding'+==============++encoding ENCODING++ hledger normally expects non-ascii text to be using the system+locale's text encoding. If you need to read CSV files which have some+other encoding, you can do it by adding 'encoding ENCODING' to your CSV+rules. Eg: 'encoding iso-8859-1'.++ The following encodings are supported:++ 'ascii', 'utf-8', 'utf-16', 'utf-32', 'iso-8859-1', 'iso-8859-2',+'iso-8859-3', 'iso-8859-4', 'iso-8859-5', 'iso-8859-6', 'iso-8859-7',+'iso-8859-8', 'iso-8859-9', 'iso-8859-10', 'iso-8859-11', 'iso-8859-13',+'iso-8859-14', 'iso-8859-15', 'iso-8859-16', 'cp1250', 'cp1251',+'cp1252', 'cp1253', 'cp1254', 'cp1255', 'cp1256', 'cp1257', 'cp1258',+'koi8-r', 'koi8-u', 'gb18030', 'macintosh', 'jis-x-0201', 'jis-x-0208',+'iso-2022-jp', 'shift-jis', 'cp437', 'cp737', 'cp775', 'cp850', 'cp852',+'cp855', 'cp857', 'cp860', 'cp861', 'cp862', 'cp863', 'cp864', 'cp865',+'cp866', 'cp869', 'cp874', 'cp932'.++ _Added in 1.42._+++File: hledger.info, Node: separator, Next: skip, Prev: encoding, Up: CSV++9.5 'separator'+===============++You can use the 'separator' rule to read other kinds of+character-separated data. The argument is any single separator+character, or the words 'tab' or 'space' (case insensitive). Eg, for+comma-separated values (CSV):++separator ,++ or for semicolon-separated values (SSV):++separator ;++ or for tab-separated values (TSV):++separator TAB++ If the input file has a '.csv', '.ssv' or '.tsv' file extension (or a+'csv:', 'ssv:', 'tsv:' prefix), the appropriate separator will be+inferred automatically, and you won't need this rule.+++File: hledger.info, Node: skip, Next: date-format, Prev: separator, Up: CSV++9.6 'skip'+==========++skip N++ The word 'skip' followed by a number (or no number, meaning 1) tells+hledger to ignore this many non-empty lines at the start of the input+data. You'll need this whenever your CSV data contains header lines.+Note, empty and blank lines are skipped automatically, so you don't need+to count those.++ 'skip' has a second meaning: it can be used inside if blocks+(described below), to skip one or more records whenever the condition is+true. Records skipped in this way are ignored, except they are still+required to be valid CSV.+++File: hledger.info, Node: date-format, Next: timezone, Prev: skip, Up: CSV++9.7 'date-format'+=================++date-format DATEFMT++ This is a helper for the 'date' (and 'date2') fields. If your CSV+dates are not formatted like 'YYYY-MM-DD', 'YYYY/MM/DD' or 'YYYY.MM.DD',+you'll need to add a date-format rule describing them with a+strptime-style date parsing pattern - see+https://hackage.haskell.org/package/time/docs/Data-Time-Format.html#v:formatTime.+The pattern must parse the CSV date value completely. Some examples:++# MM/DD/YY+date-format %m/%d/%y++# D/M/YYYY+# The - makes leading zeros optional.+date-format %-d/%-m/%Y++# YYYY-Mmm-DD+date-format %Y-%h-%d++# M/D/YYYY HH:MM AM some other junk+# Note the time and junk must be fully parsed, though only the date is used.+date-format %-m/%-d/%Y %l:%M %p some other junk++ Note currently there is no locale awareness for things like '%b', and+setting LC_TIME won't help.+++File: hledger.info, Node: timezone, Next: newest-first, Prev: date-format, Up: CSV++9.8 'timezone'+==============++timezone TIMEZONE++ When CSV contains date-times that are implicitly in some time zone+other than yours, but containing no explicit time zone information, you+can use this rule to declare the CSV's native time zone, which helps+prevent off-by-one dates.++ When the CSV date-times do contain time zone information, you don't+need this rule; instead, use '%Z' in 'date-format' (or '%z', '%EZ',+'%Ez'; see the formatTime link above).++ 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:++$ TZ=-1000 hledger print -f foo.csv # or TZ=-1000 hledger import foo.csv++ 'timezone' currently does not understand timezone names, except+"UTC", "GMT", "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", or "PDT".+For others, use numeric format: +HHMM or -HHMM.+++File: hledger.info, Node: newest-first, Next: intra-day-reversed, Prev: timezone, Up: CSV++9.9 'newest-first'+==================++hledger tries to ensure that the generated transactions will be ordered+chronologically, including same-day transactions. Usually it can+auto-detect how the CSV records are ordered. But if it encounters CSV+where all records are on the same date, it assumes that the records are+oldest first. If in fact the CSV's records are normally newest first,+like:++2022-10-01, txn 3...+2022-10-01, txn 2...+2022-10-01, txn 1...++ you can add the 'newest-first' rule to help hledger generate the+transactions in correct order.++# same-day CSV records are newest first+newest-first+++File: hledger.info, Node: intra-day-reversed, Next: decimal-mark, Prev: newest-first, Up: CSV++9.10 'intra-day-reversed'+=========================++If CSV records within a single day are ordered opposite to the overall+record order, you can add the 'intra-day-reversed' rule to improve the+order of journal entries. Eg, here the overall record order is newest+first, but same-day records are oldest first:++2022-10-02, txn 3...+2022-10-02, txn 4...+2022-10-01, txn 1...+2022-10-01, txn 2...++# transactions within each day are reversed with respect to the overall date order+intra-day-reversed+++File: hledger.info, Node: decimal-mark, Next: CSV fields and hledger fields, Prev: intra-day-reversed, Up: CSV++9.11 'decimal-mark'+===================++decimal-mark .++ or:++decimal-mark ,++ hledger automatically accepts either period or comma as a decimal+mark when parsing numbers (cf Amounts). However if any numbers in the+CSV contain digit group marks, such as thousand-separating commas, you+should declare the decimal mark explicitly with this rule, to avoid+misparsed numbers.+++File: hledger.info, Node: CSV fields and hledger fields, Next: fields list, Prev: decimal-mark, Up: CSV++9.12 CSV fields and hledger fields+==================================++This can be confusing, so let's start with an overview:++ * *CSV fields* are provided by your data file. They are named by+ their position in the CSV record, starting with 1. You can also+ give them a readable name.++ * *hledger fields* are predefined; 'date', 'description', 'account1',+ 'amount1', 'account2' are some of them. They correspond to parts+ of a transaction's journal entry, mostly.++ * The CSV fields and hledger fields are the only fields you'll be+ working with; you can't define new fields, or variables as in a+ programming language. (But you could add extra CSV fields to the+ data in preprocessing, before running the rules.)++ * For each CSV record, you'll assign values to one or more of the+ hledger fields to build up a transaction (journal entry). Values+ can be static text, CSV field values from the current record, or a+ combination of these.++ * For simple cases, you can give a CSV field the same name as one of+ the hledger fields, then its value will be automatically assigned+ to that hledger field.++ * CSV fields can only be read, not written to. They'll be on the+ right hand side, with a % prefix. Eg++ * testing a CSV field's value: 'if %CSVFIELD ...'+ * interpolating its value: 'HLEDGERFIELD %CSVFIELD'++ * hledger fields can only be written to, not read. They'll be on the+ left hand side (or in a fields list), with no prefix. Eg++ * setting the transaction's description to a value: 'description+ VALUE'+ * setting the transaction's description to the second CSV+ field's value:+ 'fields date, description, amount'+++File: hledger.info, Node: fields list, Next: Field assignment, Prev: CSV fields and hledger fields, Up: CSV++9.13 'fields' list+==================++fields FIELDNAME1, FIELDNAME2, ...++ A fields list (the word 'fields' followed by comma-separated field+names) is optional, but convenient. It does two things:++ 1. It names the CSV field in each column. This can be convenient if+ you are referencing them in other rules, so you can say+ '%SomeField' instead of remembering '%13'.++ 2. Whenever you use one of the special hledger field names (described+ below), it assigns the CSV value in this position to that hledger+ field. This is the quickest way to populate hledger's fields and+ build a transaction.++ Here's an example that says "use the 1st, 2nd and 4th fields as the+transaction's date, description and amount; name the last two fields for+later reference; and ignore the others":++fields date, description, , amount, , , somefield, anotherfield++ In a fields list, the separator is always comma; it is unrelated to+the CSV file's separator. Also:++ * There must be least two items in the list (at least one comma).+ * Field names may not contain spaces. Spaces before/after field+ names are optional.+ * Field names may contain '_' (underscore) or '-' (hyphen).+ * Fields you don't care about can be given a dummy name or an empty+ name.++ If the CSV contains column headings, it's convenient to use these for+your field names, suitably modified (eg lower-cased with spaces replaced+by underscores).++ Sometimes you may want to alter a CSV field name to avoid assigning+to a hledger field with the same name. Eg you could call the CSV's+"balance" field 'balance_' to avoid directly setting hledger's 'balance'+field (and generating a balance assertion).+++File: hledger.info, Node: Field assignment, Next: Field names, Prev: fields list, Up: CSV++9.14 Field assignment+=====================++HLEDGERFIELD FIELDVALUE++ Field assignments are the more flexible way to assign CSV values to+hledger fields. They can be used instead of or in addition to a fields+list (see above).++ To assign a value to a hledger field, write the field name (any of+the standard hledger field/pseudo-field names, defined below), a space,+followed by a text value on the same line. This text value may+interpolate CSV fields, referenced either by their 1-based position in+the CSV record ('%N') or by the name they were given in the fields list+('%CSVFIELD'), and regular expression match groups ('\N').++ Some examples:++# set the amount to the 4th CSV field, with " USD" appended+amount %4 USD++# combine three fields to make a comment, containing note: and date: tags+comment note: %somefield - %anotherfield, date: %1++ Tips:++ * Interpolation strips outer whitespace (so a CSV value like '" 1 "'+ becomes '1' when interpolated) (#1051).+ * Interpolations always refer to a CSV field - you can't interpolate+ a hledger field. (See Referencing other fields below).+++File: hledger.info, Node: Field names, Next: if block, Prev: Field assignment, Up: CSV++9.15 Field names+================++Note the two kinds of field names mentioned here, and used only in+hledger CSV rules files:++ 1. *CSV field names* ('CSVFIELD' in these docs): you can optionally+ name the CSV columns for easy reference (since hledger doesn't yet+ automatically recognise column headings in a CSV file), by writing+ arbitrary names in a 'fields' list, eg:++ fields When, What, Some_Id, Net, Total, Foo, Bar++ 2. Special *hledger field names* ('HLEDGERFIELD' in these docs): you+ must set at least some of these to generate the hledger transaction+ from a CSV record, by writing them as the left hand side of a field+ assignment, eg:++ date %When+ code %Some_Id+ description %What+ comment %Foo %Bar+ amount1 $ %Total++ or directly in a 'fields' list:++ fields date, description, code, , amount1, Foo, Bar+ currency $+ comment %Foo %Bar++ Here are all the special hledger field names available, and what+happens when you assign values to them:++* Menu:++* date field::+* date2 field::+* status field::+* code field::+* description field::+* comment field::+* account field::+* amount field::+* currency field::+* balance field::+++File: hledger.info, Node: date field, Next: date2 field, Up: Field names++9.15.1 date field+-----------------++Assigning to 'date' sets the transaction date.+++File: hledger.info, Node: date2 field, Next: status field, Prev: date field, Up: Field names++9.15.2 date2 field+------------------++'date2' sets the transaction's secondary date, if any.+++File: hledger.info, Node: status field, Next: code field, Prev: date2 field, Up: Field names++9.15.3 status field+-------------------++'status' sets the transaction's status, if any.+++File: hledger.info, Node: code field, Next: description field, Prev: status field, Up: Field names++9.15.4 code field+-----------------++'code' sets the transaction's code, if any.+++File: hledger.info, Node: description field, Next: comment field, Prev: code field, Up: Field names++9.15.5 description field+------------------------++'description' sets the transaction's description, if any.+++File: hledger.info, Node: comment field, Next: account field, Prev: description field, Up: Field names++9.15.6 comment field+--------------------++'comment' sets the transaction's comment, if any.++ 'commentN', where N is a number, sets the Nth posting's comment.++ You can assign multi-line comments by writing literal '\n' in the+code. A comment starting with '\n' will begin on a new line.++ Comments can contain tags, as usual.++ Posting comments can also contain a posting date. A secondary date,+or a year-less date, will be ignored.+++File: hledger.info, Node: account field, Next: amount field, Prev: comment field, Up: Field names++9.15.7 account field+--------------------++Assigning to 'accountN', where N is 1 to 99, sets the account name of+the Nth posting, and causes that posting to be generated.++ Most often there are two postings, so you'll want to set 'account1'+and 'account2'. Typically 'account1' is associated with the CSV file,+and is set once with a top-level assignment, while 'account2' is set+based on each transaction's description, in conditional rules.++ If a posting's account name is left unset but its amount is set (see+below), a default account name will be chosen (like "expenses:unknown"+or "income:unknown").+++File: hledger.info, Node: amount field, Next: currency field, Prev: account field, Up: Field names++9.15.8 amount field+-------------------++There are several ways to set posting amounts from CSV, useful in+different situations.++ 1. *'amount'* is the oldest and simplest. Assigning to this sets the+ amount of the first and second postings. In the second posting,+ the amount will be negated; also, if it has a cost attached, it+ will be converted to cost.++ 2. *'amount-in'* and *'amount-out'* work exactly like the above, but+ should be used when the CSV has two amount fields (such as "Debit"+ and "Credit", or "Inflow" and "Outflow"). Whichever field has a+ non-zero value will be used as the amount of the first and second+ postings. Here are some tips to avoid confusion:++ * It's not "amount-in for posting 1 and amount-out for posting+ 2", it is "extract a single amount from the amount-in or+ amount-out field, and use that for posting 1 and (negated) for+ posting 2".+ * Don't use both 'amount' and 'amount-in'/'amount-out' in the+ same rules file; choose based on whether the amount is in a+ single CSV field or spread across two fields.+ * In each record, at most one of the two CSV fields should+ contain a non-zero amount; the other field must contain a zero+ or nothing.+ * hledger assumes both CSV fields contain unsigned numbers, and+ it automatically negates the amount-out values.+ * If the data doesn't fit these requirements, you'll probably+ need an if rule (see below).++ 3. *'amountN'* (where N is a number from 1 to 99) sets the amount of+ only a single posting: the Nth posting in the transaction. You'll+ usually need at least two such assignments to make a balanced+ transaction. You can also generate more than two postings, to+ represent more complex transactions. The posting numbers don't+ have to be consecutive; with if rules, higher posting numbers can+ be useful to ensure a certain order of postings.++ 4. *'amountN-in'* and *'amountN-out'* work exactly like the above, but+ should be used when the CSV has two amount fields. This is+ analogous to 'amount-in' and 'amount-out', and those tips also+ apply here.++ 5. Remember that a 'fields' list can also do assignments. So in a+ fields list if you name a CSV field "amount", that counts as+ assigning to 'amount'. (If you don't want that, call it something+ else in the fields list, like "amount_".)++ 6. The above don't handle every situation; if you need more+ flexibility, use an 'if' rule to set amounts conditionally. See+ "Working with CSV > Setting amounts" below for more on this and on+ amount-setting generally.+++File: hledger.info, Node: currency field, Next: balance field, Prev: amount field, Up: Field names++9.15.9 currency field+---------------------++'currency' sets a currency symbol, to be prepended to all postings'+amounts. You can use this if the CSV amounts do not have a currency+symbol, eg if it is in a separate column.++ 'currencyN' prepends a currency symbol to just the Nth posting's+amount.+++File: hledger.info, Node: balance field, Prev: currency field, Up: Field names++9.15.10 balance field+---------------------++'balanceN' sets a balance assertion amount (or if the posting amount is+left empty, a balance assignment) on posting N.++ 'balance' is a compatibility spelling for hledger <1.17; it is+equivalent to 'balance1'.++ You can adjust the type of assertion/assignment with the+'balance-type' rule (see below).++ See the Working with CSV tips below for more about setting amounts+and currency.+++File: hledger.info, Node: if block, Next: Matchers, Prev: Field names, Up: CSV++9.16 'if' block+===============++Rules can be applied conditionally, depending on patterns in the CSV+data. This allows flexibility; in particular, it is how you can+categorise transactions, selecting an appropriate account name based on+their description (for example). There are two ways to write+conditional rules: "if blocks", described here, and "if tables",+described below.++ An if block is the word 'if' and one or more "matcher" expressions+(can be a word or phrase), one per line, starting either on the same or+next line; followed by one or more indented rules. Eg,++if MATCHER+ RULE++ or++if+MATCHER+MATCHER+MATCHER+ RULE+ RULE++ If any of the matchers succeeds, all of the indented rules will be+applied. They are usually field assignments, but the following special+rules may also be used within an if block:++ * 'skip' - skips the matched CSV record (generating no transaction+ from it)+ * 'end' - skips the rest of the current CSV file.++ Some examples:++# if the record contains "groceries", set account2 to "expenses:groceries"+if groceries+ account2 expenses:groceries++# if the record contains any of these phrases, set account2 and a transaction comment as shown+if+monthly service fee+atm transaction fee+banking thru software+ account2 expenses:business:banking+ comment XXX deductible ? check it++# if an empty record is seen (assuming five fields), ignore the rest of the CSV file+if ,,,,+ end+++File: hledger.info, Node: Matchers, Next: if table, Prev: if block, Up: CSV++9.17 Matchers+=============++There are two kinds of matcher:++ 1. A whole record matcher is simplest: it is just a word, single-line+ text fragment, or other regular expression, which hledger will try+ to match case-insensitively anywhere within the CSV record.+ Eg: 'whole foods'.++ 2. A field matcher has a percent-prefixed CSV field number or name+ before the pattern.+ Eg: '%3 whole foods' or '%description whole foods'.+ hledger will try to match the pattern just within the named CSV+ field.++ When using these, there's two things to be aware of:++ 1. Whole record matchers don't see the exact original record; they see+ a reconstruction of it, in which values are comma-separated, and+ quotes enclosing values and whitespace outside those quotes are+ removed.+ Eg when reading an SSV record like: '2023-01-01 ; "Acme, Inc. " ;+ 1,000'+ the whole record matcher sees instead: '2023-01-01,Acme, Inc.+ ,1,000'++ 2. Field matchers expect either a CSV field number, or a CSV field+ name declared with 'fields'. Anything else will cause it to match+ against the empty string, and probably fail silently (this makes it+ easier to reuse common rules with different CSV files). Don't use+ a hledger field name here (see CSV fields and hledger fields).++ You can also prefix a matcher with '!' (and optional space) to negate+it. Eg '! whole foods', '! %3 whole foods', '!%description whole foods'+will match if "whole foods" is NOT present. _Added in 1.32._++ The pattern is, as usual in hledger, a POSIX extended regular+expression that also supports GNU word boundaries ('\b', '\B', '\<',+'\>') and nothing else. For more details and tips, see Regular+expressions in CSV rules below.++* Menu:++* Multiple matchers::+* Match groups::+++File: hledger.info, Node: Multiple matchers, Next: Match groups, Up: Matchers++9.17.1 Multiple matchers+------------------------++When an if block has multiple matchers, each on its own line,++ * By default they are OR'd (any of them can match).+ * Matcher lines beginning with '&' (or '&&', _since 1.42_) are AND'ed+ with the matcher above (all in the AND'ed group must match).+ * Matcher lines beginning with '& !' (_since 1.41_, or '&& !', _since+ 1.42_) are first negated and then AND'ed with the matcher above.++ You can also combine multiple matchers one the same line separated by+'&&' (AND) or '&& !' (AND NOT). Eg '%description amazon && %date+2025-01-01' will match only when the description field contains "amazon"+and the date field contains "2025-01-01". _Added in 1.42._+++File: hledger.info, Node: Match groups, Prev: Multiple matchers, Up: Matchers++9.17.2 Match groups+-------------------++_Added in 1.32_++ Matchers can define match groups: parenthesised portions of the+regular expression which are available for reference in field+assignments. Groups are enclosed in regular parentheses ('(' and ')')+and can be nested. Each group is available in field assignments using+the token '\N', where N is an index into the match groups for this+conditional block (e.g. '\1', '\2', etc.).++ Example: Warp credit card payment postings to the beginning of the+billing period (Month start), to match how they are presented in+statements, using posting dates:++if %date (....-..)-..+ comment2 date:\1-01++ Another example: Read the expense account from the CSV field, but+throw away a prefix:++if %account1 liabilities:family:(expenses:.*)+ account1 \1+++File: hledger.info, Node: if table, Next: balance-type, Prev: Matchers, Up: CSV++9.18 'if' table+===============++"if tables" are an alternative to if blocks; they can express many+matchers and field assignments in a more compact tabular format, like+this:++if,HLEDGERFIELD1,HLEDGERFIELD2,...+MATCHERA,VALUE1,VALUE2,...+MATCHERB && MATCHERC,VALUE1,VALUE2,... (*since 1.42*)+; Comment line that explains MATCHERD+MATCHERD,VALUE1,VALUE2,...+<empty line>++ The first character after 'if' is taken to be this if table's field+separator. It is unrelated to the separator used in the CSV file. It+should be a non-alphanumeric character like ',' or '|' that does not+appear anywhere else in the table (it should not be used in field names+or matchers or values, and it cannot be escaped with a backslash).++ Each line must contain the same number of separators; empty values+are allowed. Whitespace can be used in the matcher lines for+readability (but not in the if line, currently). You can use the+comment lines in the table body. The table must be terminated by an+empty line (or end of file).++ An if table like the above is interpreted as follows: try all of the+lines with matchers; whenever a line with matchers succeeds, assign all+of the values on that line to the corresponding hledger fields; If+multiple lines match, later lines will override fields assigned by the+earlier ones - just like the sequence of 'if' blocks would behave.++ If table presented above is equivalent to this sequence of if blocks:++if MATCHERA+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++if MATCHERB && MATCHERC+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++; Comment line which explains MATCHERD+if MATCHERD+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++ Example:++if,account2,comment+atm transaction fee,expenses:business:banking,deductible? check it+%description groceries,expenses:groceries,+;; Comment line that desribes why this particular date is special+2023/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call-out+++File: hledger.info, Node: balance-type, Next: include, Prev: if table, Up: CSV++9.19 'balance-type'+===================++Balance assertions generated by assigning to balanceN are of the simple+'=' type by default, which is a single-commodity, subaccount-excluding+assertion. You may find the subaccount-including variants more useful,+eg if you have created some virtual subaccounts of checking to help with+budgeting. You can select a different type of assertion with the+'balance-type' rule:++# balance assertions will consider all commodities and all subaccounts+balance-type ==*++ Here are the balance assertion types for quick reference:++= single commodity, exclude subaccounts+=* single commodity, include subaccounts+== multi commodity, exclude subaccounts+==* multi commodity, include subaccounts+++File: hledger.info, Node: include, Next: Working with CSV, Prev: balance-type, Up: CSV++9.20 'include'+==============++include RULESFILE++ This includes the contents of another CSV rules file at this point.+'RULESFILE' is an absolute file path or a path relative to the current+file's directory. This can be useful for sharing common rules between+several rules files, eg:++# someaccount.csv.rules++## someaccount-specific rules+fields date,description,amount+account1 assets:someaccount+account2 expenses:misc++## common rules+include categorisation.rules+++File: hledger.info, Node: Working with CSV, Next: CSV rules examples, Prev: include, Up: CSV++9.21 Working with CSV+=====================++Some tips:++* Menu:++* Rapid feedback::+* Valid CSV::+* File Extension::+* Reading CSV from standard input::+* Reading multiple CSV files::+* Reading files specified by rule::+* Valid transactions::+* Deduplicating importing::+* Regular expressions in CSV rules::+* Setting amounts::+* Amount signs::+* Setting currency/commodity::+* Amount decimal places::+* Referencing other fields::+* How CSV rules are evaluated::+* Well factored rules::+++File: hledger.info, Node: Rapid feedback, Next: Valid CSV, Up: Working with CSV++9.21.1 Rapid feedback+---------------------++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:++$ 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. "bash -c" is used to run multiple commands, so we can echo+a separator each time the command re-runs, making it easier to read the+output.+++File: hledger.info, Node: Valid CSV, Next: File Extension, Prev: Rapid feedback, Up: Working with CSV++9.21.2 Valid CSV+----------------++Note that hledger will only accept valid CSV conforming to RFC 4180, and+equivalent SSV and TSV formats (like RFC 4180 but with semicolon or tab+as separators). This means, eg:++ * Values may be enclosed in double quotes, or not. Enclosing in+ single quotes is not allowed. (Eg ''A','B'' is rejected.)+ * When values are enclosed in double quotes, spaces outside the+ quotes are not allowed. (Eg '"A", "B"' is rejected.)+ * When values are not enclosed in quotes, they may not contain double+ quotes. (Eg 'A"A, B' is rejected.)++ If your CSV/SSV/TSV is not valid in this sense, you'll need to+transform it before reading with hledger. Try using sed, or a more+permissive CSV parser like python's csv lib.+++File: hledger.info, Node: File Extension, Next: Reading CSV from standard input, Prev: Valid CSV, Up: Working with CSV++9.21.3 File Extension+---------------------++To help hledger choose the CSV file reader and show the right error+messages (and choose the right field separator character by default),+it's best if CSV/SSV/TSV files are named with a '.csv', '.ssv' or '.tsv'+filename extension. (More about this at Data formats.)++ 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:++$ hledger -f ssv:foo.dat print++ You can also override the default field separator with a separator+rule if needed.+++File: hledger.info, Node: Reading CSV from standard input, Next: Reading multiple CSV files, Prev: File Extension, Up: Working with CSV++9.21.4 Reading CSV from standard input+--------------------------------------++You'll need the file format prefix when reading CSV from stdin also,+since hledger assumes journal format by default. Eg:++$ cat foo.dat | hledger -f ssv:- print+++File: hledger.info, Node: Reading multiple CSV files, Next: Reading files specified by rule, Prev: Reading CSV from standard input, Up: Working with CSV++9.21.5 Reading multiple CSV files+---------------------------------++If you use multiple '-f' options to read multiple CSV files at once,+hledger will look for a correspondingly-named rules file for each CSV+file. But if you specify a rules file with '--rules', that rules file+will be used for all the CSV files.+++File: hledger.info, Node: Reading files specified by rule, Next: Valid transactions, Prev: Reading multiple CSV files, Up: Working with CSV++9.21.6 Reading files specified by rule+--------------------------------------++Instead of specifying a CSV file in the command line, you can specify a+rules file, as in 'hledger -f foo.csv.rules CMD'. By default this will+read data from foo.csv in the same directory, but you can add a source+rule to specify a different data file, perhaps located in your web+browser's download directory.++ This feature was added in hledger 1.30, so you won't see it in most+CSV rules examples. But it helps remove some of the busywork of+managing CSV downloads. Most of your financial institutions's default+CSV filenames are different and can be recognised by a glob pattern. So+you can put a rule like 'source Checking1*.csv' in+foo-checking.csv.rules, and then periodically follow a workflow like:++ 1. Download CSV from Foo's website, using your browser's defaults+ 2. Run 'hledger import foo-checking.csv.rules' to import any new+ transactions++ After import, you can: discard the CSV, or leave it where it is for a+while, or move it into your archives, as you prefer. If you do nothing,+next time your browser will save something like Checking1-2.csv, and+hledger will use that because of the '*' wild card and because it is the+most recent.+++File: hledger.info, Node: Valid transactions, Next: Deduplicating importing, Prev: Reading files specified by rule, Up: Working with CSV++9.21.7 Valid transactions+-------------------------++After reading a CSV file, hledger post-processes and validates the+generated journal entries as it would for a journal file - balancing+them, applying balance assignments, and canonicalising amount styles.+Any errors at this stage will be reported in the usual way, displaying+the problem entry.++ 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:++$ hledger -f file.csv print | hledger -f- print+++File: hledger.info, Node: Deduplicating importing, Next: Regular expressions in CSV rules, Prev: Valid transactions, Up: Working with CSV++9.21.8 Deduplicating, importing+-------------------------------++When you download a CSV file periodically, eg to get your latest bank+transactions, the new file may overlap with the old one, containing some+of the same records.++ The import command will (a) detect the new transactions, and (b)+append just those transactions to your main 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:++# download the latest CSV files, then run this command.+# Note, no -f flags needed here.+$ hledger import *.csv [--dry]++ This method works for most CSV files. (Where records have a stable+chronological order, and new records appear only at the new end.)++ A number of other tools and workflows, hledger-specific and+otherwise, exist for converting, deduplicating, classifying and managing+CSV data. See:++ * https://hledger.org/cookbook.html#setups-and-workflows+ * https://plaintextaccounting.org -> data import/conversion+++File: hledger.info, Node: Regular expressions in CSV rules, Next: Setting amounts, Prev: Deduplicating importing, Up: Working with CSV++9.21.9 Regular expressions in CSV rules+---------------------------------------++Regular expressions in 'if' conditions (AKA matchers) are POSIX extended+regular expressions, that also support GNU word boundaries ('\b', '\B',+'\<', '\>'), and nothing else. (For more detail, see Regular+expressions.)++ Here are some examples that might be useful in CSV rules:++ * Is field "foo" truly empty ? 'if %foo ^$'+ * Is it empty or containing only whitespace ? 'if %foo ^ *$'+ * Is it non-empty ? 'if %foo .'+ * Does it contain non-whitespace ? 'if %foo [^ ]'++ Testing the value of numeric fields is a little harder. You can't+use hledger queries like 'amt:0' or 'amt:>10' in CSV rules. But you can+often achieve the same thing with a regular expression.++ Note the content and layout of number fields in CSV varies, and can+change over time (eg if you switch data providers). So numeric regexps+are always somewhat specific to your particular CSV data; and it's a+good idea to make them defensive and robust if you can.++ Here are some examples:++ * Does foo contain a non-zero number ? 'if %foo [1-9]'+ * Is it negative ? 'if %foo -'+ * Is it non-negative ? 'if ! %foo -'+ * Is it >= 10 ? 'if %foo [1-9][0-9]+\.' (assuming a decimal period+ and no leading zeros)+ * Is it >= 10 and < 20 ? 'if %foo \b1[0-9]\.'+++File: hledger.info, Node: Setting amounts, Next: Amount signs, Prev: Regular expressions in CSV rules, Up: Working with CSV++9.21.10 Setting amounts+-----------------------++Continuing from amount field above, here are more tips for+amount-setting:++ 1. *If the amount is in a single CSV field:*++ a. *If its sign indicates direction of flow:*+ Assign it to 'amountN', to set the Nth posting's amount. N is+ usually 1 or 2 but can go up to 99.++ b. *If another field indicates direction of flow:*+ Use one or more conditional rules to set the appropriate+ amount sign. Eg:++ # assume a withdrawal unless Type contains "deposit":+ amount1 -%Amount+ if %Type deposit+ amount1 %Amount++ 2. *If the amount is in two CSV fields (such as Debit and Credit, or+ In and Out):*++ a. *If both fields are unsigned:*+ Assign one field to 'amountN-in' and the other to+ 'amountN-out'. hledger will automatically negate the "out"+ field, and will use whichever field value is non-zero as+ posting N's amount.++ b. *If either field is signed:*+ You will probably need to override hledger's sign for one or+ the other field, as in the following example:++ # Negate the -out value, but only if it is not empty:+ fields date, description, amount1-in, amount1-out+ if %amount1-out [1-9]+ amount1-out -%amount1-out++ c. *If both fields can contain a non-zero value (or both can be+ empty):*+ The -in/-out rules normally choose the value which is+ non-zero/non-empty. Some value pairs can be ambiguous, such+ as '1' and 'none'. For such cases, use conditional rules to+ help select the amount. Eg, to handle the above you could+ select the value containing non-zero digits:++ fields date, description, in, out+ if %in [1-9]+ amount1 %in+ if %out [1-9]+ amount1 %out++ 3. *If you want posting 2's amount converted to cost:*+ Use the unnumbered 'amount' (or 'amount-in' and 'amount-out')+ syntax.++ 4. *If the CSV has only balance amounts, not transaction amounts:*+ Assign to 'balanceN', to set a balance assignment on the Nth+ posting, causing the posting's amount to be calculated+ automatically. 'balance' with no number is equivalent to+ 'balance1'. In this situation hledger is more likely to guess the+ wrong default account name, so you may need to set that explicitly.+++File: hledger.info, Node: Amount signs, Next: Setting currency/commodity, Prev: Setting amounts, Up: Working with CSV++9.21.11 Amount signs+--------------------++There is some special handling making it easier to parse and to reverse+amount signs. (This only works for whole amounts, not for cost amounts+such as COST in 'amount1 AMT @ COST'):++ * *If an amount value begins with a plus sign:*+ that will be removed: '+AMT' becomes 'AMT'++ * *If an amount value is parenthesised:*+ it will be de-parenthesised and sign-flipped: '(AMT)' becomes+ '-AMT'++ * *If an amount value has two minus signs (or two sets of+ parentheses, or a minus sign and parentheses):*+ they cancel out and will be removed: '--AMT' or '-(AMT)' becomes+ 'AMT'++ * *If an amount value contains just a sign (or just a set of+ parentheses):*+ that is removed, making it an empty value. '"+"' or '"-"' or+ '"()"' becomes '""'.++ It's not possible (without preprocessing the CSV) to set an amount to+its absolute value, ie discard its sign.+++File: hledger.info, Node: Setting currency/commodity, Next: Amount decimal places, Prev: Amount signs, Up: Working with CSV++9.21.12 Setting currency/commodity+----------------------------------++If the currency/commodity symbol is included in the CSV's amount+field(s):++2023-01-01,foo,$123.00++ you don't have to do anything special for the commodity symbol, it+will be assigned as part of the amount. Eg:++fields date,description,amount++2023-01-01 foo+ expenses:unknown $123.00+ income:unknown $-123.00++ If the currency is provided as a separate CSV field:++2023-01-01,foo,USD,123.00++ You can assign that to the 'currency' pseudo-field, which has the+special effect of prepending itself to every amount in the transaction+(on the left, with no separating space):++fields date,description,currency,amount++2023-01-01 foo+ expenses:unknown USD123.00+ income:unknown USD-123.00++ Or, you can use a field assignment to construct the amount yourself,+with more control. Eg to put the symbol on the right, and separated by+a space:++fields date,description,cur,amt+amount %amt %cur++2023-01-01 foo+ expenses:unknown 123.00 USD+ income:unknown -123.00 USD++ Note we used a temporary field name ('cur') that is not 'currency' -+that would trigger the prepending effect, which we don't want here.+++File: hledger.info, Node: Amount decimal places, Next: Referencing other fields, Prev: Setting currency/commodity, Up: Working with CSV++9.21.13 Amount decimal places+-----------------------------++When you are reading CSV data, eg with a command like 'hledger -f+foo.csv print', hledger will infer each commodity's decimal precision+(and other commodity display styles) from the amounts - much as when+reading a journal file without 'commodity' directives (see the link).++ Note, the commodity styles are not inferred from the numbers in the+original CSV data; rather, they are inferred from the amounts generated+by the CSV rules.++ When you are importing CSV data with the 'import' command, eg+'hledger import foo.csv', there's another step: 'import' tries to make+the new entries conform to the journal's existing styles. So for each+commodity - let's say it's EUR - 'import' will choose:++ 1. the style declared for EUR by a 'commodity' directive in the+ journal+ 2. otherwise, the style inferred from EUR amounts in the journal+ 3. otherwise, the style inferred from EUR amounts generated by the CSV+ rules.++ TLDR: if 'import' is not generating the precisions or styles you+want, add a 'commodity' directive to specify them.+++File: hledger.info, Node: Referencing other fields, Next: How CSV rules are evaluated, Prev: Amount decimal places, Up: Working with CSV++9.21.14 Referencing other fields+--------------------------------++In field assignments, you can interpolate only CSV fields, not hledger+fields. In the example below, there's both a CSV field and a hledger+field named amount1, but %amount1 always means the CSV field, not the+hledger field:++# Name the third CSV field "amount1"+fields date,description,amount1++# Set hledger's amount1 to the CSV amount1 field followed by USD+amount1 %amount1 USD++# Set comment to the CSV amount1 (not the amount1 assigned above)+comment %amount1++ Here, since there's no CSV amount1 field, %amount1 will produce a+literal "amount1":++fields date,description,csvamount+amount1 %csvamount USD+# Can't interpolate amount1 here+comment %amount1++ When there are multiple field assignments to the same hledger field,+only the last one takes effect. Here, comment's value will be be B, or+C if "something" is matched, but never A:++comment A+comment B+if something+ comment C+++File: hledger.info, Node: How CSV rules are evaluated, Next: Well factored rules, Prev: Referencing other fields, Up: Working with CSV++9.21.15 How CSV rules are evaluated+-----------------------------------++Here's how to think of CSV rules being evaluated. If you get a+confusing error while reading a CSV file, it may help to try to+understand which of these steps is failing:++ 1. Any included rules files are inlined, from top to bottom, depth+ first (scanning each included file for further includes,+ recursively, before proceeding).++ 2. Top level rules ('date-format', 'fields', 'newest-first', 'skip'+ etc) are read, top to bottom. "Top level rules" means+ non-conditional rules. If a rule occurs more than once, the last+ one wins; except for 'skip'/'end' rules, where the first one wins.++ 3. The CSV file is read as text. Any non-ascii characters will be+ decoded using the text encoding specified by the 'encoding' rule,+ otherwise the system locale's text encoding.++ 4. Any top-level skip or end rule is applied. 'skip [N]' immediately+ skips the current or next N CSV records; 'end' immediately skips+ all remaining CSV records (not normally used at top level).++ 5. Now any remaining CSV records are processed. For each CSV record,+ in file order:++ * Is there a conditional skip/end rule that applies for this+ record ? Search the 'if' blocks, from top to bottom, for a+ succeeding one containing a 'skip' or 'end' rule. If found,+ skip the specified number of CSV records, then continue at 5.+ Otherwise...++ * Do some basic validation on this CSV record (eg, check that it+ has at least two fields).++ * For each hledger field ('date', 'description', 'account1',+ etc.):++ 1. Get the field's assigned value, first searching top level+ assignments, made directly or by the 'fields' rule, then+ assignments made inside succeeding 'if' blocks. If there+ are more than one, the last one wins.++ 2. Compute the field's actual value (as text), by+ interpolating any %CSVFIELD references within the+ assigned value; or by choosing a default value if there+ was no assignment.++ * Generate a hledger transaction from the hledger field values,+ parsing them if needed (eg from text to an amount).++ This is all done by the CSV reader, one of several readers hledger+can use to read transactions from an input file. When all input files+have been read successfully, their transactions are passed to whichever+hledger command the user specified.+++File: hledger.info, Node: Well factored rules, Prev: How CSV rules are evaluated, Up: Working with CSV++9.21.16 Well factored rules+---------------------------++Some things than can help reduce duplication and complexity in rules+files:++ * Extracting common rules usable with multiple CSV files into a+ 'common.rules', and adding 'include common.rules' to each CSV's+ rules file.++ * Splitting if blocks into smaller if blocks, extracting the+ frequently used parts.+++File: hledger.info, Node: CSV rules examples, Prev: Working with CSV, Up: CSV++9.22 CSV rules examples+=======================++* Menu:++* Bank of Ireland::+* Coinbase::+* Amazon::+* Paypal::+++File: hledger.info, Node: Bank of Ireland, Next: Coinbase, Up: CSV rules examples++9.22.1 Bank of Ireland+----------------------++Here's a CSV with two amount fields (Debit and Credit), and a balance+field, which we can use to add balance assertions, which is not+necessary but provides extra error checking:++Date,Details,Debit,Credit,Balance+07/12/2012,LODGMENT 529898,,10.0,131.21+07/12/2012,PAYMENT,5,,126++# bankofireland-checking.csv.rules++# skip the header line+skip++# name the csv fields, and assign some of them as journal entry fields+fields date, description, amount-out, amount-in, balance++# We generate balance assertions by assigning to "balance"+# above, but you may sometimes need to remove these because:+#+# - the CSV balance differs from the true balance,+# by up to 0.0000000000005 in my experience+#+# - it is sometimes calculated based on non-chronological ordering,+# eg when multiple transactions clear on the same day++# date is in UK/Ireland format+date-format %d/%m/%Y++# set the currency+currency EUR++# set the base account for all txns+account1 assets:bank:boi:checking++$ hledger -f bankofireland-checking.csv print+2012-12-07 LODGMENT 529898+ assets:bank:boi:checking EUR10.0 = EUR131.2+ income:unknown EUR-10.0++2012-12-07 PAYMENT+ assets:bank:boi:checking EUR-5.0 = EUR126.0+ expenses:unknown EUR5.0++ The balance assertions don't raise an error above, because we're+reading directly from CSV, but they will be checked if these entries are+imported into a journal file.+++File: hledger.info, Node: Coinbase, Next: Amazon, Prev: Bank of Ireland, Up: CSV rules examples++9.22.2 Coinbase+---------------++A simple example with some CSV from Coinbase. The spot price is+recorded using cost notation. The legacy 'amount' field name+conveniently sets amount 2 (posting 2's amount) to the total cost.++# Timestamp,Transaction Type,Asset,Quantity Transacted,Spot Price Currency,Spot Price at Transaction,Subtotal,Total (inclusive of fees and/or spread),Fees and/or Spread,Notes+# 2021-12-30T06:57:59Z,Receive,USDC,100,GBP,0.740000,"","","","Received 100.00 USDC from an external account"++# coinbase.csv.rules+skip 1+fields Timestamp,Transaction_Type,Asset,Quantity_Transacted,Spot_Price_Currency,Spot_Price_at_Transaction,Subtotal,Total,Fees_Spread,Notes+date %Timestamp+date-format %Y-%m-%dT%T%Z+description %Notes+account1 assets:coinbase:cc+amount %Quantity_Transacted %Asset @ %Spot_Price_at_Transaction %Spot_Price_Currency++$ hledger print -f coinbase.csv+2021-12-30 Received 100.00 USDC from an external account+ assets:coinbase:cc 100 USDC @ 0.740000 GBP+ income:unknown -74.000000 GBP+++File: hledger.info, Node: Amazon, Next: Paypal, Prev: Coinbase, Up: CSV rules examples++9.22.3 Amazon+-------------++Here we convert amazon.com order history, and use an if block to+generate a third posting if there's a fee. (In practice you'd probably+get this data from your bank instead, but it's an example.)++"Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID"+"Jul 29, 2012","Payment","To","Foo.","Completed","$20.00","$0.00","16000000000000DGLNJPI1P9B8DKPVHL"+"Jul 30, 2012","Payment","To","Adapteva, Inc.","Completed","$25.00","$1.00","17LA58JSKRD4HDGLNJPI1P9B8DKPVHL"++# amazon-orders.csv.rules++# skip one header line+skip 1++# name the csv fields, and assign the transaction's date, amount and code.+# Avoided the "status" and "amount" hledger field names to prevent confusion.+fields date, _, toorfrom, name, amzstatus, amzamount, fees, code++# how to parse the date+date-format %b %-d, %Y++# combine two fields to make the description+description %toorfrom %name++# save the status as a tag+comment status:%amzstatus++# set the base account for all transactions+account1 assets:amazon+# leave amount1 blank so it can balance the other(s).+# I'm assuming amzamount excludes the fees, don't remember++# set a generic account2+account2 expenses:misc+amount2 %amzamount+# and maybe refine it further:+#include categorisation.rules++# add a third posting for fees, but only if they are non-zero.+if %fees [1-9]+ account3 expenses:fees+ amount3 %fees++$ hledger -f amazon-orders.csv print+2012-07-29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo. ; status:Completed+ assets:amazon+ expenses:misc $20.00++2012-07-30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc. ; status:Completed+ assets:amazon+ expenses:misc $25.00+ expenses:fees $1.00+++File: hledger.info, Node: Paypal, Prev: Amazon, Up: CSV rules examples++9.22.4 Paypal+-------------++Here's a real-world rules file for (customised) Paypal CSV, with some+Paypal-specific rules, and a second rules file included:++"Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note"+"10/01/2019","03:46:20","PDT","Calm Radio","Subscription Payment","Completed","USD","-6.99","0.00","-6.99","simon@joyful.com","memberships@calmradio.com","60P57143A8206782E","MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month","","I-R8YLY094FJYR","","-6.99",""+"10/01/2019","03:46:20","PDT","","Bank Deposit to PP Account ","Pending","USD","6.99","0.00","6.99","","simon@joyful.com","0TU1544T080463733","","","60P57143A8206782E","","0.00",""+"10/01/2019","08:57:01","PDT","Patreon","PreApproved Payment Bill User Payment","Completed","USD","-7.00","0.00","-7.00","simon@joyful.com","support@patreon.com","2722394R5F586712G","Patreon* Membership","","B-0PG93074E7M86381M","","-7.00",""+"10/01/2019","08:57:01","PDT","","Bank Deposit to PP Account ","Pending","USD","7.00","0.00","7.00","","simon@joyful.com","71854087RG994194F","Patreon* Membership","","2722394R5F586712G","","0.00",""+"10/19/2019","03:02:12","PDT","Wikimedia Foundation, Inc.","Subscription Payment","Completed","USD","-2.00","0.00","-2.00","simon@joyful.com","tle@wikimedia.org","K9U43044RY432050M","Monthly donation to the Wikimedia Foundation","","I-R5C3YUS3285L","","-2.00",""+"10/19/2019","03:02:12","PDT","","Bank Deposit to PP Account ","Pending","USD","2.00","0.00","2.00","","simon@joyful.com","3XJ107139A851061F","","","K9U43044RY432050M","","0.00",""+"10/22/2019","05:07:06","PDT","Noble Benefactor","Subscription Payment","Completed","USD","10.00","-0.59","9.41","noble@bene.fac.tor","simon@joyful.com","6L8L1662YP1334033","Joyful Systems","","I-KC9VBGY2GWDB","","9.41",""++# paypal-custom.csv.rules++# Tips:+# Export from Activity -> Statements -> Custom -> Activity download+# Suggested transaction type: "Balance affecting"+# Paypal's default fields in 2018 were:+# "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Shipping Address","Address Status","Item Title","Item ID","Shipping and Handling Amount","Insurance Amount","Sales Tax","Option 1 Name","Option 1 Value","Option 2 Name","Option 2 Value","Reference Txn ID","Invoice Number","Custom Number","Quantity","Receipt ID","Balance","Address Line 1","Address Line 2/District/Neighborhood","Town/City","State/Province/Region/County/Territory/Prefecture/Republic","Zip/Postal Code","Country","Contact Phone Number","Subject","Note","Country Code","Balance Impact"+# This rules file assumes the following more detailed fields, configured in "Customize report fields":+# "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note"++fields date, time, timezone, description_, type, status_, currency, grossamount, feeamount, netamount, fromemail, toemail, code, itemtitle, itemid, referencetxnid, receiptid, balance, note++skip 1++date-format %-m/%-d/%Y++# ignore some paypal events+if+In Progress+Temporary Hold+Update to+ skip++# add more fields to the description+description %description_ %itemtitle++# save some other fields as tags+comment itemid:%itemid, fromemail:%fromemail, toemail:%toemail, time:%time, type:%type, status:%status_++# convert to short currency symbols+if %currency USD+ currency $+if %currency EUR+ currency E+if %currency GBP+ currency P++# generate postings++# the first posting will be the money leaving/entering my paypal account+# (negative means leaving my account, in all amount fields)+account1 assets:online:paypal+amount1 %netamount++# the second posting will be money sent to/received from other party+# (account2 is set below)+amount2 -%grossamount++# if there's a fee, add a third posting for the money taken by paypal.+if %feeamount [1-9]+ account3 expenses:banking:paypal+ amount3 -%feeamount+ comment3 business:++# choose an account for the second posting++# override the default account names:+# if the amount is positive, it's income (a debit)+if %grossamount ^[^-]+ account2 income:unknown+# if negative, it's an expense (a credit)+if %grossamount ^-+ account2 expenses:unknown++# apply common rules for setting account2 & other tweaks+include common.rules++# apply some overrides specific to this csv++# Transfers from/to bank. These are usually marked Pending,+# which can be disregarded in this case.+if+Bank Account+Bank Deposit to PP Account+ description %type for %referencetxnid %itemtitle+ account2 assets:bank:wf:pchecking+ account1 assets:online:paypal++# Currency conversions+if Currency Conversion+ account2 equity:currency conversion++# common.rules++if+darcs+noble benefactor+ account2 revenues:foss donations:darcshub+ comment2 business:++if+Calm Radio+ account2 expenses:online:apps++if+electronic frontier foundation+Patreon+wikimedia+Advent of Code+ account2 expenses:dues++if Google+ account2 expenses:online:apps+ description google | music++$ 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+ expenses:online:apps $6.99++2019-10-01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $6.99 = $0.00+ assets:bank:wf:pchecking $-6.99++2019-10-01 (2722394R5F586712G) Patreon Patreon* Membership ; itemid:, fromemail:simon@joyful.com, toemail:support@patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed+ assets:online:paypal $-7.00 = $-7.00+ expenses:dues $7.00++2019-10-01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership ; itemid:, fromemail:, toemail:simon@joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $7.00 = $0.00+ assets:bank:wf:pchecking $-7.00++2019-10-19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation ; itemid:, fromemail:simon@joyful.com, toemail:tle@wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed+ assets:online:paypal $-2.00 = $-2.00+ expenses:dues $2.00+ expenses:banking:paypal ; business:++2019-10-19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $2.00 = $0.00+ assets:bank:wf:pchecking $-2.00++2019-10-22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems ; itemid:, fromemail:noble@bene.fac.tor, toemail:simon@joyful.com, time:05:07:06, type:Subscription Payment, status:Completed+ assets:online:paypal $9.41 = $9.41+ revenues:foss donations:darcshub $-10.00 ; business:+ expenses:banking:paypal $0.59 ; business:+++File: hledger.info, Node: Timeclock, Next: Timedot, Prev: CSV, Up: Top++10 Timeclock+************++hledger can read time logs in the timeclock time logging format of+timeclock.el. As with Ledger, hledger's timeclock format is a+subset/variant of timeclock.el's.++ hledger's timeclock format was updated in hledger 1.43 and 1.50. If+your old time logs are rejected, you should adapt them to modern+hledger; for now, you can restore the pre-1.43 behaviour with the+'--old-timeclock' flag.++ Here the timeclock format in hledger 1.50+:++# Comment lines like these, and blank lines, are ignored:+# comment line+; comment line+* comment line++# Lines beginning with b, h, or capital O are also ignored, for compatibility:+b SIMPLEDATE HH:MM[:SS][+-ZZZZ][ TEXT]+h SIMPLEDATE HH:MM[:SS][+-ZZZZ][ TEXT]+O SIMPLEDATE HH:MM[:SS][+-ZZZZ][ TEXT]++# Lines beginning with i or o are are clock-in / clock-out entries:+i SIMPLEDATE HH:MM[:SS][+-ZZZZ] ACCOUNT[ DESCRIPTION][;COMMENT]]+o SIMPLEDATE HH:MM[:SS][+-ZZZZ][ ACCOUNT][;COMMENT]++ The date is a hledger simple date (YYYY-MM-DD or similar). The time+parts must use two digits. The seconds are optional. A + or -+four-digit time zone is accepted for compatibility, but currently+ignored; times are always interpreted as a local time.++ In clock-in entries ('i'), the account name is required. A+transaction description, separated from the account name by 2+ spaces,+is optional. A transaction comment, beginning with ';', is also+optional. (Indented following comment lines are also allowed, as in+journal format.)++ In clock-out entries ('o') have no description, but can have a+comment if you wish. A clock-in and clock-out pair form a "transaction"+posting some number of hours to an account - also known as a session.+Eg:++i 2015/03/30 09:00:00 session1+o 2015/03/30 10:00:00++$ hledger -f a.timeclock print+2015-03-30 * 09:00-10:00+ (session1) 1.00h++ Clock-ins and clock-outs are matched by their account/session name.+If a clock-out does not specify a name, the most recent unclosed+clock-in is closed. You can have multiple sessions active+simultaneously. Entries are processed in the order they are parsed.+Sessions spanning more than one day are automatically split at day+boundaries.++ Eg, the following time log:++i 2015/03/30 09:00:00 some account optional description after 2 spaces ; optional comment, tags:+o 2015/03/30 09:20:00+i 2015/03/31 22:21:45 another:account+o 2015/04/01 02:00:34+i 2015/04/02 12:00:00 another:account ; this demonstrates multple sessions being clocked in+i 2015/04/02 13:00:00 some account+o 2015/04/02 14:00:00+o 2015/04/02 15:00:00 another:account++ generates these transactions:++$ hledger -f t.timeclock print+2015-03-30 * optional description after 2 spaces ; optional comment, tags:+ (some account) 0.33h++2015-03-31 * 22:21-23:59+ (another:account) 1.64h++2015-04-01 * 00:00-02:00+ (another:account) 2.01h++2015-04-02 * 12:00-15:00 ; this demonstrates multiple sessions being clocked in+ (another:account) 3.00h++2015-04-02 * 13:00-14:00+ (some account) 1.00h++ Here is a sample.timeclock to download and some queries to try:++$ 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++ To generate time logs, ie to clock in and clock out, you could:++ * use these shell aliases at the command line:++ alias ti='echo i `date "+%Y-%m-%d %H:%M:%S"` $* >>$TIMELOG'+ alias to='echo o `date "+%Y-%m-%d %H:%M:%S"` >>$TIMELOG'++ * or Emacs's built-in timeclock.el, or the extended timeclock-x.el,+ and perhaps the extras in ledgerutils.el++ * or use the old 'ti' and 'to' scripts in the ledger 2.x repository.+ These rely on a "timeclock" executable which I think is just the+ ledger 2 executable renamed.+++File: hledger.info, Node: Timedot, Next: PART 3 REPORTING CONCEPTS, Prev: Timeclock, Up: Top++11 Timedot+**********++'timedot' format is hledger's human-friendly time logging format.+Compared to 'timeclock' format, it is more convenient for quick,+approximate, and retroactive time logging, and more human-readable (you+can see at a glance where time was spent). A quick example:++2023-05-01+hom:errands .... .... ; two hours; the space is ignored+fos:hledger:timedot .. ; half an hour+per:admin:finance ; no time spent yet++ hledger reads this as a transaction on this day with three+(unbalanced) postings, where each dot represents "0.25". No commodity+symbol is assumed, but we typically interpret it as hours.++$ hledger -f a.timedot print # .timedot file extension (or timedot: prefix) is required+2023-05-01 *+ (hom:errands) 2.00 ; two hours+ (fos:hledger:timedot) 0.50 ; half an hour+ (per:admin:finance) 0++ A timedot file contains a series of transactions (usually one per+day). Each begins with a *simple date* (Y-M-D, Y/M/D, or Y.M.D),+optionally be followed on the same line by a transaction description,+and/or a transaction comment following a semicolon.++ After the date line are zero or more time postings, consisting of:++ * *An account name* - any hledger-style account name, optionally+ indented.++ * *Two or more spaces* - required if there is an amount (as in+ journal format).++ * *A timedot amount*, which can be++ * empty (representing zero)++ * a number, optionally followed by a unit 's', 'm', 'h', 'd',+ 'w', 'mo', or 'y', representing a precise number of seconds,+ minutes, hours, days weeks, months or years (hours is assumed+ by default), which will be converted to hours according to 60s+ = 1m, 60m = 1h, 24h = 1d, 7d = 1w, 30d = 1mo, 365d = 1y.++ * one or more dots (period characters), each representing 0.25.+ These are the dots in "timedot". Spaces are ignored and can+ be used for grouping/alignment.++ * _Added in 1.32_ one or more letters. These are like dots but+ they also generate a tag 't:' (short for "type") with the+ letter as its value, and a separate posting for each of the+ values. This provides a second dimension of categorisation,+ viewable in reports with '--pivot t'.++ * *An optional comment* following a semicolon (a hledger-style+ posting comment).++ There is some flexibility to help with keeping time log data and+notes in the same file:++ * Blank lines and lines beginning with '#' or ';' are ignored.++ * After the first date line, lines which do not contain a double+ space are parsed as postings with zero amount. (hledger's register+ reports will show these if you add -E).++ * Before the first date line, lines beginning with '*' (eg org+ headings) are ignored. And from the first date line onward, Emacs+ org mode heading prefixes at the start of lines (one or more '*''s+ followed by a space) will be ignored. This means the time log can+ also be a org outline.++ Timedot files don't support directives like journal files. So a+common pattern is to have a main journal file (eg 'time.journal') that+contains any needed directives, and then includes the timedot file+('include time.timedot').++* Menu:++* Timedot examples::+++File: hledger.info, Node: Timedot examples, Up: Timedot++11.1 Timedot examples+=====================++Numbers:++2016/2/3+inc:client1 4+fos:hledger 3h+biz:research 60m++ Dots:++# on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.+2016/2/1+inc:client1 .... .... .... .... .... ....+fos:haskell .... ..+biz:research .++2016/2/2+inc:client1 .... ....+biz:research .++$ hledger -f a.timedot print date:2016/2/2+2016-02-02 *+ (inc:client1) 2.00++2016-02-02 *+ (biz:research) 0.25++$ hledger -f a.timedot bal --daily --tree+Balance changes in 2016-02-01-2016-02-03:++ || 2016-02-01d 2016-02-02d 2016-02-03d +============++========================================+ biz || 0.25 0.25 1.00 + research || 0.25 0.25 1.00 + fos || 1.50 0 3.00 + haskell || 1.50 0 0 + hledger || 0 0 3.00 + inc || 6.00 2.00 4.00 + client1 || 6.00 2.00 4.00 +------------++----------------------------------------+ || 7.75 2.25 8.00 ++ Letters:++# Activity types:+# c cleanup/catchup/repair+# e enhancement+# s support+# l learning/research++2023-11-01+work:adm ccecces++$ hledger -f a.timedot print+2023-11-01+ (work:adm) 1 ; t:c+ (work:adm) 0.5 ; t:e+ (work:adm) 0.25 ; t:s++$ hledger -f a.timedot bal+ 1.75 work:adm+--------------------+ 1.75 ++$ hledger -f a.timedot bal --pivot t+ 1.00 c+ 0.50 e+ 0.25 s+--------------------+ 1.75 ++ Org:++* 2023 Work Diary+** Q1+*** 2023-02-29+**** DONE+0700 yoga+**** UNPLANNED+**** BEGUN+hom:chores+ cleaning ...+ water plants+ outdoor - one full watering can+ indoor - light watering+**** TODO+adm:planning: trip+*** LATER++ Using '.' as account name separator:++2016/2/4+fos.hledger.timedot 4h+fos.ledger ..++$ hledger -f a.timedot --alias '/\./=:' bal -t+ 4.50 fos+ 4.00 hledger:timedot+ 0.50 ledger+--------------------+ 4.50+++File: hledger.info, Node: PART 3 REPORTING CONCEPTS, Next: Time periods, Prev: Timedot, Up: Top++12 PART 3: REPORTING CONCEPTS+*****************************+++File: hledger.info, Node: Time periods, Next: Depth, Prev: PART 3 REPORTING CONCEPTS, Up: Top++13 Time periods+***************++* Menu:++* Report start & end date::+* Smart dates::+* Report intervals::+* Date adjustments::+* Period headings::+* Period expressions::+++File: hledger.info, Node: Report start & end date, Next: Smart dates, Up: Time periods++13.1 Report start & end date+============================++Most hledger reports will by default show the full time period+represented by the journal. The report start date will be the earliest+transaction or posting date, and the report end date will be the latest+transaction, posting, or market price date.++ Often you will want to see a shorter period, such as the current+month. You can specify a start and/or end date with the '-b/--begin',+'-e/--end', or '-p/--period' options, or a 'date:' query argument,+described below. All of these accept the smart date syntax, also+described below.++ End dates are exclusive; specify the day after the last day you want+to see in the report.++ When dates are specified by multiple options, the last (right-most)+option wins. And when 'date:' queries and date options are combined,+the report period will be their intersection.++ Examples:++'-b 2016/3/17'++ beginning on St. Patrick's day 2016+'-e 12/1'++ ending at the start of December 1st in the current year+'-p 'this month''++ during the current month+'-p thismonth'++ same as above, spaces are optional+'-b 2023'++ beginning on the first day of 2023+'date:2023..' or 'date:2023-'++ same as above++ '-b 2024 -e 2025 -p '2000 to 2030' date:2020-01 date:2020' :+during January 2020 (the smallest common period, with the -p overriding+-b and -e)+++File: hledger.info, Node: Smart dates, Next: Report intervals, Prev: Report start & end date, Up: Time periods++13.2 Smart dates+================++In hledger's user interfaces (though not in the journal file), you can+optionally use "smart date" syntax. Smart dates can be written with+english words, can be relative, and can have parts omitted. Missing+parts are inferred as 1, when needed. Smart dates can be interpreted as+dates or periods depending on the context.++ Examples:++ '2004-01-01', '2004/10/1', '2004.9.1', '20240504', '2024Q1' :+Exact dates. The year must have at least four digits, the month must be+1-12, the day must be 1-31, the separator can be '-' or '/' or '.' or+nothing. The q can be upper or lower case and the quarter number must+be 1-4.++'2004-10'++ start of month+'2004q3'++ start of third quarter of 2004+'q3'++ start of third quarter of current year+'2004'++ start of year+'10/1' or 'oct' or 'october'++ October 1st in current year+'21'++ 21st day in current month+'yesterday, today, tomorrow'++ -1, 0, 1 days from today+'last/this/next day/week/month/quarter/year'++ -1, 0, 1 periods from the current period+'last/this/next tuesday'++ the previous occurrence of the named day, or the next occurrence+ after today+'last/this/next february'++ the previous occurrence of 1st of the named month, or the next+ occurrence after the current month+'in n days/weeks/months/quarters/years'++ n periods from the current period+'n days/weeks/months/quarters/years ahead'++ n periods from the current period+'n days/weeks/months/quarters/years ago'++ -n periods from the current period+'20181201'++ 8 digit YYYYMMDD with valid year month and day+'201812'++ 6 digit YYYYMM with valid year and month++ Dates with no separators are allowed but might give surprising+results if mistyped:++ * '20181301' (YYYYMMDD with an invalid month) is parsed as an+ eight-digit year+ * '20181232' (YYYYMMDD with an invalid day) gives a parse error+ * '201801012' (a valid YYYYMMDD followed by additional digits) gives+ a parse error++ The meaning of relative dates depends on today's date. If you need+to test or reproduce old reports, you can use the '--today' option to+override that. (Except for periodic transaction rules, which are not+affected by '--today'.)+++File: hledger.info, Node: Report intervals, Next: Date adjustments, Prev: Smart dates, Up: Time periods++13.3 Report intervals+=====================++A report interval can be specified so that reports like register,+balance or activity become multi-period, showing each subperiod as a+separate row or column.++ The following standard intervals can be enabled with command-line+flags:++ * '-D/--daily'+ * '-W/--weekly'+ * '-M/--monthly'+ * '-Q/--quarterly'+ * '-Y/--yearly'++ More complex intervals can be specified using '-p/--period',+described below.+++File: hledger.info, Node: Date adjustments, Next: Period headings, Prev: Report intervals, Up: Time periods++13.4 Date adjustments+=====================++* Menu:++* Start date adjustment::+* End date adjustment::+++File: hledger.info, Node: Start date adjustment, Next: End date adjustment, Up: Date adjustments++13.4.1 Start date adjustment+----------------------------++If you let hledger infer a report's start date, it will adjust the date+to the previous natural boundary of the report interval, for convenient+periodic reports. (If you don't want that, specify a start date.)++ For example, if the journal's first transaction is on january 10th,++ * 'hledger register' (no report interval) will start the report on+ january 10th.+ * 'hledger register --monthly' will start the report on the previous+ month boundary, january 1st.+ * 'hledger register --monthly --begin 1/5' will start the report on+ january 5th [1].++ Also if you are generating transactions or budget goals with periodic+transaction rules, their start date may be adjusted in a similar way (in+certain situations).+++File: hledger.info, Node: End date adjustment, Prev: Start date adjustment, Up: Date adjustments++13.4.2 End date adjustment+--------------------------++A report's end date is always adjusted to include a whole number of+intervals, so that the last subperiod has the same length as the others.++ For example, if the journal's last transaction is on february 20th,++ * 'hledger register' will end the report on february 20th.+ * 'hledger register --monthly' will end the report at the end of+ february.+ * 'hledger register --monthly --end 2/14' also will end the report at+ the end of february (overriding the requested end date).+ * 'hledger register --monthly --begin 1/5 --end 2/14' will end the+ report on march 4th [1].++ [1] Since hledger 1.29.+++File: hledger.info, Node: Period headings, Next: Period expressions, Prev: Date adjustments, Up: Time periods++13.5 Period headings+====================++With non-standard subperiods, hledger will show "STARTDATE..ENDDATE"+headings. With standard subperiods (ie, starting on a natural interval+boundary), you'll see more compact headings, which are usually+preferable. (Though month names will be in english, currently.)++ So if you are specifying a start date and you want compact headings:+choose a start of year for yearly reports, a start of quarter for+quarterly reports, a start of month for monthly reports, etc.+(Remember, you can write eg '-b 2024' or '1/1' as a shortcut for a start+of year, or '2024-04' or '202404' or 'Apr' for a start of month or+quarter.)++ For weekly reports, choose a date that's a Monday. (You can try+different dates until you see the short headings, or write eg '-b '3+weeks ago''.)+++File: hledger.info, Node: Period expressions, Prev: Period headings, Up: Time periods++13.6 Period expressions+=======================++The '-p/--period' option specifies a period expression, which is a+compact way of expressing a start date, end date, and/or report+interval.++ Here's a period expression with a start and end date (specifying the+first quarter of 2009):++'-p "from 2009/1/1 to 2009/4/1"'++ Several keywords like "from" and "to" are supported for readability;+these are optional. "to" can also be written as ".." or "-". The+spaces are also optional, as long as you don't run two dates together.+So the following are equivalent to the above:++'-p "2009/1/1 2009/4/1"'+'-p2009/1/1to2009/4/1'+'-p2009/1/1..2009/4/1'++ Dates are smart dates, so if the current year is 2009, these are also+equivalent to the above:++'-p "1/1 4/1"'+'-p "jan-apr"'+'-p "this year to 4/1"'++ If you specify only one date, the missing start or end date will be+the earliest or latest transaction date in the journal:++'-p "from 2009/1/1"' everything after january 1, 2009+'-p "since 2009/1"' the same, since is a synonym+'-p "from 2009"' the same+'-p "to 2009"' everything before january 1, 2009++ You can also specify a period by writing a single partial or full+date:++'-p "2009"' the year 2009; equivalent to “2009/1/1 to 2010/1/1”+'-p "2009/1"' the month of january 2009; equivalent to “2009/1/1 to+ 2009/2/1”+'-p the first day of 2009; equivalent to “2009/1/1 to+"2009/1/1"' 2009/1/2”++ or by using the "Q" quarter-year syntax (case insensitive):++'-p "2009Q1"' first quarter of 2009, equivalent to “2009/1/1 to+ 2009/4/1”+'-p "q4"' fourth quarter of the current year++* Menu:++* Period expressions with a report interval::+* More complex report intervals::+* Multiple weekday intervals::+++File: hledger.info, Node: Period expressions with a report interval, Next: More complex report intervals, Up: Period expressions++13.6.1 Period expressions with a report interval+------------------------------------------------++A period expression can also begin with a report interval, separated+from the start/end dates (if any) by a space or the word 'in':++'-p "weekly from 2009/1/1 to 2009/4/1"'+'-p "monthly in 2008"'+'-p "quarterly"'+++File: hledger.info, Node: More complex report intervals, Next: Multiple weekday intervals, Prev: Period expressions with a report interval, Up: Period expressions++13.6.2 More complex report intervals+------------------------------------++Some more complex intervals can be specified within period expressions,+such as:++ * 'biweekly' (every two weeks)+ * 'fortnightly'+ * 'bimonthly' (every two months)+ * 'every day|week|month|quarter|year'+ * 'every N days|weeks|months|quarters|years'++ Weekly on a custom day:++ * 'every Nth day of week' ('th', 'nd', 'rd', or 'st' are all accepted+ after the number)+ * 'every WEEKDAYNAME' (full or three-letter english weekday name,+ case insensitive)++ Monthly on a custom day:++ * 'every Nth day [of month]' ('31st day' will be adjusted to each+ month's last day)+ * 'every Nth WEEKDAYNAME [of month]'++ Yearly on a custom month and day:++ * 'every MM/DD [of year]' (month number and day of month number)+ * 'every MONTHNAME DDth [of year]' (full or three-letter english+ month name, case insensitive, and day of month number)+ * 'every DDth MONTHNAME [of year]' (equivalent to the above)++ Examples:++'-p "bimonthly from+2008"'+'-p "every 2 weeks"'+'-p "every 5 months from+2009/03"'+'-p "every 2nd day of periods will go from Tue to Tue+week"'+'-p "every Tue"' same+'-p "every 15th day"' period boundaries will be on 15th of each+ month+'-p "every 2nd Monday"' period boundaries will be on second Monday+ of each month+'-p "every 11/05"' yearly periods with boundaries on 5th of+ November+'-p "every 5th November"' same+'-p "every Nov 5th"' same++ Show historical balances at end of the 15th day of each month (N is+an end date, exclusive as always):++$ hledger balance -H -p "every 16th day"++ Group postings from the start of wednesday to end of the following+tuesday (N is both (inclusive) start date and (exclusive) end date):++$ hledger register checking -p "every 3rd day of week"+++File: hledger.info, Node: Multiple weekday intervals, Prev: More complex report intervals, Up: Period expressions++13.6.3 Multiple weekday intervals+---------------------------------++This special form is also supported:++ * 'every WEEKDAYNAME,WEEKDAYNAME,...' (full or three-letter english+ weekday names, case insensitive)++ Also, 'weekday' and 'weekendday' are shorthand for+'mon,tue,wed,thu,fri' and 'sat,sun'.++ This is mainly intended for use with '--forecast', to generate+periodic transactions on arbitrary days of the week. It may be less+useful with '-p', since it divides each week into subperiods of unequal+length, which is unusual. (Related: #1632)++ Examples:++'-p "every dates will be Mon, Wed, Fri; periods will be+mon,wed,fri"' Mon-Tue, Wed-Thu, Fri-Sun+'-p "every dates will be Mon, Tue, Wed, Thu, Fri; periods will+weekday"' be Mon, Tue, Wed, Thu, Fri-Sun+'-p "every dates will be Sat, Sun; periods will be Sat, Sun-Fri+weekendday"'+++File: hledger.info, Node: Depth, Next: Queries, Prev: Time periods, Up: Top++14 Depth+********++With the '--depth NUM' option (short form, usually preferred: '-NUM'),+reports will show accounts only to the specified depth, hiding deeper+subaccounts. Use this when you want a summary with less detail. This+flag has the same effect as a 'depth:' query argument. So all of these+are equivalent: 'depth:2', '--depth=2', '-2'.++ You can also provide custom depths for specific accounts, by+providing a 'REGEX=NUM' argument instead of just 'NUM' _(since 1.41)_.+For example, '--depth assets=2' (or 'depth:assets=2') will collapse+accounts matching the regular expression "assets" to depth 2. So+'assets:bank:savings' would be collapsed to 'assets:bank', but+'liabilities:bank:credit card' would not be affected.++ If REGEX contains spaces or other special characters, enclose it in+quotes in the usual way. Eg: '--depth 'credit card=2''++* Menu:++* Combining depth options::+++File: hledger.info, Node: Combining depth options, Up: Depth++14.1 Combining depth options+============================++If a command line contains multiple general depth options, the last one+wins. (Useful for overriding a depth specified by scripts.)++ Or a command may contain a combination of general and custom depth+options. In this case, the most specifically (deepest) matching option+wins. Some examples:++ * '--depth assets=3 --depth expenses=2 --depth 1' would collapse+ accounts containing "assets" to depth 3, accounts containing+ "expenses" to depth 2, and all other accounts to depth 1.++ * '--depth assets=1 --depth savings=2' would collapse+ 'assets:bank:savings' to depth 2 (not depth 1; because "savings"+ matches a deeper part of the account name than "assets").++ Note currently, to override a custom depth option '--depth REGEX=NUM'+with a later option, the later option must use the same REGEX.+++File: hledger.info, Node: Queries, Next: Pivoting, Prev: Depth, Up: Top++15 Queries+**********++Many hledger commands accept query arguments, which restrict their scope+and let you report on a precise subset of your data. Here's a quick+overview of hledger's queries:++ * By default, a query argument is treated as a case-insensitive+ substring pattern for matching account names. Eg:++ dining groceries+ car:fuel++ * Patterns containing spaces or other special characters must be+ enclosed in single or double quotes:++ 'personal care'++ * Patterns are actually regular expressions, so you can add regexp+ metacharacters for more precision (or you may need to+ backslash-escape certain characters; see "Regular expressions"+ above):++ '^expenses\b'+ 'food$'+ 'fuel|repair'+ 'accounts (payable|receivable)'++ * To match something other than the account name, you can add a query+ type prefix, such as:++ 'date:202312-'+ 'status:'+ 'desc:amazon'+ 'cur:USD'+ 'cur:\\$'+ 'amt:'>0''+ 'acct:groceries' (but 'acct:' is the default, so we usually don't+ bother writing it)++ * To negate a query, add a 'not:' prefix:++ not:status:'*'+ not:desc:'opening|closing'+ not:cur:USD++ * Multiple query terms can be combined, as space-separated queries+ Eg: 'hledger print date:2022 desc:amazon desc:amzn' (show+ transactions dated in 2022 whose description contains "amazon" or+ "amzn").++ * Or more flexibly as boolean queries. Eg: 'hledger print+ expr:'date:2022 and (desc:amazon or desc:amzn) and not+ date:202210''++ All hledger commands use the same query language, but different+commands may interpret the query in different ways. We haven't+described the commands yet (that's coming in PART 4: COMMANDS below) but+here's the gist of it:++ * Transaction-oriented commands ('print', 'aregister', 'close',+ 'import', 'descriptions'..) try to match transactions (including+ the transaction's postings).++ * Posting-oriented commands ('register', 'balance', 'balancesheet',+ 'incomestatement', 'accounts'..) try to match postings. Postings+ inherit their transaction's attributes for querying purposes, so+ transaction fields like date or description can still be referenced+ in a posting query.++ * A few commands match in more specific ways. (Eg 'aregister', which+ has a special first argument.)++* Menu:++* Query types::+* Negative queries::+* Space-separated queries::+* Boolean queries::+* Queries and command options::+* Queries and account aliases::+* Queries and valuation::+++File: hledger.info, Node: Query types, Next: Negative queries, Up: Queries++15.1 Query types+================++Here are the query types available:++* Menu:++* acct query::+* amt query::+* code query::+* cur query::+* desc query::+* date query::+* date2 query::+* depth query::+* note query::+* payee query::+* real query::+* status query::+* type query::+* tag query::+++File: hledger.info, Node: acct query, Next: amt query, Up: Query types++15.1.1 acct: query+------------------++*'acct:REGEX'*, or just *'REGEX'*+Match account names containing this case insensitive regular expression.+This is the default query type, so we usually don't bother writing the+"acct:" prefix.+++File: hledger.info, Node: amt query, Next: code query, Prev: acct query, Up: Query types++15.1.2 amt: query+-----------------++*'amt:N, amt:'<N', amt:'<=N', amt:'>N', amt:'>=N''*+Match postings with a single-commodity amount equal to, less than, or+greater than N. (Postings with multi-commodity amounts are not tested+and will always match.) 'amt:' needs quotes to hide the less+than/greater than sign from the command line shell.++ The comparison has two modes: if N is preceded by a + or - sign (or+is 0), the two signed numbers are compared. Otherwise, the absolute+magnitudes are compared, ignoring sign.++ Keep in mind that 'amt:' matches posting amounts, not account+balances.+++File: hledger.info, Node: code query, Next: cur query, Prev: amt query, Up: Query types++15.1.3 code: query+------------------++*'code:REGEX'*+Match by transaction code (eg check number).+++File: hledger.info, Node: cur query, Next: desc query, Prev: code query, Up: Query types++15.1.4 cur: query+-----------------++*'cur:REGEX'*+Match postings or transactions including any amounts whose+currency/commodity symbol is fully matched by REGEX. (Contrary to+hledger's usual infix matching. To do infix matching, write+'.*REGEX.*'.) Note, to match special characters which are+regex-significant, you need to escape them with '\'. And for characters+which are significant to your shell you will usually need one more level+of escaping. Eg to match the dollar sign: 'cur:\\$' or 'cur:'\$''+++File: hledger.info, Node: desc query, Next: date query, Prev: cur query, Up: Query types++15.1.5 desc: query+------------------++*'desc:REGEX'*+Match transaction descriptions.+++File: hledger.info, Node: date query, Next: date2 query, Prev: desc query, Up: Query types++15.1.6 date: query+------------------++*'date:PERIODEXPR'*+Match dates (or with the '--date2' flag, secondary dates) within the+specified period. PERIODEXPR is a period expression. Examples:+'date:2016', 'date:thismonth', 'date:2/1-2/15',+'date:2021-07-27..nextquarter'.++ PERIODEXPR may include a report interval (since 1.52). On the+command line, this is equivalent to specifying a report interval with a+command line option. In other contexts (hledger-ui, hledger-web), the+report interval may be ignored.+++File: hledger.info, Node: date2 query, Next: depth query, Prev: date query, Up: Query types++15.1.7 date2: query+-------------------++*'date2:PERIODEXPR'*+If you use secondary dates: this matches secondary dates within the+specified period. It is not affected by the '--date2' flag. A report+interval in PERIODEXPR will be ignored.+++File: hledger.info, Node: depth query, Next: note query, Prev: date2 query, Up: Query types++15.1.8 depth: query+-------------------++*'depth:[REGEXP=]N'*+Match (or display, depending on command) accounts at or above this+depth, optionally only for accounts matching a provided regular+expression. See Depth for detailed rules.+++File: hledger.info, Node: note query, Next: payee query, Prev: depth query, Up: Query types++15.1.9 note: query+------------------++*'note:REGEX'*+Match transaction notes (the part of the description right of '|', or+the whole description if there's no '|').+++File: hledger.info, Node: payee query, Next: real query, Prev: note query, Up: Query types++15.1.10 payee: query+--------------------++*'payee:REGEX'*+Match transaction payee/payer names (the part of the description left of+'|', or the whole description if there's no '|').+++File: hledger.info, Node: real query, Next: status query, Prev: payee query, Up: Query types++15.1.11 real: query+-------------------++*'real:, real:0'*+Match real or virtual postings respectively.+++File: hledger.info, Node: status query, Next: type query, Prev: real query, Up: Query types++15.1.12 status: query+---------------------++*'status:, status:!, status:*'*+Match unmarked, pending, or cleared transactions respectively.+++File: hledger.info, Node: type query, Next: tag query, Prev: status query, Up: Query types++15.1.13 type: query+-------------------++*'type:TYPECODES'*+Match by account type (see Declaring accounts > Account types).+'TYPECODES' is one or more of the single-letter account type codes+'ALERXCVG', case insensitive. Note 'type:A', 'type:E', and 'type:R'+will also match their respective subtypes 'C' (Cash), 'V' (Conversion),+and 'G' (Gain). Certain kinds of account alias can disrupt account+types, see Rewriting accounts > Aliases and account types.+++File: hledger.info, Node: tag query, Prev: type query, Up: Query types++15.1.14 tag: query+------------------++*'tag:NAMEREGEX[=VALREGEX]'*+Match by tag name, and optionally also by tag value. Note:++ * Both regular expressions do infix matching. If you need a complete+ match, use '^' and '$'.+ Eg: 'tag:'^fullname$'', 'tag:'^fullname$=^fullvalue$'+ * To match values, ignoring names, do 'tag:.=VALREGEX'+ * Accounts also inherit the tags of their parent accounts.+ * Postings also inherit the tags of their account and their+ transaction .+ * Transactions also acquire the tags of their postings.+++File: hledger.info, Node: Negative queries, Next: Space-separated queries, Prev: Query types, Up: Queries++15.2 Negative queries+=====================++* Menu:++* not query::+++File: hledger.info, Node: not query, Up: Negative queries++15.2.1 not: query+-----------------++*'not:QUERY'*+You can prepend *'not:'* to a query to negate the match.+Eg: 'not:equity', 'not:desc:apple'+(Also, a trick: 'not:not:...' can sometimes solve query problems+conveniently.)+++File: hledger.info, Node: Space-separated queries, Next: Boolean queries, Prev: Negative queries, Up: Queries++15.3 Space-separated queries+============================++When given multiple space-separated query terms, most commands select+things which match:++ * any of the description terms AND+ * any of the account terms AND+ * any of the status terms AND+ * all the other terms.++ The print command is a little different, showing transactions which:++ * match any of the description terms AND+ * have any postings matching any of the positive account terms AND+ * have no postings matching any of the negative account terms AND+ * match all the other terms.+++File: hledger.info, Node: Boolean queries, Next: Queries and command options, Prev: Space-separated queries, Up: Queries++15.4 Boolean queries+====================++You can write more complicated "boolean" query expressions, enclosed in+quotes and prefixed with 'expr:'. These can combine subqueries with+NOT, AND, OR operators (case insensitive), and parentheses for grouping.+Eg, to show transactions involving both cash and expense accounts:++hledger print expr:'cash AND expenses'++ The prefix and enclosing quotes are required, so don't write 'hledger+print cash AND expenses'. That would be a space-separated query showing+transactions involving accounts with any of "cash", "and", "expenses" in+their names.++ You can write space-separated queries _inside_ a boolean query, and+they will combine as described above, but it might be confusing and best+avoided. Eg these are equivalent, showing transactions involving cash+or expenses accounts:++hledger print expr:'cash expenses'+hledger print cash expenses++ There is a restriction with 'date:' queries: they may not be used+inside OR expressions.++ Actually, there are three types of boolean query: 'expr:' for general+use, and 'any:' and 'all:' variants which can be useful with 'print'.++* Menu:++* expr query::+* any query::+* all query::+++File: hledger.info, Node: expr query, Next: any query, Up: Boolean queries++15.4.1 expr: query+------------------++*'expr:'QUERYEXPR''*+For example, 'expr:'date:lastmonth AND NOT (food OR rent)'' means "match+things which are dated in the last month and do not have food or rent in+the account name".++ When using 'expr:' with transaction-oriented commands like 'print',+posting-oriented query terms like 'acct:' and 'amt:' are considered to+match the transaction if they match any of its postings.+So, 'hledger print expr:'cash and amt:>0'' means "show transactions with+(at least one posting involving a cash account) and (at least one+posting with a positive amount)".+++File: hledger.info, Node: any query, Next: all query, Prev: expr query, Up: Boolean queries++15.4.2 any: query+-----------------++*'any:'QUERYEXPR''*+Like 'expr:', but when used with transaction-oriented commands like+'print', it matches the transaction only if a posting can be matched by+all of QUERYEXPR.+So, 'hledger print any:'cash and amt:>0'' means "show transactions where+at least one posting posts a positive amount to a cash account".+++File: hledger.info, Node: all query, Prev: any query, Up: Boolean queries++15.4.3 all: query+-----------------++*'all:'QUERYEXPR''*+Like 'expr:', but when used with transaction-oriented commands like+'print', it matches the transaction only if all postings are matched by+all of QUERYEXPR (and there is at least one posting).+So, 'hledger print all:'cash and amt:0'' means "show transactions where+all postings involve a cash account and have a zero amount".+Or, 'hledger print all:'cash or checking'' means "show transactions+which touch only cash and/or checking accounts".+++File: hledger.info, Node: Queries and command options, Next: Queries and account aliases, Prev: Boolean queries, Up: Queries++15.5 Queries and command options+================================++Some queries can also be expressed as command-line options: 'depth:2' is+equivalent to '--depth 2', 'date:2023' is equivalent to '-p 2023', etc.+When you mix command options and query arguments, generally the+resulting query is their intersection.+++File: hledger.info, Node: Queries and account aliases, Next: Queries and valuation, Prev: Queries and command options, Up: Queries++15.6 Queries and account aliases+================================++When account names are rewritten with '--alias' or 'alias', 'acct:' will+match either the old or the new account name.+++File: hledger.info, Node: Queries and valuation, Prev: Queries and account aliases, Up: Queries++15.7 Queries and valuation+==========================++When amounts are converted to other commodities in cost or value+reports, 'cur:' and 'amt:' match the old commodity symbol and the old+amount quantity, not the new ones. (Except in hledger 1.22, #1625.)+++File: hledger.info, Node: Pivoting, Next: Generating data, Prev: Queries, Up: Top++16 Pivoting+***********++Normally, hledger groups amounts and displays their totals by account+(name). With '--pivot PIVOTEXPR', some other field's (or multiple+fields') value is used as a synthetic account name, causing different+grouping and display. PIVOTEXPR can be++ * any of these standard transaction or posting fields (their value is+ substituted): 'status', 'code', 'desc', 'payee', 'note', 'acct',+ 'comm'/'cur', 'amt', 'cost'+ * or a tag name+ * or any combination of these, colon-separated.++ Some special cases:++ * Colons appearing in PIVOTEXPR or in a pivoted tag value will+ generate account hierarchy.+ * When pivoting a posting that has multiple values for a tag, the+ tag's first value will be used as the pivoted value.+ * When a posting has multiple commodities, the pivoted value of+ "comm"/"cur" will be "". Also when an unrecognised tag name or+ field is provided, its pivoted value will be "". (If this causes+ confusing output, consider excluding those postings from the+ report.)++ Examples:++2016/02/16 Yearly Dues Payment+ assets:bank account 2 EUR+ income:dues -2 EUR ; member: John Doe, kind: Lifetime++ Normal balance report showing account names:++$ hledger balance+ 2 EUR assets:bank account+ -2 EUR income:dues+--------------------+ 0++ Pivoted balance report, using member: tag values instead:++$ hledger balance --pivot member+ 2 EUR+ -2 EUR John Doe+--------------------+ 0++ One way to show only amounts with a member: value (using a query):++$ hledger balance --pivot member tag:member=.+ -2 EUR John Doe+--------------------+ -2 EUR++ Another way (the acct: query matches against the pivoted "account+name"):++$ hledger balance --pivot member acct:.+ -2 EUR John Doe+--------------------+ -2 EUR++ Hierarchical reports can be generated with multiple pivot values:++$ hledger balance Income:Dues --pivot kind:member+ -2 EUR Lifetime:John Doe+--------------------+ -2 EUR+++File: hledger.info, Node: Generating data, Next: Forecasting, Prev: Pivoting, Up: Top++17 Generating data+******************++hledger can enrich the data provided to it, or generate new data, in a+number of ways. Mostly, this is done only if you request it:++ * Missing amounts or missing costs in transactions are inferred+ automatically when possible.+ * The '--infer-equity' flag infers missing conversion equity postings+ from @/@@ costs.+ * The '--infer-costs' flag infers missing costs from conversion+ equity postings.+ * The '--infer-market-prices' flag infers 'P' price directives from+ costs.+ * The '--auto' flag adds extra postings to transactions matched by+ auto posting rules.+ * The '--forecast' option generates transactions from periodic+ transaction rules.+ * The 'balance --budget' report infers budget goals from periodic+ transaction rules.+ * Commands like 'close', 'rewrite', and 'hledger-interest' generate+ transactions or postings.+ * CSV data is converted to transactions by applying CSV conversion+ rules.. etc.++ Such generated data is temporary, existing only at report time. You+can convert it to permanent recorded data by, eg, capturing the output+of 'hledger print' and saving it in your journal file. This can+sometimes be useful as a data entry aid.++ If you are curious what data is being generated and why, run 'hledger+print -x --verbose-tags'. '-x/--explicit' shows inferred amounts and+'--verbose-tags' adds tags like 'generated-transaction' (from periodic+rules) and 'generated-posting', 'modified' (from auto posting rules).+Similar hidden tags (with an underscore prefix) are always present,+also, so you can always match such data with queries like+'tag:generated' or 'tag:modified'.+++File: hledger.info, Node: Forecasting, Next: Budgeting, Prev: Generating data, Up: Top++18 Forecasting+**************++Forecasting, or speculative future reporting, can be useful for+estimating future balances, or for exploring different future scenarios.++ The simplest and most flexible way to do it with hledger is to+manually record a bunch of future-dated transactions. You could keep+these in a separate 'future.journal' and include that with '-f' only+when you want to see them.++* Menu:++* --forecast::+* Inspecting forecast transactions::+* Forecast reports::+* Forecast tags::+* Forecast period in detail::+* Forecast troubleshooting::+++File: hledger.info, Node: --forecast, Next: Inspecting forecast transactions, Up: Forecasting++18.1 -forecast+==============++There is another way: with the '--forecast' option, hledger can generate+temporary "forecast transactions" for reporting purposes, according to+periodic transaction rules defined in the journal. Each rule can+generate multiple recurring transactions, so by changing one rule you+can change many forecasted transactions.++ Forecast transactions usually start after ordinary transactions end.+By default, they begin after your latest-dated ordinary transaction, or+today, whichever is later, and they end six months from today. (The+exact rules are a little more complicated, and are given below.)++ This is the "forecast period", which need not be the same as the+report period. You can override it - eg to forecast farther into the+future, or to force forecast transactions to overlap your ordinary+transactions - by giving the -forecast option a period expression+argument, like '--forecast=..2099' or '--forecast=2023-02-15..'. Note+that the '=' is required.+++File: hledger.info, Node: Inspecting forecast transactions, Next: Forecast reports, Prev: --forecast, Up: Forecasting++18.2 Inspecting forecast transactions+=====================================++'print' is the best command for inspecting and troubleshooting forecast+transactions. Eg:++~ monthly from 2022-12-20 rent+ assets:bank:checking+ expenses:rent $1000++$ hledger print --forecast --today=2023/4/21+2023-05-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++2023-06-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++2023-07-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++2023-08-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++2023-09-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++ Here there are no ordinary transactions, so the forecasted+transactions begin on the first occurrence after today's date. (You+won't normally use '--today'; it's just to make these examples+reproducible.)+++File: hledger.info, Node: Forecast reports, Next: Forecast tags, Prev: Inspecting forecast transactions, Up: Forecasting++18.3 Forecast reports+=====================++Forecast transactions affect all reports, as you would expect. Eg:++$ hledger areg rent --forecast --today=2023/4/21+Transactions in expenses:rent and subaccounts:+2023-05-20 rent as:ba:checking $1000 $1000+2023-06-20 rent as:ba:checking $1000 $2000+2023-07-20 rent as:ba:checking $1000 $3000+2023-08-20 rent as:ba:checking $1000 $4000+2023-09-20 rent as:ba:checking $1000 $5000++$ hledger bal -M expenses --forecast --today=2023/4/21+Balance changes in 2023-05-01..2023-09-30:++ || May Jun Jul Aug Sep +===============++===================================+ expenses:rent || $1000 $1000 $1000 $1000 $1000 +---------------++-----------------------------------+ || $1000 $1000 $1000 $1000 $1000 +++File: hledger.info, Node: Forecast tags, Next: Forecast period in detail, Prev: Forecast reports, Up: Forecasting++18.4 Forecast tags+==================++Forecast transactions generated by -forecast have a hidden tag,+'_generated-transaction'. So if you ever need to match forecast+transactions, you could use 'tag:_generated-transaction' (or just+'tag:generated') in a query.++ For troubleshooting, you can add the '--verbose-tags' flag. Then,+visible 'generated-transaction' tags will be added also, so you can view+them with the 'print' command. Their value indicates which periodic+rule was responsible.+++File: hledger.info, Node: Forecast period in detail, Next: Forecast troubleshooting, Prev: Forecast tags, Up: Forecasting++18.5 Forecast period, in detail+===============================++Forecast start/end dates are chosen so as to do something useful by+default in almost all situations, while also being flexible. Here are+(with luck) the exact rules, to help with troubleshooting:++ The forecast period starts on:++ * the later of+ * the start date in the periodic transaction rule+ * the start date in '--forecast''s argument++ * otherwise (if those are not available): the later of+ * the report start date specified with '-b'/'-p'/'date:'+ * the day after the latest ordinary transaction in the journal++ * otherwise (if none of these are available): today.++ The forecast period ends on:++ * the earlier of+ * the end date in the periodic transaction rule+ * the end date in '--forecast''s argument++ * otherwise: the report end date specified with '-e'/'-p'/'date:'+ * otherwise: 180 days (~6 months) from today.+++File: hledger.info, Node: Forecast troubleshooting, Prev: Forecast period in detail, Up: Forecasting++18.6 Forecast troubleshooting+=============================++When -forecast is not doing what you expect, one of these tips should+help:++ * Remember to use the '--forecast' option.+ * Remember to have at least one periodic transaction rule in your+ journal.+ * Test with 'print --forecast'.+ * Check for typos or too-restrictive start/end dates in your periodic+ transaction rule.+ * Leave at least 2 spaces between the rule's period expression and+ description fields.+ * Check for future-dated ordinary transactions suppressing forecasted+ transactions.+ * Try setting explicit report start and/or end dates with '-b', '-e',+ '-p' or 'date:'+ * Try adding the '-E' flag to encourage display of empty periods/zero+ transactions.+ * Try setting explicit forecast start and/or end dates with+ '--forecast=START..END'+ * Consult Forecast period, in detail, above.+ * Check inside the engine: add '--debug=2' (eg).+++File: hledger.info, Node: Budgeting, Next: Amount formatting, Prev: Forecasting, Up: Top++19 Budgeting+************++With the balance command's '--budget' report, each periodic transaction+rule generates recurring budget goals in specified accounts, and goals+and actual performance can be compared. See the balance command's doc+below.++ You can generate budget goals and forecast transactions at the same+time, from the same or different periodic transaction rules: 'hledger+bal -M --budget --forecast ...'++ See also: Budgeting and Forecasting.+++File: hledger.info, Node: Amount formatting, Next: Cost reporting, Prev: Budgeting, Up: Top++20 Amount formatting+********************++* Menu:++* Commodity display style::+* Rounding::+* Trailing decimal marks::+* Amount parseability::+++File: hledger.info, Node: Commodity display style, Next: Rounding, Up: Amount formatting++20.1 Commodity display style+============================++For the amounts in each commodity, hledger chooses a consistent display+style (symbol placement, decimal mark and digit group marks, number of+decimal digits) to use in most reports. This is inferred as follows:++ First, if there's a 'D' directive declaring a default commodity, that+commodity symbol and amount format is applied to all no-symbol amounts+in the journal.++ Then each commodity's display style is determined from its+'commodity' directive. We recommend always declaring commodities with+'commodity' directives, since they help ensure consistent display styles+and precisions, and bring other benefits such as error checking for+commodity symbols. Here's an example:++# Set display styles (and decimal marks, for parsing, if there is no decimal-mark directive)+# for the $, EUR, INR and no-symbol commodities:+commodity $1,000.00+commodity EUR 1.000,00+commodity INR 9,99,99,999.00+commodity 1 000 000.9455++ But for convenience, if a 'commodity' directive is not present,+hledger infers a commodity's display styles from its amounts as they are+written in the journal (excluding cost amounts and amounts in periodic+transaction rules or auto posting rules). It uses++ * the symbol placement and decimal mark of the first amount seen+ * the digit group marks of the first amount with digit group marks+ * and the maximum number of decimal digits seen across all amounts.++ And as fallback if no applicable amounts are found, it would use a+default style, like '$1000.00' (symbol on the left with no space, period+as decimal mark, and two decimal digits).++ Finally, commodity styles can be overridden by the+'-c/--commodity-style' command line option.+++File: hledger.info, Node: Rounding, Next: Trailing decimal marks, Prev: Commodity display style, Up: Amount formatting++20.2 Rounding+=============++Amounts are stored internally as decimal numbers with up to 255 decimal+places. They are displayed with their original journal precisions by+print and print-like reports, and rounded to their display precision+(the number of decimal digits specified by the commodity display style)+by other reports. When rounding, hledger uses banker's rounding (it+rounds to the nearest even digit). So eg 0.5 displayed with zero+decimal digits appears as "0".+++File: hledger.info, Node: Trailing decimal marks, Next: Amount parseability, Prev: Rounding, Up: Amount formatting++20.3 Trailing decimal marks+===========================++If you're wondering why your 'print' report sometimes shows trailing+decimal marks, with no decimal digits; it does this when showing amounts+that have digit group marks but no decimal digits, to disambiguate them+and allow them to be re-parsed reliably (see Decimal marks). Eg:++commodity $1,000.00++2023-01-02+ (a) $1000++$ hledger print+2023-01-02+ (a) $1,000.++ If this is a problem (eg when exporting to Ledger), you can avoid it+by disabling digit group marks, eg with -c/-commodity (for each affected+commodity):++$ hledger print -c '$1000.00'+2023-01-02+ (a) $1000++ or by forcing print to always show decimal digits, with -round:++$ hledger print -c '$1,000.00' --round=soft+2023-01-02+ (a) $1,000.00+++File: hledger.info, Node: Amount parseability, Prev: Trailing decimal marks, Up: Amount formatting++20.4 Amount parseability+========================++More generally, hledger output falls into three rough categories, which+format amounts a little bit differently to suit different consumers:++ *1. "hledger-readable output" - should be readable by hledger (and+by humans)*++ * This is produced by reports that show full journal entries:+ 'print', 'import', 'close', 'rewrite' etc.+ * It shows amounts with their original journal precisions, which may+ not be consistent from one amount to the next.+ * It adds a trailing decimal mark when needed to avoid showing+ ambiguous amounts.+ * It can be parsed reliably (by hledger and ledger2beancount at+ least, but perhaps not by Ledger..)++ *2. "human-readable output" - usually for humans*++ * This is produced by all other reports.+ * It shows amounts with standard display precisions, which will be+ consistent within each commodity.+ * It shows ambiguous amounts unmodified.+ * It can be parsed reliably in the context of a known report (when+ you know decimals are consistently not being shown, you can assume+ a single mark is a digit group mark).++ *3. "machine-readable output" - usually for other software*++ * This is produced by all reports when an output format like 'csv',+ 'tsv', 'json', or 'sql' is selected.+ * It shows amounts as 1 or 2 do, but without digit group marks.+ * It can be parsed reliably (if needed, the decimal mark can be+ changed with -c/-commodity-style).+++File: hledger.info, Node: Cost reporting, Next: Value reporting, Prev: Amount formatting, Up: Top++21 Cost reporting+*****************++In some transactions - for example a currency conversion, or a purchase+or sale of stock - one commodity is exchanged for another. In these+transactions there is a conversion rate, also called the cost (when+buying) or selling price (when selling). (In hledger docs we just say+"cost" generically for convenience.) With the '-B/--cost' flag, hledger+can show amounts "at cost", converted to the cost's commodity.++* Menu:++* Recording costs::+* Reporting at cost::+* Equity conversion postings::+* Inferring equity conversion postings::+* Combining costs and equity conversion postings::+* Requirements for detecting equity conversion postings::+* Infer cost and equity by default ?::+++File: hledger.info, Node: Recording costs, Next: Reporting at cost, Up: Cost reporting++21.1 Recording costs+====================++We'll explore several ways of recording transactions involving costs.+These are also summarised at hledger Cookbook > Cost notation.++ Costs can be recorded explicitly in the journal, using the '@+UNITCOST' or '@@ TOTALCOST' notation described in Journal > Costs:++ *Variant 1*++2022-01-01+ assets:dollars $-135+ assets:euros €100 @ $1.35 ; $1.35 per euro (unit cost)++ *Variant 2*++2022-01-01+ assets:dollars $-135+ assets:euros €100 @@ $135 ; $135 total cost++ Typically, writing the unit cost (variant 1) is preferable; it can be+more effort, requiring more attention to decimal digits; but it reveals+the per-unit cost basis, and makes stock sales easier.++ Costs can also be left implicit, and hledger will infer the cost that+is consistent with a balanced transaction:++ *Variant 3*++2022-01-01+ assets:dollars $-135+ assets:euros €100++ Here, hledger will attach a '@@ €100' cost to the first amount (you+can see it with 'hledger print -x'). This form looks convenient, but+there are downsides:++ * It sacrifices some error checking. For example, if you+ accidentally wrote €10 instead of €100, hledger would not be able+ to detect the mistake.++ * It is sensitive to the order of postings - if they were reversed, a+ different entry would be inferred and reports would be different.++ * The per-unit cost basis is not easy to read.++ So generally this kind of entry is not recommended. You can make+sure you have none of these by using '-s' (strict mode), or by running+'hledger check balanced'.+++File: hledger.info, Node: Reporting at cost, Next: Equity conversion postings, Prev: Recording costs, Up: Cost reporting++21.2 Reporting at cost+======================++Now when you add the '-B'/'--cost' flag to reports ("B" is from Ledger's+-B/-basis/-cost flag), any amounts which have been annotated with costs+will be converted to their cost's commodity (in the report output). Ie+they will be displayed "at cost" or "at sale price".++ Some things to note:++ * Costs are attached to specific posting amounts in specific+ transactions, and once recorded they do not change. This contrasts+ with market prices, which are ambient and fluctuating.++ * Conversion to cost is performed before conversion to market value+ (described below).+++File: hledger.info, Node: Equity conversion postings, Next: Inferring equity conversion postings, Prev: Reporting at cost, Up: Cost reporting++21.3 Equity conversion postings+===============================++There is a problem with the entries above - they are not conventional+Double Entry Bookkeeping (DEB) notation, and because of the "magical"+transformation of one commodity into another, they cause an imbalance in+the Accounting Equation. This shows up as a non-zero grand total in+balance reports like 'hledger bse'.++ For most hledger users, this doesn't matter in practice and can+safely be ignored ! But if you'd like to learn more, keep reading.++ Conventional DEB uses an extra pair of equity postings to balance the+transaction. Of course you can do this in hledger as well:++ *Variant 4*++2022-01-01+ assets:dollars $-135+ assets:euros €100+ equity:conversion $135+ equity:conversion €-100++ Now the transaction is perfectly balanced according to standard DEB,+and 'hledger bse''s total will not be disrupted.++ And, hledger can still infer the cost for cost reporting, but it's+not done by default - you must add the '--infer-costs' flag like so:++$ hledger print --infer-costs+2022-01-01 one hundred euros purchased at $1.35 each+ assets:dollars $-135 @@ €100+ assets:euros €100+ equity:conversion $135+ equity:conversion €-100++$ hledger bal --infer-costs -B+ €-100 assets:dollars + €100 assets:euros +-------------------- + 0 ++ Here are some downsides of this kind of entry:++ * The per-unit cost basis is not easy to read.++ * Instead of '-B' you must remember to type '-B --infer-costs'.++ * '--infer-costs' works only where hledger can identify the two+ equity:conversion postings and match them up with the two+ non-equity postings. So writing the journal entry in a particular+ format becomes more important. More on this below.+++File: hledger.info, Node: Inferring equity conversion postings, Next: Combining costs and equity conversion postings, Prev: Equity conversion postings, Up: Cost reporting++21.4 Inferring equity conversion postings+=========================================++Can we go in the other direction ? Yes, if you have transactions+written with the @/@@ cost notation, hledger can infer the missing+equity postings, if you add the '--infer-equity' flag. Eg:++2022-01-01+ assets:dollars -$135+ assets:euros €100 @ $1.35++$ hledger print --infer-equity+2022-01-01+ assets:dollars $-135+ assets:euros €100 @ $1.35+ equity:conversion:$-€:€ €-100+ equity:conversion:$-€:$ $135.00++ The equity account names will be "equity:conversion:A-B:A" and+"equity:conversion:A-B:B" where A is the alphabetically first commodity+symbol. You can customise the "equity:conversion" part by declaring an+account with the 'V'/'Conversion' account type.++ Note you will need to add account declarations for these to your+journal, if you use 'check accounts' or 'check --strict'. (And unlike+normal postings, generated equity postings do not inherit tags from+account declarations.)+++File: hledger.info, Node: Combining costs and equity conversion postings, Next: Requirements for detecting equity conversion postings, Prev: Inferring equity conversion postings, Up: Cost reporting++21.5 Combining costs and equity conversion postings+===================================================++Finally, you can use both the @/@@ cost notation and equity postings at+the same time. This in theory gives the best of all worlds - preserving+the accounting equation, revealing the per-unit cost basis, and+providing more flexibility in how you write the entry:++ *Variant 5*++2022-01-01 one hundred euros purchased at $1.35 each+ assets:dollars $-135+ equity:conversion $135+ equity:conversion €-100+ assets:euros €100 @ $1.35++ All the other variants above can (usually) be rewritten to this final+form with:++$ hledger print -x --infer-costs --infer-equity++ Downsides:++ * The precise format of the journal entry becomes more important. If+ hledger can't detect and match up the cost and equity postings, it+ will give a transaction balancing error.++ * The add command does not yet accept this kind of entry (#2056).++ * This is the most verbose form.+++File: hledger.info, Node: Requirements for detecting equity conversion postings, Next: Infer cost and equity by default ?, Prev: Combining costs and equity conversion postings, Up: Cost reporting++21.6 Requirements for detecting equity conversion postings+==========================================================++'--infer-costs' has certain requirements (unlike '--infer-equity', which+always works). It will infer costs only in transactions with:++ * Two non-equity postings, in different commodities. Their order is+ significant: the cost will be added to the first of them.++ * Two postings to equity conversion accounts, next to one another,+ which balance the two non-equity postings. This balancing is+ checked to the same precision (number of decimal places) used in+ the conversion posting's amount. Equity conversion accounts are:++ * any accounts declared with account type 'V'/'Conversion', or+ their subaccounts+ * otherwise, accounts named 'equity:conversion', 'equity:trade',+ or 'equity:trading', or their subaccounts.++ And multiple such four-posting groups can coexist within a single+transaction. When '--infer-costs' fails, it does not infer a cost in+that transaction, and does not raise an error (ie, it infers costs where+it can).++ Reading variant 5 journal entries, combining cost notation and equity+postings, has all the same requirements. When reading such an entry+fails, hledger raises an "unbalanced transaction" error.+++File: hledger.info, Node: Infer cost and equity by default ?, Prev: Requirements for detecting equity conversion postings, Up: Cost reporting++21.7 Infer cost and equity by default ?+=======================================++Should '--infer-costs' and '--infer-equity' be enabled by default ? Try+using them always, eg with a shell alias:++alias h="hledger --infer-equity --infer-costs"++ and let us know what problems you find.+++File: hledger.info, Node: Value reporting, Next: PART 4 COMMANDS, Prev: Cost reporting, Up: Top++22 Value reporting+******************++hledger can also show amounts "at market value", converted to some other+commodity using the market price or conversion rate on a certain date.++ This is controlled by the '--value=TYPE[,COMMODITY]' option. We also+provide simpler '-V' and '-X COMMODITY' aliases for this, which are+often sufficient. The market prices are declared with a special 'P'+directive, and/or they can be inferred from the costs recorded in+transactions, by using the '--infer-market-prices' flag.++* Menu:++* -X Value in specified commodity::+* -V Value in default commoditys::+* Valuation date::+* Finding market price::+* --infer-market-prices market prices from transactions::+* Valuation commodity::+* --value Flexible valuation::+* Valuation examples::+* Interaction of valuation and queries::+* Effect of valuation on reports::+++File: hledger.info, Node: -X Value in specified commodity, Next: -V Value in default commoditys, Up: Value reporting++22.1 -X: Value in specified commodity+=====================================++The '-X COMM' (or '--exchange=COMM') option converts amounts to their+market value in the specified commodity, using the market prices in+effect on the _valuation date(s)_, if any. (More on these in a minute.)++ Use this when you want to (eg) show everything in your base currency+as far as possible. (Commodities for which no conversion rate can be+found, will not be converted.)++ COMM should be the full commodity symbol or name. Remember to quote+special shell characters, if needed. Some examples:++ * '-X€'+ * '-X$' (nothing after $, no quoting needed)+ * '-X CNY' (the space after -X is optional)+ * '-X 'red apples''+ * '-X 'r&r''+++File: hledger.info, Node: -V Value in default commoditys, Next: Valuation date, Prev: -X Value in specified commodity, Up: Value reporting++22.2 -V: Value in default commodity(s)+======================================++The '-V/--market' flag is a variant of '-X' where you don't have to+specify COMM. Instead it tries to guess a _default valuation commodity_+for each original commodity, based on the market prices in effect on the+valuation date(s).++ '-V' can often be a convenient shortcut for '-X MYCURRENCY', but not+always; depending on your data it could guess multiple valuation+commodities. Usually you want to convert to a single commodity, so it's+better to use '-X', unless you're sure '-V' is doing what you want.+++File: hledger.info, Node: Valuation date, Next: Finding market price, Prev: -V Value in default commoditys, Up: Value reporting++22.3 Valuation date+===================++Market prices can change from day to day. hledger will use the prices+on a particular valuation date (or on more than one date). By default+hledger uses "end" dates for valuation. More specifically:++ * For single period reports (including normal print and register+ reports):+ * If an explicit report end date is specified, that is used.+ * Otherwise the latest transaction date or non-future P+ directive date is used.++ * For multiperiod reports, each period is valued on its last day.++ This can be customised with the -value option described below, which+can select either "then", "end", "now", or "custom" dates.+++File: hledger.info, Node: Finding market price, Next: --infer-market-prices market prices from transactions, Prev: Valuation date, Up: Value reporting++22.4 Finding market price+=========================++To convert a commodity A to its market value in another commodity B,+hledger looks for a suitable market price (exchange rate) as follows, in+this order of preference:++ 1. A _declared market price_ or _inferred market price_: A's latest+ market price in B on or before the valuation date as declared by a+ P directive, or (with the '--infer-market-prices' flag) inferred+ from costs.++ 2. A _reverse market price_: the inverse of a declared or inferred+ market price from B to A.++ 3. A _forward chain of market prices_: a synthetic price formed by+ combining the shortest chain of "forward" (only 1 above) market+ prices, leading from A to B.++ 4. _Any chain of market prices_: a chain of any market prices,+ including both forward and reverse prices (1 and 2 above), leading+ from A to B.++ There is a limit to the length of these price chains; if hledger+reaches that length without finding a complete chain or exhausting all+possibilities, it will give up (with a "gave up" message visible in+'--debug=2' output). That limit is currently 1000.++ Amounts for which no suitable market price can be found, are not+converted.+++File: hledger.info, Node: --infer-market-prices market prices from transactions, Next: Valuation commodity, Prev: Finding market price, Up: Value reporting++22.5 -infer-market-prices: market prices from transactions+==========================================================++Normally, market value in hledger is fully controlled by, and requires,+P directives in your journal. Since adding and updating those can be a+chore, and since transactions usually take place at close to market+value, why not use the recorded costs as additional market prices (as+Ledger does) ? Adding the '--infer-market-prices' flag to '-V', '-X' or+'--value' enables this.++ So for example, 'hledger bs -V --infer-market-prices' will get market+prices both from P directives and from transactions. If both occur on+the same day, the P directive takes precedence.++ There is a downside: value reports can sometimes be affected in+confusing/undesired ways by your journal entries. If this happens to+you, read all of this Value reporting section carefully, and try adding+'--debug' or '--debug=2' to troubleshoot.++ '--infer-market-prices' can infer market prices from:++ * multicommodity transactions with explicit prices ('@'/'@@')++ * multicommodity transactions with implicit prices (no '@', two+ commodities, unbalanced). (With these, the order of postings+ matters. 'hledger print -x' can be useful for troubleshooting.)++ * multicommodity transactions with equity postings, if cost is+ inferred with '--infer-costs'.++ There is a limitation (bug) currently: when a valuation commodity is+not specified, prices inferred with '--infer-market-prices' do not help+select a default valuation commodity, as 'P' prices would. So+conversion might not happen because no valuation commodity was detected+('--debug=2' will show this). To be safe, specify the valuation+commmodity, eg:++ * '-X EUR --infer-market-prices', not '-V --infer-market-prices'+ * '--value=then,EUR --infer-market-prices', not '--value=then+ --infer-market-prices'++ Signed costs and market prices can be confusing. For reference, here+is the current behaviour, since hledger 1.25. (If you think it should+work differently, see #1870.)++2022-01-01 Positive Unit prices+ a A 1+ b B -1 @ A 1++2022-01-01 Positive Total prices+ a A 1+ b B -1 @@ A 1+++2022-01-02 Negative unit prices+ a A 1+ b B 1 @ A -1++2022-01-02 Negative total prices+ a A 1+ b B 1 @@ A -1+++2022-01-03 Double Negative unit prices+ a A -1+ b B -1 @ A -1++2022-01-03 Double Negative total prices+ a A -1+ b B -1 @@ A -1++ All of the transactions above are considered balanced (and on each+day, the two transactions are considered equivalent). Here are the+market prices inferred for B:++$ hledger -f- --infer-market-prices prices+P 2022-01-01 B A 1+P 2022-01-01 B A 1.0+P 2022-01-02 B A -1+P 2022-01-02 B A -1.0+P 2022-01-03 B A -1+P 2022-01-03 B A -1.0+++File: hledger.info, Node: Valuation commodity, Next: --value Flexible valuation, Prev: --infer-market-prices market prices from transactions, Up: Value reporting++22.6 Valuation commodity+========================++*When you specify a valuation commodity ('-X COMM' or '--value+TYPE,COMM'):*+hledger will convert all amounts to COMM, wherever it can find a+suitable market price (including by reversing or chaining prices).++ *When you leave the valuation commodity unspecified ('-V' or '--value+TYPE'):*+For each commodity A, hledger picks a default valuation commodity as+follows, in this order of preference:++ 1. The price commodity from the latest P-declared market price for A+ on or before valuation date.++ 2. The price commodity from the latest P-declared market price for A+ on any date. (Allows conversion to proceed when there are inferred+ prices before the valuation date.)++ 3. If there are no P directives at all (any commodity or date) and the+ '--infer-market-prices' flag is used: the price commodity from the+ latest transaction-inferred price for A on or before valuation+ date.++ This means:++ * If you have P directives, they determine which commodities '-V'+ will convert, and to what.++ * If you have no P directives, and use the '--infer-market-prices'+ flag, costs determine it.++ Amounts for which no valuation commodity can be found are not+converted.+++File: hledger.info, Node: --value Flexible valuation, Next: Valuation examples, Prev: Valuation commodity, Up: Value reporting++22.7 -value: Flexible valuation+===============================++'-V' and '-X' are special cases of the more general '--value' option:++ --value=TYPE[,COMM] TYPE is then, end, now or YYYY-MM-DD.+ COMM is an optional commodity symbol.+ Shows amounts converted to:+ - default valuation commodity (or COMM) using market prices at posting dates+ - default valuation commodity (or COMM) using market prices at period end(s)+ - default valuation commodity (or COMM) using current market prices+ - default valuation commodity (or COMM) using market prices at some date++ The TYPE part selects cost or value and valuation date:++'--value=then'++ Convert amounts to their value in the default valuation commodity,+ using market prices on each posting's date.+'--value=end'++ Convert amounts to their value in the default valuation commodity,+ using market prices on the last day of the report period (or if+ unspecified, the journal's end date); or in multiperiod reports,+ market prices on the last day of each subperiod.+'--value=now'++ Convert amounts to their value in the default valuation commodity+ using current market prices (as of when report is generated).+'--value=YYYY-MM-DD'++ Convert amounts to their value in the default valuation commodity+ using market prices on this date.++ To select a different valuation commodity, add the optional ',COMM'+part: a comma, then the target commodity's symbol. Eg:+*'--value=now,EUR'*. hledger will do its best to convert amounts to+this commodity, deducing market prices as described above.+++File: hledger.info, Node: Valuation examples, Next: Interaction of valuation and queries, Prev: --value Flexible valuation, Up: Value reporting++22.8 Valuation examples+=======================++Here are some quick examples of '-V':++; one euro is worth this many dollars from nov 1+P 2016/11/01 € $1.10++; purchase some euros on nov 3+2016/11/3+ assets:euros €100+ assets:checking++; the euro is worth fewer dollars by dec 21+P 2016/12/21 € $1.03++ How many euros do I have ?++$ hledger -f t.j bal -N euros+ €100 assets:euros++ What are they worth at end of nov 3 ?++$ 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)++$ hledger -f t.j bal -N euros -V+ $103.00 assets:euros++ Here are some examples showing the effect of '--value', as seen with+'print':++P 2000-01-01 A 1 B+P 2000-02-01 A 2 B+P 2000-03-01 A 3 B+P 2000-04-01 A 4 B++2000-01-01+ (a) 1 A @ 5 B++2000-02-01+ (a) 1 A @ 6 B++2000-03-01+ (a) 1 A @ 7 B++ Show the cost of each posting:++$ hledger -f- print --cost+2000-01-01+ (a) 5 B++2000-02-01+ (a) 6 B++2000-03-01+ (a) 7 B++ Show the value as of the last day of the report period (2000-02-29):++$ hledger -f- print --value=end date:2000/01-2000/03+2000-01-01+ (a) 2 B++2000-02-01+ (a) 2 B++ With no report period specified, the latest transaction date or price+date is used as valuation date (2000-04-01):++$ hledger -f- print --value=end+2000-01-01+ (a) 3 B++2000-02-01+ (a) 3 B++2000-03-01+ (a) 3 B++ The value today is the same (the 2000-04-01 price is still in+effect):++$ hledger -f- print --value=now+2000-01-01+ (a) 4 B++2000-02-01+ (a) 4 B++2000-03-01+ (a) 4 B++ Show the value on 2000/01/15:++$ hledger -f- print --value=2000-01-15+2000-01-01+ (a) 1 B++2000-02-01+ (a) 1 B++2000-03-01+ (a) 1 B+++File: hledger.info, Node: Interaction of valuation and queries, Next: Effect of valuation on reports, Prev: Valuation examples, Up: Value reporting++22.9 Interaction of valuation and queries+=========================================++When matching postings based on queries in the presence of valuation,+the following happens:++ 1. The query is separated into two parts:+ 1. the currency ('cur:') or amount ('amt:').+ 2. all other parts.++ 2. The postings are matched to the currency and amount queries based+ on pre-valued amounts.+ 3. Valuation is applied to the postings.+ 4. The postings are matched to the other parts of the query based on+ post-valued amounts.++ Related: #1625+++File: hledger.info, Node: Effect of valuation on reports, Prev: Interaction of valuation and queries, Up: Value reporting++22.10 Effect of valuation on reports+====================================++Here is a reference for how valuation is supposed to affect each part of+hledger's reports. It may be useful when troubleshooting. If you find+problems, please report them, ideally with a reproducible example.+Related: #329, #1083.++ First, a quick glossary:++_cost_++ calculated using price(s) recorded in the transaction(s).+_value_++ market value using available market price declarations, or the+ unchanged amount if no conversion rate can be found.+_report start_++ the first day of the report period specified with -b or -p or+ date:, otherwise today.+_report or journal start_++ the first day of the report period specified with -b or -p or+ date:, otherwise the earliest transaction date in the journal,+ otherwise today.+_report end_++ the last day of the report period specified with -e or -p or date:,+ otherwise today.+_report or journal end_++ the last day of the report period specified with -e or -p or date:,+ otherwise the latest transaction date in the journal, otherwise+ today.+_report interval_++ a flag (-D/-W/-M/-Q/-Y) or period expression that activates the+ report's multi-period mode (whether showing one or many+ subperiods).++Report '-B', '-V', '-X' '--value=then' '--value=end''--value=DATE',+type '--cost' '--value=now'+------------------------------------------------------------------------------+*print*+posting cost value at value at posting value at value+amounts report end date report or at+ or today journal DATE/today+ end+balance unchanged unchanged unchanged unchanged unchanged+assertions/assignments+*register*+starting cost value at valued at day value at value+balance report or each historical report or at+(-H) journal posting was made journal DATE/today+ end end+starting cost value at valued at day value at value+balance day before each historical day before at+(-H) report or posting was made report or DATE/today+with journal journal+report start start+interval+posting cost value at value at posting value at value+amounts report or date report or at+ journal journal DATE/today+ end end+summary summarised value at sum of postings value at value+posting cost period in interval, period at+amounts ends valued at ends DATE/today+with interval start+report+interval+running sum/average sum/average sum/average of sum/average sum/average+total/averageof of displayed values of of+ displayed displayed displayed displayed+ values values values values+*balance+(bs,+bse, cf,+is)*+balance sums of value at value at posting value at value+changes costs report end date report or at+ or today journal DATE/today+ of sums of end of of+ postings sums of sums+ postings of+ postings+budget like like like balance like like+amounts balance balance changes balances balance+(-budget) changes changes changes+grand sum of sum of sum of displayed sum of sum of+total displayed displayed valued displayed displayed+ values values values values+*balance+(bs,+bse, cf,+is) with+report+interval*+starting sums of value at sums of values value at sums+balances costs of report of postings report of+(-H) postings start of before report start of postings+ before sums of start at sums of before+ report all respective all report+ start postings posting dates postings start+ before before+ report report+ start start+balance sums of same as sums of values balance value+changes costs of -value=end of postings in change in at+(bal, postings period at each DATE/today+is, bs in period respective period, of+-change, posting dates valued at sums+cf period of+-change) ends postings+end sums of same as sums of values period end value+balances costs of -value=end of postings from balances, at+(bal -H, postings before period valued at DATE/today+is -H, from start to period period of+bs, cf) before end at ends sums+ report respective of+ start to posting dates postings+ period end+budget like like like balance like like+amounts balance balance changes/end balances balance+(-budget) changes/end changes/end balances changes/end+ balances balances balances+row sums, sums, sums, averages sums, sums,+totals, averages averages of displayed averages averages+row of of values of of+averages displayed displayed displayed displayed+(-T, -A) values values values values+column sums of sums of sums of sums of sums+totals displayed displayed displayed values displayed of+ values values values displayed+ values+grand sum, sum, sum, average of sum, sum,+total, average of average of column totals average of average+grand column column column of+average totals totals totals column+ totals++ '--cumulative' is omitted to save space, it works like '-H' but with+a zero starting balance.+++File: hledger.info, Node: PART 4 COMMANDS, Next: Help commands, Prev: Value reporting, Up: Top++23 PART 4: COMMANDS+*******************++Here are hledger's standard subcommands. You can list these by running+'hledger'. If you have installed more add-on commands, they also will+be listed.++ In the following command docs, each command's specific options are+shown. Most commands also support the general options described above,+though some of them might have no effect. (Usually if there's a+sensible way for a general option to affect a command, it will.) You+can list all of a command's options by running 'hledger CMD -h'.++ *Help commands*++ * commands - show the hledger commands list (default)+ * demo - show small hledger demos in the terminal+ * help - show the hledger manual with info, man, or pager++ *User interface commands*++ * repl - run commands from an interactive prompt+ * run - run commands from a script+ * ui - (if installed) run hledger's terminal UI+ * web - (if installed) run hledger's web UI++ *Data entry commands*++ * add - add transactions using terminal prompts+ * import - add new transactions from other files, eg CSV files++ *Basic report commands*++ * accounts - show account names+ * codes - show transaction codes+ * commodities - show commodity/currency symbols+ * descriptions - show transaction descriptions+ * files - show input file paths+ * notes - show note parts of transaction descriptions+ * payees - show payee parts of transaction descriptions+ * prices - show market prices+ * stats - show journal statistics+ * tags - show tag names++ *Standard report commands*++ * print - show transactions or export journal data+ * aregister (areg) - show transactions in a particular account+ * register (reg) - show postings in one or more accounts & running+ total+ * balancesheet (bs) - show assets, liabilities and net worth+ * balancesheetequity (bse) - show assets, liabilities and equity+ * cashflow (cf) - show changes in liquid assets+ * incomestatement (is) - show revenues and expenses++ *Advanced report commands*++ * balance (bal) - show balance changes, end balances, budgets,+ gains..+ * roi - show return on investments++ *Chart commands*++ * activity - show bar charts of posting counts per period++ *Data generation commands*++ * close - generate balance-zeroing/restoring transactions+ * rewrite - generate auto postings, like print -auto++ *Maintenance commands*++ * check - check for various kinds of error in the data+ * diff - compare account transactions in two journal files+ * setup - check and show the status of the hledger installation+ * test - run self tests++ Next, these commands are described in detail.+++File: hledger.info, Node: Help commands, Next: User interface commands, Prev: PART 4 COMMANDS, Up: Top++24 Help commands+****************++* Menu:++* commands::+* demo::+* help::+++File: hledger.info, Node: commands, Next: demo, Up: Help commands++24.1 commands+=============++Show the hledger commands list.++Flags:+ --builtin show only builtin commands, not addons+++File: hledger.info, Node: demo, Next: help, Prev: commands, Up: Help commands++24.2 demo+=========++Play demos of hledger usage in the terminal, if asciinema is installed.++Flags:+ -s --speed=SPEED playback speed (1 is original speed, .5 is half, 2+ is double, etc (default: 2))++ Run this command with no argument to list the demos. To play a demo,+write its number or a prefix or substring of its title. Tips:++ Make your terminal window large enough to see the demo clearly.++ Use the -s/-speed SPEED option to set your preferred playback speed,+eg '-s4' to play at 4x original speed or '-s.5' to play at half speed.+The default speed is 2x.++ During playback, several keys are available: SPACE to pause/unpause,+. to step forward (while paused), CTRL-c quit.++ Examples:++$ hledger demo # list available demos+$ hledger demo 1 # play the first demo at default speed (2x)+$ hledger demo install -s4 # play the "install" demo at 4x speed++ This command is experimental: there aren't many useful demos yet.+++File: hledger.info, Node: help, Prev: demo, Up: Help commands++24.3 help+=========++Show the hledger user manual with 'info', 'man', or a pager. With a+(case insensitive) TOPIC argument, try to open it at that section+heading.++Flags:+ -i show the manual with info+ -m show the manual with man+ -p show the manual with $PAGER or less+ (less is always used if TOPIC is specified)++ This command shows the hledger manual built in to your hledger+executable. It can be useful when offline, or when you prefer the+terminal to a web browser, or when the appropriate hledger manual or+viewers are not installed properly on your system.++ By default it chooses the best viewer found in $PATH, trying in this+order: 'info', 'man', '$PAGER', 'less', 'more', stdout. (If a TOPIC is+specified, '$PAGER' and 'more' are not tried.) You can force the use of+info, man, or a pager with the '-i', '-m', or '-p' flags. If no viewer+can be found, or if running non-interactively, it just prints the manual+to stdout.++ When using 'info', TOPIC can match either the full heading or a+prefix. If your 'info --version' is < 6, you'll need to upgrade it, eg+with ''brew install texinfo'' on mac.++ When using 'man' or 'less', TOPIC must match the full heading. For a+prefix match, you can write ''TOPIC.*''.++ Examples++$ hledger help -h # show the help command's usage+$ hledger help # show the manual with info, man or $PAGER+$ hledger help 'time periods' # show the manual's "Time periods" topic+$ hledger help 'time periods' -m # use man, even if info is installed+++File: hledger.info, Node: User interface commands, Next: Data entry commands, Prev: Help commands, Up: Top++25 User interface commands+**************************++* Menu:++* repl::+* run::+* ui::+* web::+++File: hledger.info, Node: repl, Next: run, Up: User interface commands++25.1 repl+=========++Start an interactive prompt, where you can run any of hledger's+commands. Data files are parsed just once, so the commands run faster.++Flags:+no command-specific flags++ This command is experimental and could change in the future.++ 'hledger repl' starts a read-eval-print loop (REPL) where you can+enter commands interactively. As with the 'run' command, each input+file (or each input file/input options combination) is parsed just once,+so commands will run more quickly than if you ran them individually at+the command line.++ Also like 'run', the input file(s) specified for the 'repl' command+will be the default input for all interactive commands. You can+override this temporarily by specifying an '-f' option in particular+commands. But note that commands will not see any changes made to input+files (eg by 'add') until you exit and restart the REPL.++ The command syntax is the same as with 'run':++ * enter one hledger command at a time, without the usual 'hledger'+ first word+ * empty lines and comment text from '#' to end of line are ignored+ * use single or double quotes to quote arguments when needed+ * type 'exit' or 'quit' or control-D to exit the REPL.++ While it is running, the REPL remembers your command history, and you+can navigate in the usual ways:++ * Keypad or Emacs navigation keys to edit the current command line+ * UP/DOWN or control-P/control-N to step back/forward through history+ * control-R to search for a past command+ * TAB to complete file paths.++ Generally 'repl' command lines should feel much like the normal+hledger CLI, but you may find differences. 'repl' is a little stricter;+eg it requires full command names or official abbreviations (as seen in+the commands list).++ The 'commands' and 'help' commands, and the command help flags ('CMD+--tldr', 'CMD -h/--help', 'CMD --info', 'CMD --man'), can be useful.++ You can type control-C to cancel a long-running command (but only+once; typing it a second time will exit the REPL).++ And in most shells you can type control-Z to temporarily exit to the+shell (and then 'fg' to return to the REPL).++* Menu:++* Examples::+++File: hledger.info, Node: Examples, Up: repl++25.1.1 Examples+---------------++Start the REPL and enter some commands:++$ hledger repl +Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.+% stats+Main file : .../2025.journal+...+% stats -f 2024/2024.journal +Main file : .../2024.journal+...+% stats+Main file : .../2025.journal+...++ or:++$ hledger repl -f some.journal+Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.+% bs+...+% print -b 'last week'+...+% bs -f other.journal+...+++File: hledger.info, Node: run, Next: ui, Prev: repl, Up: User interface commands++25.2 run+========++Run a sequence of hledger commands, provided as files or command line+arguments. Data files are parsed just once, so the commands run faster.++Flags:+no command-specific flags++ This command is experimental and could change in the future.++ You can use 'run' in three ways:++ * 'hledger run -- CMD1 -- CMD2 -- CMD3' - read commands from the+ command line, separated by '--'+ * 'hledger run SCRIPTFILE1 SCRIPTFILE2' - read commands from one or+ more files+ * 'cat SCRIPTFILE1 | hledger run' - read commands from standard+ input.++ 'run' first loads the input file(s) specified by 'LEDGER_FILE' or by+'-f' options, in the usual way. Then it runs each command in turn, each+using the same input data. But if you want a particular command to use+different input, you can specify an '-f' option within that command.+This will override (not add to) the default input, just for that+command.++ Each input file (more precisely, each combination of input file and+input options) is parsed only once. This means that commands will not+see any changes made to these files, until the next run. But the+commands will run more quickly than if run individually (typically about+twice as fast).++ Command scripts, whether in a file or written on the command line,+have a simple syntax:++ * each line may contain a single hledger command and its arguments,+ without the usual 'hledger' first word+ * empty lines are ignored+ * text from '#' to end of line is a comment, and ignored+ * you can use single or double quotes to quote arguments when needed,+ as on the command line+ * these extra commands are available: 'echo TEXT' prints some text,+ and 'exit' or 'quit' ends the run.++ On unix systems you can use '#!/usr/bin/env hledger run' in the first+line of a command file to make it a runnable script. If that gives an+error, use '#!/usr/bin/env -S hledger run'.++ It's ok to use the 'run' command recursively within a command script.++ You may find some differences in behaviour between 'run' command+lines and normal hledger command lines. 'run' is a little stricter; eg+it requires full command names or official abbreviations (as seen in the+commands list), and command options must be written after the command+name.++* Menu:++* Examples: Examples 2.+++File: hledger.info, Node: Examples 2, Up: run++25.2.1 Examples+---------------++Run commands from the command line:++hledger -f some.journal run -- balance assets --depth 2 -- balance liabilities -f /some/other.journal --depth 3 --transpose -- stats++ This would load 'some.journal', run 'balance assets --depth 2' on it,+then run 'balance liabilities --depth 3 --transpose' on+'/some/other.journal', and finally run 'stats' on 'some.journal'++ Run commands from standard input:++(echo "files"; echo "stats") | hledger -f some.journal run++ Run commands as a script:++$ cat report+#!/usr/bin/env -S hledger run -f some.journal++echo "List of accounts in some.journal"+accounts++echo "Assets of some.journal"+balance assets --depth 2++echo "Liabilities from /some/other.journal"+balance liabilities -f /some/other.journal --depth 3 --transpose++echo "Commands from another.script, applied to another.journal"+run -f another.journal another.script++$ chmod +x report+$ ./report+List of accounts in some.journal+...+++File: hledger.info, Node: ui, Next: web, Prev: run, Up: User interface commands++25.3 ui+=======++Runs hledger-ui (if installed).+++File: hledger.info, Node: web, Prev: ui, Up: User interface commands++25.4 web+========++Runs hledger-web (if installed).+++File: hledger.info, Node: Data entry commands, Next: Basic report commands, Prev: User interface commands, Up: Top++26 Data entry commands+**********************++* Menu:++* add::+* add and balance assertions::+* add and balance assignments::+* import::+++File: hledger.info, Node: add, Next: add and balance assertions, Up: Data entry commands++26.1 add+========++Add new transactions to a journal file, with interactive prompting.++Flags:+ --no-new-accounts don't allow creating new accounts++ Many hledger users edit their journals directly with a text editor,+or generate them from CSV. For more interactive data entry, there is the+'add' command, which prompts interactively on the console for new+transactions, and appends them to the main journal file (which should be+in journal format). Existing transactions are not changed. This is one+of the few hledger commands that writes to the journal file (see also+'import').++ To use it, just run 'hledger add' and follow the prompts. You can+add as many transactions as you like; when you are finished, enter '.'+or press control-d or control-c to exit.++ Features:++ * add tries to provide useful defaults, using the most similar (by+ description) recent transaction (filtered by the query, if any) as+ a template.+ * You can also set the initial defaults with command line arguments.+ * Readline-style edit keys can be used during data entry.+ * The tab key will auto-complete whenever possible - accounts,+ payees/descriptions, dates ('yesterday', 'today', 'tomorrow'). If+ the input area is empty, it will insert the default value.+ * A parenthesised transaction code may be entered following a date.+ * Comments and tags may be entered following a description or amount.+ * If you make a mistake, enter '<' at any prompt to go one step+ backward.+ * Input prompts are displayed in a different colour when the terminal+ supports it.++ Notes:++ * If you enter a number with no commodity symbol, and you have+ declared a default commodity with a 'D' directive, you might expect+ 'add' to add this symbol for you. It does not do this; we assume+ that if you are using a 'D' directive you prefer not to see the+ commodity symbol repeated on amounts in the journal.+ * 'add' creates entries in journal format; it won't work with+ timeclock or timedot files.+ * There is a known issue on Windows if this hledger version is built+ from stackage: the prompts will show ANSI junk instead of colours+ (#2410). You can avoid this by using official hledger release+ binaries or by building it with haskeline >=0.8.4; or by running+ 'add' with '--color=no', perhaps configured in your config file.++ Examples:++ * Record new transactions, saving to the default journal file:++ hledger add++ * Add transactions to 2024.journal, but also load 2023.journal for+ completions:++ hledger add --file 2024.journal --file 2023.journal++ * Provide answers for the first four prompts:++ hledger add today 'best buy' expenses:supplies '$20'++ There is a detailed tutorial at https://hledger.org/add.html.+++File: hledger.info, Node: add and balance assertions, Next: add and balance assignments, Prev: add, Up: Data entry commands++26.2 add and balance assertions+===============================++Since hledger 1.43, you can add a balance assertion by writing 'AMOUNT =+BALANCE' when asked for an amount. Eg '100 = 500'.++ Also, each time you enter a new amount, hledger re-checks all balance+assertions in the journal and rejects the new amount if it would make+any of them fail. You can run 'add' with '-I'/'--ignore-assertions' to+disable balance assertion checking.+++File: hledger.info, Node: add and balance assignments, Next: import, Prev: add and balance assertions, Up: Data entry commands++26.3 add and balance assignments+================================++Since hledger 1.51, you can add a balance assignment by writing '=+BALANCE' (or '==', '=*' etc) when asked for an amount. The missing+amount will be calculated automatically.++ 'add' normally won't let you add a new posting which is dated earlier+than an existing balance assignment. (Because when 'add' runs, existing+balance assignments have already been calculated and converted to+amounts and balance assertions.) You can allow it by disabling balance+assertion checking with '-I'.+++File: hledger.info, Node: import, Prev: add and balance assignments, Up: Data entry commands++26.4 import+===========++Import new transactions from one or more data files to the main journal.++Flags:+ --catchup just mark all transactions as already imported+ --dry-run just show the transactions to be imported++ This command detects new transactions in one or more data files+specified as arguments, and appends them to the main journal.++ You can import from any input file format hledger supports, but+CSV/SSV/TSV files, downloaded from financial institutions, are the most+common import source.++ The import destination is the default journal file, or another+specified in the usual way with '$LEDGER_FILE' or '-f/--file'. It+should be in journal format.++ Examples:++$ hledger import bank1-checking.csv bank1-savings.csv++$ hledger import *.csv++* Menu:++* Import dry run::+* Overlap detection::+* First import::+* Importing balance assignments::+* Import and commodity styles::+* Import archiving::+* Import special cases::+++File: hledger.info, Node: Import dry run, Next: Overlap detection, Up: import++26.4.1 Import dry run+---------------------++It's useful to preview the import by running first with '--dry-run', to+sanity check the range of dates being imported, and to check the effect+of your conversion rules if converting from CSV. Eg:++$ hledger import bank.csv --dry-run++ The dry run output is valid journal format, so hledger can re-parse+it. If the output is large, you could show just the uncategorised+transactions like so:++$ hledger import --dry-run bank.csv | hledger -f- -I print unknown++ You could also run this repeatedly to see the effect of edits to your+conversion rules:++$ watchexec -- "hledger import --dry-run bank.csv | hledger -f- -I print unknown"++ Once the conversion and dates look good enough to import to your+journal, perhaps with some manual fixups to follow, you would do the+actual import:++$ hledger import bank.csv+++File: hledger.info, Node: Overlap detection, Next: First import, Prev: Import dry run, Up: import++26.4.2 Overlap detection+------------------------++Reading CSV files is built in to hledger, and not specific to 'import';+so you could also import by doing 'hledger -f bank.csv print+>>$LEDGER_FILE'.++ But 'import' is easier and provides some advantages. The main one is+that it avoids re-importing transactions it has seen on previous runs.+This means you don't have to worry about overlapping data in successive+downloads of your bank CSV; just download and 'import' as often as you+like, and only the new transactions will be imported each time.++ We don't call this "deduplication", as it's generally not possible to+reliably detect duplicates in bank CSV. Instead, 'import' remembers the+latest date processed previously in each CSV file (saving it in a hidden+file), and skips any records prior to that date. This works well for+most real-world CSV, where:++ 1. the data file name is stable (does not change) across imports+ 2. the item dates are stable across imports+ 3. the order of same-date items is stable across imports+ 4. the newest items have the newest dates++ (Occasional violations of 2-4 are often harmless; you can reduce the+chance of disruption by downloading and importing more often.)++ Overlap detection is automatic, and shouldn't require much attention+from you, except perhaps at first import (see below). But here's how it+works:++ * For each 'FILE' being imported from:++ 1. hledger reads a file named '.latest.FILE' file in the same+ directory, if any. This file contains the latest record date+ previously imported from FILE, in YYYY-MM-DD format. If+ multiple records with that date were imported, the date is+ repeated on N lines.++ 2. hledger reads records from FILE. If a latest date was found in+ step 1, any records before that date, and the first N records+ on that date, are skipped.++ * After a successful import from all FILEs, without error and without+ '--dry-run', hledger updates each FILE's '.latest.FILE' for next+ time.++ If this goes wrong, it's relatively easy to repair:++ * You'll notice it before import when you preview with 'import+ --dry-run'.+ * Or after import when you try to reconcile your hledger account+ balances with your bank.+ * 'hledger print -f FILE.csv' will show all recently downloaded+ transactions. Compare these with your journal. Copy/paste if+ needed.+ * Update your conversion rules and print again, if needed.+ * You can manually update or remove the .latest file, or use 'import+ --catchup FILE'.+ * Download and import more often, eg twice a week, at least while you+ are learning. It's easier to review and troubleshoot when there+ are fewer transactions.+++File: hledger.info, Node: First import, Next: Importing balance assignments, Prev: Overlap detection, Up: import++26.4.3 First import+-------------------++The first time you import from a file, when no corresponding .latest+file has been created yet, all of the records will be imported.++ But perhaps you have been entering the data manually, so you know+that all of these transactions are already recorded in the journal. In+this case you can run 'hledger import --catchup' once. This will create+a .latest file containing the latest CSV record date, so that none of+those records will be re-imported.++ Or, if you know that some but not all of the transactions are in the+journal, you can create the .latest file yourself. Eg, let's say you+previously recorded foobank transactions up to 2024-10-31 in the+journal. Then in the directory where you'll be saving 'foobank.csv',+you would create a '.latest.foobank.csv' file containing++2024-10-31++ Or if you had three foobank transactions recorded with that date, you+would repeat the date that many times:++2024-10-31+2024-10-31+2024-10-31++ Then 'hledger import foobank.csv [--dry-run]' will import only the+newer records.+++File: hledger.info, Node: Importing balance assignments, Next: Import and commodity styles, Prev: First import, Up: import++26.4.4 Importing balance assignments+------------------------------------++Journal entries added by import will have all posting amounts made+explicit (like 'print -x').++ This means that any balance assignments in the imported entries would+need to be evaluated. But this generally isn't possible, as the main+file's account balances are not visible during import. So try to avoid+generating balance assignments with your CSV rules, or importing from a+journal that contains balance assignments. (Balance assignments are+best avoided anyway.)++ But if you must use them, eg because your CSV includes only balances:+you can import with 'print', which leaves implicit amounts implicit.+('print' can also do overlap detection like import, with the '--new'+flag):++$ hledger print --new -f bank.csv >> $LEDGER_FILE++ (If you think 'import' should preserve implicit balances, please test+that and send a pull request.)+++File: hledger.info, Node: Import and commodity styles, Next: Import archiving, Prev: Importing balance assignments, Up: import++26.4.5 Import and commodity styles+----------------------------------++Amounts in entries added by import will be formatted according to the+journal's canonical commodity styles, as declared by 'commodity'+directives or inferred from the journal's amounts.++ Related: CSV > Amount decimal places.+++File: hledger.info, Node: Import archiving, Next: Import special cases, Prev: Import and commodity styles, Up: import++26.4.6 Import archiving+-----------------------++When importing from a CSV rules file ('hledger import bank.rules'), you+can use the archive rule to enable automatic archiving of the data file.+After a successful import, the data file (specified by 'source') will be+moved to an archive folder ('data/', next to the rules file,+auto-created), and renamed similar to the rules file, with a date. This+can be useful for troubleshooting, detecting variations in your banks'+CSV data, regenerating entries with improved rules, etc.++ The 'archive' rule also causes 'import' to handle 'source' glob+patterns differently: when there are multiple matched files, it will+pick the oldest, not the newest.+++File: hledger.info, Node: Import special cases, Prev: Import archiving, Up: import++26.4.7 Import special cases+---------------------------++* Menu:++* Deduplication::+* Varying file name::+* Multiple versions::+++File: hledger.info, Node: Deduplication, Next: Varying file name, Up: Import special cases++26.4.7.1 Deduplication+......................++Here are two kinds of "deduplication" which 'import' does not handle+(and should not, because these can happen legitimately in financial+data):++ * Two or more of the new CSV records are identical, and generate+ identical new journal entries.+ * A new CSV record generates a journal entry identical to one(s)+ already in the journal.+++File: hledger.info, Node: Varying file name, Next: Multiple versions, Prev: Deduplication, Up: Import special cases++26.4.7.2 Varying file name+..........................++If you have a download whose file name varies, you could rename it to a+fixed name after each download. Or you could use a CSV 'source' rule+with a suitable glob pattern, and import from the .rules file.+++File: hledger.info, Node: Multiple versions, Prev: Varying file name, Up: Import special cases++26.4.7.3 Multiple versions+..........................++Say you download 'bank.csv', import it, but forget to delete it from+your downloads folder. The next time you download it, your web browser+will save it as (eg) 'bank (2).csv'. The source rule's glob patterns+are for just this situation: instead of specifying 'source bank.csv',+specify 'source bank*.csv'. Then 'hledger -f bank.rules CMD' or+'hledger import bank.rules' will automatically pick the newest matched+file ('bank (2).csv').++ Alternately, what if you download, but forget to import or delete,+then download again ? Now each of 'bank.csv' and 'bank (2).csv' might+contain data that's not in the other, and not in your journal. In this+case, it's best to import each of them in turn, oldest first (otherwise,+overlap detection could cause new records to be skipped). Enabling+import archiving ensures this. Then 'hledger import bank.rules; hledger+import bank.rules' will import and archive first 'bank.csv', then 'bank+(2).csv'.+++File: hledger.info, Node: Basic report commands, Next: Standard report commands, Prev: Data entry commands, Up: Top++27 Basic report commands+************************++* Menu:++* accounts::+* codes::+* commodities::+* descriptions::+* files::+* notes::+* payees::+* prices::+* stats::+* tags::+++File: hledger.info, Node: accounts, Next: codes, Up: Basic report commands++27.1 accounts+=============++List the account names used or declared in the journal.++Flags:+ -u --used list accounts used+ -d --declared list accounts declared+ --undeclared list accounts used but not declared+ --unused list accounts declared but not used+ --find list the first account matched by the first+ argument (a case-insensitive infix regexp)+ --directives show as account directives, for use in journals+ --locations also show where accounts were declared+ --types also show account types when known+ -l --flat list/tree mode: show accounts as a flat list+ (default)+ -t --tree list/tree mode: show accounts as a tree+ --drop=N flat mode: omit N leading account name parts++ This command lists account names - all of them by default, or just+the ones which have been used in transactions ('-u/--used'), or declared+with 'account' directives ('-d/--declared'), or used but not declared+('--undeclared'), or declared but not used ('--unused'), or just the+first one matched by a pattern ('--find', returning a non-zero exit code+if it fails).++ You can add query arguments to select a subset of transactions or+accounts.++ With '--directives', it shows valid account directives which could be+pasted into a journal file. This is useful together with '--undeclared'+when updating your account declarations to satisfy 'hledger check+accounts'.++ With '--locations', it also shows the file and line number of each+account's declaration, if any, and the account's overall declaration+order; these may be useful when troubleshooting account display order.++ With '--types', it also shows each account's type, if it's known.+(See Declaring accounts > Account types.)++ It shows a flat list by default. With '--tree', it uses indentation+to show the account hierarchy. In flat mode you can add '--drop N' to+omit the first few account name components. Account names can be+depth-clipped with 'depth:N' or '--depth N' or '-N'.++ Examples:++$ hledger accounts+assets:bank:checking+assets:bank:saving+assets:cash+expenses:food+expenses:supplies+income:gifts+income:salary+liabilities:debts++$ hledger accounts --undeclared --directives >> $LEDGER_FILE+$ hledger check accounts+++File: hledger.info, Node: codes, Next: commodities, Prev: accounts, Up: Basic report commands++27.2 codes+==========++List the codes seen in transactions, in the order parsed.++Flags:+no command-specific flags++ This command prints the value of each transaction's code field, in+the order transactions were parsed. The transaction code is an optional+value written in parentheses between the date and description, often+used to store a cheque number, order number or similar.++ Transactions aren't required to have a code, and missing or empty+codes will not be shown by default. With the '-E'/'--empty' flag, they+will be printed as blank lines.++ You can add a query to select a subset of transactions.++ Examples:++2022/1/1 (123) Supermarket + Food $5.00+ Checking ++2022/1/2 (124) Post Office+ Postage $8.32+ Checking++2022/1/3 Supermarket+ Food $11.23+ Checking ++2022/1/4 (126) Post Office+ Postage $3.21+ Checking++$ hledger codes+123+124+126++$ hledger codes -E+123+124++126+++File: hledger.info, Node: commodities, Next: descriptions, Prev: codes, Up: Basic report commands++27.3 commodities+================++List the commodity symbols used or declared in the journal.++Flags:+ --used list commodities used+ --declared list commodities declared+ --undeclared list commodities used but not declared+ --unused list commodities declared but not used+ --find list the first commodity matched by the first+ argument (a case-insensitive infix regexp)++ This command lists commodity symbols/names - all of them by default,+or just the ones which have been used in transactions or 'P' directives,+or declared with 'commodity' directives, or used but not declared, or+declared but not used, or just the first one matched by a pattern (with+'--find', returning a non-zero exit code if it fails).++ You can add 'cur:' query arguments to further limit the commodities.+++File: hledger.info, Node: descriptions, Next: files, Prev: commodities, Up: Basic report commands++27.4 descriptions+=================++List the unique descriptions used in transactions.++Flags:+no command-specific flags++ This command lists the unique descriptions that appear in+transactions, in alphabetic order. You can add a query to select a+subset of transactions.++ Example:++$ hledger descriptions+Store Name+Gas Station | Petrol+Person A+++File: hledger.info, Node: files, Next: notes, Prev: descriptions, Up: Basic report commands++27.5 files+==========++List all files included in the journal. With a REGEX argument, only+file names matching the regular expression (case sensitive) are shown.++Flags:+no command-specific flags+++File: hledger.info, Node: notes, Next: payees, Prev: files, Up: Basic report commands++27.6 notes+==========++List the unique notes that appear in transactions.++Flags:+no command-specific flags++ This command lists the unique notes that appear in transactions, in+alphabetic order. You can add a query to select a subset of+transactions. The note is the part of the transaction description after+a | character (or if there is no |, the whole description).++ Example:++$ hledger notes+Petrol+Snacks+++File: hledger.info, Node: payees, Next: prices, Prev: notes, Up: Basic report commands++27.7 payees+===========++List the payee/payer names used or declared in the journal.++Flags:+ --used list payees used+ --declared list payees declared+ --undeclared list payees used but not declared+ --unused list payees declared but not used+ --find list the first payee matched by the first+ argument (a case-insensitive infix regexp)++ This command lists unique payee/payer names - all of them by default,+or just the ones which have been used in transaction descriptions, or+declared with 'payee' directives, or used but not declared, or declared+but not used, or just the first one matched by a pattern (with '--find',+returning a non-zero exit code if it fails).++ The payee/payer name is the part of the transaction description+before a | character (or if there is no |, the whole description).++ You can add query arguments to select a subset of transactions or+payees.++ Example:++$ hledger payees+Store Name+Gas Station+Person A+++File: hledger.info, Node: prices, Next: stats, Prev: payees, Up: Basic report commands++27.8 prices+===========++Print the market prices declared with P directives. With+-infer-market-prices, also show any additional prices inferred from+costs. With -show-reverse, also show additional prices inferred by+reversing known prices.++Flags:+ --show-reverse also show the prices inferred by reversing known+ prices++ Price amounts are always displayed with their full precision, except+for reverse prices which are limited to 8 decimal digits.++ Prices can be filtered by a date:, cur: or amt: query.++ Generally if you run this command with -infer-market-prices+-show-reverse, it will show the same prices used internally to calculate+value reports. But if in doubt, you can inspect those directly by+running the value report with -debug=2.+++File: hledger.info, Node: stats, Next: tags, Prev: prices, Up: Basic report commands++27.9 stats+==========++Show journal and performance statistics.++Flags:+ -1 show a single line of output+ -v --verbose show more detailed output+ -o --output-file=FILE write output to FILE.++ The stats command shows summary information for the whole journal, or+a matched part of it. With a reporting interval, it shows a report for+each report period.++ It also shows some performance statistics:++ * how long the program ran for+ * the number of transactions processed per second+ * the peak live memory in use by the program to do its work+ * the peak allocated memory as seen by the program++ By default, the output is reasonably discreet; it reveals the main+file name, your activity level, and the speed of your machine.++ With '-v/--verbose', more details are shown: the full paths of all+files, and the names of the commodities you work with.++ With '-1', only one line of output is shown, in a machine-friendly+tab-separated format: the program version, the main journal file name,+and the performance stats,++ The run time of 'stats' is similar to that of a balance report.++ Example:++$ hledger stats -f examples/1ktxns-1kaccts.journal +Main file : .../1ktxns-1kaccts.journal+Included files : 0+Txns span : 2000-01-01 to 2002-09-27 (1000 days)+Last txn : 2002-09-26 (7827 days ago)+Txns : 1000 (1.0 per day)+Txns last 30 days : 0 (0.0 per day)+Txns last 7 days : 0 (0.0 per day)+Payees/descriptions : 1000+Accounts : 1000 (depth 10)+Commodities : 26+Market prices : 1000+Runtime stats : 0.12 s elapsed, 8266 txns/s, 4 MB live, 16 MB alloc++$ hledger stats -1 -f examples/10ktxns-1kaccts.journal+1.50.99-g0835a2485-20251119, mac-aarch64 10ktxns-1kaccts.journal 0.66 s elapsed 15244 txns/s 28 MB live 86 MB alloc++ This command supports the -o/-output-file option (but not+-O/-output-format).+++File: hledger.info, Node: tags, Prev: stats, Up: Basic report commands++27.10 tags+==========++List the tag names used or declared in the journal, or their values.++Flags:+ --used list tags used+ --declared list tags declared+ --undeclared list tags used but not declared+ --unused list tags declared but not used+ --find list the first tag whose name is matched by the+ first argument (a case-insensitive infix regexp)+ --values list tag values instead of tag names+ --parsed show them in the order they were parsed (mostly),+ including duplicates++ This command lists tag names - all of them by default, or just the+ones which have been used on transactions/postings/accounts, or declared+with 'tag' directives, or used but not declared, or declared but not+used, or just the first one matched by a pattern (with '--find',+returning a non-zero exit code if it fails).++ Note this command's non-standard first argument: it is a+case-insensitive infix regular expression for matching tag names, which+limits the tags shown. Any additional arguments are standard query+arguments, which limit the transactions, postings, or accounts providing+tags.++ With '--values', the tags' unique non-empty values are listed+instead.++ With '-E'/'--empty', blank/empty values are also shown.++ With '--parsed', tags or values are shown in the order they were+parsed, with duplicates included. (Except, tags from account+declarations are always shown first.)++ Remember that accounts also acquire tags from their parents; postings+also acquire tags from their account and transaction; and transactions+also acquire tags from their postings.+++File: hledger.info, Node: Standard report commands, Next: Advanced report commands, Prev: Basic report commands, Up: Top++28 Standard report commands+***************************++* Menu:++* print::+* aregister::+* register::+* balancesheet::+* balancesheetequity::+* cashflow::+* incomestatement::+++File: hledger.info, Node: print, Next: aregister, Up: Standard report commands++28.1 print+==========++Show full journal entries, representing transactions.++Flags:+ -x --explicit show all amounts explicitly+ --invert display all amounts with reversed sign+ --locations add tags showing file paths and line numbers+ -m --match=DESC fuzzy search for one recent transaction with+ description closest to DESC+ --new show only newer-dated transactions added in each+ file since last run+ --round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none - show original decimal digits,+ as in journal (default)+ soft - just add or remove decimal zeros+ to match precision+ hard - round posting amounts to precision+ (can unbalance transactions)+ all - also round cost amounts to precision+ (can unbalance transactions)+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, beancount, csv, tsv, html, fods, json, sql.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ The print command displays full journal entries (transactions) from+the journal file, sorted by date (or with '--date2', by secondary date).++ Directives and inter-transaction comments are not shown, currently.+This means the print command is somewhat lossy, and if you are using it+to reformat/regenerate your journal you should take care to also copy+over the directives and inter-transaction comments.++ Eg:++$ hledger print -f examples/sample.journal date:200806+2008/06/01 gift+ assets:bank:checking $1+ income:gifts $-1++2008/06/02 save+ assets:bank:saving $1+ assets:bank:checking $-1++2008/06/03 * eat & shop+ expenses:food $1+ expenses:supplies $1+ assets:cash $-2++* Menu:++* print amount explicitness::+* print alignment::+* print amount style::+* print parseability::+* print other features::+* print output format::+++File: hledger.info, Node: print amount explicitness, Next: print alignment, Up: print++28.1.1 print amount explicitness+--------------------------------++Normally, whether posting amounts are implicit or explicit is preserved.+For example, when an amount is omitted in the journal, it will not+appear in the output. Similarly, if a conversion cost is implied but+not written, it will not appear in the output.++ You can use the '-x'/'--explicit' flag to force explicit display of+all amounts and costs. This can be useful for troubleshooting or for+making your journal more readable and robust against data entry errors.+'-x' is also implied by using any of '-B','-V','-X','--value'.++ The '-x'/'--explicit' flag will cause any postings with a+multi-commodity amount (which can arise when a multi-commodity+transaction has an implicit amount) to be split into multiple+single-commodity postings, keeping the output parseable.+++File: hledger.info, Node: print alignment, Next: print amount style, Prev: print amount explicitness, Up: print++28.1.2 print alignment+----------------------++Amounts are shown right-aligned within each transaction (but not aligned+across all transactions; you can achieve that with ledger-mode in+Emacs).+++File: hledger.info, Node: print amount style, Next: print parseability, Prev: print alignment, Up: print++28.1.3 print amount style+-------------------------++Amounts will be displayed mostly in their commodity's display style,+with standardised symbol placement, decimal mark, and digit group marks.+This does not apply to their decimal digits; 'print' normally shows the+same decimal digits that are recorded in each journal entry.++ You can override the decimal precisions with 'print''s special+'--round' option (_since 1.32_). '--round' tries to show amounts with+their commodities' standard decimal precisions, increasingly strongly:++ * '--round=none' show amounts with original precisions (default)+ * '--round=soft' add/remove decimal zeros in amounts (except costs)+ * '--round=hard' round amounts (except costs), possibly hiding+ significant digits+ * '--round=all' round all amounts and costs++ 'soft' is good for non-lossy cleanup, displaying more consistent+decimals where possible, without making entries unbalanced.++ 'hard' or 'all' can be good for stronger cleanup, when decimal+rounding is wanted. Note rounding can produce unbalanced journal+entries, perhaps requiring manual fixup.+++File: hledger.info, Node: print parseability, Next: print other features, Prev: print amount style, Up: print++28.1.4 print parseability+-------------------------++Normally, print's output is a valid hledger journal, which you can+"pipe" to a second hledger command for further processing. This is+sometimes convenient for achieving certain kinds of query (though less+needed now that queries have become more powerful):++# Show running total of food expenses paid from cash.+# -f- reads from stdin. -I/--ignore-assertions is sometimes needed.+$ hledger print assets:cash | hledger -f- -I reg expenses:food++ But here are some things which can cause print's output to become+unparseable:++ * '--round' (see above) can disrupt transaction balancing.+ * Account aliases or pivoting can disrupt account names, balance+ assertions, or balance assignments.+ * Value reporting also can disrupt balance assertions or balance+ assignments.+ * Auto postings can generate too many amountless postings.+ * '--infer-costs or --infer-equity' can generate too-complex+ redundant costs.+ * Because print always shows transactions in date order, balance+ assertions involving non-date-ordered transactions (and same-day+ postings) could be disrupted.+++File: hledger.info, Node: print other features, Next: print output format, Prev: print parseability, Up: print++28.1.5 print, other features+----------------------------++With '-B'/'--cost', amounts with costs are shown converted to cost.++ With '--invert', posting amounts are shown with their sign flipped.+It could be useful if you have accidentally recorded some transactions+with the wrong signs.++ With '--new', print shows only transactions it has not seen on a+previous run. This uses the same deduplication system as the 'import'+command. (See import's docs for details.)++ With '-m DESC'/'--match=DESC', print shows one recent transaction+whose description is most similar to DESC. DESC should contain at least+two characters. If there is no similar-enough match, no transaction+will be shown and the program exit code will be non-zero.++ With '--locations', print adds the source file and line number to+every transaction, as a tag.+++File: hledger.info, Node: print output format, Prev: print other features, Up: print++28.1.6 print output format+--------------------------++This command also supports the output destination and output format+options The output formats supported are 'txt', 'beancount' (_Added in+1.32_), 'csv', 'tsv' (_Added in 1.32_), 'json' and 'sql'.++ The 'beancount' format tries to produce Beancount-compatible output,+as follows:++ * Transaction and postings with unmarked status are converted to+ cleared ('*') status.+ * Transactions' payee and note are backslash-escaped and+ double-quote-escaped and wrapped in double quotes.+ * Transaction tags are copied to Beancount #tag format.+ * Commodity symbols are converted to upper case, and a small number+ of currency symbols like '$' are converted to the corresponding+ currency names.+ * Account name parts are capitalised and unsupported characters are+ replaced with '-'. If an account name part does not begin with a+ letter, or if the first part is not Assets, Liabilities, Equity,+ Income, or Expenses, an error is raised. (Use '--alias' options to+ bring your accounts into compliance.)+ * An 'open' directive is generated for each account used, on the+ earliest transaction date.++ Some limitations:++ * Balance assertions are removed.+ * Balance assignments become missing amounts.+ * Virtual and balanced virtual postings become regular postings.+ * Directives are not converted.++ Here's an example of print's CSV output:++$ hledger print -Ocsv+"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"+"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""+"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""+"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""+"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""+"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""+"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""+"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""+"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""+"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""+"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""+"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""++ * There is one CSV record per posting, with the parent transaction's+ fields repeated.+ * The "txnidx" (transaction index) field shows which postings belong+ to the same transaction. (This number might change if transactions+ are reordered within the file, files are parsed/included in a+ different order, etc.)+ * The amount is separated into "commodity" (the symbol) and "amount"+ (numeric quantity) fields.+ * The numeric amount is repeated in either the "credit" or "debit"+ column, for convenience. (Those names are not accurate in the+ accounting sense; it just puts negative amounts under credit and+ zero or greater amounts under debit.)+++File: hledger.info, Node: aregister, Next: register, Prev: print, Up: Standard report commands++28.2 aregister+==============++(areg)++ Show the transactions and running balances in one account, with each+transaction on one line.++Flags:+ --txn-dates filter strictly by transaction date, not posting+ date. Warning: this can show a wrong running+ balance.+ --no-elide don't show only 2 commodities per amount+ --cumulative accumulation mode: show running total from report+ start date+ -H --historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date) (default)+ --invert display all amounts with reversed sign+ --drop=N omit N leading account name parts+ --heading=YN show heading row above table: yes (default) or no+ -w --width=N set output width (default: terminal width). -wN,M+ sets description width as well.+ --align-all guarantee alignment across all lines (slower)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ 'aregister' shows the overall transactions affecting a particular+account (and any subaccounts). Each report line represents one+transaction in this account. Transactions before the report start date+are included in the running balance ('--historical' mode is the+default). You can suppress this behaviour using the '--cumulative'+option.++ This is a more "real world", bank-like view than the 'register'+command (which shows individual postings, possibly from multiple+accounts, not necessarily in historical mode). As a quick rule of+thumb:++ * 'aregister' is best when reconciling real-world asset/liability+ accounts+ * 'register' is best when reviewing individual revenues/expenses.++ Note this command's non-standard, and required, first argument; it+specifies the account whose register will be shown. You can write the+account's name, or (to save typing) a case-insensitive infix regular+expression matching the name, which selects the alphabetically first+matched account. (For example, if you have 'assets:personal checking'+and 'assets:business checking', 'hledger areg checking' would select+'assets:business checking'.)++ Transactions involving subaccounts of this account will also be+shown. 'aregister' ignores depth limits, so its final total will always+match a historical balance report with similar arguments.++ Any additional arguments are standard query arguments, which will+limit the transactions shown. Note some queries will disturb the+running balance, 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":++$ hledger areg checking date:jul++ Each 'aregister' line item shows:++ * the transaction's date (or the relevant posting's date if+ different, see below)+ * the names of all the other account(s) involved in this transaction+ (probably abbreviated)+ * the total change to this account's balance from this transaction+ * the account's historical running balance after this transaction.++ Transactions making a net change of zero are not shown by default;+add the '-E/--empty' flag to show them.++ For performance reasons, column widths are chosen based on the first+1000 lines; this means unusually wide values in later lines can cause+visual discontinuities as column widths are adjusted. If you want to+ensure perfect alignment, at the cost of more time and memory, use the+'--align-all' flag.++ By default, 'aregister' shows a heading above the data. However,+when reporting in a language different from English, it is easier to+omit this heading and prepend your own one. For this purpose, use the+'--heading=no' option.++ This command also supports the output destination and output format+options. The output formats supported are 'txt', 'csv', 'tsv' (_Added+in 1.32_), 'html', 'fods' (_Added in 1.41_) and 'json'.++* Menu:++* aregister and posting dates::+++File: hledger.info, Node: aregister and posting dates, Up: aregister++28.2.1 aregister and posting dates+----------------------------------++aregister always shows one line (and date and amount) per transaction.+But sometimes transactions have postings with different dates. Also,+not all of a transaction's postings may be within the report period. To+resolve this, aregister shows the earliest of the transaction's date and+posting dates that is in-period, and the sum of the in-period postings.+In other words it will show a combined line item with just the earliest+date, and the running balance will (temporarily, until the transaction's+last posting) be inaccurate. Use 'register -H' if you need to see the+individual postings.++ There is also a '--txn-dates' flag, which filters strictly by+transaction date, ignoring posting dates. This too can cause an+inaccurate running balance.+++File: hledger.info, Node: register, Next: balancesheet, Prev: aregister, Up: Standard report commands++28.3 register+=============++(reg)++ Show postings and their running total.++Flags:+ --cumulative accumulation mode: show running total from report+ start date (default)+ -H --historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date)+ -A --average show running average of posting amounts instead+ of total (implies --empty)+ -m --match=DESC fuzzy search for one recent posting with+ description closest to DESC+ -r --related show postings' siblings instead+ --invert display all amounts with reversed sign+ --drop=N omit N leading account name parts+ --sort=FIELDS sort by: date, desc, account, amount, absamount,+ or a comma-separated combination of these. For a+ descending sort, prefix with -. (Default: date)+ -w --width=N set output width (default: terminal width). -wN,M+ sets description width as well.+ --align-all guarantee alignment across all lines (slower)+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, csv, tsv, html, fods, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ The register command displays matched postings, across all accounts,+in date order, with their running total or running historical balance.+(See also the 'aregister' command, which shows matched transactions in a+specific account.)++ register normally shows line per posting, but note that+multi-commodity amounts will occupy multiple lines (one line per+commodity).++ It is typically used with a query selecting a particular account, to+see that account's activity:++$ hledger register checking+2008/01/01 income assets:bank:checking $1 $1+2008/06/01 gift assets:bank:checking $1 $2+2008/06/02 save assets:bank:checking $-1 $1+2008/12/31 pay off assets:bank:checking $-1 0++ With '--date2', it shows and sorts by secondary date instead.++ For performance reasons, column widths are chosen based on the first+1000 lines; this means unusually wide values in later lines can cause+visual discontinuities as column widths are adjusted. If you want to+ensure perfect alignment, at the cost of more time and memory, use the+'--align-all' flag.++ The '--historical'/'-H' flag adds the balance from any undisplayed+prior postings to the running total. This is useful when you want to+see only recent activity, with a historically accurate running balance:++$ hledger register checking -b 2008/6 --historical+2008/06/01 gift assets:bank:checking $1 $2+2008/06/02 save assets:bank:checking $-1 $1+2008/12/31 pay off assets:bank:checking $-1 0++ The '--depth' option limits the amount of sub-account detail+displayed.++ The '--drop' option will trim leading segments from account names.++ The '--average'/'-A' flag shows the running average posting amount+instead of the running total (so, the final number displayed is the+average for the whole report period). This flag implies '--empty' (see+below). It is affected by '--historical'. It works best when showing+just one account and one commodity.++ The '--related'/'-r' flag shows the _other_ postings in the+transactions of the postings which would normally be shown.++ The '--invert' flag negates all amounts. For example, it can be used+on an income account where amounts are normally displayed as negative+numbers. It's also useful to show postings on the checking account+together with the related account:++ The '--sort=FIELDS' flag sorts by the fields given, which can be any+of 'account', 'amount', 'absamount', 'date', or 'desc'/'description',+optionally separated by commas. For example, '--sort account,amount'+will group all transactions in each account, sorted by transaction+amount. Each field can be negated by a preceding '-', so '--sort+-amount' will show transactions ordered from smallest amount to largest+amount.++$ hledger register --related --invert assets:checking++ With a reporting interval, register shows summary postings, one per+interval, aggregating the postings to each account:++$ hledger register --monthly income+2008/01 income:salary $-1 $-1+2008/06 income:gifts $-1 $-2++ Periods with no activity, and summary postings with a zero amount,+are not shown by default; use the '--empty'/'-E' flag to see them:++$ hledger register --monthly income -E+2008/01 income:salary $-1 $-1+2008/02 0 $-1+2008/03 0 $-1+2008/04 0 $-1+2008/05 0 $-1+2008/06 income:gifts $-1 $-2+2008/07 0 $-2+2008/08 0 $-2+2008/09 0 $-2+2008/10 0 $-2+2008/11 0 $-2+2008/12 0 $-2++ Often, you'll want to see just one line per interval. The '--depth'+option helps with this, causing subaccounts to be aggregated:++$ hledger register --monthly assets --depth 1+2008/01 assets $1 $1+2008/06 assets $-1 0+2008/12 assets $-1 $-1++ Note when using report intervals, if you specify start/end dates+these will be adjusted outward if necessary to contain a whole number of+intervals. This ensures that the first and last intervals are full+length and comparable to the others in the report.++ If you have a deeply nested account tree some reports might benefit+from trimming leading segments from the account names using '--drop'.++$ hledger register --monthly income --drop 1+2008/01 salary $-1 $-1+2008/06 gifts $-1 $-2++ With '-m DESC'/'--match=DESC', register does a fuzzy search for one+recent posting whose description is most similar to DESC. DESC should+contain at least two characters. If there is no similar-enough match,+no posting will be shown and the program exit code will be non-zero.++* Menu:++* Custom register output::+++File: hledger.info, Node: Custom register output, Up: register++28.3.1 Custom register output+-----------------------------++register normally uses the full terminal width (or 80 columns if it+can't detect that). You can override this with the '--width'/'-w'+option.++ The description and account columns normally share the space equally+(about half of (width - 40) each). You can adjust this by adding a+description width as part of -width's argument, comma-separated:+'--width W,D' . Here's a diagram (won't display correctly in -help):++<--------------------------------- width (W) ---------------------------------->+date (10) description (D) account (W-41-D) amount (12) balance (12)+DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA++ and some examples:++$ hledger reg # use terminal width (or 80 on windows)+$ hledger reg -w 100 # use width 100+$ hledger reg -w 100,40 # set overall width 100, description width 40++ This command also supports the output destination and output format+options The output formats supported are 'txt', 'csv', 'tsv' (_Added in+1.32_), and 'json'.+++File: hledger.info, Node: balancesheet, Next: balancesheetequity, Prev: register, Up: Standard report commands++28.4 balancesheet+=================++(bs)++ Show the end balances in asset and liability accounts. Amounts are+shown with normal positive sign, as in conventional financial+statements.++Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This command displays a balance sheet, showing historical ending+balances of asset and liability accounts. (To see equity as well, use+the balancesheetequity command.)++ Accounts declared with the 'Asset', 'Cash' or 'Liability' type are+shown (see account types). Or if no such accounts are declared, it+shows top-level accounts named 'asset' or 'liability' (case insensitive,+plurals allowed) and their subaccounts.++ Example:++$ hledger balancesheet+Balance Sheet 2008-12-31++ || 2008-12-31 +====================++============+ Assets || +--------------------++------------+ assets:bank:saving || $1 + assets:cash || $-2 +--------------------++------------+ || $-1 +====================++============+ Liabilities || +--------------------++------------+ liabilities:debts || $-1 +--------------------++------------+ || $-1 +====================++============+ Net: || 0 ++ This command is a higher-level variant of the 'balance' command, and+supports many of that command's features, such as multi-period reports.+It is similar to 'hledger balance -H assets liabilities', but with+smarter account detection, and liabilities displayed with their sign+flipped.++ This command also supports the output destination and output format+options The output formats supported are 'txt', 'csv', 'tsv' (_Added in+1.32_), 'html', and 'json'.+++File: hledger.info, Node: balancesheetequity, Next: cashflow, Prev: balancesheet, Up: Standard report commands++28.5 balancesheetequity+=======================++(bse)++ This command displays a balance sheet, showing historical ending+balances of asset, liability and equity accounts. Amounts are shown+with normal positive sign, as in conventional financial statements.++Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This report shows accounts declared with the 'Asset', 'Cash',+'Liability' or 'Equity' type (see account types). 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:++$ hledger balancesheetequity+Balance Sheet With Equity 2008-12-31++ || 2008-12-31 +====================++============+ Assets || +--------------------++------------+ assets:bank:saving || $1 + assets:cash || $-2 +--------------------++------------+ || $-1 +====================++============+ Liabilities || +--------------------++------------+ liabilities:debts || $-1 +--------------------++------------+ || $-1 +====================++============+ Equity || +--------------------++------------+--------------------++------------+ || 0 +====================++============+ Net: || 0 ++ This command is a higher-level variant of the 'balance' command, and+supports many of that command's features, such as multi-period reports.+It is similar to 'hledger balance -H assets liabilities equity', but+with smarter account detection, and liabilities/equity displayed with+their sign flipped.++ This report is the easiest way to see if the accounting equation+(A+L+E = 0) is satisfied (after you have done a 'close --retain' to+merge revenues and expenses with equity, and perhaps added+'--infer-equity' to balance your commodity conversions).++ This command also supports the output destination and output format+options The output formats supported are 'txt', 'csv', 'tsv', 'html',+and 'json'.+++File: hledger.info, Node: cashflow, Next: incomestatement, Prev: balancesheetequity, Up: Standard report commands++28.6 cashflow+=============++(cf)++ This command displays a (simple) cashflow statement, showing the+inflows and outflows affecting "cash" (ie, liquid, easily convertible)+assets. Amounts are shown with normal positive sign, as in conventional+financial statements.++Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This report shows accounts declared with the 'Cash' type (see account+types). Or if no such accounts are declared, it shows accounts++ * under a top-level account named 'asset' (case insensitive, plural+ allowed)+ * whose name contains some variation of 'cash', 'bank', 'checking' or+ 'saving'.++ More precisely: all accounts matching this case insensitive regular+expression:++ ^assets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|currentcash)(:|$)++ and their subaccounts.++ An example cashflow report:++$ hledger cashflow+Cashflow Statement 2008++ || 2008 +====================++======+ Cash flows || +--------------------++------+ assets:bank:saving || $1 + assets:cash || $-2 +--------------------++------+ || $-1 ++ This command is a higher-level variant of the 'balance' command, and+supports many of that command's features, such as multi-period reports.+It is similar to 'hledger balance assets not:fixed not:investment+not:receivable', but with smarter account detection.++ This command also supports the output destination and output format+options The output formats supported are 'txt', 'csv', 'tsv' (_Added in+1.32_), 'html', and 'json'.+++File: hledger.info, Node: incomestatement, Prev: cashflow, Up: Standard report commands++28.7 incomestatement+====================++(is)++ Show revenue inflows and expense outflows during the report period.+Amounts are shown with normal positive sign, as in conventional+financial statements.++Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This command displays an income statement, showing revenues and+expenses during one or more periods.++ It shows accounts declared with the 'Revenue' or 'Expense' type (see+account types). Or if no such accounts are declared, it shows top-level+accounts named 'revenue' or 'income' or 'expense' (case insensitive,+plurals allowed) and their subaccounts.++ Example:++$ hledger incomestatement+Income Statement 2008++ || 2008 +===================++======+ Revenues || +-------------------++------+ income:gifts || $1 + income:salary || $1 +-------------------++------+ || $2 +===================++======+ Expenses || +-------------------++------+ expenses:food || $1 + expenses:supplies || $1 +-------------------++------+ || $2 +===================++======+ Net: || 0 ++ This command is a higher-level variant of the 'balance' command, and+supports many of that command's features, such as multi-period reports.+It is similar to 'hledger balance '(revenues|income)' expenses', but+with smarter account detection, and revenues/income displayed with their+sign flipped.++ This command also supports the output destination and output format+options The output formats supported are 'txt', 'csv', 'tsv' (_Added in+1.32_), 'html', and 'json'.+++File: hledger.info, Node: Advanced report commands, Next: Chart commands, Prev: Standard report commands, Up: Top++29 Advanced report commands+***************************++* Menu:++* balance::+* roi::+++File: hledger.info, Node: balance, Next: roi, Up: Advanced report commands++29.1 balance+============++(bal)++ A flexible, general purpose "summing" report that shows accounts with+some kind of numeric data. This can be balance changes per period, end+balances, budget performance, unrealised capital gains, etc.++Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --budget[=DESCPAT] calculation mode: show sum of posting amounts+ together with budget goals defined by periodic+ transactions. With a DESCPAT argument (must be+ separated by = not space),+ use only periodic transactions with matching+ description+ (case insensitive substring match).+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports,+ default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name (in+ flat mode). With multiple columns, sorts by the row+ total, or by row average if that is displayed.+ -% --percent express values in percentage of each column's+ total+ -r --related show the other accounts transacted with, instead+ --invert display all amounts with reversed sign+ --transpose switch rows and columns (use vertical time axis)+ --layout=ARG how to lay out multi-commodity amounts and the+ overall table:+ 'wide[,W]': commodities on same line, up to W wide+ 'tall' : commodities on separate lines+ 'bare' : commodity symbols in a separate column+ 'tidy' : each data field in its own column+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json, fods.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ 'balance' is one of hledger's oldest and most versatile commands, for+listing account balances, balance changes, values, value changes and+more, during one time period or many. Generally it shows a table, with+rows representing accounts, and columns representing periods.++ Note there are some variants of the 'balance' command with convenient+defaults, which are simpler to use: 'balancesheet',+'balancesheetequity', 'cashflow' and 'incomestatement'. When you need+more control, then use 'balance'.++* Menu:++* balance features::+* Simple balance report::+* Balance report line format::+* Filtered balance report::+* List or tree mode::+* Depth limiting::+* Dropping top-level accounts::+* Showing declared accounts::+* Sorting by amount::+* Percentages::+* Multi-period balance report::+* Balance change end balance::+* Balance report modes::+* Budget report::+* Balance report layout::+* Balance report output::+* Some useful balance reports::+++File: hledger.info, Node: balance features, Next: Simple balance report, Up: balance++29.1.1 balance features+-----------------------++Here's a quick overview of the 'balance' command's features, followed by+more detailed descriptions and examples. Many of these work with the+other balance-like commands as well ('bs', 'cf', 'is'..).++ 'balance' can show..++ * accounts as a list ('-l') or a tree ('-t')+ * optionally depth-limited ('-[1-9]')+ * sorted by declaration order and name, or by amount++ ..and their..++ * balance changes (the default)+ * or actual and planned balance changes ('--budget')+ * or value of balance changes ('-V')+ * or change of balance values ('--valuechange')+ * or unrealised capital gain/loss ('--gain')+ * or balance changes from sibling postings ('--related'/'-r')+ * or postings count ('--count')++ ..in..++ * one time period (the whole journal period by default)+ * or multiple periods ('-D', '-W', '-M', '-Q', '-Y', '-p INTERVAL')++ ..either..++ * per period (the default)+ * or accumulated since report start date ('--cumulative')+ * or accumulated since account creation ('--historical/-H')++ ..possibly converted to..++ * cost ('--value=cost[,COMM]'/'--cost'/'-B')+ * or market value, as of transaction dates ('--value=then[,COMM]')+ * or at period ends ('--value=end[,COMM]')+ * or now ('--value=now')+ * or at some other date ('--value=YYYY-MM-DD')++ ..with..++ * totals ('-T'), averages ('-A'), percentages ('-%'), inverted sign+ ('--invert')+ * rows and columns swapped ('--transpose')+ * another field used as account name ('--pivot')+ * custom-formatted line items (single-period reports only)+ ('--format')+ * commodities displayed on the same line or multiple lines+ ('--layout')++ This command supports the output destination and output format+options, with output formats 'txt', 'csv', 'tsv' (_Added in 1.32_),+'json', and (multi-period reports only:) 'html', 'fods' (_Added in+1.40_). In 'txt' output in a colour-supporting terminal, negative+amounts are shown in red.+++File: hledger.info, Node: Simple balance report, Next: Balance report line format, Prev: balance features, Up: balance++29.1.2 Simple balance report+----------------------------++With no arguments, 'balance' shows a list of all accounts and their+change of balance - ie, the sum of posting amounts, both inflows and+outflows - during the entire period of the journal. ("Simple" here+means just one column of numbers, covering a single period. You can+also have multi-period reports, described later.)++ For real-world accounts, these numbers will normally be their end+balance at the end of the journal period; more on this below.++ Accounts are sorted by declaration order if any, and then+alphabetically by account name. For instance (using+examples/sample.journal):++$ hledger -f examples/sample.journal bal+ $1 assets:bank:saving+ $-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $-1 income:gifts+ $-1 income:salary+ $1 liabilities:debts+--------------------+ 0 ++ 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):++$ hledger -f examples/sample.journal bal -E+ 0 assets:bank:checking+ $1 assets:bank:saving+ $-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $-1 income:gifts+ $-1 income:salary+ $1 liabilities:debts+--------------------+ 0 ++ The total of the amounts displayed is shown as the last line, unless+'-N'/'--no-total' is used.+++File: hledger.info, Node: Balance report line format, Next: Filtered balance report, Prev: Simple balance report, Up: balance++29.1.3 Balance report line format+---------------------------------++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:++$ hledger -f examples/sample.journal balance --format "%20(account) %12(total)"+ assets $-1+ bank:saving $1+ cash $-2+ expenses $2+ food $1+ supplies $1+ income $-2+ gifts $-1+ salary $-1+ liabilities:debts $1+---------------------------------+ 0++ The FMT format string specifies the formatting applied to each+account/balance pair. It may contain any suitable text, with data+fields interpolated like so:++ %[MIN][.MAX](FIELDNAME)++ * MIN pads with spaces to at least this width (optional)++ * MAX truncates at this width (optional)++ * FIELDNAME must be enclosed in parentheses, and can be one of:++ * 'depth_spacer' - a number of spaces equal to the account's+ depth, or if MIN is specified, MIN * depth spaces.+ * 'account' - the account's name+ * 'total' - the account's balance/posted total, right justified++ Also, FMT can begin with an optional prefix to control how+multi-commodity amounts are rendered:++ * '%_' - render on multiple lines, bottom-aligned (the default)+ * '%^' - render on multiple lines, top-aligned+ * '%,' - render on one line, comma-separated++ There are some quirks. Eg in one-line mode, '%(depth_spacer)' has no+effect, instead '%(account)' has indentation built in. Experimentation+may be needed to get pleasing results.++ Some example formats:++ * '%(total)' - the account's total+ * '%-20.20(account)' - the account's name, left justified, padded to+ 20 characters and clipped at 20 characters+ * '%,%-50(account) %25(total)' - account name padded to 50+ characters, total padded to 20 characters, with multiple+ commodities rendered on one line+ * '%20(total) %2(depth_spacer)%-(account)' - the default format for+ the single-column balance report+++File: hledger.info, Node: Filtered balance report, Next: List or tree mode, Prev: Balance report line format, Up: balance++29.1.4 Filtered balance report+------------------------------++You can show fewer accounts, a different time period, totals from+cleared transactions only, etc. by using query arguments or options to+limit the postings being matched. Eg:++$ hledger -f examples/sample.journal bal --cleared assets date:200806+ $-2 assets:cash+--------------------+ $-2 +++File: hledger.info, Node: List or tree mode, Next: Depth limiting, Prev: Filtered balance report, Up: balance++29.1.5 List or tree mode+------------------------++By default, or with '-l/--flat', accounts are shown as a flat list 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:++$ hledger -f examples/sample.journal balance+ $-1 assets+ $1 bank:saving+ $-2 cash+ $2 expenses+ $1 food+ $1 supplies+ $-2 income+ $-1 gifts+ $-1 salary+ $1 liabilities:debts+--------------------+ 0++ Notes:++ * "Boring" accounts are combined with their subaccount for more+ compact output, unless '--no-elide' is used. Boring accounts have+ no balance of their own and just one subaccount (eg 'assets:bank'+ and 'liabilities' above).++ * All balances shown are "inclusive", ie including the balances from+ all subaccounts. Note this means some repetition in the output,+ which requires explanation when sharing reports with+ non-plaintextaccounting-users. A tree mode report's final total is+ the sum of the top-level balances shown, not of all the balances+ shown.++ * Each group of sibling accounts (ie, under a common parent) is+ sorted separately.+++File: hledger.info, Node: Depth limiting, Next: Dropping top-level accounts, Prev: List or tree mode, Up: balance++29.1.6 Depth limiting+---------------------++With a 'depth:NUM' query, or '--depth NUM' option, or just '-NUM' (eg:+'-3') balance reports will show accounts only to the specified depth,+hiding the deeper subaccounts. This can be useful for getting an+overview without too much detail.++ Account balances at the depth limit always include the balances from+any deeper subaccounts (even in list mode). Eg, limiting to depth 1:++$ hledger -f examples/sample.journal balance -1+ $-1 assets+ $2 expenses+ $-2 income+ $1 liabilities+--------------------+ 0 +++File: hledger.info, Node: Dropping top-level accounts, Next: Showing declared accounts, Prev: Depth limiting, Up: balance++29.1.7 Dropping top-level accounts+----------------------------------++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:++$ hledger -f examples/sample.journal bal expenses --drop 1+ $1 food+ $1 supplies+--------------------+ $2 +++File: hledger.info, Node: Showing declared accounts, Next: Sorting by amount, Prev: Dropping top-level accounts, Up: balance++29.1.8 Showing declared accounts+--------------------------------++With '--declared', accounts which have been declared with an account+directive will be included in the balance report, even if they have no+transactions. (Since they will have a zero balance, you will also need+'-E/--empty' to see them.)++ More precisely, _leaf_ declared accounts (with no subaccounts) will+be included, since those are usually the more useful in reports.++ The idea of this is to be able to see a useful "complete" balance+report, even when you don't have transactions in all of your declared+accounts yet.+++File: hledger.info, Node: Sorting by amount, Next: Percentages, Prev: Showing declared accounts, Up: balance++29.1.9 Sorting by amount+------------------------++With '-S/--sort-amount', accounts with the largest (most positive)+balances are shown first. Eg: 'hledger bal expenses -MAS' shows your+biggest averaged monthly expenses first. When more than one commodity+is present, they will be sorted by the alphabetically earliest commodity+first, and then by subsequent commodities (if an amount is missing a+commodity, it is treated as 0).++ Revenues and liability balances are typically negative, however, so+'-S' shows these in reverse order. To work around this, you can add+'--invert' to flip the signs. Or you could use one of the higher-level+balance reports ('bs', 'is'..), which flip the sign automatically (eg:+'hledger is -MAS').+++File: hledger.info, Node: Percentages, Next: Multi-period balance report, Prev: Sorting by amount, Up: balance++29.1.10 Percentages+-------------------++With '-%/--percent', balance reports show each account's value expressed+as a percentage of the (column) total.++ 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:++$ hledger bal -% amt:`>0`+$ hledger bal -% amt:`<0`++ 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:++$ hledger bal -% cur:\\$+$ hledger bal -% cur:€+++File: hledger.info, Node: Multi-period balance report, Next: Balance change end balance, Prev: Percentages, Up: balance++29.1.11 Multi-period balance report+-----------------------------------++With a report interval (set by the '-D/--daily', '-W/--weekly',+'-M/--monthly', '-Q/--quarterly', '-Y/--yearly', or '-p/--period' flag),+'balance' shows a tabular report, with columns representing successive+time periods (and a title):++$ hledger -f examples/sample.journal bal --quarterly income expenses -E+Balance changes in 2008:++ || 2008q1 2008q2 2008q3 2008q4 +===================++=================================+ expenses:food || 0 $1 0 0 + expenses:supplies || 0 $1 0 0 + income:gifts || 0 $-1 0 0 + income:salary || $-1 0 0 0 +-------------------++---------------------------------+ || $-1 $1 0 0 ++ Notes:++ * The report's start/end dates will be expanded, if necessary, to+ fully encompass the displayed subperiods (so that the first and+ last subperiods have the same duration as the others).+ * Leading and trailing periods (columns) containing all zeroes are+ not shown, unless '-E/--empty' is used.+ * Accounts (rows) containing all zeroes are not shown, unless+ '-E/--empty' is used.+ * Amounts with many commodities are shown in abbreviated form, unless+ '--no-elide' is used.+ * Average and/or total columns can be added with the '-A/--average'+ and '-T/--row-total' flags.+ * The '--transpose' flag can be used to exchange rows and columns.+ * The '--pivot FIELD' option causes a different transaction field to+ be used as "account name". See PIVOTING.+ * The '--summary-only' flag ('--summary' also works) hides all but+ the Total and Average columns (those should be enabled with+ '--row-total' and '-A/--average').++ Multi-period reports with many periods can be too wide for easy+viewing in the terminal. Here are some ways to handle that:++ * Hide the totals row with '-N/--no-total'+ * Filter to a single currency with 'cur:'+ * Convert to a single currency with '-V [--infer-market-price]'+ * Use a more compact layout like '--layout=bare'+ * Maximize the terminal window+ * Reduce the terminal's font size+ * View with a pager like less, eg: 'hledger bal -D --color=yes | less+ -RS'+ * Output as CSV and use a CSV viewer like visidata ('hledger bal -D+ -O csv | vd -f csv'), Emacs' csv-mode ('M-x csv-mode, C-c C-a'), or+ a spreadsheet ('hledger bal -D -o a.csv && open a.csv')+ * Output as HTML and view with a browser: 'hledger bal -D -o a.html+ && open a.html'+++File: hledger.info, Node: Balance change end balance, Next: Balance report modes, Prev: Multi-period balance report, Up: balance++29.1.12 Balance change, end balance+-----------------------------------++It's important to be clear on the meaning of the numbers shown in+balance reports. Here is some terminology we use:++ A *_balance change_* is the net amount added to, or removed from, an+account during some period.++ An *_end balance_* is the amount accumulated in an account as of some+date (and some time, but hledger doesn't store that; assume end of day+in your timezone). It is the sum of previous balance changes.++ We call it a *_historical end balance_* if it includes all balance+changes since the account was created. For a real world account, this+means it will match the "historical record", eg the balances reported in+your bank statements or bank web UI. (If they are correct!)++ In general, balance changes are what you want to see when reviewing+revenues and expenses, and historical end balances are what you want to+see when reviewing or reconciling asset, liability and equity accounts.++ 'balance' shows balance changes by default. To see accurate+historical end balances:++ 1. Initialise account starting balances with an "opening balances"+ transaction (a transfer from equity to the account), unless the+ journal covers the account's full lifetime.++ 2. Include all of of the account's prior postings in the report, by+ not specifying a report start date, or by using the+ '-H/--historical' flag. ('-H' causes report start date to be+ ignored when summing postings.)+++File: hledger.info, Node: Balance report modes, Next: Budget report, Prev: Balance change end balance, Up: balance++29.1.13 Balance report modes+----------------------------++The balance command is quite flexible; here is the full detail on how to+control what it reports. If the following seems complicated, don't+worry - this is for advanced reporting, and it does take time and+experimentation to get familiar with all the report modes.++ There are three important option groups:++ hledger balance [CALCULATIONMODE] [ACCUMULATIONMODE] [VALUATIONMODE] ...++* Menu:++* Calculation mode::+* Accumulation mode::+* Valuation mode::+* Combining balance report modes::+++File: hledger.info, Node: Calculation mode, Next: Accumulation mode, Up: Balance report modes++29.1.13.1 Calculation mode+..........................++The basic calculation to perform for each table cell. It is one of:++ * '--sum' : sum the posting amounts (*default*)+ * '--budget' : sum the amounts, but also show the budget goal amount+ (for each account/period)+ * '--valuechange' : show the change in period-end historical balance+ values (caused by deposits, withdrawals, and/or market price+ fluctuations)+ * '--gain' : show the unrealised capital gain/loss, (the current+ valued balance minus each amount's original cost)+ * '--count' : show the count of postings+++File: hledger.info, Node: Accumulation mode, Next: Valuation mode, Prev: Calculation mode, Up: Balance report modes++29.1.13.2 Accumulation mode+...........................++How amounts should accumulate across a report's subperiods/columns.+Another way to say it: which time period's postings should contribute to+each cell's calculation. It is one of:++ * '--change' : calculate with postings from column start to column+ end, ie "just this column". Typically used to see+ revenues/expenses. (*default for balance, cashflow,+ incomestatement*)++ * '--cumulative' : calculate with postings from report start to+ column end, ie "previous columns plus this column". Typically used+ to show changes accumulated since the report's start date. Not+ often used.++ * '--historical/-H' : calculate with postings from journal start to+ column end, ie "all postings from before report start date until+ this column's end". Typically used to see historical end balances+ of assets/liabilities/equity. (*default for balancesheet,+ balancesheetequity*)+++File: hledger.info, Node: Valuation mode, Next: Combining balance report modes, Prev: Accumulation mode, Up: Balance report modes++29.1.13.3 Valuation mode+........................++Which kind of value or cost conversion should be applied, if any, before+displaying the report. See Cost reporting and Value reporting for more+about conversions.++ A valuation (or cost) mode can be selected with the -value option:++ * no conversion : don't convert to cost or value (*default*)+ * '--value=cost[,COMM]' : convert amounts to cost (then optionally to+ some other commodity)+ * '--value=then[,COMM]' : convert amounts to market value on+ transaction dates+ * '--value=end[,COMM]' : convert amounts to market value on period+ end date(s)+ (*default with '--valuechange', '--gain'*)+ * '--value=now[,COMM]' : convert amounts to market value on today's+ date+ * '--value=YYYY-MM-DD[,COMM]' : convert amounts to market value on+ another date++ or with the legacy -B/-V/-X options, which are equivalent and easier+to type:++ * '-B'/'--cost' : like -value=cost+ * '-V'/'--market' : like -value=end+ * '-X COMM'/'--exchange COMM' : like -value=end,COMM++ Note that -value can also convert to cost, as a convenience; but+actually -cost and -value are independent options, and could be used+together.+++File: hledger.info, Node: Combining balance report modes, Prev: Valuation mode, Up: Balance report modes++29.1.13.4 Combining balance report modes+........................................++Most combinations of these modes should produce reasonable reports, but+if you find any that seem wrong or misleading, let us know. The+following restrictions are applied:++ * '--valuechange' implies '--value=end'+ * '--valuechange' makes '--change' the default when used with the+ 'balancesheet'/'balancesheetequity' commands+ * '--cumulative' or '--historical' disables '--row-total/-T'++ For reference, here is what the combinations of accumulation and+valuation show:++Valuation:>no valuation '--value= then' '--value= end' '--value=+Accumulation:v YYYY-MM-DD+ /now'+-----------------------------------------------------------------------------+'--change'change in sum of period-end DATE-value+ period posting-date value of of change in+ market values change in period+ in period period+'--cumulative'change from sum of period-end DATE-value+ report start to posting-date value of of change+ period end market values change from from report+ from report report start start to+ start to period to period end period end+ end+'--historicalchange from sum of period-end DATE-value+/-H' journal start posting-date value of of change+ to period end market values change from from journal+ (historical end from journal journal start start to+ balance) start to period to period end period end+ end+++File: hledger.info, Node: Budget report, Next: Balance report layout, Prev: Balance report modes, Up: balance++29.1.14 Budget report+---------------------++The '--budget' report is like a regular balance report, but with two+main differences:++ * Budget goals and performance percentages are also shown, in+ brackets+ * Accounts which don't have budget goals are hidden by default.++ This is useful for comparing planned and actual income, expenses,+time usage, etc.++ Periodic transaction rules are used to define budget goals. For+example, here's a periodic rule defining monthly goals for bus travel+and food expenses:++;; Budget+~ monthly+ (expenses:bus) $30+ (expenses:food) $400++ After recording some actual expenses,++;; Two months worth of expenses+2017-11-01+ income $-1950+ expenses:bus $35+ expenses:food:groceries $310+ expenses:food:dining $42+ expenses:movies $38+ assets:bank:checking++2017-12-01+ income $-2100+ expenses:bus $53+ expenses:food:groceries $380+ expenses:food:dining $32+ expenses:gifts $100+ assets:bank:checking++ we can see a budget report like this:++$ hledger bal -M --budget+Budget performance in 2017-11-01..2017-12-31:++ || Nov Dec +===============++============================================+ <unbudgeted> || $-425 $-565 + expenses || $425 [ 99% of $430] $565 [131% of $430] + expenses:bus || $35 [117% of $30] $53 [177% of $30] + expenses:food || $352 [ 88% of $400] $412 [103% of $400] +---------------++--------------------------------------------+ || 0 [ 0% of $430] 0 [ 0% of $430] ++ This is "goal-based budgeting"; you define goals for accounts and+periods, often recurring, and hledger shows performance relative to the+goals. This contrasts with "envelope budgeting", which is more detailed+and strict - useful when cash is tight, but also quite a bit more work.+https://plaintextaccounting.org/Budgeting has more on this topic.++* Menu:++* Using the budget report::+* Budget date surprises::+* Selecting budget goals::+* Budgeting vs forecasting::+++File: hledger.info, Node: Using the budget report, Next: Budget date surprises, Up: Budget report++29.1.14.1 Using the budget report+.................................++Historically this report has been confusing and fragile. hledger's+version should be relatively robust and intuitive, but you may still+find surprises. Here are more notes to help with learning and+troubleshooting.++ * In the above example, 'expenses:bus' and 'expenses:food' are shown+ because they have budget goals during the report period.++ * Their parent 'expenses' is also shown, with budget goals aggregated+ from the children.++ * The subaccounts 'expenses:food:groceries' and+ 'expenses:food:dining' are not shown since they have no budget goal+ of their own, but they contribute to 'expenses:food''s actual+ amount.++ * Unbudgeted accounts 'expenses:movies' and 'expenses:gifts' are also+ not shown, but they contribute to 'expenses''s actual amount.++ * The other unbudgeted accounts 'income' and 'assets:bank:checking'+ are grouped as '<unbudgeted>'.++ * '--depth' or 'depth:' can be used to limit report depth in the+ usual way (but will not reveal unbudgeted subaccounts).++ * Amounts are always inclusive of subaccounts (even in '-l/--list'+ mode).++ * Numbers displayed in a -budget report will not always agree with+ the totals, because of hidden unbudgeted accounts; this is normal.+ '-E/--empty' can be used to reveal the hidden accounts.++ * In the periodic rules used for setting budget goals, unbalanced+ postings are convenient.++ * You can filter budget reports with the usual queries, eg to focus+ on particular accounts. It's common to restrict them to just+ expenses. (The '<unbudgeted>' account is occasionally hard to+ exclude; this is because of date surprises, discussed below.)++ * When you have multiple currencies, you may want to convert them to+ one ('-X COMM --infer-market-prices') and/or show just one at a+ time ('cur:COMM'). If you do need to show multiple currencies at+ once, '--layout bare' can be helpful.++ * You can "roll over" amounts (actual and budgeted) to the next+ period with '--cumulative'.++ See also: https://hledger.org/budgeting.html.+++File: hledger.info, Node: Budget date surprises, Next: Selecting budget goals, Prev: Using the budget report, Up: Budget report++29.1.14.2 Budget date surprises+...............................++With small data, or when starting out, some of the generated budget goal+transaction dates might fall outside the report periods. Eg with the+following journal and report, the first period appears to have no+'expenses:food' budget. (Also the '<unbudgeted>' account should be+excluded by the 'expenses' query, but isn't.):++~ monthly in 2020+ (expenses:food) $500++2020-01-15+ expenses:food $400+ assets:checking++$ hledger bal --budget expenses+Budget performance in 2020-01-15:++ || 2020-01-15 +===============++====================+ <unbudgeted> || $400 + expenses:food || 0 [ 0% of $500] +---------------++--------------------+ || $400 [80% of $500] ++ In this case, the budget goal transactions are generated on first+days of of month (this can be seen with 'hledger print --forecast+tag:generated expenses'). Whereas the report period defaults to just+the 15th day of january (this can be seen from the report table's column+headings).++ To fix this kind of thing, be more explicit about the report period+(and/or the periodic rules' dates). In this case, adding '-b 2020' does+the trick.+++File: hledger.info, Node: Selecting budget goals, Next: Budgeting vs forecasting, Prev: Budget date surprises, Up: Budget report++29.1.14.3 Selecting budget goals+................................++By default, the budget report uses all available periodic transaction+rules to generate goals. This includes rules with a different report+interval from your report. Eg if you have daily, weekly and monthly+periodic rules, all of these will contribute to the goals in a monthly+budget report.++ You can select a subset of periodic rules by providing an argument to+the '--budget' flag. '--budget=DESCPAT' will match all periodic rules+whose description contains DESCPAT, a case-insensitive substring (not a+regular expression or query). This means you can give your periodic+rules descriptions (remember that two spaces are needed between period+expression and description), and then select from multiple budgets+defined in your journal.+++File: hledger.info, Node: Budgeting vs forecasting, Prev: Selecting budget goals, Up: Budget report++29.1.14.4 Budgeting vs forecasting+..................................++'--forecast' and '--budget' both use the periodic transaction rules in+the journal to generate temporary transactions for reporting purposes.+However they are separate features - though you can use both at the same+time if you want. Here are some differences between them:++-forecast -budget+--------------------------------------------------------------------------+is a general option; it enables is a balance command option;+forecasting with all reports it selects the balance+ report's budget mode+generates visible transactions which generates invisible+appear in reports transactions which produce+ goal amounts+generates forecast transactions from generates budget goal+after the last regular transaction, to transactions throughout the+the end of the report period; or with report period, optionally+an argument '--forecast=PERIODEXPR' restricted by periods+generates them throughout the specified in the periodic+specified period, both optionally transaction rules+restricted by periods specified in the+periodic transaction rules+uses all periodic rules uses all periodic rules; or+ with an argument+ '--budget=DESCPAT' uses just+ the rules matched by DESCPAT+++File: hledger.info, Node: Balance report layout, Next: Balance report output, Prev: Budget report, Up: balance++29.1.15 Balance report layout+-----------------------------++The '--layout' option affects how 'balance' and the other balance-like+commands show multi-commodity amounts and commodity symbols. It can+improve readability, for humans and/or machines (other software). It+has four possible values:++ * '--layout=wide[,WIDTH]': commodities are shown on a single line,+ optionally elided to WIDTH+ * '--layout=tall': each commodity is shown on a separate line+ * '--layout=bare': commodity symbols are in their own column, amounts+ are bare numbers+ * '--layout=tidy': data is normalised to easily-consumed "tidy" form,+ with one row per data value. (This one is currently supported only+ by the 'balance' command.)++ Here are the '--layout' modes supported by each output format Only+CSV output supports all of them:++- txt csv html json sql+---------------------------------------+wide Y Y Y+tall Y Y Y+bare Y Y Y+tidy Y++ Examples:++* Menu:++* Wide layout::+* Tall layout::+* Bare layout::+* Tidy layout::+++File: hledger.info, Node: Wide layout, Next: Tall layout, Up: Balance report layout++29.1.15.1 Wide layout+.....................++With many commodities, reports can be very wide:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide+Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total +==================++====================================================================================================================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT +------------------++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT ++ A width limit reduces the width, but some commodities will be hidden:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide,32+Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total +==================++===========================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. +------------------++---------------------------------------------------------------------------------------------------------------------------+ || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more.. +++File: hledger.info, Node: Tall layout, Next: Bare layout, Prev: Wide layout, Up: Balance report layout++29.1.15.2 Tall layout+.....................++Each commodity gets a new line (may be different in each column), and+account names are repeated:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=tall+Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total +==================++==================================================+ Assets:US:ETrade || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD + Assets:US:ETrade || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + Assets:US:ETrade || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD + Assets:US:ETrade || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + Assets:US:ETrade || 18.00 VHT 294.00 VHT +------------------++--------------------------------------------------+ || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD + || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT + || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD + || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA + || 18.00 VHT 294.00 VHT +++File: hledger.info, Node: Bare layout, Next: Tidy layout, Prev: Tall layout, Up: Balance report layout++29.1.15.3 Bare layout+.....................++Commodity symbols are kept in one column, each commodity has its own+row, amounts are bare numbers, account names are repeated:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=bare+Balance changes in 2012-01-01..2014-12-31:++ || Commodity 2012 2013 2014 Total +==================++=============================================+ Assets:US:ETrade || GLD 0 70.00 0 70.00 + Assets:US:ETrade || ITOT 10.00 18.00 -11.00 17.00 + Assets:US:ETrade || USD 337.18 -98.12 4881.44 5120.50 + Assets:US:ETrade || VEA 12.00 10.00 14.00 36.00 + Assets:US:ETrade || VHT 106.00 18.00 170.00 294.00 +------------------++---------------------------------------------+ || GLD 0 70.00 0 70.00 + || ITOT 10.00 18.00 -11.00 17.00 + || USD 337.18 -98.12 4881.44 5120.50 + || VEA 12.00 10.00 14.00 36.00 + || VHT 106.00 18.00 170.00 294.00 ++ Bare layout also affects CSV output, which is useful for producing+data that is easier to consume, eg for making charts:++$ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare+"account","commodity","balance"+"Assets:US:ETrade","GLD","70.00"+"Assets:US:ETrade","ITOT","17.00"+"Assets:US:ETrade","USD","5120.50"+"Assets:US:ETrade","VEA","36.00"+"Assets:US:ETrade","VHT","294.00"+"Total:","GLD","70.00"+"Total:","ITOT","17.00"+"Total:","USD","5120.50"+"Total:","VEA","36.00"+"Total:","VHT","294.00"++ Bare layout will sometimes display an extra row for the no-symbol+commodity, because of zero amounts (hledger treats zeroes as+commodity-less, usually). This can break 'hledger-bar' confusingly+(workaround: add a 'cur:' query to exclude the no-symbol row).+++File: hledger.info, Node: Tidy layout, Prev: Bare layout, Up: Balance report layout++29.1.15.4 Tidy layout+.....................++This produces normalised "tidy data" (see+https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html)+where every variable has its own column and each row represents a single+data point. This is the easiest kind of data for other software to+consume:++$ 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"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","ITOT","10.00"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","USD","337.18"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","VEA","12.00"+"Assets:US:ETrade","2012","2012-01-01","2012-12-31","VHT","106.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","GLD","70.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","ITOT","18.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","USD","-98.12"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","VEA","10.00"+"Assets:US:ETrade","2013","2013-01-01","2013-12-31","VHT","18.00"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","GLD","0"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","ITOT","-11.00"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","USD","4881.44"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","VEA","14.00"+"Assets:US:ETrade","2014","2014-01-01","2014-12-31","VHT","170.00"+++File: hledger.info, Node: Balance report output, Next: Some useful balance reports, Prev: Balance report layout, Up: balance++29.1.16 Balance report output+-----------------------------++As noted in Output format, if you choose HTML output (by using '-O html'+or '-o somefile.html'), you can create a 'hledger.css' file in the same+directory to customise the report's appearance.++ The HTML and FODS output formats can generate hyperlinks to a+'hledger-web' register view for each account and period. E.g. if your+'hledger-web' server is reachable at 'http://localhost:5000' then you+might run the 'balance' command with the extra option+'--base-url=http://localhost:5000'. You can also produce relative+links, like '--base-url="some/path"' or '--base-url=""'.)+++File: hledger.info, Node: Some useful balance reports, Prev: Balance report output, Up: balance++29.1.17 Some useful balance reports+-----------------------------------++Some frequently used 'balance' options/reports are:++ * 'bal -M revenues expenses'+ Show revenues/expenses in each month. Also available as the+ 'incomestatement' command.++ * 'bal -M -H assets liabilities'+ Show historical asset/liability balances at each month end. Also+ available as the 'balancesheet' command.++ * 'bal -M -H assets liabilities equity'+ Show historical asset/liability/equity balances at each month end.+ Also available as the 'balancesheetequity' command.++ * 'bal -M assets not:receivable'+ Show changes to liquid assets in each month. Also available as the+ 'cashflow' command.++ Also:++ * 'bal -M expenses -2 -SA'+ Show monthly expenses summarised to depth 2 and sorted by average+ amount.++ * 'bal -M --budget expenses'+ Show monthly expenses and budget goals.++ * 'bal -M --valuechange investments'+ Show monthly change in market value of investment assets.++ * 'bal investments --valuechange -D date:lastweek amt:'>1000' -STA+ [--invert]'+ Show top gainers [or losers] last week+++File: hledger.info, Node: roi, Prev: balance, Up: Advanced report commands++29.2 roi+========++Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on+your investments.++Flags:+ --cashflow show all amounts that were used to compute+ returns+ --investment=QUERY query to select your investment transactions+ --profit-loss=QUERY --pnl query to select profit-and-loss or+ appreciation/valuation transactions++ At a minimum, you need to supply a query (which could be just an+account name) to select your investment(s) with '--inv', and another+query to identify your profit and loss transactions with '--pnl'.++ If you do not record changes in the value of your investment+manually, or do not require computation of time-weighted return (TWR),+'--pnl' could be an empty query ('--pnl ""' or '--pnl STR' where 'STR'+does not match any of your accounts).++ This command will compute and display the internalized rate of return+(IRR, also known as money-weighted rate of return) and time-weighted+rate of return (TWR) for your investments for the time period requested.+IRR is always annualized due to the way it is computed, but TWR is+reported both as a rate over the chosen reporting period and as an+annual rate.++ Price directives will be taken into account if you supply appropriate+'--cost' or '--value' flags (see VALUATION).++ Note, in some cases this report can fail, for these reasons:++ * Error (NotBracketed): No solution for Internal Rate of Return+ (IRR). Possible causes: IRR is huge (>1000000%), balance of+ investment becomes negative at some point in time.+ * Error (SearchFailed): Failed to find solution for Internal Rate of+ Return (IRR). Either search does not converge to a solution, or+ converges too slowly.++ Examples:++ * Using roi to compute total return of investment in stocks:+ https://github.com/simonmichael/hledger/blob/master/examples/investing/roi-unrealised.ledger++ * Cookbook > Return on Investment: https://hledger.org/roi.html++* Menu:++* Spaces and special characters in --inv and --pnl::+* Semantics of --inv and --pnl::+* IRR and TWR explained::+++File: hledger.info, Node: Spaces and special characters in --inv and --pnl, Next: Semantics of --inv and --pnl, Up: roi++29.2.1 Spaces and special characters in '--inv' and+---------------------------------------------------++'--pnl' Note that '--inv' and '--pnl''s argument is a query, and queries+could have several space-separated terms (see QUERIES).++ To indicate that all search terms form single command-line argument,+you will need to put them in quotes (see Special characters):++$ hledger roi --inv 'term1 term2 term3 ...'++ If any query terms contain spaces themselves, you will need an extra+level of nested quoting, eg:++$ hledger roi --inv="'Assets:Test 1'" --pnl="'Equity:Unrealized Profit and Loss'"+++File: hledger.info, Node: Semantics of --inv and --pnl, Next: IRR and TWR explained, Prev: Spaces and special characters in --inv and --pnl, Up: roi++29.2.2 Semantics of '--inv' and '--pnl'+---------------------------------------++Query supplied to '--inv' has to match all transactions that are related+to your investment. Transactions not matching '--inv' will be ignored.++ In these transactions, ROI will conside postings that match '--inv'+to be "investment postings" and other postings (not matching '--inv')+will be sorted into two categories: "cash flow" and "profit and loss",+as ROI needs to know which part of the investment value is your+contributions and which is due to the return on investment.++ * "Cash flow" is depositing or withdrawing money, buying or selling+ assets, or otherwise converting between your investment commodity+ and any other commodity. Example:++ 2019-01-01 Investing in Snake Oil+ assets:cash -$100+ investment:snake oil+ + 2020-01-01 Selling my Snake Oil+ assets:cash $10+ investment:snake oil = 0++ * "Profit and loss" is change in the value of your investment:++ 2019-06-01 Snake Oil falls in value+ investment:snake oil = $57+ equity:unrealized profit or loss++ All non-investment postings are assumed to be "cash flow", unless+they match '--pnl' query. Changes in value of your investment due to+"profit and loss" postings will be considered as part of your investment+return.++ Example: if you use '--inv snake --pnl equity:unrealized', then+postings in the example below would be classifed as:++2019-01-01 Snake Oil #1+ assets:cash -$100 ; cash flow posting+ investment:snake oil ; investment posting++2019-03-01 Snake Oil #2+ equity:unrealized pnl -$100 ; profit and loss posting+ snake oil ; investment posting++2019-07-01 Snake Oil #3+ equity:unrealized pnl ; profit and loss posting+ cash -$100 ; cash flow posting+ snake oil $50 ; investment posting+++File: hledger.info, Node: IRR and TWR explained, Prev: Semantics of --inv and --pnl, Up: roi++29.2.3 IRR and TWR explained+----------------------------++"ROI" stands for "return on investment". Traditionally this was+computed as a difference between current value of investment and its+initial value, expressed in percentage of the initial value.++ However, this approach is only practical in simple cases, where+investments receives no in-flows or out-flows of money, and where rate+of growth is fixed over time. For more complex scenarios you need+different ways to compute rate of return, and this command implements+two of them: IRR and TWR.++ Internal rate of return, or "IRR" (also called "money-weighted rate+of return") takes into account effects of in-flows and out-flows, and+the time between them. Investment at a particular fixed interest rate+is going to give you more interest than the same amount invested at the+same interest rate, but made later in time. If you are withdrawing from+your investment, your future gains would be smaller (in absolute+numbers), and will be a smaller percentage of your initial investment,+so your IRR will be smaller. And if you are adding to your investment,+you will receive bigger absolute gains, which will be a bigger+percentage of your initial investment, so your IRR will be larger.++ As mentioned before, in-flows and out-flows would be any cash that+you personally put in or withdraw, and for the "roi" command, these are+the postings that match the query in the'--inv' argument and NOT match+the query in the'--pnl' argument.++ If you manually record changes in the value of your investment as+transactions that balance them against "profit and loss" (or "unrealized+gains") account or use price directives, then in order for IRR to+compute the precise effect of your in-flows and out-flows on the rate of+return, you will need to record the value of your investement on or+close to the days when in- or out-flows occur.++ In technical terms, IRR uses the same approach as computation of net+present value, and tries to find a discount rate that makes net present+value of all the cash flows of your investment to add up to zero. This+could be hard to wrap your head around, especially if you haven't done+discounted cash flow analysis before. Implementation of IRR in hledger+should produce results that match the '=XIRR' formula in Excel.++ Second way to compute rate of return that 'roi' command implements is+called "time-weighted rate of return" or "TWR". Like IRR, it will+account for the effect of your in-flows and out-flows, but unlike IRR it+will try to compute the true rate of return of the underlying asset,+compensating for the effect that deposits and withdrawas have on the+apparent rate of growth of your investment.++ TWR represents your investment as an imaginary "unit fund" where+in-flows/ out-flows lead to buying or selling "units" of your investment+and changes in its value change the value of "investment unit". Change+in "unit price" over the reporting period gives you rate of return of+your investment, and make TWR less sensitive than IRR to the effects of+cash in-flows and out-flows.++ References:++ * Explanation of rate of return+ * Explanation of IRR+ * Explanation of TWR+ * IRR vs TWR+ * Examples of computing IRR and TWR and discussion of the limitations+ of both metrics+++File: hledger.info, Node: Chart commands, Next: Data generation commands, Prev: Advanced report commands, Up: Top++30 Chart commands+*****************++* Menu:++* activity::+++File: hledger.info, Node: activity, Up: Chart commands++30.1 activity+=============++Show an ascii barchart of posting counts per interval.++Flags:+no command-specific flags++ The activity command displays an ascii histogram showing transaction+counts by day, week, month or other reporting interval (by day is the+default). With query arguments, it counts only matched transactions.++ Examples:++$ hledger activity --quarterly+2008-01-01 **+2008-04-01 *******+2008-07-01 +2008-10-01 **+++File: hledger.info, Node: Data generation commands, Next: Maintenance commands, Prev: Chart commands, Up: Top++31 Data generation commands+***************************++* Menu:++* close::+* rewrite::+++File: hledger.info, Node: close, Next: rewrite, Up: Data generation commands++31.1 close+==========++(equity)++ 'close' prints several kinds of "closing" and/or "opening"+transactions, useful in various situations: migrating balances to a new+journal file, retaining earnings into equity, consolidating balances,+viewing lot costs.. Like 'print', it prints valid journal entries. You+can copy these into your journal file(s) when you are happy with how+they look.++Flags:+ --clopen[=TAGVAL] show closing and opening balances transactions,+ for AL accounts by default+ --close[=TAGVAL] show just a closing balances transaction+ --open[=TAGVAL] show just an opening balances transaction+ --assert[=TAGVAL] show a balance assertions transaction+ --assign[=TAGVAL] show a balance assignments transaction+ --retain[=TAGVAL] show a retain earnings transaction, for RX+ accounts by default+ -x --explicit show all amounts explicitly+ --show-costs show amounts with different costs separately+ --interleaved show source and destination postings together+ --assertion-type=TYPE =, ==, =* or ==*+ --close-desc=DESC set closing transaction's description+ --close-acct=ACCT set closing transaction's destination account+ --open-desc=DESC set opening transaction's description+ --open-acct=ACCT set opening transaction's source account+ --round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none - show original decimal digits,+ as in journal (default)+ soft - just add or remove decimal zeros+ to match precision+ hard - round posting amounts to precision+ (can unbalance transactions)+ all - also round cost amounts to precision+ (can unbalance transactions)++ 'close' has six modes, selected by choosing one of the mode flags:+'--clopen', '--close' (default), '--open', '--assert', '--assign', or+'--retain'. They are all doing the same kind of operation, but with+different defaults for different situations.++ The journal entries generated by 'close' will have a 'clopen:' tag,+which is helpful when you want to exclude them from reports. If the+main journal file name contains a number, the tag's value will be that+base file name with the number incremented. Eg if the journal file is+2025.journal, the tag will be 'clopen:2026'. Or you can set the tag+value by providing an argument to the mode flag. Eg '--close=foo' or+'--clopen=2025-main'.++* Menu:++* close --clopen::+* close --close::+* close --open::+* close --assert::+* close --assign::+* close --retain::+* close customisation::+* close and balance assertions::+* close examples::+++File: hledger.info, Node: close --clopen, Next: close --close, Up: close++31.1.1 close -clopen+--------------------++This is useful if migrating balances to a new journal file at the start+of a new year. It prints a "closing balances" transaction that zeroes+out account balances (Asset and Liability accounts, by default), and an+opposite "opening balances" transaction that restores them again.+Typically, you would run++hledger close --clopen -e NEWYEAR >> $LEDGER_FILE++ and then move the opening transaction from the old file to the new+file (and probably also update your LEDGER_FILE environment variable).++ Why might you do this ? If your reports are fast, you may not need+it. But at some point you will probably want to partition your data by+time, for performance or data integrity or regulatory reasons. A new+file or set of files per year is common. Then, having each file/fileset+"bookended" with opening and closing balance transactions will allow you+to freely pick and choose which files to read - just the current year,+any past year, any sequence of years, or all of them - while showing+correct account balances in each case. The earliest opening balances+transaction sets correct starting balances, and any later+closing/opening pairs will harmlessly cancel each other out.++ The balances will be transferred to and from 'equity:opening/closing+balances' by default. You can override this by using '--close-acct'+and/or '--open-acct'.++ You can select a different set of accounts to close/open by providing+an account query. Eg to add Equity accounts, provide arguments like+'assets liabilities equity' or 'type:ALE'. When migrating to a new+file, you'll usually want to bring along the AL or ALE accounts, but not+the RX accounts (Revenue, Expense).++ Assertions will be added indicating and checking the new balances of+the closed/opened accounts.+++File: hledger.info, Node: close --close, Next: close --open, Prev: close --clopen, Up: close++31.1.2 close -close+-------------------++This prints just the closing balances transaction of '--clopen'. It is+the default if you don't specify a mode.++ More customisation options are described below. Among other things,+you can use 'close --close' to generate a transaction moving the+balances from any set of accounts, to a different account. (If you need+to move just a portion of the balance, see hledger-move.)+++File: hledger.info, Node: close --open, Next: close --assert, Prev: close --close, Up: close++31.1.3 close -open+------------------++This prints just the opening balances transaction of '--clopen'. (It is+similar to Ledger's equity command.)+++File: hledger.info, Node: close --assert, Next: close --assign, Prev: close --open, Up: close++31.1.4 close -assert+--------------------++This prints a transaction that asserts the account balances as they are+on the end date (and adds an 'assert:' tag). It could be useful as+documention and to guard against changes.+++File: hledger.info, Node: close --assign, Next: close --retain, Prev: close --assert, Up: close++31.1.5 close -assign+--------------------++This prints a transaction that assigns the account balances as they are+on the end date (and adds an "assign:" tag). Unlike balance assertions,+assignments will post changes to balances as needed to reach the+specified amounts.++ This is another way to set starting balances when migrating to a new+file, and it will set them correctly even in the presence of earlier+files which do not have a closing balances transaction. However, it can+hide errors, and disturb the accounting equation, so '--clopen' is+usually recommended.+++File: hledger.info, Node: close --retain, Next: close customisation, Prev: close --assign, Up: close++31.1.6 close -retain+--------------------++This is like '--close', but it closes Revenue and Expense account+balances by default. They will be transferred to 'equity:retained+earnings', or another account specified with '--close-acct'.++ Revenues and expenses correspond to changes in equity. They are+categorised separately for reporting purposes, but traditionally at the+end of each accounting period, businesses consolidate them into equity,+This is called "retaining earnings", or "closing the books".++ In personal accounting, there's not much reason to do this, and most+people don't. (One reason to do it is to help the 'balancesheetequity'+report show a zero total, demonstrating that the accounting equation+(A-L=E) is satisfied.)+++File: hledger.info, Node: close customisation, Next: close and balance assertions, Prev: close --retain, Up: close++31.1.7 close customisation+--------------------------++In all modes, the following things can be overridden:++ * the accounts to be closed/opened, with account query arguments+ * the closing/opening dates, with '-e OPENDATE'+ * the balancing account, with '--close-acct=ACCT' and/or+ '--open-acct=ACCT'+ * the transaction descriptions, with '--close-desc=DESC' and+ '--open-desc=DESC'+ * the transactions' 'clopen' tag value, with a 'TAGVAL' argument for+ the mode flag (see above).++ By default, the closing date is yesterday, or the journal's end date,+whichever is later; and the opening date is always one day after the+closing date. You can change these by specifying a report end date; the+closing date will be the last day of the report period. Eg '-e 2024'+means "close on 2023-12-31, open on 2024-01-01".++ With '--x/--explicit', the balancing amount will be shown explicitly,+and if it involves multiple commodities, a separate posting will be+generated for each of them (similar to 'print -x').++ With '--interleaved', each individual transfer is shown with source+and destination postings next to each other (perhaps useful for+troubleshooting).++ With '--show-costs', balances' costs are also shown, with different+costs kept separate. This may generate very large journal entries, if+you have many currency conversions or investment transactions. 'close+--show-costs' is currently the best way to view investment lots with+hledger. (To move or dispose of lots, see the more capable+'hledger-move' script.)+++File: hledger.info, Node: close and balance assertions, Next: close examples, Prev: close customisation, Up: close++31.1.8 close and balance assertions+-----------------------------------++'close' adds balance assertions verifying that the accounts have been+reset to zero in a closing transaction or restored to their previous+balances in an opening transaction. These provide useful error+checking, but you can ignore them temporarily with '-I', or remove them+if you prefer.++ Single-commodity, subaccount-exclusive balance assertions ('=') are+generated by default. This can be changed with '--assertion-type='==*''+(eg).++ When running 'close' you should probably avoid using '-C', '-R',+'status:' (filtering by status or realness) or '--auto' (generating+postings), since the generated balance assertions would then require+these.++ Transactions with multiple dates (eg posting dates) spanning the file+boundary also can disrupt the balance assertions:++2023-12-30 a purchase made in december, cleared in january+ expenses:food 5+ assets:bank:checking -5 ; date: 2023-01-02++ To solve this you can transfer the money to and from a temporary+account, splitting the multi-day transaction into two single-day+transactions:++; in 2022.journal:+2022-12-30 a purchase made in december, cleared in january+ expenses:food 5+ equity:pending -5++; in 2023.journal:+2023-01-02 last year's transaction cleared+ equity:pending 5 = 0+ assets:bank:checking -5+++File: hledger.info, Node: close examples, Prev: close and balance assertions, Up: close++31.1.9 close examples+---------------------++* Menu:++* Retain earnings::+* Migrate balances to a new file::+* More detailed close examples::+++File: hledger.info, Node: Retain earnings, Next: Migrate balances to a new file, Up: close examples++31.1.9.1 Retain earnings+........................++Record 2022's revenues/expenses as retained earnings on 2022-12-31,+appending the generated transaction to the journal:++$ hledger close --retain -f 2022.journal -p 2022 >> 2022.journal++ After this, to see 2022's revenues and expenses you must exclude the+retain earnings transaction:++$ hledger -f 2022.journal is not:desc:'retain earnings'+++File: hledger.info, Node: Migrate balances to a new file, Next: More detailed close examples, Prev: Retain earnings, Up: close examples++31.1.9.2 Migrate balances to a new file+.......................................++Close assets/liabilities on 2022-12-31 and re-open them on 2023-01-01:++$ hledger close --clopen -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++ After this, to see 2022's end-of-year balances you must exclude the+closing balances transaction:++$ hledger -f 2022.journal bs not:desc:'closing balances'++ For more flexibility, it helps to tag closing and opening+transactions with eg 'clopen:NEWYEAR', then you can ensure correct+balances by excluding all opening/closing transactions except the first,+like so:++$ hledger bs -Y -f 2021.j -f 2022.j -f 2023.j expr:'tag:clopen=2021 or not tag:clopen'+$ hledger bs -Y -f 2021.j -f 2022.j expr:'tag:clopen=2021 or not tag:clopen'+$ hledger bs -Y -f 2022.j -f 2023.j expr:'tag:clopen=2022 or not tag:clopen'+$ hledger bs -Y -f 2021.j expr:'tag:clopen=2021 or not tag:clopen'+$ hledger bs -Y -f 2022.j expr:'tag:clopen=2022 or not tag:clopen'+$ hledger bs -Y -f 2023.j # unclosed file, no query needed+++File: hledger.info, Node: More detailed close examples, Prev: Migrate balances to a new file, Up: close examples++31.1.9.3 More detailed close examples+.....................................++See examples/multi-year.+++File: hledger.info, Node: rewrite, Prev: close, Up: Data generation commands++31.2 rewrite+============++Print all transactions, rewriting the postings of matched transactions.+For now the only rewrite available is adding new postings, like print+-auto.++Flags:+ --add-posting='ACCT AMTEXPR' add a posting to ACCT, which may be+ parenthesised. AMTEXPR is either a literal+ amount, or *N which means the transaction's+ first matched amount multiplied by N (a+ decimal number). Two spaces separate ACCT+ and AMTEXPR.+ --diff generate diff suitable as an input for+ patch tool++ This is a start at a generic rewriter of transaction entries. It+reads the default journal and prints the transactions, like print, 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++ rewrites.hledger may consist of entries like:++= ^income amt:<0 date:2017+ (liabilities:tax) *0.33 ; tax on income+ (reserve:grocery) *0.25 ; reserve 25% for grocery+ (reserve:) *0.25 ; reserve 25% for grocery++ Note the single quotes to protect the dollar sign from bash, and the+two spaces between account and amount.++ More:++$ hledger rewrite [QUERY] --add-posting "ACCT AMTEXPR" ...+$ hledger rewrite ^income --add-posting '(liabilities:tax) *.33'+$ hledger rewrite expenses:gifts --add-posting '(budget:gifts) *-1"'+$ hledger rewrite ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'++ Argument for '--add-posting' option is a usual posting of transaction+with an exception for amount specification. More precisely, you can use+''*'' (star symbol) before the amount to indicate that that this is a+factor for an amount of original matched posting. If the amount+includes a commodity name, the new posting amount will be in the new+commodity; otherwise, it will be in the matched posting amount's+commodity.++* Menu:++* Re-write rules in a file::+* Diff output format::+* rewrite vs print --auto::+++File: hledger.info, Node: Re-write rules in a file, Next: Diff output format, Up: rewrite++31.2.1 Re-write rules in a file+-------------------------------++During the run this tool will execute so called "Automated Transactions"+found in any journal it process. I.e instead of specifying this+operations in command line you can put them in a journal file.++$ rewrite-rules.journal++ Make contents look like this:++= ^income+ (liabilities:tax) *.33++= expenses:gifts+ budget:gifts *-1+ assets:budget *1++ Note that ''='' (equality symbol) that is used instead of date in+transactions you usually write. It indicates the query by which you+want to match the posting to add new ones.++$ hledger rewrite -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal++ This is something similar to the commands pipeline:++$ hledger rewrite -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \+ | hledger rewrite -f - expenses:gifts --add-posting 'budget:gifts *-1' \+ --add-posting 'assets:budget *1' \+ > rewritten-tidy-output.journal++ It is important to understand that relative order of such entries in+journal is important. You can re-use result of previously added+postings.+++File: hledger.info, Node: Diff output format, Next: rewrite vs print --auto, Prev: Re-write rules in a file, Up: rewrite++31.2.2 Diff output format+-------------------------++To use this tool for batch modification of your journal files you may+find useful output in form of unified diff.++$ hledger rewrite --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33'++ Output might look like:++--- /tmp/examples/sample.journal++++ /tmp/examples/sample.journal+@@ -18,3 +18,4 @@+ 2008/01/01 income+- assets:bank:checking $1++ assets:bank:checking $1+ income:salary++ (liabilities:tax) 0+@@ -22,3 +23,4 @@+ 2008/06/01 gift+- assets:bank:checking $1++ assets:bank:checking $1+ income:gifts++ (liabilities:tax) 0++ If you'll pass this through 'patch' tool you'll get transactions+containing the posting that matches your query be updated. Note that+multiple files might be update according to list of input files+specified via '--file' options and 'include' directives inside of these+files.++ Be careful. Whole transaction being re-formatted in a style of+output from 'hledger print'.++ See also:++ https://github.com/simonmichael/hledger/issues/99+++File: hledger.info, Node: rewrite vs print --auto, Prev: Diff output format, Up: rewrite++31.2.3 rewrite vs. print -auto+------------------------------++This command predates print -auto, and currently does much the same+thing, but with these differences:++ * with multiple files, rewrite lets rules in any file affect all+ other files. print -auto uses standard directive scoping; rules+ affect only child files.++ * rewrite's query limits which transactions can be rewritten; all are+ printed. print -auto's query limits which transactions are+ printed.++ * rewrite applies rules specified on command line or in the journal.+ print -auto applies rules specified in the journal.+++File: hledger.info, Node: Maintenance commands, Next: PART 5 COMMON TASKS, Prev: Data generation commands, Up: Top++32 Maintenance commands+***********************++* Menu:++* check::+* diff::+* setup::+* test::+++File: hledger.info, Node: check, Next: diff, Up: Maintenance commands++32.1 check+==========++Check for various kinds of errors in your data.++Flags:+no command-specific flags++ hledger provides a number of built-in correctness checks to help+validate your data and prevent errors. Some are run automatically, some+when you enable '--strict' mode; or you can run any of them on demand by+providing them as arguments to the 'check' command. 'check' produces no+output and a zero exit code if all is well. Eg:++hledger check # run basic checks+hledger check -s # run basic and strict checks+hledger check ordereddates payees # run basic checks and two others++ If you are an Emacs user, you can also configure flycheck-hledger to+run these checks, providing instant feedback as you edit the journal.++ Here are the checks currently available. They are generally checked+in the order they are shown here, and only the first failure will be+reported.++* Menu:++* Basic checks::+* Strict checks::+* Other checks::+* Custom checks::+++File: hledger.info, Node: Basic checks, Next: Strict checks, Up: check++32.1.1 Basic checks+-------------------++These important checks are performed by default, by almost all hledger+commands:++ * *parseable* - data files are in a supported format, with no syntax+ errors and no invalid include directives. This ensures that all+ files exist and are readable.++ * *autobalanced* - all transactions are balanced, after automatically+ inferring missing amounts and conversion rates and then converting+ amounts to cost. This ensures that each transaction's journal+ entry is well formed.++ * *assertions* - all balance assertions in the journal are passing.+ Balance assertions are a strong defense against errors, catching+ many problems. This check is on by default, but if it gets in your+ way, you can disable it temporarily with+ '-I'/'--ignore-assertions', or as a default by adding that flag to+ your config file. (Then use '-s'/'--strict' or 'hledger check+ assertions' when you want to enable it).+++File: hledger.info, Node: Strict checks, Next: Other checks, Prev: Basic checks, Up: check++32.1.2 Strict checks+--------------------++When the '-s'/'--strict' flag is used (AKA strict mode), all commands+will perform the following additional checks (and 'assertions', above).+These provide extra error-catching power to help you keep your data+clean and correct:++ * *balanced* - like 'autobalanced', but implicit conversions between+ commodities are not allowed; all conversion transactions must use+ cost notation or equity postings. This prevents wrong conversions+ caused by typos.++ * *commodities* - all commodity symbols used must be declared. This+ guards against mistyping or omitting commodity symbols.++ * *accounts* - all account names used must be declared. This+ prevents the use of mis-spelled or outdated account names.+++File: hledger.info, Node: Other checks, Next: Custom checks, Prev: Strict checks, Up: check++32.1.3 Other checks+-------------------++These are not wanted by everyone, but can be run using the 'check'+command:++ * *tags* - all tags used must be declared. This prevents mis-spelled+ tag names. Note hledger fairly often finds unintended tags in+ comments.++ * *payees* - all payees used in transactions must be declared. This+ will force you to declare any new payee name before using it. Most+ people will probably find this a bit too strict.++ * *ordereddates* - within each file, transactions must be ordered by+ date. This is a simple and effective error catcher. It's not+ included in strict mode, but you can add it by running 'hledger+ check -s ordereddates'. If enabled, this check is performed before+ balance assertions.++ * *recentassertions* - all accounts with balance assertions must have+ one that's within the 7 days before their latest posting. This+ will encourage adding balance assertions for your active+ asset/liability accounts, which in turn should encourage you to+ reconcile regularly with those real world balances - another strong+ defense against errors. ('hledger close --assert >>$LEDGER_FILE'+ is a convenient way to add new balance assertions. Later these+ become quite redundant, and you might choose to remove them to+ reduce clutter.)++ * *uniqueleafnames* - no two accounts may have the same last account+ name part (eg the 'checking' in 'assets:bank:checking'). This+ ensures each account can be matched by a unique short name, easier+ to remember and to type.+++File: hledger.info, Node: Custom checks, Prev: Other checks, Up: check++32.1.4 Custom checks+--------------------++You can build your own custom checks with add-on command scripts. See+also Cookbook > Scripting. Here are some examples from hledger/bin/:++ * *hledger-check-tagfiles* - all tag values containing '/' exist as+ file paths++ * *hledger-check-fancyassertions* - more complex balance assertions+ are passing+++File: hledger.info, Node: diff, Next: setup, Prev: check, Up: Maintenance commands++32.2 diff+=========++Compares a particular account's transactions in two input files. It+shows any transactions to this account which are in one file but not in+the other.++Flags:+no command-specific flags++ More precisely: for each posting affecting this account in either+file, this command looks for a corresponding posting in the other file+which posts the same amount to the same account (ignoring date,+description, etc).++ Since it compares postings, not transactions, this also works when+multiple bank transactions have been combined into a single journal+entry.++ This command is useful eg if you have downloaded an account's+transactions from your bank (eg as CSV data): when hledger and your bank+disagree about the account balance, you can compare the bank data with+your journal to find out the cause.++ Examples:++$ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro +These transactions are in the first file only:++2014/01/01 Opening Balances+ assets:bank:giro EUR ...+ ...+ equity:opening balances EUR -...++These transactions are in the second file only:+++File: hledger.info, Node: setup, Next: test, Prev: diff, Up: Maintenance commands++32.3 setup+==========++Check the status of the hledger installation.++Flags:+no command-specific flags++ 'setup' tests your hledger installation and prints a list of results,+sometimes with helpful hints. This is a good first command to run after+installing hledger. Also after upgrading, or when something's not+working, or just when you want a reminder of where things are.++ It makes one network request to detect the latest hledger release+version. It's ok if this fails or times out. It will use ANSI color by+default, unless disabled by NO_COLOR or -color=n. It does not use a+pager or a config file.++ It expects that the hledger version you are running is installed in+your PATH. If not, it will stop until you have done that (to keep things+simple).++ Example:++$ hledger setup+Checking your hledger setup..+Legend: good, neutral, unknown, warning++hledger+* is a released version ? no hledger 1.42.99-gbca4b39c5-20250425, mac-aarch64+* is up to date ? yes 1.42.99 installed, latest is 1.42.1+* is a native binary for this machine ? yes aarch64+* is installed in PATH ? yes /Users/simon/.local/bin/hledger+* has a system text encoding configured ? yes UTF-8, data files should use this encoding+* has a user config file ? (optional) no +* current directory has a local config ? yes /Users/simon/src/hledger/hledger.conf+* the config file is readable ? yes /Users/simon/src/hledger/hledger.conf++terminal+* the NO_COLOR variable is defined ? no +* --color is configured by config file ? no +* hledger will use color by default ? yes +* the PAGER variable is defined ? yes less+* --pager is configured by config file ? no +* hledger will use a pager when needed ? yes /opt/homebrew/bin/less+* the LESS variable is defined ? yes +* the HLEDGER_LESS variable is defined ? no +* adjusting LESS variable for color etc. ? yes +* --pretty is enabled by config file ? no tables will use ASCII characters+* bash shell completions are installed ? ? +* zsh shell completions are installed ? ? ++journal+* the LEDGER_FILE variable is defined ? yes /Users/simon/finance/2025/2025.journal+* a default journal file is readable ? yes /Users/simon/finance/2025/2025.journal+* it includes additional files ? yes 15+* all commodities are declared ? yes 10+* all accounts are declared ? yes 160+* all accounts have types ? no 14 untyped+* accounts of each type were detected ? yes ALERXCV+* commodities/accounts are checked ? no use -s to check commodities/accounts+* balance assertions are checked ? yes use -I to ignore assertions+++File: hledger.info, Node: test, Prev: setup, Up: Maintenance commands++32.4 test+=========++Run built-in unit tests.++Flags:+no command-specific flags++ This command runs the unit tests built in to hledger and hledger-lib,+printing the results on stdout. If any test fails, the exit code will+be non-zero.++ This is mainly used by hledger developers, but you can also use it to+sanity-check the installed hledger executable on your platform. All+tests are expected to pass - if you ever see a failure, please report as+a bug!++ Any arguments before a '--' argument will be passed to the 'tasty'+test runner as test-selecting -p patterns, and any arguments after '--'+will be passed to tasty unchanged.++ Examples:++$ hledger test # run all unit tests+$ hledger test balance # run tests with "balance" in their name+$ hledger test -- -h # show tasty's options+++File: hledger.info, Node: PART 5 COMMON TASKS, Next: BUGS, Prev: Maintenance commands, Up: Top++33 PART 5: COMMON TASKS+***********************++Here are some quick examples of how to do some basic tasks with hledger.++* Menu:++* Getting help::+* Constructing command lines::+* Starting a journal file::+* Setting LEDGER_FILE::+* Setting opening balances::+* Recording transactions::+* Reconciling::+* Reporting::+* Migrating to a new file::+++File: hledger.info, Node: Getting help, Next: Constructing command lines, Up: PART 5 COMMON TASKS++33.1 Getting help+=================++Here's how to list commands and view options and command docs:++$ hledger # show available commands+$ hledger --help # show common options+$ hledger CMD --help # show CMD's options, common options and CMD's documentation++ You can also view your hledger version's manual in several formats by+using the help command. Eg:++$ hledger help # show the hledger manual with info, man or $PAGER (best available)+$ hledger help journal # show the journal topic in the hledger manual+$ hledger help --help # find out more about the help command++ To view manuals and introductory docs on the web, visit+https://hledger.org. Chat and mail list support and discussion archives+can be found at https://hledger.org/support.+++File: hledger.info, Node: Constructing command lines, Next: Starting a journal file, Prev: Getting help, Up: PART 5 COMMON TASKS++33.2 Constructing command lines+===============================++hledger has a flexible command line interface. We strive to keep it+simple and ergonomic, but if you run into one of the sharp edges+described in OPTIONS, here are some tips that might help:++ * command-specific options must go after the command (it's fine to+ put common options there too: 'hledger CMD OPTS ARGS')+ * you can run addon commands via hledger ('hledger ui [ARGS]') or+ directly ('hledger-ui [ARGS]')+ * enclose "problematic" arguments in single quotes+ * if needed, also add a backslash to hide regular expression+ metacharacters from the shell+ * to see how a misbehaving command line is being parsed, add+ '--debug=2'.+++File: hledger.info, Node: Starting a journal file, Next: Setting LEDGER_FILE, Prev: Constructing command lines, Up: PART 5 COMMON TASKS++33.3 Starting a journal file+============================++hledger looks for your accounting data in a journal file,+'$HOME/.hledger.journal' by default:++$ hledger stats+The hledger journal file "/Users/simon/.hledger.journal" was not found.+Please create it first, eg with "hledger add" or a text editor.+Or, specify an existing journal file with -f or LEDGER_FILE.++ You can override this by setting the 'LEDGER_FILE' environment+variable (see below). It's a good practice to keep this important file+under version control, and to start a new file each year. So you could+do something like this:++$ mkdir ~/finance+$ cd ~/finance+$ git init+Initialized empty Git repository in /Users/simon/finance/.git/+$ touch 2023.journal+$ echo "export LEDGER_FILE=$HOME/finance/2023.journal" >> ~/.profile+$ source ~/.profile+$ hledger stats+Main file : /Users/simon/finance/2023.journal+Included files : +Transactions span : to (0 days)+Last transaction : none+Transactions : 0 (0.0 per day)+Transactions last 30 days: 0 (0.0 per day)+Transactions last 7 days : 0 (0.0 per day)+Payees/descriptions : 0+Accounts : 0 (depth 0)+Commodities : 0 ()+Market prices : 0 ()+++File: hledger.info, Node: Setting LEDGER_FILE, Next: Setting opening balances, Prev: Starting a journal file, Up: PART 5 COMMON TASKS++33.4 Setting LEDGER_FILE+========================++* Menu:++* Set LEDGER_FILE on unix::+* Set LEDGER_FILE on mac::+* Set LEDGER_FILE on Windows::+++File: hledger.info, Node: Set LEDGER_FILE on unix, Next: Set LEDGER_FILE on mac, Up: Setting LEDGER_FILE++33.4.1 Set LEDGER_FILE on unix+------------------------------++It depends on your shell, but running these commands in the terminal+will work for many people; adapt if needed:++$ echo 'export LEDGER_FILE=~/finance/main.journal' >> ~/.profile+$ source ~/.profile++ When correctly configured:++ * 'env | grep LEDGER_FILE' will show your new setting+ * and so should 'hledger setup' and 'hledger files'.+++File: hledger.info, Node: Set LEDGER_FILE on mac, Next: Set LEDGER_FILE on Windows, Prev: Set LEDGER_FILE on unix, Up: Setting LEDGER_FILE++33.4.2 Set LEDGER_FILE on mac+-----------------------------++In a terminal window, follow the unix procedure above.++ Also, this optional step may be helpful for GUI applications:++ 1. Add an entry to '~/.MacOSX/environment.plist' like++ {+ "LEDGER_FILE" : "~/finance/main.journal"+ }++ 2. Run 'killall Dock' in a terminal window (or restart the machine),+ to complete the change.++ When correctly configured for GUI applications:++ * apps started from the dock or a spotlight search, such as a GUI+ Emacs, will be aware of the new LEDGER_FILE setting.+++File: hledger.info, Node: Set LEDGER_FILE on Windows, Prev: Set LEDGER_FILE on mac, Up: Setting LEDGER_FILE++33.4.3 Set LEDGER_FILE on Windows+---------------------------------++It can be easier to create a default file at+'C:\Users\USER\.hledger.journal', and have it include your other files.+See I'm on Windows, how do I keep my files in AppData++ Otherwise: using the gui is easiest:++ 1. In task bar, search for 'environment variables', and choose "Edit+ environment variables for your account".+ 2. Create or change a 'LEDGER_FILE' setting in the User variables+ pane. A typical value would be+ 'C:\Users\USER\finance\main.journal'.+ 3. Click OK to complete the change.+ 4. And open a new powershell window. (Existing windows won't see the+ change.)++ Or at the command line, you can do it this way:++ 1. In a powershell window, run+ '[Environment]::SetEnvironmentVariable("LEDGER_FILE",+ "C:\User\USER\finance\main.journal",+ [System.EnvironmentVariableTarget]::User)'+ 2. And open a new powershell window. (Existing windows won't see the+ change.)++ Warning, doing this from the Windows command line can be tricky;+other methods you may find online:++ * may not affect the current window+ * may not be persistent+ * may not work unless you are an administrator+ * may limit values to 1024 characters+ * may break dynamic references to other variables+ * may require a new-enough version of powershell+ * or may be intended for the older command window.+ * If you still have trouble, see eg Setting Windows PowerShell+ environment variables or Adding path permanently to windows using+ powershell doesn't appear to work.++ When correctly configured:++ * in a new powershell window, '$env:LEDGER_FILE' will show your new+ setting+ * and so should 'hledger setup' and (once the file exists) 'hledger+ files'.+++File: hledger.info, Node: Setting opening balances, Next: Recording transactions, Prev: Setting LEDGER_FILE, Up: PART 5 COMMON TASKS++33.5 Setting opening balances+=============================++Pick a starting date for which you can look up the balances of some+real-world assets (bank accounts, wallet..) and liabilities (credit+cards..).++ To avoid a lot of data entry, you may want to start with just one or+two accounts, like your checking account or cash wallet; and pick a+recent starting date, like today or the start of the week. You can+always come back later and add more accounts and older transactions, eg+going back to january 1st.++ Add an opening balances transaction to the journal, declaring the+balances on this date. Here are two ways to do it:++ * The first way: open the journal in any text editor and save an+ entry like this:++ 2023-01-01 * opening balances+ assets:bank:checking $1000 = $1000+ assets:bank:savings $2000 = $2000+ assets:cash $100 = $100+ liabilities:creditcard $-50 = $-50+ equity:opening/closing balances++ These are start-of-day balances, ie whatever was in the account at+ the end of the previous day.++ The * after the date is an optional status flag. Here it means+ "cleared & confirmed".++ The currency symbols are optional, but usually a good idea as+ you'll be dealing with multiple currencies sooner or later.++ The = amounts are optional balance assertions, providing extra+ error checking.++ * The second way: run 'hledger add' and follow the prompts to record+ a similar transaction:++ $ hledger add+ Adding transactions to journal file /Users/simon/finance/2023.journal+ Any command line arguments will be used as defaults.+ Use tab key to complete, readline keys to edit, enter to accept defaults.+ An optional (CODE) may follow transaction dates.+ An optional ; COMMENT may follow descriptions or amounts.+ If you make a mistake, enter < at any prompt to go one step backward.+ To end a transaction, enter . when prompted.+ To quit, enter . at a date prompt or press control-d or control-c.+ Date [2023-02-07]: 2023-01-01+ Description: * opening balances+ Account 1: assets:bank:checking+ Amount 1: $1000+ Account 2: assets:bank:savings+ Amount 2 [$-1000]: $2000+ Account 3: assets:cash+ Amount 3 [$-3000]: $100+ Account 4: liabilities:creditcard+ Amount 4 [$-3100]: $-50+ Account 5: equity:opening/closing balances+ Amount 5 [$-3050]: + Account 6 (or . or enter to finish this transaction): .+ 2023-01-01 * opening balances+ assets:bank:checking $1000+ assets:bank:savings $2000+ assets:cash $100+ liabilities:creditcard $-50+ equity:opening/closing balances $-3050+ + Save this transaction to the journal ? [y]: + Saved.+ Starting the next transaction (. or ctrl-D/ctrl-C to quit)+ Date [2023-01-01]: .++ If you're using version control, this could be a good time to commit+the journal. Eg:++$ git commit -m 'initial balances' 2023.journal+++File: hledger.info, Node: Recording transactions, Next: Reconciling, Prev: Setting opening balances, Up: PART 5 COMMON TASKS++33.6 Recording transactions+===========================++As you spend or receive money, you can record these transactions using+one of the methods above (text editor, hledger add) or by using the+hledger-iadd or hledger-web add-ons, or by using the import command to+convert CSV data downloaded from your bank.++ Here are some simple transactions, see the hledger_journal(5) manual+and hledger.org for more ideas:++2023/1/10 * gift received+ assets:cash $20+ income:gifts++2023.1.12 * farmers market+ expenses:food $13+ assets:cash++2023-01-15 paycheck+ income:salary+ assets:bank:checking $1000+++File: hledger.info, Node: Reconciling, Next: Reporting, Prev: Recording transactions, Up: PART 5 COMMON TASKS++33.7 Reconciling+================++Periodically you should reconcile - compare your hledger-reported+balances against external sources of truth, like bank statements or your+bank's website - to be sure that your ledger accurately represents the+real-world balances (and, that the real-world institutions have not made+a mistake!). This gets easy and fast with (1) practice and (2)+frequency. If you do it daily, it can take 2-10 minutes. If you let it+pile up, expect it to take longer as you hunt down errors and+discrepancies.++ A typical workflow:++ 1. Reconcile cash. Count what's in your wallet. Compare with what+ hledger reports ('hledger bal cash'). If they are different, try+ to remember the missing transaction, or look for the error in the+ already-recorded transactions. A register report can be helpful+ ('hledger reg cash'). If you can't find the error, add an+ adjustment transaction. Eg if you have $105 after the above, and+ can't explain the missing $2, it could be:++ 2023-01-16 * adjust cash+ assets:cash $-2 = $105+ expenses:misc++ 2. Reconcile checking. Log in to your bank's website. Compare+ today's (cleared) balance with hledger's cleared balance ('hledger+ bal checking -C'). If they are different, track down the error or+ record the missing transaction(s) or add an adjustment transaction,+ similar to the above. Unlike the cash case, you can usually+ compare the transaction history and running balance from your bank+ with the one reported by 'hledger reg checking -C'. This will be+ easier if you generally record transaction dates quite similar to+ your bank's clearing dates.++ 3. Repeat for other asset/liability accounts.++ Tip: instead of the register command, use hledger-ui to see a+live-updating register while you edit the journal: 'hledger-ui --watch+--register checking -C'++ After reconciling, it could be a good time to mark the reconciled+transactions' status as "cleared and confirmed", if you want to track+that, by adding the '*' marker. Eg in the paycheck transaction above,+insert '*' between '2023-01-15' and 'paycheck'++ If you're using version control, this can be another good time to+commit:++$ git commit -m 'txns' 2023.journal+++File: hledger.info, Node: Reporting, Next: Migrating to a new file, Prev: Reconciling, Up: PART 5 COMMON TASKS++33.8 Reporting+==============++Here are some basic reports.++ Show all transactions:++$ hledger print+2023-01-01 * opening balances+ assets:bank:checking $1000+ assets:bank:savings $2000+ assets:cash $100+ liabilities:creditcard $-50+ equity:opening/closing balances $-3050++2023-01-10 * gift received+ assets:cash $20+ income:gifts++2023-01-12 * farmers market+ expenses:food $13+ assets:cash++2023-01-15 * paycheck+ income:salary+ assets:bank:checking $1000++2023-01-16 * adjust cash+ assets:cash $-2 = $105+ expenses:misc++ Show account names, and their hierarchy:++$ hledger accounts --tree+assets+ bank+ checking+ savings+ cash+equity+ opening/closing balances+expenses+ food+ misc+income+ gifts+ salary+liabilities+ creditcard++ Show all account totals:++$ hledger balance+ $4105 assets+ $4000 bank+ $2000 checking+ $2000 savings+ $105 cash+ $-3050 equity:opening/closing balances+ $15 expenses+ $13 food+ $2 misc+ $-1020 income+ $-20 gifts+ $-1000 salary+ $-50 liabilities:creditcard+--------------------+ 0++ Show only asset and liability balances, as a flat list, limited to+depth 2:++$ hledger bal assets liabilities -2+ $4000 assets:bank+ $105 assets:cash+ $-50 liabilities:creditcard+--------------------+ $4055++ Show the same thing without negative numbers, formatted as a simple+balance sheet:++$ hledger bs -2+Balance Sheet 2023-01-16++ || 2023-01-16 +========================++============+ Assets || +------------------------++------------+ assets:bank || $4000 + assets:cash || $105 +------------------------++------------+ || $4105 +========================++============+ Liabilities || +------------------------++------------+ liabilities:creditcard || $50 +------------------------++------------+ || $50 +========================++============+ Net: || $4055 ++ The final total is your "net worth" on the end date. (Or use 'bse'+for a full balance sheet with equity.)++ Show income and expense totals, formatted as an income statement:++hledger is +Income Statement 2023-01-01-2023-01-16++ || 2023-01-01-2023-01-16 +===============++=======================+ Revenues || +---------------++-----------------------+ income:gifts || $20 + income:salary || $1000 +---------------++-----------------------+ || $1020 +===============++=======================+ Expenses || +---------------++-----------------------+ expenses:food || $13 + expenses:misc || $2 +---------------++-----------------------+ || $15 +===============++=======================+ Net: || $1005 ++ The final total is your net income during this period.++ Show transactions affecting your wallet, with running total:++$ hledger register cash+2023-01-01 opening balances assets:cash $100 $100+2023-01-10 gift received assets:cash $20 $120+2023-01-12 farmers market assets:cash $-13 $107+2023-01-16 adjust cash assets:cash $-2 $105++ Show weekly posting counts as a bar chart:++$ hledger activity -W+2019-12-30 *****+2023-01-06 ****+2023-01-13 ****+++File: hledger.info, Node: Migrating to a new file, Prev: Reporting, Up: PART 5 COMMON TASKS++33.9 Migrating to a new file+============================++At the end of the year, you may want to continue your journal in a new+file, so that old transactions don't slow down or clutter your reports,+and to help ensure the integrity of your accounting history. See the+close command.++ If using version control, don't forget to 'git add' the new file.+++File: hledger.info, Node: BUGS, Prev: PART 5 COMMON TASKS, Up: Top++34 BUGS+*******++We welcome bug reports in the hledger issue tracker+(https://bugs.hledger.org), or on the hledger chat or mail list+(https://hledger.org/support).++ Some known issues and limitations:++ hledger uses the system's text encoding when reading non-ascii text.+If no system encoding is configured, or if the data's encoding is+different, hledger will give an error. (See Text encoding,+Troubleshooting.)++ On Microsoft Windows, depending what kind of terminal window you use,+non-ascii characters, ANSI text formatting, and/or the add command's TAB+key, may not be fully supported. (For best results, try a powershell+window.)++ When processing large data files, hledger uses more memory than+Ledger.++* Menu:++* Troubleshooting::+++File: hledger.info, Node: Troubleshooting, Up: BUGS++34.1 Troubleshooting+====================++Here are some common issues you might encounter when you run hledger,+and how to resolve them (and remember also you can usually get quick+Support):++ *PATH issues: I get an error like "No command 'hledger' found"*+Depending how you installed hledger, the executables may not be in your+shell's PATH. Eg on unix systems, stack installs hledger in+'~/.local/bin' and cabal installs it in '~/.cabal/bin'. You may need to+add one of these directories to your shell's PATH, and/or open a new+terminal window.++ *LEDGER_FILE issues: I configured LEDGER_FILE but hledger is not+using it*++ * 'LEDGER_FILE' should be a real environment variable, not just a+ shell variable. Eg on unix, the command 'env | grep LEDGER_FILE'+ should show it. You may need to use 'export' (see+ https://stackoverflow.com/a/7411509). On Windows,+ '$env:LEDGER_FILE' should show it.+ * You may need to force your shell to see the new configuration. A+ simple way is to close your terminal window and open a new one.++ *Text decoding issues: I get errors like "Illegal byte sequence" or+"Invalid or incomplete multibyte or wide character" or+"commitAndReleaseBuffer: invalid argument (invalid character)"*+hledger usually needs its input to be decodable with the system locale's+text encoding. See Text encoding and Install: Text encoding.++ *COMPATIBILITY ISSUES: hledger gives an error with my Ledger file*+Not all of Ledger's journal file syntax or feature set is supported.+See hledger and Ledger for full details.+++Tag Table:+Node: Top208+Node: PART 1 USER INTERFACE4090+Node: Input4229+Node: Text encoding5321+Node: Data formats6070+Node: Standard input7804+Node: Multiple files8193+Node: Strict mode8930+Node: Commands9764+Node: Add-on commands11046+Node: Options12097+Node: Special characters19247+Node: Escaping shell special characters20237+Node: Escaping regular expression special characters21596+Node: Escaping in other situations23111+Node: Unicode characters24259+Node: Regular expressions25680+Node: hledger's regular expressions28939+Node: Argument files30610+Node: Config files31507+Node: Shell completions34776+Node: Output35265+Node: Output destination35456+Node: Output format36014+Node: Text output37800+Node: Box-drawing characters38784+Node: Colour39284+Node: Paging39870+Node: HTML output41411+Node: CSV / TSV output41829+Node: FODS output42083+Node: Beancount output42887+Node: Beancount account names44388+Node: Beancount commodity names44929+Node: Beancount virtual postings45576+Node: Beancount metadata45892+Node: Beancount costs46672+Node: Beancount operating currency47088+Node: SQL output47538+Node: JSON output48329+Node: Commodity styles49146+Node: Debug output50156+Node: Environment50988+Node: PART 2 DATA FORMATS52157+Node: Journal52300+Node: Journal cheatsheet54803+Node: Comments61054+Node: Transactions61998+Node: Dates63135+Node: Simple dates63287+Node: Posting dates63903+Node: Status65076+Node: Code66842+Node: Description67461+Node: Payee and note68148+Node: Transaction comments69239+Node: Postings69755+Node: Debits and credits71071+Node: Account names71630+Node: Two space delimiter72587+Node: Account hierarchy73992+Node: Other account name features74875+Node: Amounts75293+Node: Decimal marks76299+Node: Digit group marks77403+Node: Commodity78038+Node: Costs79141+Node: Cost basis / lot syntax82710+Node: Balance assertions84373+Node: Assertions and ordering85637+Node: Assertions and multiple files86356+Node: Assertions and costs87524+Node: Assertions and commodities88171+Node: Assertions and subaccounts89830+Node: Assertions and status90490+Node: Assertions and virtual postings90910+Node: Assertions and auto postings91275+Node: Assertions and precision92150+Node: Assertions and hledger add92634+Node: Posting comments93382+Node: Transaction balancing93922+Node: Tags96130+Node: Tag propagation97649+Node: Displaying tags99148+Node: When to use tags ?99541+Node: Tag names100205+Node: Directives102204+Node: Directives and multiple files103661+Node: Directive effects104606+Node: account directive107762+Node: Account comments109229+Node: Account tags109816+Node: Account error checking110225+Node: Account display order111758+Node: Account types112956+Node: alias directive116660+Node: Basic aliases117871+Node: Regex aliases118746+Node: Combining aliases119793+Node: Aliases and multiple files121247+Node: end aliases directive122030+Node: Aliases can generate bad account names122398+Node: Aliases and account types123231+Node: commodity directive124123+Node: Commodity directive syntax125935+Node: Commodity tags127501+Node: Commodity error checking127979+Node: decimal-mark directive128442+Node: include directive129021+Node: P directive131244+Node: payee directive132278+Node: tag directive132903+Node: Periodic transactions133518+Node: Periodic rule syntax135672+Node: Periodic rules and relative dates136495+Node: Two spaces between period expression and description!137272+Node: Auto postings138233+Node: Auto postings and multiple files141519+Node: Auto postings and dates141924+Node: Auto postings and transaction balancing / inferred amounts / balance assertions142365+Node: Auto posting tags143211+Node: Auto postings on forecast transactions only144106+Node: Other syntax144576+Node: Balance assignments145393+Node: Balance assignments and costs146921+Node: Balance assignments and multiple files147343+Node: Bracketed posting dates147766+Node: D directive148464+Node: apply account directive150240+Node: Y directive151107+Node: Secondary dates152098+Node: Star comments153583+Node: Valuation expressions154275+Node: Virtual postings154574+Node: Other Ledger directives156198+Node: Ledger virtual costs156956+Node: Ledger lot syntax157298+Node: Ledger fixed lot costs158151+Node: CSV159721+Node: CSV rules cheatsheet161921+Node: source164219+Node: Data cleaning / data generating commands165623+Node: archive167522+Node: encoding168450+Node: separator169493+Node: skip170146+Node: date-format170796+Node: timezone171741+Node: newest-first172867+Node: intra-day-reversed173580+Node: decimal-mark174182+Node: CSV fields and hledger fields174680+Node: fields list176556+Node: Field assignment178381+Node: Field names179600+Node: date field180932+Node: date2 field181096+Node: status field181291+Node: code field181481+Node: description field181669+Node: comment field181886+Node: account field182443+Node: amount field183161+Node: currency field186000+Node: balance field186408+Node: if block186931+Node: Matchers188458+Node: Multiple matchers190361+Node: Match groups191169+Node: if table192062+Node: balance-type194125+Node: include194952+Node: Working with CSV195521+Node: Rapid feedback196110+Node: Valid CSV196693+Node: File Extension197569+Node: Reading CSV from standard input198304+Node: Reading multiple CSV files198690+Node: Reading files specified by rule199166+Node: Valid transactions200563+Node: Deduplicating importing201388+Node: Regular expressions in CSV rules202634+Node: Setting amounts204126+Node: Amount signs206664+Node: Setting currency/commodity207729+Node: Amount decimal places209105+Node: Referencing other fields210362+Node: How CSV rules are evaluated211470+Node: Well factored rules214187+Node: CSV rules examples214677+Node: Bank of Ireland214875+Node: Coinbase216472+Node: Amazon217655+Node: Paypal219497+Node: Timeclock227247+Node: Timedot231300+Node: Timedot examples234777+Node: PART 3 REPORTING CONCEPTS237054+Node: Time periods237218+Node: Report start & end date237491+Node: Smart dates238967+Node: Report intervals241338+Node: Date adjustments241912+Node: Start date adjustment242132+Node: End date adjustment243035+Node: Period headings243816+Node: Period expressions244749+Node: Period expressions with a report interval246654+Node: More complex report intervals247102+Node: Multiple weekday intervals249218+Node: Depth250229+Node: Combining depth options251215+Node: Queries252165+Node: Query types254867+Node: acct query255242+Node: amt query255553+Node: code query256250+Node: cur query256445+Node: desc query257051+Node: date query257234+Node: date2 query257848+Node: depth query258189+Node: note query258525+Node: payee query258791+Node: real query259072+Node: status query259277+Node: type query259517+Node: tag query260075+Node: Negative queries260704+Node: not query260886+Node: Space-separated queries261173+Node: Boolean queries261861+Node: expr query263179+Node: any query263859+Node: all query264312+Node: Queries and command options264894+Node: Queries and account aliases265342+Node: Queries and valuation265667+Node: Pivoting266029+Node: Generating data268312+Node: Forecasting270112+Node: --forecast270768+Node: Inspecting forecast transactions271869+Node: Forecast reports273202+Node: Forecast tags274311+Node: Forecast period in detail274931+Node: Forecast troubleshooting276019+Node: Budgeting277090+Node: Amount formatting277650+Node: Commodity display style277894+Node: Rounding279735+Node: Trailing decimal marks280340+Node: Amount parseability281273+Node: Cost reporting282882+Node: Recording costs283713+Node: Reporting at cost285440+Node: Equity conversion postings286205+Node: Inferring equity conversion postings288850+Node: Combining costs and equity conversion postings290096+Node: Requirements for detecting equity conversion postings291321+Node: Infer cost and equity by default ?292843+Node: Value reporting293280+Node: -X Value in specified commodity294238+Node: -V Value in default commoditys295098+Node: Valuation date295835+Node: Finding market price296667+Node: --infer-market-prices market prices from transactions298047+Node: Valuation commodity301091+Node: --value Flexible valuation302524+Node: Valuation examples304367+Node: Interaction of valuation and queries306511+Node: Effect of valuation on reports307228+Node: PART 4 COMMANDS315078+Node: Help commands317867+Node: commands318053+Node: demo318261+Node: help319354+Node: User interface commands321059+Node: repl321270+Node: Examples323534+Node: run324092+Node: Examples 2326507+Node: ui327531+Node: web327668+Node: Data entry commands327796+Node: add328057+Node: add and balance assertions330991+Node: add and balance assignments331565+Node: import332258+Node: Import dry run333337+Node: Overlap detection334285+Node: First import337171+Node: Importing balance assignments338366+Node: Import and commodity styles339421+Node: Import archiving339855+Node: Import special cases340680+Node: Deduplication340898+Node: Varying file name341389+Node: Multiple versions341773+Node: Basic report commands342880+Node: accounts343181+Node: codes345693+Node: commodities346715+Node: descriptions347723+Node: files348183+Node: notes348480+Node: payees348992+Node: prices350149+Node: stats351041+Node: tags353099+Node: Standard report commands354923+Node: print355228+Node: print amount explicitness357959+Node: print alignment358897+Node: print amount style359211+Node: print parseability360441+Node: print other features361718+Node: print output format362680+Node: aregister365965+Node: aregister and posting dates370492+Node: register371393+Node: Custom register output379114+Node: balancesheet380299+Node: balancesheetequity385264+Node: cashflow390599+Node: incomestatement395412+Node: Advanced report commands400261+Node: balance400469+Node: balance features405890+Node: Simple balance report407993+Node: Balance report line format409803+Node: Filtered balance report412163+Node: List or tree mode412682+Node: Depth limiting414195+Node: Dropping top-level accounts414962+Node: Showing declared accounts415472+Node: Sorting by amount416202+Node: Percentages417056+Node: Multi-period balance report417763+Node: Balance change end balance420515+Node: Balance report modes422152+Node: Calculation mode422831+Node: Accumulation mode423535+Node: Valuation mode424636+Node: Combining balance report modes425980+Node: Budget report428010+Node: Using the budget report430310+Node: Budget date surprises432586+Node: Selecting budget goals433950+Node: Budgeting vs forecasting434898+Node: Balance report layout436575+Node: Wide layout437780+Node: Tall layout440185+Node: Bare layout441491+Node: Tidy layout443555+Node: Balance report output445099+Node: Some useful balance reports445873+Node: roi447133+Node: Spaces and special characters in --inv and --pnl449380+Node: Semantics of --inv and --pnl450106+Node: IRR and TWR explained452193+Node: Chart commands455604+Node: activity455785+Node: Data generation commands456282+Node: close456488+Node: close --clopen459553+Node: close --close461449+Node: close --open461973+Node: close --assert462223+Node: close --assign462550+Node: close --retain463229+Node: close customisation464086+Node: close and balance assertions465764+Node: close examples467286+Node: Retain earnings467523+Node: Migrate balances to a new file468026+Node: More detailed close examples469388+Node: rewrite469610+Node: Re-write rules in a file472170+Node: Diff output format473471+Node: rewrite vs print --auto474741+Node: Maintenance commands475455+Node: check475674+Node: Basic checks476757+Node: Strict checks477823+Node: Other checks478696+Node: Custom checks480398+Node: diff480837+Node: setup482045+Node: test484912+Node: PART 5 COMMON TASKS485815+Node: Getting help486264+Node: Constructing command lines487165+Node: Starting a journal file488030+Node: Setting LEDGER_FILE489434+Node: Set LEDGER_FILE on unix489722+Node: Set LEDGER_FILE on mac490241+Node: Set LEDGER_FILE on Windows490971+Node: Setting opening balances492876+Node: Recording transactions496218+Node: Reconciling496963+Node: Reporting499372+Node: Migrating to a new file503506+Node: BUGS503962+Node: Troubleshooting504788++End Tag Table+++Local Variables:+coding: utf-8+End:
+ embeddedfiles/hledger.md view
@@ -0,0 +1,37 @@+# hledger++> A robust, friendly plain text accounting app.+> See also: `hledger-ui` for TUI, `hledger-web` for web interface.+> More information: <https://hledger.org/hledger.html>.++- Record new transactions interactively, saving to the default journal file:++`hledger add`++- Import new transactions from `bank.csv`, using `bank.csv.rules` to convert:++`hledger import {{path/to/bank.csv}}`++- Print all transactions, reading from multiple specified journal files:++`hledger print --file {{path/to/prices-2024.journal}} --file {{path/to/prices-2023.journal}}`++- Show all accounts, as a hierarchy, and their types:++`hledger accounts --tree --types`++- Show asset and liability account balances, including zeros, hierarchically:++`hledger balancesheet --empty --tree --no-elide`++- Show monthly incomes/expenses/totals, largest first, summarised to 2 levels:++`hledger incomestatement --monthly --row-total --average --sort --depth 2`++- Show the `assets:bank:checking` account's transactions and running balance:++`hledger aregister assets:bank:checking`++- Show the amount spent on food from the `assets:cash` account:++`hledger print assets:cash | hledger -f- -I aregister expenses:food`
embeddedfiles/hledger.txt view
@@ -1,2421 +1,10857 @@ -hledger(1) hledger User Manuals hledger(1)----NAME- hledger - a command-line accounting tool--SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [ARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]- hledger--DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any- other commodity, using double-entry accounting and a simple, editable- file format. hledger is inspired by and largely compatible with- ledger(1).- Tested on unix, mac, windows, hledger aims to be a reliable, practical- tool for daily use.-- This is hledger's command-line interface (there are also curses and web- interfaces). Its basic function is to read a plain text file describ-- ing financial transactions (in accounting terms, a general journal) and- print useful reports on standard output, or export them as CSV.- hledger can also read some other file formats such as CSV files, trans-- lating them to journal format. Additionally, hledger lists other- hledger-* executables found in the user's $PATH and can invoke them as- subcommands.-- hledger reads data from one or more files in hledger journal, time-- clock, timedot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal). If using $LEDGER_FILE, note this must- be a real environment variable, not a shell variable. You can specify- standard input with -f-.-- Transactions are dated movements of money between two (or more) named- accounts, and are recorded with journal entries like this:-- 2015/10/16 bought food- expenses:food $10- assets:cash-- For more about this format, see hledger_journal(5).-- Most users use a text editor to edit the journal, usually with an edi-- tor mode such as ledger-mode for added convenience. hledger's interac-- tive add command is another way to record new transactions. hledger- never changes existing transactions.-- To get started, you can either save some entries like the above in- ~/.hledger.journal, or run hledger add and follow the prompts. Then- try some commands like hledger print or hledger balance. Run hledger- with no arguments for a list of commands.--EXAMPLES- Two simple transactions in hledger journal format:-- 2015/9/30 gift received- assets:cash $20- income:gifts-- 2015/10/16 farmers market- expenses:food $10- assets:cash-- Some basic reports:-- $ hledger print- 2015/09/30 gift received- assets:cash $20- income:gifts $-20-- 2015/10/16 farmers market- expenses:food $10- assets:cash $-10-- $ hledger accounts --tree- assets- cash- expenses- food- income- gifts-- $ hledger balance- $10 assets:cash- $10 expenses:food- $-20 income:gifts- --------------------- 0-- $ hledger register cash- 2015/09/30 gift received assets:cash $20 $20- 2015/10/16 farmers market assets:cash $-10 $10-- More commands:-- $ hledger # show available commands- $ hledger add # add more transactions to the journal file- $ hledger balance # all accounts with aggregated balances- $ hledger balance --help # show detailed help for balance command- $ hledger balance --depth 1 # only top-level accounts- $ hledger register # show account postings, with running total- $ hledger reg income # show postings to/from income accounts- $ hledger reg 'assets:some bank:checking' # show postings to/from this checking account- $ hledger print desc:shop # show transactions with shop in the description- $ hledger activity -W # show transaction counts per week as a bar chart--OPTIONS- General options- To see general usage help, including general options which are sup-- ported by most hledger commands, run hledger -h.-- General help options:-- -h --help- show general usage (or after COMMAND, command usage)-- --version- show version-- --debug[=N]- show debug output (levels 1-9, default: 1)-- General input options:-- -f FILE --file=FILE- use a different input file. For stdin, use - (default:- $LEDGER_FILE or $HOME/.hledger.journal)-- --rules-file=RULESFILE- Conversion rules file to use when reading CSV (default:- FILE.rules)-- --separator=CHAR- Field separator to expect when reading CSV (default: ',')-- --alias=OLD=NEW- rename accounts named OLD to NEW-- --anon anonymize accounts and payees-- --pivot FIELDNAME- use some other field or tag for the account name-- -I --ignore-assertions- ignore any failing balance assertions-- General reporting options:-- -b --begin=DATE- include postings/txns on or after this date-- -e --end=DATE- include postings/txns before this date-- -D --daily- multiperiod/multicolumn report by day-- -W --weekly- multiperiod/multicolumn report by week-- -M --monthly- multiperiod/multicolumn report by month-- -Q --quarterly- multiperiod/multicolumn report by quarter-- -Y --yearly- multiperiod/multicolumn report by year-- -p --period=PERIODEXP- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)-- --date2- match the secondary date instead (see command help for other- effects)-- -U --unmarked- include only unmarked postings/txns (can combine with -P or -C)-- -P --pending- include only pending postings/txns-- -C --cleared- include only cleared postings/txns-- -R --real- include only non-virtual postings-- -NUM --depth=NUM- hide/aggregate accounts or postings more than NUM levels deep-- -E --empty- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)-- -B --cost- convert amounts to their cost at transaction time (using the- transaction price, if any)-- -V --value- convert amounts to their market value on the report end date- (using the most recent applicable market price, if any)-- --auto apply automated posting rules to modify transactions.-- --forecast- apply periodic transaction rules to generate future transac-- tions, to 6 months from now or report end date.-- When a reporting option appears more than once in the command line, the- last one takes precedence.-- Some reporting options can also be written as query arguments.-- Command options- To see options for a particular command, including command-specific- options, run: hledger COMMAND -h.-- Command-specific options must be written after the command name, eg:- hledger print -x.-- Additionally, if the command is an addon, you may need to put its- options after a double-hyphen, eg: hledger ui -- --watch. Or, you can- run the addon executable directly: hledger-ui --watch.-- Command arguments- Most hledger commands accept arguments after the command name, which- are often a query, filtering the data in some way.-- Argument files- You can save a set of command line options/arguments in a file, one per- line, and then reuse them by writing @FILENAME in a command line. To- prevent this expansion of @-arguments, precede them with a -- argument.- For more, see Save frequently used options.-- Special characters in arguments and queries- In shell command lines, option and argument values which contain "prob-- lematic" characters, ie spaces, and also characters significant to your- shell such as <, >, (, ), | and $, should be escaped by enclosing them- in quotes or by writing backslashes before the characters. Eg:-- hledger register -p 'last year' "accounts receivable (receiv-- able|payable)" amt:\>100.-- More escaping- Characters significant both to the shell and in regular expressions may- need one extra level of escaping. These include parentheses, the pipe- symbol and the dollar sign. Eg, to match the dollar symbol, bash users- should do:-- hledger balance cur:'\$'-- or:-- hledger balance cur:\\$-- Even more escaping- When hledger runs an addon executable (eg you type hledger ui, hledger- runs hledger-ui), it de-escapes command-line options and arguments- once, so you might need to triple-escape. Eg in bash, running the ui- command and matching the dollar sign, it's:-- hledger ui cur:'\\$'-- or:-- hledger ui cur:\\\\$-- If you asked why four slashes above, this may help:--- unescaped: $- escaped: \$- double-escaped: \\$- triple-escaped: \\\\$-- (The number of backslashes in fish shell is left as an exercise for the- reader.)-- You can always avoid the extra escaping for addons by running the addon- directly:-- hledger-ui cur:\\$-- Less escaping- Inside an argument file, or in the search field of hledger-ui or- hledger-web, or at a GHCI prompt, you need one less level of escaping- than at the command line. And backslashes may work better than quotes.- Eg:-- ghci> :main balance cur:\$-- Command line tips- If in doubt, keep things simple:-- o write options after the command (hledger CMD -OPTIONS ARGS)-- o run add-on executables directly (hledger-ui -OPTIONS ARGS)-- o enclose problematic args in single quotes-- o if needed, also add a backslash to escape regexp metacharacters-- To find out exactly how a command line is being parsed, add --debug=2- to troubleshoot.-- Unicode characters- hledger is expected to handle unicode (non-ascii) characters, but this- requires a well-configured environment.-- To handle unicode characters in the command line or input data, a sys-- tem locale that can decode them must be configured (POSIX's default C- locale will not work). Eg in bash, you could do:-- export LANG=en_US.UTF-8-- See Troubleshooting for more about this.-- Unicode characters should appear correctly in hledger's output. For- the hledger and hledger-ui tools, this requires that-- o your terminal supports unicode-- o the terminal's font includes the required unicode glyphs-- o the terminal is configured to display "wide" characters as double- width (otherwise report alignment will be off)-- Input files- 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:-- $ setenv LEDGER_FILE ~/finance/2016.journal- $ hledger stats-- or with the -f/--file option:-- $ hledger -f /some/file stats-- The file name - (hyphen) means standard input:-- $ cat some.journal | hledger -f--- Usually the data file is in hledger's journal format, but it can also- be one of several other formats, listed below. hledger detects the- format automatically based on the file extension, or if that is not- recognised, by trying each built-in "reader" in turn:--- Reader: Reads: Used for file extensions:- ------------------------------------------------------------------------------ journal hledger's journal format, also .journal .j .hledger- some Ledger journals .ledger- timeclock timeclock files (precise time .timeclock- logging)- timedot timedot files (approximate time .timedot- logging)- csv comma-separated values (data .csv- interchange)-- If needed (eg to ensure correct error messages when a file has the- "wrong" extension), you can force a specific reader/format by prepend-- ing it to the file path with a colon. Examples:-- $ hledger -f csv:/some/csv-file.dat stats- $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:--- You can also specify multiple -f options, to read multiple files as one- big journal. There are some limitations with this:-- o directives in one file will not affect the other files-- o balance assertions will not see any account balances from previous- files-- If you need those, either use the include directive, or concatenate the- files, eg: cat a.journal b.journal | hledger -f- CMD.-- Smart dates- hledger's user interfaces accept a flexible "smart date" syntax (unlike- dates in the journal file). Smart dates allow some english words, can- be relative to today's date, and can have less-significant date parts- omitted (defaulting to 1).-- Examples:--- 2004/10/1, 2004-01-01, exact date, several sepa-- 2004.9.1 rators allowed. Year is- 4+ digits, month is 1-12,- day is 1-31- 2004 start of year-- 2004/10 start of month- 10/1 month and day in current- year- 21 day in current month- october, oct start of month in current- year- yesterday, today, tomorrow -1, 0, 1 days from today- last/this/next day/week/month/quar- -1, 0, 1 periods from the- ter/year current period- 20181201 8 digit YYYYMMDD with- valid year month and day- 201812 6 digit YYYYMM with valid- year and month-- Counterexamples - malformed digit sequences might give surprising- results:--- 201813 6 digits with an invalid- month is parsed as start- of 6-digit year- 20181301 8 digits with an invalid- month is parsed as start- of 8-digit year- 20181232 8 digits with an invalid- day gives an error- 201801012 9+ digits beginning with a- valid YYYYMMDD gives an- error-- Report start & end date- Most hledger reports show the full span of time represented by the- journal data, by default. So, the effective report start and end dates- will be the earliest and latest transaction or posting dates found in- the journal.-- Often you will want to see a shorter time span, such as the current- month. You can specify a start and/or end date using -b/--begin,- -e/--end, -p/--period or a date: query (described below). All of these- accept the smart date syntax. One important thing to be aware of when- specifying end dates: as in Ledger, end dates are exclusive, so you- need to write the date after the last day you want to include.-- Examples:--- -b 2016/3/17 begin on St. Patrick's- day 2016- -e 12/1 end at the start of decem-- ber 1st of the current- year (11/30 will be the- last date included)- -b thismonth all transactions on or- after the 1st of the cur-- rent month- -p thismonth all transactions in the- current month- date:2016/3/17- the above written as- queries instead- date:-12/1- date:thismonth-- date:thismonth-- Report intervals- A report interval can be specified so that commands like register, bal-- ance and activity will divide their reports into multiple subperiods.- The basic intervals can be selected with one of -D/--daily,- -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly. More com-- plex intervals may be specified with a period expression. Report- intervals can not be specified with a query, currently.-- Period expressions- The -p/--period option accepts period expressions, a shorthand way of- expressing a start date, end date, and/or report interval all at once.-- Here's a basic period expression specifying the first quarter of 2009.- Note, hledger always treats start dates as inclusive and end dates as- exclusive:-- -p "from 2009/1/1 to 2009/4/1"-- Keywords like "from" and "to" are optional, and so are the spaces, as- long as you don't run two dates together. "to" can also be written as- "-". These are equivalent to the above:--- -p "2009/1/1 2009/4/1"- -p2009/1/1to2009/4/1- -p2009/1/1-2009/4/1-- Dates are smart dates, so if the current year is 2009, the above can- also be written as:--- -p "1/1 4/1"- -p "january-apr"- -p "this year to 4/1"-- If you specify only one date, the missing start or end date will be the- earliest or latest transaction in your journal:--- -p "from 2009/1/1" everything after january- 1, 2009- -p "from 2009/1" the same- -p "from 2009" the same- -p "to 2009" everything before january- 1, 2009-- A single date with no "from" or "to" defines both the start and end- date like so:--- -p "2009" the year 2009; equivalent- to "2009/1/1 to 2010/1/1"- -p "2009/1" the month of jan; equiva-- lent to "2009/1/1 to- 2009/2/1"- -p "2009/1/1" just that day; equivalent- to "2009/1/1 to 2009/1/2"-- The argument of -p can also begin with, or be, a report interval- expression. The basic report intervals are daily, weekly, monthly,- quarterly, or yearly, which have the same effect as the -D,-W,-M,-Q, or- -Y flags. Between report interval and start/end dates (if any), the- word in is optional. Examples:--- -p "weekly from 2009/1/1 to 2009/4/1"- -p "monthly in 2008"- -p "quarterly"-- Note that weekly, monthly, quarterly and yearly intervals will always- start on the first day on week, month, quarter or year accordingly, and- will end on the last day of same period, even if associated period- expression specifies different explicit start and end date.-- For example:--- -p "weekly from 2009/1/1 to 2009/4/1"- -- starts on 2008/12/29, closest pre-- ceeding Monday- -p "monthly in 2008/11/25" -- starts on- 2018/11/01- -p "quar-- terly from 2009-05-05 to 2009-06-01" -- starts on 2009/04/01, ends on- 2009/06/30, which are first and last- days of Q2 2009- -p "yearly from 2009-12-29" - starts on- 2009/01/01, first day of 2009-- The following more complex report intervals are also supported:- biweekly, bimonthly, every day|week|month|quarter|year,- every N days|weeks|months|quarters|years.-- All of these will start on the first day of the requested period and- end on the last one, as described above.-- Examples:--- -p "bimonthly from 2008" -- periods- will have boundaries on 2008/01/01,- 2008/03/01, ...- -p "every 2 weeks" -- starts on closest- preceeding Monday- -p "every 5 month from 2009/03" --- periods will have boundaries on- 2009/03/01, 2009/08/01, ...-- If you want intervals that start on arbitrary day of your choosing and- span a week, month or year, you need to use any of the following:-- every Nth day of week, every <weekday>, every Nth day [of month],- every Nth weekday [of month], every MM/DD [of year],- every Nth MMM [of year], every MMM Nth [of year].-- Examples:--- -p "every 2nd day of week" -- periods- will go from Tue to Tue- -p "every Tue" -- same- -p "every 15th day" -- period bound-- aries will be on 15th of each month- -p "every 2nd Monday" -- period bound-- aries will be on second Monday of each- month- -p "every 11/05" -- yearly periods with- boundaries on 5th of Nov- -p "every 5th Nov" -- same- -p "every Nov 5th" -- same-- Show historical balances at end of 15th each month (N is exclusive end- date):-- hledger balance -H -p "every 16th day"-- Group postings from start of wednesday to end of next tuesday (N is- start date and exclusive end date):-- hledger register checking -p "every 3rd day of week"-- Depth limiting- With the --depth N option (short form: -N), commands like account, bal-- ance and register will show only the uppermost accounts in the account- tree, down to level N. Use this when you want a summary with less- detail. This flag has the same effect as a depth: query argument (so- -2, --depth=2 or depth:2 are basically equivalent).-- Pivoting- Normally hledger sums amounts, and organizes them in a hierarchy, based- on account name. The --pivot FIELD option causes it to sum and orga-- nize hierarchy based on the value of some other field instead. FIELD- can be: code, description, payee, note, or the full name (case insensi-- tive) of any tag. As with account names, values containing colon:sepa-- rated:parts will be displayed hierarchically in reports.-- --pivot is a general option affecting all reports; you can think of- hledger transforming the journal before any other processing, replacing- every posting's account name with the value of the specified field on- that posting, inheriting it from the transaction or using a blank value- if it's not present.-- An example:-- 2016/02/16 Member Fee Payment- assets:bank account 2 EUR- income:member fees -2 EUR ; member: John Doe-- Normal balance report showing account names:-- $ hledger balance- 2 EUR assets:bank account- -2 EUR income:member fees- --------------------- 0-- Pivoted balance report, using member: tag values instead:-- $ hledger balance --pivot member- 2 EUR- -2 EUR John Doe- --------------------- 0-- One way to show only amounts with a member: value (using a query,- described below):-- $ hledger balance --pivot member tag:member=.- -2 EUR John Doe- --------------------- -2 EUR-- Another way (the acct: query matches against the pivoted "account- name"):-- $ hledger balance --pivot member acct:.- -2 EUR John Doe- --------------------- -2 EUR-- Cost- The -B/--cost flag converts amounts to their cost at transaction time,- if they have a transaction price specified.-- Market value- The -V/--value flag converts reported amounts to their current market- value.- Specifically, when there is a market price (P directive) for the- amount's commodity, dated on or before today's date (or the report end- date if specified), the amount will be converted to the price's commod-- ity.-- When there are multiple applicable P directives, -V chooses the most- recent one, or in case of equal dates, the last-parsed one.-- For example:-- # one euro is worth this many dollars from nov 1- P 2016/11/01 $1.10-- # purchase some euros on nov 3- 2016/11/3- assets:euros 100- assets:checking-- # the euro is worth fewer dollars by dec 21- P 2016/12/21 $1.03-- How many euros do I have ?-- $ hledger -f t.j bal -N euros- 100 assets:euros-- What are they worth at end of nov 3 ?-- $ 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)-- $ hledger -f t.j bal -N euros -V- $103.00 assets:euros-- Currently, hledger's -V only uses market prices recorded with P direc-- tives, not transaction prices (unlike Ledger).-- Currently, -V has a limitation in multicolumn balance reports: it uses- the market prices on the report end date for all columns. (Instead of- the prices on each column's end date.)-- Combining -B and -V- Using -B/--cost and -V/--value together is currently allowed, but the- results are probably not meaningful. Let us know if you find a use for- this.-- Output destination- Some commands (print, register, stats, the balance commands) can write- their output to a destination other than the console. This is con-- trolled by the -o/--output-file option.-- $ hledger balance -o - # write to stdout (the default)- $ hledger balance -o FILE # write to FILE-- Output format- Some commands can write their output in other formats. Eg print and- register can output CSV, and the balance commands can output CSV or- HTML. This is controlled by the -O/--output-format option, or by spec-- ifying a .csv or .html file extension with -o/--output-file.-- $ hledger balance -O csv # write CSV to stdout- $ hledger balance -o FILE.csv # write CSV to FILE.csv-- Regular expressions- hledger uses regular expressions in a number of places:-- o query terms, on the command line and in the hledger-web search form:- REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX-- o CSV rules conditional blocks: if REGEX ...-- o account alias directives and options: alias /REGEX/ = REPLACEMENT,- --alias /REGEX/=REPLACEMENT-- hledger's regular expressions come from the regex-tdfa library. In- general they:-- o are case insensitive-- o are infix matching (do not need to match the entire thing being- matched)-- o are POSIX extended regular expressions-- o also support GNU word boundaries (\<, \>, \b, \B)-- o and parenthesised capturing groups and numeric backreferences in- replacement strings-- o do not support mode modifiers like (?s)-- Some things to note:-- o In the alias directive and --alias option, regular expressions must- be enclosed in forward slashes (/REGEX/). Elsewhere in hledger,- these are not required.-- o In queries, to match a regular expression metacharacter like $ as a- literal character, prepend a backslash. Eg to search for amounts- with the dollar sign in hledger-web, write cur:\$.-- o On the command line, some metacharacters like $ have a special mean-- ing to the shell and so must be escaped at least once more. See Spe-- cial characters.--QUERIES- One of hledger's strengths is being able to quickly report on precise- subsets of your data. Most commands accept an optional query expres-- sion, written as arguments after the command name, to filter the data- by date, account name or other criteria. The syntax is similar to a- web search: one or more space-separated search terms, quotes to enclose- whitespace, prefixes to match specific fields, a not: prefix to negate- the match.-- We do not yet support arbitrary boolean combinations of search terms;- instead most commands show transactions/postings/accounts which match- (or negatively match):-- o any of the description terms AND-- o any of the account terms AND-- o any of the status terms AND-- o all the other terms.-- The print command instead shows transactions which:-- o match any of the description terms AND-- o have any postings matching any of the positive account terms AND-- o have no postings matching any of the negative account terms AND-- o match all the other terms.-- The following kinds of search terms can be used. Remember these can- also be prefixed with not:, eg to exclude a particular subaccount.-- REGEX, acct:REGEX- match account names by this regular expression. (With no pre-- fix, acct: is assumed.)- same as above-- amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N- match postings with a single-commodity amount that is equal to,- less than, or greater than N. (Multi-commodity amounts are not- tested, and will always match.) The comparison has two modes: if- N is preceded by a + or - sign (or is 0), the two signed numbers- are compared. Otherwise, the absolute magnitudes are compared,- ignoring sign.-- code:REGEX- match by transaction code (eg check number)-- cur:REGEX- match postings or transactions including any amounts whose cur-- rency/commodity symbol is fully matched by REGEX. (For a par-- tial match, use .*REGEX.*). Note, to match characters which are- regex-significant, like the dollar sign ($), you need to prepend- \. And when using the command line you need to add one more- level of quoting to hide it from the shell, so eg do:- hledger print cur:'\$' or hledger print cur:\\$.-- desc:REGEX- match transaction descriptions.-- date:PERIODEXPR- match dates within the specified period. PERIODEXPR is a period- expression (with no report interval). Examples: date:2016,- date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the- --date2 command line flag is present, this matches secondary- dates instead.-- date2:PERIODEXPR- match secondary dates within the specified period.-- depth:N- match (or display, depending on command) accounts at or above- this depth-- note:REGEX- match transaction notes (part of description right of |, or- whole description when there's no |)-- payee:REGEX- match transaction payee/payer names (part of description left of- |, or whole description when there's no |)-- real:, real:0- match real or virtual postings respectively-- status:, status:!, status:*- match unmarked, pending, or cleared transactions respectively-- tag:REGEX[=REGEX]- match by tag name, and optionally also by tag value. Note a- tag: query is considered to match a transaction if it matches- any of the postings. Also remember that postings inherit the- tags of their parent transaction.-- The following special search term is used automatically in hledger-web,- only:-- inacct:ACCTNAME- tells hledger-web to show the transaction register for this- account. Can be filtered further with acct etc.-- Some of these can also be expressed as command-line options (eg depth:2- is equivalent to --depth 2). Generally you can mix options and query- arguments, and the resulting query will be their intersection (perhaps- excluding the -p/--period option).--COMMANDS- hledger provides a number of subcommands; hledger with no arguments- shows a list.-- If you install additional hledger-* packages, or if you put programs or- scripts named hledger-NAME in your PATH, these will also be listed as- subcommands.-- Run a subcommand by writing its name as first argument (eg- hledger incomestatement). You can also write one of the standard short- aliases displayed in parentheses in the command list (hledger b), or- any any unambiguous prefix of a command name (hledger inc).-- Here are all the builtin commands in alphabetical order. See also- hledger for a more organised command list, and hledger CMD -h for- detailed command help.-- accounts- accounts, a- Show account names.-- This command lists account names, either declared with account direc-- tives (--declared), posted to (--used), or both (the default). With- query arguments, only matched account names and account names refer-- enced by matched postings are shown. It shows a flat list by default.- With --tree, it uses indentation to show the account hierarchy. In- flat mode you can add --drop N to omit the first few account name com-- ponents. Account names can be depth-clipped with depth:N or --depth N- or -N.-- Examples:-- $ hledger accounts- assets:bank:checking- assets:bank:saving- assets:cash- expenses:food- expenses:supplies- income:gifts- income:salary- liabilities:debts-- activity- activity- Show an ascii barchart of posting counts per interval.-- The activity command displays an ascii histogram showing transaction- counts by day, week, month or other reporting interval (by day is the- default). With query arguments, it counts only matched transactions.-- Examples:-- $ hledger activity --quarterly- 2008-01-01 **- 2008-04-01 *******- 2008-07-01- 2008-10-01 **-- add- add- Prompt for transactions and add them to the journal.-- Many hledger users edit their journals directly with a text editor, or- generate them from CSV. For more interactive data entry, there is the- add command, which prompts interactively on the console for new trans-- actions, and appends them to the journal file (if there are multiple- -f FILE options, the first file is used.) Existing transactions are not- changed. This is the only hledger command that writes to the journal- file.-- To use it, just run hledger add and follow the prompts. You can add as- many transactions as you like; when you are finished, enter . or press- control-d or control-c to exit.-- Features:-- o add tries to provide useful defaults, using the most similar (by- description) recent transaction (filtered by the query, if any) as a- template.-- o You can also set the initial defaults with command line arguments.-- o Readline-style edit keys can be used during data entry.-- o The tab key will auto-complete whenever possible - accounts, descrip-- tions, dates (yesterday, today, tomorrow). If the input area is- empty, it will insert the default value.-- o If the journal defines a default commodity, it will be added to any- bare numbers entered.-- o A parenthesised transaction code may be entered following a date.-- o Comments and tags may be entered following a description or amount.-- o If you make a mistake, enter < at any prompt to restart the transac-- tion.-- o Input prompts are displayed in a different colour when the terminal- supports it.-- Example (see the tutorial for a detailed explanation):-- $ hledger add- Adding transactions to journal file /src/hledger/examples/sample.journal- Any command line arguments will be used as defaults.- Use tab key to complete, readline keys to edit, enter to accept defaults.- An optional (CODE) may follow transaction dates.- An optional ; COMMENT may follow descriptions or amounts.- If you make a mistake, enter < at any prompt to restart the transaction.- To end a transaction, enter . when prompted.- To quit, enter . at a date prompt or press control-d or control-c.- Date [2015/05/22]:- Description: supermarket- Account 1: expenses:food- Amount 1: $10- Account 2: assets:checking- Amount 2 [$-10.0]:- Account 3 (or . or enter to finish this transaction): .- 2015/05/22 supermarket- expenses:food $10- assets:checking $-10.0-- Save this transaction to the journal ? [y]:- Saved.- Starting the next transaction (. or ctrl-D/ctrl-C to quit)- Date [2015/05/22]: <CTRL-D> $-- balance- balance, bal, b- Show accounts and their balances.-- The balance command is hledger's most versatile command. Note, despite- the name, it is not always used for showing real-world account bal-- ances; the more accounting-aware balancesheet and incomestatement may- be more convenient for that.-- By default, it displays all accounts, and each account's change in bal-- ance during the entire period of the journal. Balance changes are cal-- culated by adding up the postings in each account. You can limit the- postings matched, by a query, to see fewer accounts, changes over a- different time period, changes from only cleared transactions, etc.-- If you include an account's complete history of postings in the report,- the balance change is equivalent to the account's current ending bal-- ance. For a real-world account, typically you won't have all transac-- tions in the journal; instead you'll have all transactions after a cer-- tain date, and an "opening balances" transaction setting the correct- starting balance on that date. Then the balance command will show- real-world account balances. In some cases the -H/--historical flag is- used to ensure this (more below).-- The balance command can produce several styles of report:-- Classic balance report- This is the original balance report, as found in Ledger. It usually- looks like this:-- $ hledger balance- $-1 assets- $1 bank:saving- $-2 cash- $2 expenses- $1 food- $1 supplies- $-2 income- $-1 gifts- $-1 salary- $1 liabilities:debts- --------------------- 0-- By default, accounts are displayed hierarchically, with subaccounts- indented below their parent. At each level of the tree, accounts are- sorted by account code if any, then by account name. Or with- -S/--sort-amount, by their balance amount.-- "Boring" accounts, which contain a single interesting subaccount and no- balance of their own, are elided into the following line for more com-- pact output. (Eg above, the "liabilities" account.) Use --no-elide to- prevent this.-- Account balances are "inclusive" - they include the balances of any- subaccounts.-- Accounts which have zero balance (and no non-zero subaccounts) are- omitted. Use -E/--empty to show them.-- A final total is displayed by default; use -N/--no-total to suppress- it, eg:-- $ hledger balance -p 2008/6 expenses --no-total- $2 expenses- $1 food- $1 supplies-- Customising the classic balance report- You can customise the layout of classic balance reports with --for-- mat FMT:-- $ hledger balance --format "%20(account) %12(total)"- assets $-1- bank:saving $1- cash $-2- expenses $2- food $1- supplies $1- income $-2- gifts $-1- salary $-1- liabilities:debts $1- ---------------------------------- 0-- The FMT format string (plus a newline) specifies the formatting applied- to each account/balance pair. It may contain any suitable text, with- data fields interpolated like so:-- %[MIN][.MAX](FIELDNAME)-- o MIN pads with spaces to at least this width (optional)-- o MAX truncates at this width (optional)-- o FIELDNAME must be enclosed in parentheses, and can be one of:-- o depth_spacer - a number of spaces equal to the account's depth, or- if MIN is specified, MIN * depth spaces.-- o account - the account's name-- o total - the account's balance/posted total, right justified-- Also, FMT can begin with an optional prefix to control how multi-com-- modity amounts are rendered:-- o %_ - render on multiple lines, bottom-aligned (the default)-- o %^ - render on multiple lines, top-aligned-- o %, - render on one line, comma-separated-- There are some quirks. Eg in one-line mode, %(depth_spacer) has no- effect, instead %(account) has indentation built in.- Experimentation may be needed to get pleasing results.-- Some example formats:-- o %(total) - the account's total-- o %-20.20(account) - the account's name, left justified, padded to 20- characters and clipped at 20 characters-- o %,%-50(account) %25(total) - account name padded to 50 characters,- total padded to 20 characters, with multiple commodities rendered on- one line-- o %20(total) %2(depth_spacer)%-(account) - the default format for the- single-column balance report-- Colour support- The balance command shows negative amounts in red, if:-- o the TERM environment variable is not set to dumb-- o the output is not being redirected or piped anywhere-- Flat mode- To see a flat list instead of the default hierarchical display, use- --flat. In this mode, accounts (unless depth-clipped) show their full- names and "exclusive" balance, excluding any subaccount balances. In- this mode, you can also use --drop N to omit the first few account name- components.-- $ hledger balance -p 2008/6 expenses -N --flat --drop 1- $1 food- $1 supplies-- Depth limited balance reports- With --depth N or depth:N or just -N, balance reports show accounts- only to the specified numeric depth. This is very useful to summarise- a complex set of accounts and get an overview.-- $ hledger balance -N -1- $-1 assets- $2 expenses- $-2 income- $1 liabilities-- Flat-mode balance reports, which normally show exclusive balances, show- inclusive balances at the depth limit.-- Multicolumn balance report- Multicolumn or tabular balance reports are a very useful hledger fea-- ture, and usually the preferred style. They share many of the above- features, but they show the report as a table, with columns represent-- ing time periods. This mode is activated by providing a reporting- interval.-- There are three types of multicolumn balance report, showing different- information:-- 1. By default: each column shows the sum of postings in that period, ie- the account's change of balance in that period. This is useful eg- for a monthly income statement:-- $ hledger balance --quarterly income expenses -E- Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4- ===================++=================================- expenses:food || 0 $1 0 0- expenses:supplies || 0 $1 0 0- income:gifts || 0 $-1 0 0- income:salary || $-1 0 0 0- -------------------++---------------------------------- || $-1 $1 0 0-- 2. With --cumulative: each column shows the ending balance for that- period, accumulating the changes across periods, starting from 0 at- the report start date:-- $ hledger balance --quarterly income expenses -E --cumulative- Ending balances (cumulative) in 2008:-- || 2008/03/31 2008/06/30 2008/09/30 2008/12/31- ===================++=================================================- expenses:food || 0 $1 $1 $1- expenses:supplies || 0 $1 $1 $1- income:gifts || 0 $-1 $-1 $-1- income:salary || $-1 $-1 $-1 $-1- -------------------++-------------------------------------------------- || $-1 0 0 0-- 3. With --historical/-H: each column shows the actual historical ending- balance for that period, accumulating the changes across periods,- starting from the actual balance at the report start date. This is- useful eg for a multi-period balance sheet, and when you are showing- only the data after a certain start date:-- $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1- Ending balances (historical) in 2008/04/01-2008/12/31:-- || 2008/06/30 2008/09/30 2008/12/31- ======================++=====================================- assets:bank:checking || $1 $1 0- assets:bank:saving || $1 $1 $1- assets:cash || $-2 $-2 $-2- liabilities:debts || 0 0 $1- ----------------------++-------------------------------------- || 0 0 0-- Multicolumn balance reports display accounts in flat mode by default;- to see the hierarchy, use --tree.-- With a reporting interval (like --quarterly above), the report- start/end dates will be adjusted if necessary so that they encompass- the displayed report periods. This is so that the first and last peri-- ods will be "full" and comparable to the others.-- The -E/--empty flag does two things in multicolumn balance reports:- first, the report will show all columns within the specified report- period (without -E, leading and trailing columns with all zeroes are- not shown). Second, all accounts which existed at the report start- date will be considered, not just the ones with activity during the- report period (use -E to include low-activity accounts which would oth-- erwise would be omitted).-- The -T/--row-total flag adds an additional column showing the total for- each row.-- The -A/--average flag adds a column showing the average value in each- row.-- Here's an example of all three:-- $ hledger balance -Q income expenses --tree -ETA- Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4 Total Average- ============++===================================================- expenses || 0 $2 0 0 $2 $1- food || 0 $1 0 0 $1 0- supplies || 0 $1 0 0 $1 0- income || $-1 $-1 0 0 $-2 $-1- gifts || 0 $-1 0 0 $-1 0- salary || $-1 0 0 0 $-1 0- ------------++---------------------------------------------------- || $-1 $1 0 0 0 0-- # Average is rounded to the dollar here since all journal amounts are-- Limitations:-- In multicolumn reports the -V/--value flag uses the market price on the- report end date, for all columns (not the price on each column's end- date).-- Eliding of boring parent accounts in tree mode, as in the classic bal-- ance report, is not yet supported in multicolumn reports.-- Budget report- With --budget, extra columns are displayed showing budget goals for- each account and period, if any. Budget goals are defined by periodic- transactions. This is very useful for comparing planned and actual- income, expenses, time usage, etc. --budget is most often combined- with a report interval.-- For example, you can take average monthly expenses in the common- expense categories to construct a minimal monthly budget:-- ;; Budget- ~ monthly- income $2000- expenses:food $400- expenses:bus $50- expenses:movies $30- assets:bank:checking-- ;; Two months worth of expenses- 2017-11-01- income $1950- expenses:food $396- expenses:bus $49- expenses:movies $30- expenses:supplies $20- assets:bank:checking-- 2017-12-01- income $2100- expenses:food $412- expenses:bus $53- expenses:gifts $100- assets:bank:checking-- You can now see a monthly budget report:-- $ hledger balance -M --budget- Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec- ======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- expenses || $495 [ 103% of $480] $565 [ 118% of $480]- expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]- expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]- expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]- income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]- ----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0]-- Note this is different from a normal balance report in several ways:-- o Only accounts with budget goals during the report period are shown,- by default.-- o In each column, in square brackets after the actual amount, budgeted- amounts are shown, along with the percentage of budget used.-- o All parent accounts are always shown, even in flat mode. Eg assets,- assets:bank, and expenses above.-- o Amounts always include all subaccounts, budgeted or unbudgeted, even- in flat mode.-- This means that the numbers displayed will not always add up! Eg above,- the expenses actual amount includes the gifts and supplies transac-- tions, but the expenses:gifts and expenses:supplies accounts are not- 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:-- $ hledger balance -M --budget --empty- Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec- ======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- expenses || $495 [ 103% of $480] $565 [ 118% of $480]- expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]- expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]- expenses:gifts || 0 $100- expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]- expenses:supplies || $20 0- income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]- ----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0]-- You can roll over unspent budgets to next period with --cumulative:-- $ hledger balance -M --budget --cumulative- Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec- ======================++====================================================- assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]- assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]- assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]- expenses || $495 [ 103% of $480] $1060 [ 110% of $960]- expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100]- expenses:food || $396 [ 99% of $400] $808 [ 101% of $800]- expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60]- income || $1950 [ 98% of $2000] $4050 [ 101% of $4000]- ----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0]-- For more examples, see Budgeting and Forecasting.-- Nested budgets- You can add budgets to any account in your account hierarchy. If you- have budgets on both parent account and some of its children, then bud-- get(s) of the child account(s) would be added to the budget of their- parent, much like account balances behave.-- In the most simple case this means that once you add a budget to any- account, all its parents would have budget as well.-- To illustrate this, consider the following budget:-- ~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities-- With this, monthly budget for electronics is defined to be $100 and- budget for personal expenses is an additional $1000, which implicity- means that budget for both expenses:personal and expenses is $1100.-- Transactions in expenses:personal:electronics will be counted both- towards its $100 budget and $1100 of expenses:personal , and transac-- tions in any other subaccount of expenses:personal would be counted- towards only towards the budget of expenses:personal.-- For example, let's consider these transactions:-- ~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities-- 2019/01/01 Google home hub- expenses:personal:electronics $90.00- liabilities $-90.00-- 2019/01/02 Phone screen protector- expenses:personal:electronics:upgrades $10.00- liabilities-- 2019/01/02 Weekly train ticket- expenses:personal:train tickets $153.00- liabilities-- 2019/01/03 Flowers- expenses:personal $30.00- liabilities-- As you can see, we have transactions in expenses:personal:electron-- ics:upgrades and expenses:personal:train tickets, and since both of- these accounts are without explicitly defined budget, these transac-- tions would be counted towards budgets of expenses:personal:electronics- and expenses:personal accordingly:-- $ hledger balance --budget -M- Budget performance in 2019/01:-- || Jan- ===============================++===============================- expenses || $283.00 [ 26% of $1100.00]- expenses:personal || $283.00 [ 26% of $1100.00]- expenses:personal:electronics || $100.00 [ 100% of $100.00]- liabilities || $-283.00 [ 26% of $-1100.00]- -------------------------------++-------------------------------- || 0 [ 0]-- And with --empty, we can get a better picture of budget allocation and- consumption:-- $ hledger balance --budget -M --empty- Budget performance in 2019/01:-- || Jan- ========================================++===============================- expenses || $283.00 [ 26% of $1100.00]- expenses:personal || $283.00 [ 26% of $1100.00]- expenses:personal:electronics || $100.00 [ 100% of $100.00]- expenses:personal:electronics:upgrades || $10.00- expenses:personal:train tickets || $153.00- liabilities || $-283.00 [ 26% of $-1100.00]- ----------------------------------------++-------------------------------- || 0 [ 0]-- Output format- The balance command supports output destination and output format- selection.-- balancesheet- balancesheet, bs- This command displays a simple balance sheet, showing historical ending- balances of asset and liability accounts (ignoring any report begin- date). It assumes that these accounts are under a top-level asset or- liability account (case insensitive, plural forms also allowed).-- Note this report shows all account balances with normal positive sign- (like conventional financial statements, unlike balance/print/register)- (experimental).-- Example:-- $ hledger balancesheet- Balance Sheet-- Assets:- $-1 assets- $1 bank:saving- $-2 cash- --------------------- $-1-- Liabilities:- $1 liabilities:debts- --------------------- $1-- Total:- --------------------- 0-- With a reporting interval, multiple columns will be shown, one for each- report period. As with multicolumn balance reports, you can alter the- report mode with --change/--cumulative/--historical. Normally bal-- ancesheet shows historical ending balances, which is what you need for- a balance sheet; note this means it ignores report begin dates.-- This command also supports output destination and output format selec-- tion.-- balancesheetequity- balancesheetequity, bse- Just like balancesheet, but also reports Equity (which it assumes is- under a top-level equity account).-- Example:-- $ hledger balancesheetequity- Balance Sheet With Equity-- Assets:- $-2 assets- $1 bank:saving- $-3 cash- --------------------- $-2-- Liabilities:- $1 liabilities:debts- --------------------- $1-- Equity:- $1 equity:owner- --------------------- $1-- Total:- --------------------- 0-- cashflow- cashflow, cf- This command displays a simple cashflow statement, showing changes in- "cash" accounts. It assumes that these accounts are under a top-level- asset account (case insensitive, plural forms also allowed) and do not- contain receivable or A/R in their name. Note this report shows all- account balances with normal positive sign (like conventional financial- statements, unlike balance/print/register) (experimental).-- Example:-- $ hledger cashflow- Cashflow Statement-- Cash flows:- $-1 assets- $1 bank:saving- $-2 cash- --------------------- $-1-- Total:- --------------------- $-1-- With a reporting interval, multiple columns will be shown, one for each- report period. Normally cashflow shows changes in assets per period,- though as with multicolumn balance reports you can alter the report- mode with --change/--cumulative/--historical.-- This command also supports output destination and output format selec-- tion.-- check-dates- check-dates- Check that transactions are sorted by increasing date. With --date2,- checks secondary dates instead. With --strict, dates must also be- unique. With a query, only matched transactions' dates are checked.- Reads the default journal file, or another specified with -f.-- check-dupes- check-dupes- Reports account names having the same leaf but different prefixes. In- other words, two or more leaves that are categorized differently.- Reads the default journal file, or another specified as an argument.-- An example: http://stefanorodighiero.net/software/hledger-dupes.html-- close- close, equity- Prints a "closing balances" transaction and an "opening balances"- transaction that bring account balances to and from zero, respectively.- Useful for bringing asset/liability balances forward into a new journal- file, or for closing out revenues/expenses to retained earnings at the- end of a period.-- The closing transaction transfers balances to "equity:closing bal-- ances". The opening transaction transfers balances from "equity:open-- ing balances". You can chose to print just one of the transactions by- using the --opening or --closing flag.-- If you split your journal files by time (eg yearly), you will typically- run this command at the end of the year, and save the closing transac-- tion as last entry of the old file, and the opening transaction as the- first entry of the new file. This makes the files self contained, so- that correct balances are reported no matter which of them are loaded.- Ie, if you load just one file, the balances are initialised correctly;- or if you load several files, the redundant closing/opening transac-- tions cancel each other out. (They will show up in print or register- reports; you can exclude them with a query like not:desc:'(open-- ing|closing) balances'.)-- If you're running a business, you might also use this command to "close- the books" at the end of an accounting period, transferring income- statement account balances to retained earnings. (You may want to- change the equity account name to something like "equity:retained earn-- ings".)-- By default, the closing transaction is dated yesterday, the balances- are calculated as of end of yesterday, and the opening transaction is- dated today. To close on some other date, use: hledger close -e OPEN-- INGDATE. Eg, to close/open on the 2018/2019 boundary, use -e 2019.- You can also use -p or date:PERIOD (any starting date is ignored).-- Both transactions will include balance assertions for the- closed/reopened accounts. You probably shouldn't use status or real-- ness filters (like -C or -R or status:) with this command, or the gen-- erated balance assertions will depend on these flags. Likewise, if you- run this command with --auto, the balance assertions will probably- always require --auto.-- Examples:-- Carrying asset/liability balances into a new file for 2019, all from- command line:-- 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- $ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal-- Now:-- $ 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:-- 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:-- ; in 2018.journal:- 2018/12/30 a purchase made in 2018, clearing the following year- expenses:food 5- liabilities:pending-- ; in 2019.journal:- 2019/1/2 clearance of last year's pending transactions- liabilities:pending 5 = 0- assets:checking-- files- files- List all files included in the journal. With a REGEX argument, only- file names matching the regular expression (case sensitive) are shown.-- help- help- Show any of the hledger manuals.-- The help command displays any of the main hledger manuals, in one of- several ways. Run it with no argument to list the manuals, or provide- a full or partial manual name to select one.-- hledger manuals are available in several formats. hledger help will- use the first of these display methods that it finds: info, man,- $PAGER, less, stdout (or when non-interactive, just stdout). You can- force a particular viewer with the --info, --man, --pager, --cat flags.-- Examples:-- $ hledger help- Please choose a manual by typing "hledger help MANUAL" (a substring is ok).- Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot-- $ hledger help h --man-- hledger(1) hledger User Manuals hledger(1)-- NAME- hledger - a command-line accounting tool-- SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [ARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]- hledger-- DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any- ...-- import- import- Read new transactions added to each FILE since last run, and add them- to the main journal file. Or with --dry-run, just print the transac-- tions that would be added.-- The input files are specified as arguments - no need to write -f before- each one. So eg to add new transactions from all CSV files to the main- journal, it's just: hledger import *.csv-- New transactions are detected in the same way as print --new: by assum-- ing transactions are always added to the input files in increasing date- order, and by saving .latest.FILE state files.-- The --dry-run output is in journal format, so you can filter it, eg to- see only uncategorised transactions:-- $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions-- incomestatement- incomestatement, is- This command displays a simple income statement, showing revenues and- expenses during a period. It assumes that these accounts are under a- top-level revenue or income or expense account (case insensitive, plu-- ral forms also allowed). Note this report shows all account balances- with normal positive sign (like conventional financial statements,- unlike balance/print/register) (experimental).-- This command displays a simple income statement. It currently assumes- that you have top-level accounts named income (or revenue) and expense- (plural forms also allowed.)-- $ hledger incomestatement- Income Statement-- Revenues:- $-2 income- $-1 gifts- $-1 salary- --------------------- $-2-- Expenses:- $2 expenses- $1 food- $1 supplies- --------------------- $2-- Total:- --------------------- 0-- With a reporting interval, multiple columns will be shown, one for each- report period. Normally incomestatement shows revenues/expenses per- period, though as with multicolumn balance reports you can alter the- report mode with --change/--cumulative/--historical.-- This command also supports output destination and output format selec-- tion.-- prices- prices- Print market price directives from the journal. With --costs, also- print synthetic market prices based on transaction prices. With- --inverted-costs, also print inverse prices based on transaction- prices. Prices (and postings providing prices) can be filtered by a- query.-- print- print, txns, p- Show transaction journal entries, sorted by date.-- The print command displays full journal entries (transactions) from the- journal file in date order, tidily formatted. With --date2, transac-- tions are sorted by secondary date instead.-- print's output is always a valid hledger journal.- It preserves all transaction information, but it does not preserve- directives or inter-transaction comments-- $ hledger print- 2008/01/01 income- assets:bank:checking $1- income:salary $-1-- 2008/06/01 gift- assets:bank:checking $1- income:gifts $-1-- 2008/06/02 save- assets:bank:saving $1- assets:bank:checking $-1-- 2008/06/03 * eat & shop- expenses:food $1- expenses:supplies $1- assets:cash $-2-- 2008/12/31 * pay off- liabilities:debts $1- assets:bank:checking $-1-- Normally, the journal entry's explicit or implicit amount style is pre-- served. Ie when an amount is omitted in the journal, it will be omit-- ted in the output. You can use the -x/--explicit flag to make all- amounts explicit, which can be useful for troubleshooting or for making- your journal more readable and robust against data entry errors. Note,- -x will cause postings with a multi-commodity amount (these can arise- when a multi-commodity transaction has an implicit amount) will be- split into multiple single-commodity postings, for valid journal out-- put.-- With -B/--cost, amounts with transaction prices are converted to cost- using that price. This can be used for troubleshooting.-- With -m/--match and a STR argument, print will show at most one trans-- action: the one one whose description is most similar to STR, and is- most recent. STR should contain at least two characters. If there is- no similar-enough match, no transaction will be shown.-- With --new, for each FILE being read, hledger reads (and writes) a spe-- cial state file (.latest.FILE in the same directory), containing the- latest transaction date(s) that were seen last time FILE was read.- When this file is found, only transactions 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:-- $ hledger -f bank1.csv print --new- # shows transactions added since last print --new on this file-- This assumes that transactions added to FILE always have same or- increasing dates, and that transactions on the same day do not get- reordered. See also the import command.-- This command also supports output destination and output format selec-- tion. Here's an example of print's CSV output:-- $ hledger print -Ocsv- "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"- "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""- "1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""- "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""- "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""- "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""- "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""- "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""- "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""- "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""- "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""- "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""-- o There is one CSV record per posting, with the parent transaction's- fields repeated.-- o The "txnidx" (transaction index) field shows which postings belong to- the same transaction. (This number might change if transactions are- reordered within the file, files are parsed/included in a different- order, etc.)-- o The amount is separated into "commodity" (the symbol) and "amount"- (numeric quantity) fields.-- o The numeric amount is repeated in either the "credit" or "debit" col-- umn, for convenience. (Those names are not accurate in the account-- ing sense; it just puts negative amounts under credit and zero or- greater amounts under debit.)-- print-unique- print-unique- Print transactions which do not reuse an already-seen description.-- Example:-- $ cat unique.journal- 1/1 test- (acct:one) 1- 2/2 test- (acct:two) 2- $ LEDGER_FILE=unique.journal hledger print-unique- (-f option not supported)- 2015/01/01 test- (acct:one) 1-- register- register, reg, r- Show postings and their running total.-- The register command displays postings in date order, one per line, and- their running total. This is typically used with a query selecting a- particular account, to see that account's activity:-- $ hledger register checking- 2008/01/01 income assets:bank:checking $1 $1- 2008/06/01 gift assets:bank:checking $1 $2- 2008/06/02 save assets:bank:checking $-1 $1- 2008/12/31 pay off assets:bank:checking $-1 0-- With --date2, it shows and sorts by secondary date instead.-- The --historical/-H flag adds the balance from any undisplayed prior- postings to the running total. This is useful when you want to see- only recent activity, with a historically accurate running balance:-- $ hledger register checking -b 2008/6 --historical- 2008/06/01 gift assets:bank:checking $1 $2- 2008/06/02 save assets:bank:checking $-1 $1- 2008/12/31 pay off assets:bank:checking $-1 0-- The --depth option limits the amount of sub-account detail displayed.-- The --average/-A flag shows the running average posting amount instead- of the running total (so, the final number displayed is the average for- the whole report period). This flag implies --empty (see below). It- is affected by --historical. It works best when showing just one- account and one commodity.-- The --related/-r flag shows the other postings in the transactions of- the postings which would normally be shown.-- The --invert flag negates all amounts. For example, it can be used on- an income account where amounts are normally displayed as negative num-- bers. It's also useful to show postings on the checking account- together with the related account:-- $ hledger register --related --invert assets:checking-- With a reporting interval, register shows summary postings, one per- interval, aggregating the postings to each account:-- $ hledger register --monthly income- 2008/01 income:salary $-1 $-1- 2008/06 income:gifts $-1 $-2-- Periods with no activity, and summary postings with a zero amount, are- not shown by default; use the --empty/-E flag to see them:-- $ hledger register --monthly income -E- 2008/01 income:salary $-1 $-1- 2008/02 0 $-1- 2008/03 0 $-1- 2008/04 0 $-1- 2008/05 0 $-1- 2008/06 income:gifts $-1 $-2- 2008/07 0 $-2- 2008/08 0 $-2- 2008/09 0 $-2- 2008/10 0 $-2- 2008/11 0 $-2- 2008/12 0 $-2-- Often, you'll want to see just one line per interval. The --depth- option helps with this, causing subaccounts to be aggregated:-- $ hledger register --monthly assets --depth 1h- 2008/01 assets $1 $1- 2008/06 assets $-1 0- 2008/12 assets $-1 $-1-- Note when using report intervals, if you specify start/end dates these- will be adjusted outward if necessary to contain a whole number of- intervals. This ensures that the first and last intervals are full- length and comparable to the others in the report.-- Custom register output- register uses the full terminal width by default, except on windows.- You can override this by setting the COLUMNS environment variable (not- a bash shell variable) or by using the --width/-w option.-- The description and account columns normally share the space equally- (about half of (width - 40) each). You can adjust this by adding a- description width as part of --width's argument, comma-separated:- --width W,D . Here's a diagram (won't display correctly in --help):-- <--------------------------------- width (W) ---------------------------------->- date (10) description (D) account (W-41-D) amount (12) balance (12)- DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA-- and some examples:-- $ hledger reg # use terminal width (or 80 on windows)- $ hledger reg -w 100 # use width 100- $ COLUMNS=100 hledger reg # set with one-time environment variable- $ export COLUMNS=100; hledger reg # set till session end (or window resize)- $ hledger reg -w 100,40 # set overall width 100, description width 40- $ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40-- This command also supports output destination and output format selec-- tion.-- register-match- register-match- Print the one posting whose transaction description is closest to DESC,- in the style of the register command. If there are multiple equally- good matches, it shows the most recent. Query options (options, not- arguments) can be used to restrict the search space. Helps- ledger-autosync detect already-seen transactions when importing.-- rewrite- rewrite- Print all transactions, rewriting the postings of matched transactions.- For now the only rewrite available is adding new postings, like print- --auto.-- This is a start at a generic rewriter of transaction entries. It reads- the default journal and prints the transactions, like print, but adds- one or more specified postings to any transactions matching QUERY. The- posting amounts can be fixed, or a multiplier of the existing transac-- tion'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-- rewrites.hledger may consist of entries like:-- = ^income amt:<0 date:2017- (liabilities:tax) *0.33 ; tax on income- (reserve:grocery) *0.25 ; reserve 25% for grocery- (reserve:) *0.25 ; reserve 25% for grocery-- Note the single quotes to protect the dollar sign from bash, and the- two spaces between account and amount.-- More:-- $ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...- $ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'- $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'- $ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'-- Argument for --add-posting option is a usual posting of transaction- with an exception for amount specification. More precisely, you can- use '*' (star symbol) before the amount to indicate that that this is a- factor for an amount of original matched posting. If the amount- includes a commodity name, the new posting amount will be in the new- commodity; otherwise, it will be in the matched posting amount's com-- modity.-- Re-write rules in a file- During the run this tool will execute so called "Automated Transac-- tions" found in any journal it process. I.e instead of specifying this- operations in command line you can put them in a journal file.-- $ rewrite-rules.journal-- Make contents look like this:-- = ^income- (liabilities:tax) *.33-- = expenses:gifts- budget:gifts *-1- assets:budget *1-- Note that '=' (equality symbol) that is used instead of date in trans-- actions you usually write. It indicates the query by which you want to- match the posting to add new ones.-- $ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal-- This is something similar to the commands pipeline:-- $ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \- | hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \- --add-posting 'assets:budget *1' \- > rewritten-tidy-output.journal-- It is important to understand that relative order of such entries in- journal is important. You can re-use result of previously added post-- ings.-- Diff output format- To use this tool for batch modification of your journal files you may- find useful output in form of unified diff.-- $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33'-- Output might look like:-- --- /tmp/examples/sample.journal- +++ /tmp/examples/sample.journal- @@ -18,3 +18,4 @@- 2008/01/01 income- - assets:bank:checking $1- + assets:bank:checking $1- income:salary- + (liabilities:tax) 0- @@ -22,3 +23,4 @@- 2008/06/01 gift- - assets:bank:checking $1- + assets:bank:checking $1- income:gifts- + (liabilities:tax) 0-- If you'll pass this through patch tool you'll get transactions contain-- ing the posting that matches your query be updated. Note that multiple- files might be update according to list of input files specified via- --file options and include directives inside of these files.-- Be careful. Whole transaction being re-formatted in a style of output- from hledger print.-- See also:-- https://github.com/simonmichael/hledger/issues/99-- rewrite vs. print --auto- This command predates print --auto, and currently does much the same- thing, but with these differences:-- o with multiple files, rewrite lets rules in any file affect all other- files. print --auto uses standard directive scoping; rules affect- only child files.-- o rewrite's query limits which transactions can be rewritten; all are- printed. print --auto's query limits which transactions are printed.-- o rewrite applies rules specified on command line or in the journal.- print --auto applies rules specified in the journal.-- roi- roi- Shows the time-weighted (TWR) and money-weighted (IRR) rate of return- on your investments.-- This command assumes that you have account(s) that hold nothing but- your investments and whenever you record current appraisal/valuation of- these investments you offset unrealized profit and loss into account(s)- that, again, hold nothing but unrealized profit and loss.-- Any transactions affecting balance of investment account(s) and not- originating from unrealized profit and loss account(s) are assumed to- be your investments or withdrawals.-- At a minimum, you need to supply a query (which could be just an- account name) to select your investments with --inv, and another query- to identify your profit and loss transactions with --pnl.-- It will compute and display the internalized rate of return (IRR) and- time-weighted rate of return (TWR) for your investments for the time- period requested. Both rates of return are annualized before display,- regardless of the length of reporting interval.-- stats- stats- Show some journal statistics.-- The stats command displays summary information for the whole journal,- or a matched part of it. With a reporting interval, it shows a report- for each report period.-- Example:-- $ hledger stats- Main journal file : /src/hledger/examples/sample.journal- Included journal files :- Transactions span : 2008-01-01 to 2009-01-01 (366 days)- Last transaction : 2008-12-31 (2333 days ago)- Transactions : 5 (0.0 per day)- Transactions last 30 days: 0 (0.0 per day)- Transactions last 7 days : 0 (0.0 per day)- Payees/descriptions : 5- Accounts : 8 (depth 3)- Commodities : 1 ($)-- This command also supports output destination and output format selec-- tion.-- tags- tags- List all the tag names used in the journal. With a TAGREGEX argument,- only tag names matching the regular expression (case insensitive) are- shown. With QUERY arguments, only transactions matching the query are- considered.-- test- test- Run built-in unit tests.-- This command runs the unit tests built in to hledger-lib and hledger,- printing test names and results on stdout. If any test fails, the exit- code will be non-zero.-- Test names include a group prefix. If a (exact, case sensitive) group- prefix, or a full test name is provided as the first argument, only- that group or test is run.-- If a numeric second argument is provided, it will set the randomness- seed, for repeatable results from tests using randomness (currently- none of them).-- This is mainly used by developers, but it's nice to be able to san-- ity-check your installed hledger executable at any time. All tests are- expected to pass - if you ever see otherwise, something has gone wrong,- please report a bug!--ADD-ON COMMANDS- hledger also searches for external add-on commands, and will include- these in the commands list. These are programs or scripts in your PATH- whose name starts with hledger- and ends with a recognised file exten-- sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh).-- Add-ons can be invoked like any hledger command, but there are a few- things to be aware of. Eg if the hledger-web add-on is installed,-- o hledger -h web shows hledger's help, while hledger web -h shows- hledger-web's help.-- o Flags specific to the add-on must have a preceding -- to hide them- from hledger. So hledger web --serve --port 9000 will be rejected;- you must use hledger web -- --serve --port 9000.-- o You can always run add-ons directly if preferred:- hledger-web --serve --port 9000.-- Add-ons are a relatively easy way to add local features or experiment- with new ideas. They can be written in any language, but haskell- scripts have a big advantage: they can use the same hledger (and- haskell) library functions that built-in commands do, for command-line- options, journal parsing, reporting, etc.-- Here are some hledger add-ons available:-- Official add-ons- These are maintained and released along with hledger.-- api- hledger-api serves hledger data as a JSON web API.-- ui- hledger-ui provides an efficient curses-style interface.-- web- hledger-web provides a simple web interface.-- Third party add-ons- These are maintained separately, and usually updated shortly after a- hledger release.-- diff- hledger-diff shows differences in an account's transactions between one- journal file and another.-- iadd- hledger-iadd is a curses-style, more interactive replacement for the- add command.-- interest- hledger-interest generates interest transactions for an account accord-- ing to various schemes.-- irr- hledger-irr calculates the internal rate of return of an investment- account, but it's superseded now by the built-in roi command.-- Experimental add-ons- These are available in source form in the hledger repo's bin/ direc-- tory; installing them is pretty easy. They may be less mature and doc-- umented than built-in commands. Reading and tweaking these is a good- way to start making your own!-- autosync- hledger-autosync is a symbolic link for easily running ledger-autosync,- if installed. ledger-autosync does deduplicating conversion of OFX- data and some CSV formats, and can also download the data if your bank- offers OFX Direct Connect.-- chart- hledger-chart.hs is an old pie chart generator, in need of some love.-- check- hledger-check.hs checks more powerful account balance assertions.--ENVIRONMENT- COLUMNS The screen width used by the register command. Default: the- full terminal width.-- LEDGER_FILE The journal file path when not specified with -f. Default:- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-- nal).--FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal).--BUGS- The need to precede addon command options with -- when invoked from- hledger is awkward.-- When input data contains non-ascii characters, a suitable system locale- must be configured (or there will be an unhelpful error). Eg on POSIX,- set LANG to something other than C.-- In a Microsoft Windows CMD window, non-ascii characters and colours are- not supported.-- In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger- add.-- Not all of Ledger's journal file syntax is supported. See file format- differences.-- On large data files, hledger is slower and uses more memory than- Ledger.--TROUBLESHOOTING- Here are some issues you might encounter when you run hledger (and- remember you can also seek help from the IRC channel, mail list or bug- tracker):-- Successfully installed, but "No command 'hledger' found"- stack and cabal install binaries into a special directory, which should- be added to your PATH environment variable. Eg on unix-like systems,- that is ~/.local/bin and ~/.cabal/bin respectively.-- I set a custom LEDGER_FILE, but hledger is still using the default file- LEDGER_FILE should be a real environment variable, not just a shell- variable. The command env | grep LEDGER_FILE should show it. You may- need to use export. Here's an explanation.-- "Illegal byte sequence" or "Invalid or incomplete multibyte or wide- character" errors- In order to handle non-ascii letters and symbols (like ), hledger needs- an appropriate locale. This is usually configured system-wide; you can- also configure it temporarily. The locale may need to be one that sup-- ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,- I'm not sure yet).-- Here's an example of setting the locale temporarily, on ubuntu- gnu/linux:-- $ file my.journal- my.journal: UTF-8 Unicode text # <- the file is UTF8-encoded- $ locale -a- C- en_US.utf8 # <- a UTF8-aware locale is available- POSIX- $ LANG=en_US.utf8 hledger -f my.journal print # <- use it for this command-- Here's one way to set it permanently, there are probably better ways:-- $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile- $ bash --login-- If we preferred to use eg fr_FR.utf8, we might have to install that- first:-- $ apt-get install language-pack-fr- $ locale -a- C- en_US.utf8- fr_BE.utf8- fr_CA.utf8- fr_CH.utf8- fr_FR.utf8- fr_LU.utf8- POSIX- $ LANG=fr_FR.utf8 hledger -f my.journal print-- Note some platforms allow variant locale spellings, but not all (ubuntu- accepts fr_FR.UTF8, mac osx requires exactly fr_FR.UTF-8).----REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)---AUTHORS- Simon Michael <simon@joyful.com> and contributors---COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.---SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org----hledger 1.14 March 2019 hledger(1)+HLEDGER(1) hledger User Manuals HLEDGER(1)++NAME+ hledger - a robust, friendly plain text accounting app (command line ver-+ sion).++SYNOPSIS+ hledger+ or+ hledger COMMAND [OPTS] [ARGS]++DESCRIPTION+ hledger is a robust, user-friendly, cross-platform set of programs for+ tracking money, time, or any other commodity, using double-entry accounting+ and a simple, editable file format. hledger is inspired by and largely+ compatible with ledger(1), and largely interconvertible with beancount(1).++ This manual is for hledger's command line interface, version 1.52. It also+ describes the common options, file formats and concepts used by all hledger+ programs. It might accidentally teach you some bookkeeping/accounting as+ well! You don't need to know everything in here to use hledger produc-+ tively, but when you have a question about functionality, this doc should+ answer it. It is detailed, so do skip ahead or skim when needed. You can+ read it on hledger.org, or as an info manual or man page on your system.+ You can also open a built-in copy, at a point of interest, by running+ hledger --man [CMD], hledger --info [CMD] or hledger help [TOPIC].++ (And for shorter help, try hledger --tldr [CMD].)++ The main function of the hledger CLI is to read plain text files describing+ financial transactions, crunch the numbers, and print a useful report on+ the terminal (or save it as HTML, CSV, JSON or SQL). Many reports are+ available, as subcommands. hledger will also detect other hledger-* exe-+ cutables as extra subcommands.++ hledger usually reads from (and appends to) a journal file specified by the+ LEDGER_FILE environment variable (defaulting to $HOME/.hledger.journal); or+ you can specify files with -f options. It can also read timeclock files,+ timedot files, or any CSV/SSV/TSV file with a date field.++ Here is a small journal file describing one transaction:++ 2015-10-16 bought food+ expenses:food $10+ assets:cash++ Transactions are dated movements of money (etc.) between two or more ac-+ counts: bank accounts, your wallet, revenue/expense categories, people,+ etc. You can choose any account names you wish, using : to indicate subac-+ counts. There must be at least two spaces between account name and amount.+ Positive amounts are inflow to that account (debit), negatives are outflow+ from it (credit). (Some reports show revenue, liability and equity account+ balances as negative numbers as a result; this is normal.)++ hledger's add command can help you add transactions, or you can install+ other data entry UIs like hledger-web or hledger-iadd. For more exten-+ sive/efficient changes, use a text editor: Emacs + ledger-mode, VIM ++ vim-ledger, or VS Code + hledger-vscode are some good choices (see+ https://hledger.org/editors.html).++ To get started, run hledger add and follow the prompts, or save some en-+ tries like the above in $HOME/.hledger.journal, then try commands like:++ $ hledger print -x+ $ hledger aregister assets+ $ hledger balance+ $ hledger balancesheet+ $ hledger incomestatement++ Run hledger to list the commands. See also the "Starting a journal file"+ and "Setting opening balances" sections in PART 5: COMMON TASKS.++PART 1: USER INTERFACE+Input+ hledger reads one or more data files, each time you run it. You can spec-+ ify a file with -f, like so++ $ hledger -f FILE [-f FILE2 ...] print++ Files are most often in hledger's journal format, with the .journal file+ extension (.hledger or .j also work); these files describe transactions,+ like an accounting general journal.++ When no file is specified, hledger looks for .hledger.journal in your home+ directory.++ But most people prefer to keep financial files in a dedicated folder, per-+ haps with version control. Also, starting a new journal file each year is+ common (it's not required, but helps keep things fast and organised). So+ we usually configure a different journal file, by setting the LEDGER_FILE+ environment variable, to something like ~/finance/2023.journal. For more+ about how to do that on your system, see Common tasks > Setting+ LEDGER_FILE.++ Text encoding+ hledger expects non-ascii input to be decodable with the system locale's+ text encoding. (For CSV/SSV/TSV files, this can be overridden by the en-+ coding CSV rule.)++ So, trying to read non-ascii files which have the wrong text encoding, or+ when no system locale is configured, will fail. To fix this, configure+ your system locale appropriately, and/or convert the files to your system's+ text encoding (using iconv on unix, or powershell or notepad on Windows).+ See Install: Text encoding for more tips.++ hledger's output will use the system locale's encoding.++ hledger's docs and example files mostly use UTF-8 encoding.++ Data formats+ Usually the data file is in hledger's journal format, but it can be in any+ of the supported file formats, which currently are:++ Reader: Reads: Automatically used for+ files with extensions:+ -----------------------------------------------------------------------------+ journal hledger journal files and some .journal .j .hledger+ Ledger journals, for transactions .ledger+ timeclock timeclock files, for precise time .timeclock+ logging+ timedot timedot files, for approximate .timedot+ time logging+ csv Comma- or other delimiter-sepa- .csv+ rated values, for data import+ ssv Semicolon separated values .ssv+ tsv Tab separated values .tsv+ rules CSV/SSV/TSV/other separated val- .rules+ ues, alternate way++ These formats are described in more detail below.++ hledger detects the format automatically based on the file extensions shown+ above. If it can't recognise the file extension, it assumes journal for-+ mat. So for non-journal files, it's important to use a recognised file ex-+ tension, so as to either read successfully or to show relevant error mes-+ sages.++ You can also force a specific reader/format by prefixing the file path with+ the format and a colon. Eg, to read a .dat file containing tab separated+ values:++ $ hledger -f tsv:/some/file.dat stats++ Standard input+ The file name - means standard input:++ $ cat FILE | hledger -f- print++ If reading non-journal data in this way, you'll need to write the format as+ a prefix, like timeclock: here:++ $ echo 'i 2009/13/1 08:00:00' | hledger print -f timeclock:-++ Multiple files+ You can specify multiple -f options, to read multiple files as one big+ journal. When doing this, note that certain features (described below)+ will be affected:++ * Balance assertions will not see the effect of transactions in previous+ files. (Usually this doesn't matter as each file will set the corre-+ sponding opening balances.)++ * Some directives will not affect previous or subsequent files.++ If needed, you can work around these by using a single parent file which+ includes the others, or concatenating the files into one, eg: cat a.journal+ b.journal | hledger -f- CMD.++ Strict mode+ hledger checks input files for valid data. By default, the most important+ errors are detected, while still accepting easy journal files without a lot+ of declarations:++ * Are the input files parseable, with valid syntax ?++ * Are all transactions balanced ?++ * Do all balance assertions pass ?++ With the -s/--strict flag, additional checks are performed:++ * Are all accounts posted to, declared with an account directive ? (Ac-+ count error checking)++ * Are all commodities declared with a commodity directive ? (Commodity er-+ ror checking)++ * Are all commodity conversions declared explicitly ?++ You can use the check command to run individual checks - the ones listed+ above and some more.++Commands+ hledger provides various subcommands for getting things done. Most of+ these commands do not change the journal file; they just read it and output+ a report. A few commands assist with adding data and file management.+ Some often-used commands are add, print, register, balancesheet and in-+ comestatement.++ To show a summary of commands, run hledger with no arguments. You can see+ the same commands summary at the start of PART 4: COMMANDS below.++ To use a particular command, run hledger CMD [CMDOPTS] [CMDARGS],++ * CMD is the full command name, or its standard abbreviation shown in the+ commands list, or any unambiguous prefix of the name.++ * CMDOPTS are command-specific options, if any. Command-specific options+ must be written after the command name. Eg: hledger print -x.++ * CMDARGS are additional arguments to the command, if any. Most hledger+ commands accept arguments representing a query, to limit the data in some+ way. Eg: hledger reg assets:checking.++ To list a command's options, arguments, and documentation in the terminal,+ run hledger CMD -h. Eg: hledger bal -h.++ Add-on commands+ In addition to the built-in commands, you can install add-on commands,+ which will also appear in hledger's commands list. Some of these can be+ installed as separate packages; others can be found in hledger's bin/ di-+ rectory, documented at https://hledger.org/scripts.html.++ Add-on commands are programs or scripts in your shell's PATH, whose name+ starts with "hledger-" and ends with no extension or a recognised extension+ (".bat", ".com", ".exe", ".hs", ".js", ".lhs", ".lua", ".php", ".pl",+ ".py", ".rb", ".rkt", or ".sh"), and (on unix and mac) which has executable+ permission for the current user.++ You can run add-on commands directly: hledger-ui --watch.++ Or you can run them with hledger, like built-in commands: hledger ui+ --watch. In this case hledger's config file will be used, so you can set+ custom options for the addon there. (Before hledger 1.50, an -- argument+ was needed before addon options, but not any more.)++Options+ Run hledger -h to see general command line help. Options can be written+ either before or after the command name. These options are specific to the+ hledger CLI:++ Flags:+ --conf=CONFFILE Use extra options defined in this config file. If+ not specified, searches upward and in XDG config+ dir for hledger.conf (or .hledger.conf in $HOME).+ -n --no-conf ignore any config file++ And the following general options are common to most hledger commands:++ General input/data transformation flags:+ -f --file=[FMT:]FILE Read data from FILE, or from stdin if FILE is -,+ inferring format from extension or a FMT: prefix.+ Can be specified more than once. If not specified,+ reads from $LEDGER_FILE or $HOME/.hledger.journal.+ --rules=RULESFILE Use rules defined in this rules file for+ converting subsequent CSV/SSV/TSV files. If not+ specified, uses FILE.csv.rules for each FILE.csv.+ --alias=A=B|/RGX/=RPL transform account names from A to B, or by+ replacing regular expression matches+ --auto generate extra postings by applying auto posting+ rules ("=") to all transactions+ --forecast[=PERIOD] Generate extra transactions from periodic rules+ ("~"), from after the latest ordinary transaction+ until 6 months from now. Or, during the specified+ PERIOD (the equals is required). Auto posting rules+ will also be applied to these transactions. In+ hledger-ui, also make future-dated transactions+ visible at startup.+ -I --ignore-assertions don't check balance assertions by default+ --txn-balancing=... how to check that transactions are balanced:+ 'old': use global display precision+ 'exact': use transaction precision (default)+ --infer-costs infer conversion equity postings from costs+ --infer-equity infer costs from conversion equity postings+ --infer-market-prices infer market prices from costs+ --pivot=TAGNAME use a different field or tag as account names+ -s --strict do extra error checks (and override -I)+ --verbose-tags add tags indicating generated/modified data++ General output/reporting flags (supported by some commands):+ -b --begin=DATE include postings/transactions on/after this date+ -e --end=DATE include postings/transactions before this date+ (with a report interval, will be adjusted to+ following subperiod end)+ -D --daily multiperiod report with 1 day interval+ -W --weekly multiperiod report with 1 week interval+ -M --monthly multiperiod report with 1 month interval+ -Q --quarterly multiperiod report with 1 quarter interval+ -Y --yearly multiperiod report with 1 year interval+ -p --period=PERIODEXP set begin date, end date, and/or report interval,+ with more flexibility+ --today=DATE override today's date (affects relative dates)+ --date2 match/use secondary dates instead (deprecated)+ -U --unmarked include only unmarked postings/transactions+ -P --pending include only pending postings/transactions+ -C --cleared include only cleared postings/transactions+ (-U/-P/-C can be combined)+ -R --real include only non-virtual postings+ -E --empty Show zero items, which are normally hidden.+ In hledger-ui & hledger-web, do the opposite.+ --depth=DEPTHEXP if a number (or -NUM): show only top NUM levels+ of accounts. If REGEXP=NUM, only apply limiting to+ accounts matching the regular expression.+ -B --cost show amounts converted to their cost/sale amount+ -V --market Show amounts converted to their value at period+ end(s) in their default valuation commodity.+ Equivalent to --value=end.+ -X --exchange=COMM Show amounts converted to their value at period+ end(s) in the specified commodity.+ Equivalent to --value=end,COMM.+ --value=WHEN[,COMM] show amounts converted to their value on the+ specified date(s) in their default valuation+ commodity or a specified commodity. WHEN can be:+ 'then': value on transaction dates+ 'end': value at period end(s)+ 'now': value today+ YYYY-MM-DD: value on given date+ -c --commodity-style=S Override a commodity's display style.+ Eg: -c '.' or -c '1.000,00 EUR'+ --pretty[=YN] Use box-drawing characters in text output? Can be+ 'y'/'yes' or 'n'/'no'.+ If YN is specified, the equals is required.++ General help flags:+ -h --help show command line help+ --tldr show command examples with tldr+ --info show the manual with info+ --man show the manual with man+ --version show version information+ --debug=[1-9] show this much debug output (default: 1)+ --pager=YN use a pager when needed ? y/yes (default) or n/no+ --color=YNA --colour use ANSI color ? y/yes, n/no, or auto (default)++ Usually hledger accepts any unambiguous flag prefix, eg you can write --tl+ instead of --tldr or --dry instead of --dry-run.++ You can combine short flags which don't take arguments, eg you can write+ -MAST instead of -M -A -S -T. Flags requiring an argument can't be com-+ bined in this way (-If FILE won't work).++ If the same option appears more than once in a command line, usually the+ last (right-most) wins. Similarly, if mutually exclusive flags are used+ together, the right-most wins. (When flags are mutually exclusive, they'll+ usually have a group prefix in --help.)++ With most commands, arguments are interpreted as a hledger query which fil-+ ter the data. Some queries can be expressed either with options or with+ arguments.++ Below are more tips for using the command line interface - feel free to+ skip these until you need them.++ Special characters+ In commands you type at the command line, certain characters have special+ meaning and sometimes need to be "escaped" or "quoted", by prefixing back-+ slashes or enclosing in quotes.++ If you are able to minimise the use of special characters in your data, you+ won't have to deal with this as much. For example, you could use hyphen -+ or underscore _ instead of spaces in account names, and you could use the+ USD currency code instead of the $ currency symbol in amounts.++ But if you prefer to use spaced account names and $, it's fine. Just be+ aware of this topic so you can check this doc when needed. (These examples+ are mostly tested on unix; some details might need to be adapted if you're+ on Windows.)++ Escaping shell special characters+ These are some characters which may have special meaning to your shell (the+ program which interprets command lines):++ * SPACE, <, >, (, ), |, \, %++ * $ if followed by a word character++ So for example, to match an account name containing spaces, like "credit+ card", don't write:++ $ hledger register credit card++ Instead, enclose the name in single quotes:++ $ hledger register 'credit card'++ On unix or in Windows powershell, if you use double quotes your shell will+ silently treat $ as variable interpolation. So you should probably avoid+ double quotes, unless you want that behaviour, eg in a script:++ $ hledger register "assets:$SOMEACCT"++ But in an older Windows CMD.EXE window, you must use double quotes:++ C:\Users\Me> hledger register "credit card"++ On unix or in Windows powershell, as an alternative to quotes you can write+ a backslash before each special character:++ $ hledger register credit\ card++ Finally, since hledger's query arguments are regular expressions (described+ below), you could also fill that gap with . which matches any character:++ $ hledger register credit.card++ Escaping regular expression special characters+ Some characters also have special meaning in regular expressions, which+ hledger's arguments often are. Those include:++ * ., ^, $, [, ], (, ), |, \++ To escape one of these, write \ before it. But note this is in addition to+ the shell escaping above. So for characters which are special to both+ shell and regular expressions, like \ and $, you will sometimes need two+ levels of escaping.++ For example, a balance report that uses a cur: query restricting it to just+ the $ currency, should be written like this:++ $ hledger balance cur:\\$++ Explanation:++ 1. Add a backslash \ before the dollar sign $ to protect it from regular+ expressions (so it will be matched literally with no special meaning).++ 2. Add another backslash before that backslash, to protect it from the+ shell (so the shell won't consume it).++ 3. $ doesn't need to be protected from the shell in this case, because it's+ not followed by a word character; but it would be harmless to do so.++ But here's another way to write that, which tends to be easier: add back-+ slashes to escape from regular expressions, then enclose with quotes to es-+ cape from the shell:++ $ hledger balance cur:'\$'++ Escaping in other situations+ hledger options and arguments are sometimes used in places other than the+ command line, where the escaping/quoting rules are different. For example,+ backslash-quoting may not be available. Here's a quick reference:++ In unix shell Use single quotes and/or backslash (or double quotes+ for variable interpolation)+ In Windows power- Use single quotes (or double quotes for variable in-+ shell terpolation)+ In Windows cmd Use double quotes+ In hledger-ui's Use single or double quotes+ filter prompt+ In hledger-web's Use single or double quotes+ search form+ In an argument Don't use spaces, don't shell-escape, do regex-es-+ file cape, write one argument/option per line+ In a config file Use single or double quotes, and enclose the whole+ argument ('desc:a b' not desc:'a b')+ In ghci (the Use double quotes, and enclose the whole argument+ Haskell REPL)++ Unicode characters+ hledger is expected to handle non-ascii characters correctly:++ * they should be parsed correctly in input files and on the command line,+ by all hledger tools (add, iadd, hledger-web's search/add/edit forms,+ etc.)++ * they should be displayed correctly by all hledger tools, and on-screen+ alignment should be preserved.++ This requires a well-configured environment. Here are some tips:++ * A system locale must be configured, which can decode the characters being+ used. This is essential - see Text encoding and Install: Text encoding.++ * Your terminal software (eg Terminal.app, iTerm, CMD.exe, xterm..) must+ support unicode. On Windows, you may need to use Windows Terminal.++ * The terminal must be using a font which includes the required unicode+ glyphs.++ * The terminal should be configured to display wide characters as double+ width (for report alignment).++ * On Windows, for best results you should run hledger in the same kind of+ environment in which it was built. Eg hledger built in the standard+ CMD.EXE environment (like the binaries on our download page) might show+ display problems when run in a cygwin or msys terminal, and vice versa.+ (See eg #961).++ Regular expressions+ A regular expression (regexp) is a small piece of text where certain char-+ acters (like ., ^, $, +, *, (), |, [], \) have special meanings, forming a+ tiny language for matching text precisely - very useful in hledger and+ elsewhere. To learn all about them, visit regular-expressions.info.++ hledger supports regexps whenever you are entering a pattern to match some-+ thing, eg in query arguments, account aliases, CSV if rules, hledger-web's+ search form, hledger-ui's / search, etc. You may need to wrap them in+ quotes, especially at the command line (see Special characters above).+ Here are some examples:++ Account name queries (quoted for command line use):++ Regular expression: Matches:+ ------------------- ------------------------------------------------------------+ bank assets:bank, assets:bank:savings, expenses:art:banksy, ...+ :bank assets:bank:savings, expenses:art:banksy+ :bank: assets:bank:savings+ '^bank' none of those ( ^ matches beginning of text )+ 'bank$' assets:bank ( $ matches end of text )+ 'big \$ bank' big $ bank ( \ disables following character's special meaning )+ '\bbank\b' assets:bank, assets:bank:savings ( \b matches word boundaries )+ '(sav|check)ing' saving or checking ( (|) matches either alternative )+ 'saving|checking' saving or checking ( outer parentheses are not needed )+ 'savings?' saving or savings ( ? matches 0 or 1 of the preceding thing )+ 'my +bank' my bank, my bank, ... ( + matches 1 or more of the preceding thing )+ 'my *bank' mybank, my bank, my bank, ... ( * matches 0 or more of the preceding thing )+ 'b.nk' bank, bonk, b nk, ... ( . matches any character )++ Some other queries:++ desc:'amazon|amzn|audible' Amazon transactions+ cur:EUR amounts with commodity symbol containing EUR+ cur:'\$' amounts with commodity symbol containing $+ cur:'^\$$' only $ amounts, not eg AU$ or CA$+ cur:....? amounts with 4-or-more-character symbols+ tag:.=202[1-3] things with any tag whose value contains 2021, 2022 or 2023++ Account name aliases: accept . instead of : as account separator:++ alias /\./=: replaces all periods in account names with colons++ Show multiple top-level accounts combined as one:++ --alias='/^[^:]+/=combined' ( [^:] matches any character other than : )++ Show accounts with the second-level part removed:++ --alias '/^([^:]+):[^:]+/ = \1'+ match a top-level account and a second-level account+ and replace those with just the top-level account+ ( \1 in the replacement text means "whatever was matched+ by the first parenthesised part of the regexp"++ CSV rules: match CSV records containing dining-related MCC codes:++ if \?MCC581[124]++ Match CSV records with a specific amount around the end/start of month:++ if %amount \b3\.99+ & %date (29|30|31|01|02|03)$++ hledger's regular expressions+ hledger's regular expressions come from the regex-tdfa library. If they're+ not doing what you expect, it's important to know exactly what they sup-+ port:++ 1. they are case insensitive++ 2. they are infix matching (they do not need to match the entire thing be-+ ing matched)++ 3. they are POSIX ERE (extended regular expressions)++ 4. they also support GNU word boundaries (\b, \B, \<, \>)++ 5. backreferences are supported when doing text replacement in account+ aliases or CSV rules, where backreferences can be used in the replace-+ ment string to reference capturing groups in the search regexp. Other-+ wise, if you write \1, it will match the digit 1.++ 6. they do not support lazy quantifiers (*?), mode modifiers ((?s)), char-+ acter classes (\w, \d), or anything else not mentioned above.++ 7. they may not (I'm guessing not) properly support right-to-left or bidi-+ rectional text.++ Some things to note:++ * In the alias directive and --alias option, regular expressions must be+ enclosed in forward slashes (/REGEX/). Elsewhere in hledger, these are+ not required.++ * In queries, to match a regular expression metacharacter like $ as a lit-+ eral character, prepend a backslash. Eg to search for amounts with the+ dollar sign in hledger-web, write cur:\$.++ * On the command line, some metacharacters like $ have a special meaning to+ the shell and so must be escaped at least once more. See Special charac-+ ters.++ Argument files+ You can save a set of command line options and arguments in a file, and+ then use them by writing @FILE.args as a hledger command argument. The+ .args file extension is conventional, but not required. In an argument+ file,++ * Each line can contain one argument, flag, or option.++ * Blank lines or lines beginning with # are ignored.++ * An option's flag and value should be joined by =.++ * An option value or an argument may contain spaces. Don't use single or+ double quotes.++ * And generally, use one less level of quoting/escaping than at the command+ line. Eg cur:\$, not cur:\\$ as on the command line.++ For example:++ # cash.args++ assets:cash+ assets:charles schwab:sweep+ cur:\$+ -c=$1.++ $ hledger bal @cash.args++ Config files+ With hledger 1.40+, you can save extra command line options and arguments+ in a more featureful hledger config file. Here's a small example:++ # General options are listed first, and used with hledger commands that support them.+ --pretty++ # Options following a `[COMMAND]` heading are used with that hledger command only.+ [print]+ --explicit --infer-costs++ To use a config file, specify it with the --conf option. Its options will+ be inserted near the start of your command line, so you can override them+ with command line options if needed.++ Or, you can set up an automatic config file that is used whenever you run+ hledger, by creating hledger.conf in the current directory or above, or+ .hledger.conf in your home directory (~/.hledger.conf), or hledger.conf in+ your XDG config directory (~/.config/hledger/hledger.conf).++ Here is another example config you could start with: https://github.com/si-+ monmichael/hledger/blob/master/hledger.conf.sample++ You can put not only options, but also arguments in a config file. If the+ first word in a config file's top (general) section does not begin with a+ dash (eg: print), it is treated as the command argument (overriding any ar-+ gument on the command line).++ On unix machines, you can add a shebang line at the top of a config file,+ set executable permission on the file, and use it like a script. Eg (the+ -S is needed on some operating systems):++ #!/usr/bin/env -S hledger --conf++ You can ignore config files by adding the -n/--no-conf flag to the command+ line. This is useful when using hledger in scripts, or when troubleshoot-+ ing. When both --conf and --no-conf options are used, the right-most wins.++ To inspect the processing of config files, use --debug or --debug=8. Or,+ run the setup command, which will display any active config files. (setup+ is not affected by config files itself, unlike other commands.)++ Warning!++ There aren't many hledger features that need a warning, but this is one!++ Automatic config files, while convenient, also make hledger less pre-+ dictable and dependable. It's easy to make a config file that changes a+ report's behaviour, or breaks your hledger-using scripts/applications, in+ ways that will surprise you later.++ If you don't want this,++ 1. Just don't create a hledger.conf file on your machine.++ 2. Also be alert to downloaded directories which may contain a hledger.conf+ file.++ 3. Also if you are sharing scripts or examples or support, consider that+ others may have a hledger.conf file.++ Conversely, once you decide to use this feature, try to remember:++ 1. Whenever a hledger command does not work as expected, try it again with+ -n (--no-conf) to see if a config file was to blame.++ 2. Whenever you call hledger from a script, consider whether that call+ should use -n or not.++ 3. Be conservative about what you put in your config file; try to consider+ the effect on all your reports.++ 4. To troubleshoot the effect of config files, run with --debug or --debug+ 8.++ The config file feature was added in hledger 1.40.++ Shell completions+ If you use the bash or zsh shells, you can optionally set up context-sensi-+ tive autocompletion for hledger command lines. Try pressing+ hledger<SPACE><TAB><TAB> (should list all hledger commands) or hledger reg+ acct:<TAB><TAB> (should list your top-level account names). If completions+ aren't working, or for more details, see Install > Shell completions.++Output+ Output destination+ hledger commands send their output to the terminal by default. You can of+ course redirect this, eg into a file, using standard shell syntax:++ $ hledger print > foo.txt++ Some commands (print, register, stats, the balance commands) also provide+ the -o/--output-file option, which does the same thing without needing the+ shell. Eg:++ $ hledger print -o foo.txt+ $ hledger print -o - # write to stdout (the default)++ Output format+ Some commands offer other kinds of output, not just text on the terminal.+ Here are those commands and the formats currently supported:++ command txt html csv/tsv fods beancount sql json+ --------------------------------------------------------------------------------------------+ aregister Y Y Y Y Y+ balance Y Y Y Y Y+ balancesheet Y Y Y Y Y+ balancesheetequity Y Y Y Y Y+ cashflow Y Y Y Y Y+ incomestatement Y Y Y Y Y+ print Y Y Y Y Y Y Y+ register Y Y Y Y Y++ You can also see which output formats a command supports by running hledger+ CMD -h and looking for the -O/--output-format=FMT option,++ You can select the output format by using that option:++ $ hledger print -O csv # print CSV to standard output++ or by choosing a suitable filename extension with the -o/--out-+ put-file=FILE.FMT option:++ $ 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:++ $ hledger balancesheet -o foo.txt -O csv # write CSV to foo.txt++ Here are some notes about the various output formats.++ Text output+ This is the default: human readable, plain text report output, suitable for+ viewing with a monospace font in a terminal. If your data contains unicode+ or wide characters, you'll need a terminal and font that render those cor-+ rectly. (This can be challenging on MS Windows.)++ Some reports (register, aregister) will normally use the full window width.+ If this isn't working or you want to override it, you can use the+ -w/--width option.++ Balance reports (balance, balancesheet, incomestatement...) use whatever+ width they need. Multi-period multi-currency reports can often be wider+ than the window. Besides using a pager, helpful techniques for this situa-+ tion include --layout=bare, -X COMM, cur:, --transpose, --tree, --depth,+ --drop, switching to html output, etc.++ Box-drawing characters+ hledger draws simple table borders by default, to minimise the risk of dis-+ play problems caused by a terminal/font not supporting box-drawing charac-+ ters.++ But your terminal and font probably do support them, so we recommend using+ the --pretty flag to show prettier tables in the terminal. This is a good+ flag to add to your hledger config file.++ Colour+ hledger tries to automatically detect ANSI colour and text styling support+ and use it when appropriate. (Currently, it is used rather minimally: some+ reports show negative numbers in red, and help output uses bold text for+ emphasis.)++ You can override this by setting the NO_COLOR environment variable to dis-+ able it, or by using the --color/--colour option, perhaps in your config+ file, with a y/yes or n/no value to force it on or off.++ Paging+ In unix-like environments, when displaying large output (in any output for-+ mat) in the terminal, hledger tries to use a pager when appropriate. (You+ can disable this with the --pager=no option, perhaps in your config file.)++ The pager shows one page of text at a time, and lets you scroll around to+ see more. While it is active, usually SPACE shows the next page, h shows+ help, and q quits. The home/end/page up/page down/cursor keys, and mouse+ scrolling, may also work.++ hledger will use the pager specified by the PAGER environment variable,+ otherwise less if available, otherwise more if available. (With one excep-+ tion: hledger help -p TOPIC will always use less, so that it can scroll to+ the topic.)++ The pager is expected to display hledger's ANSI colour and text styling.+ If you see junk characters, you might need to configure your pager to han-+ dle ANSI codes. Or you could disable colour as described above.++ If you are using the less pager, hledger tries to provide a consistently+ pleasant experience by running it with some extra options added to your+ LESS environment variable:++ --chop-long-lines --hilite-unread --ignore-case --no-init+ --quit-if-one-screen --shift=8 --squeeze-blank-lines --use-backslash++ and when colour output is enabled:++ --RAW-CONTROL-CHARS++ You can prevent this by setting your preferred options in the HLEDGER_LESS+ variable, which will be used instead of LESS.++ HTML output+ HTML output can be styled by an optional hledger.css file in the same di-+ rectory.++ HTML output will be a HTML fragment, not a complete HTML document. Like+ other hledger output, for non-ascii characters it will use the system lo-+ cale's text encoding (see Text encoding).++ CSV / TSV output+ In CSV or TSV output, digit group marks (such as thousands separators) are+ disabled automatically.++ FODS output+ FODS is the OpenDocument Spreadsheet format as plain XML, as accepted by+ LibreOffice and OpenOffice. If you use their spreadsheet applications,+ this is better than CSV because it works across locales (decimal point vs.+ decimal comma, character encoding stored in XML header, thus no problems+ with umlauts), it supports fixed header rows and columns, cell types+ (string vs. number vs. date), separation of number and currency (currency+ is displayed but the cell type is still a number accessible for computa-+ tion), styles (bold), borders. Btw. you can still extract CSV from+ FODS/ODS using various utilities like libreoffice --headless or ods2csv.++ Beancount output+ This is Beancount's journal format. You can use this to export your+ hledger data to Beancount, eg to use the Fava web app.++ hledger will try to adjust your data to suit Beancount, automatically. Be+ cautious and check the conversion until you are confident it is good. If+ you plan to export to Beancount often, you may want to follow its conven-+ tions, for a cleaner conversion:++ * use Beancount-friendly account names++ * use currency codes instead of currency symbols++ * use cost notation instead of equity conversion postings++ * avoid virtual postings, balance assignments, and secondary dates.++ There is one big adjustment you must handle yourself: for Beancount, the+ top level account names must be Assets, Liabilities, Equity, Income, and/or+ Expenses. You can use account aliases to rewrite your account names tem-+ porarily, if needed, as in this hledger2beancount.conf config file.++ 2024-12-20: Some more things not yet handled for you:++ * P directives are not converted automatically - convert those yourself.++ * Balance assignments are not converted (Beancount doesn't support them) -+ replace those with explicit amounts.++ Beancount account names+ Aside from the top-level names, hledger will adjust your account names to+ make valid Beancount account names, by capitalising each part, replacing+ spaces with -, replacing other unsupported characters with C<HEXBYTES>,+ prepending A to account name parts which don't begin with a letter or+ digit, and appending :A to account names which have only one part.++ Beancount commodity names+ hledger will adjust your commodity names to make valid Beancount commod-+ ity/currency names, which must be 2-24 uppercase letters, digits, or ', .,+ _, -, beginning with a letter and ending with a letter or digit. hledger+ will convert known currency symbols to ISO 4217 currency codes, capitalise+ letters, replace spaces with -, replace other unsupported characters with+ C<HEXBYTES>, and prepend or append C if needed.++ Beancount virtual postings+ Beancount doesn't allow virtual postings; if you have any, they will be+ omitted from beancount output.++ Beancount metadata+ hledger tags will be converted to Beancount metadata (except for tags whose+ name begins with _). Metadata names will be adjusted to be Beancount-com-+ patible: beginning with a lowercase letter, at least two characters long,+ and with unsupported characters encoded. Metadata values will use Bean-+ count's string type.++ In hledger, objects can have the same tag repeated with multiple values.+ Eg an assets:cash account might have both type:Asset and type:Cash tags.+ For Beancount these will be combined into one, with the values combined,+ comma separated. Eg: type: "Asset, Cash".++ Beancount costs+ Beancount doesn't allow redundant costs and conversion postings as hledger+ does. If you have any of these, the conversion postings will be omitted.+ Currently we support at most one cost + conversion postings group per+ transaction.++ Beancount operating currency+ Declaring an operating currency (or several) improves Beancount and Fava+ reports. Currently hledger will declare each currency used in cost amounts+ as an operating currency. If needed, replace these with your own declara-+ tion, like++ option "operating_currency" "USD"++ SQL output+ SQL output is expected to work at least with SQLite, MySQL and Postgres.++ The SQL statements are expected to be executed in the empty database. If+ you already have tables created via SQL output of hledger, you would proba-+ bly want to either clear data from these (via delete or truncate SQL state-+ ments) or drop the tables completely before import; otherwise your postings+ would be duplicated.++ For SQLite, it is more useful if you modify the generated id field to be a+ PRIMARY KEY. Eg:++ $ hledger print -O sql | sed 's/id serial/id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL/g' | ...++ This is not yet much used; feedback is welcome.++ JSON output+ Our JSON is rather large and verbose, since it is a faithful representation+ of hledger's internal data types. To understand its structure, read the+ Haskell type definitions, which are mostly in https://github.com/simon-+ michael/hledger/blob/master/hledger-lib/Hledger/Data/Types.hs.+ hledger-web's OpenAPI specification may also be relevant.++ hledger stores numbers with sometimes up to 255 significant digits. This+ is too many digits for most JSON consumers, so in JSON output we round num-+ bers to at most 10 decimal places. (We don't limit the number of integer+ digits.) If you find this causing problems, please let us know. Related:+ #1195++ This is not yet much used; feedback is welcome.++ Commodity styles+ When displaying amounts, hledger infers a standard display style for each+ commodity/currency, as described below in Commodity display style.++ If needed, this can be overridden by a -c/--commodity-style option (except+ for cost amounts and amounts displayed by the print command, which are al-+ ways displayed with all decimal digits). For example, the following will+ force dollar amounts to be displayed as shown:++ $ hledger print -c '$1.000,0'++ This option can be repeated to set the display style for multiple commodi-+ ties/currencies. Its argument is as described in the commodity directive.+ Note that omitting the commodity symbol will set the display style for just+ the no-symbol commodity, not all commodities.++ In some cases hledger will adjust number formatting to improve their+ parseability (such as adding trailing decimal marks when needed).++ Debug output+ We intend hledger to be relatively easy to troubleshoot, introspect and de-+ velop. You can add --debug[=N] to any hledger command line to see addi-+ tional debug output. N ranges from 1 (least output, the default) to 9+ (maximum output). 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:++ hledger bal --debug=3 2>hledger.log++ (This option doesn't work in a config file yet.)++Environment+ These environment variables affect hledger:++ HLEDGER_LESS If less is your pager, this variable specifies the less op-+ tions hledger should use. (Otherwise, LESS + custom options are used.)++ LEDGER_FILE The default journal file, to be used when no -f/--file option+ is provided. For example, it could be ~/finance/main.journal. This can+ also be a glob pattern, eg ./2???.journal. (If the glob matches multiple+ files, only the alphanumerically first one is used.) If LEDGER_FILE points+ to a non-existent file, an error will be raised. If the value is the empty+ string, it is ignored.++ If LEDGER_FILE is not set and -f is not provided, the default journal file+ is $HOME/.hledger.journal (or if a home directory can't be detected,+ ./.hledger.journal).++ See also Common tasks > Setting LEDGER_FILE.++ NO_COLOR If this environment variable exists (with any value, including+ empty), hledger will not use ANSI color codes in terminal output, unless+ overridden by an explicit --color=y or --colour=y option.++PART 2: DATA FORMATS+Journal+ hledger's usual data source is a plain text file containing journal entries+ in hledger journal format. If you're looking for a quick reference, jump+ ahead to the journal cheatsheet (or use the table of contents at+ https://hledger.org/hledger.html).++ This file represents an accounting General Journal. The .journal file ex-+ tension is most often used, though not strictly required. The journal file+ contains a number of transaction entries, each describing a transfer of+ money (or any commodity) between two or more named accounts, in a simple+ format readable by both hledger and humans.++ hledger's journal format is compatible with most of Ledger's journal for-+ mat, but not all of it. The differences and interoperation tips are de-+ scribed at hledger and Ledger. With some care, and by avoiding incompati-+ ble features, you can keep your hledger journal readable by Ledger and vice+ versa. This can useful eg for comparing the behaviour of one app against+ the other.++ You can use hledger without learning any more about this file; just use the+ add or web or import commands to create and update it.++ Many users, though, edit the journal file with a text editor, and track+ changes with a version control system such as git. Editor add-ons such as+ ledger-mode or hledger-mode for Emacs, vim-ledger for Vim, and hledger-vs-+ code for Visual Studio Code, make this easier, adding colour, formatting,+ tab completion, and useful commands. See Editors at hledger.org for the+ full list.++ A hledger journal file can contain three kinds of thing: comment lines,+ transactions, and/or directives (including periodic transaction rules and+ auto posting rules). Understanding the journal file format will also give+ you a good understanding of hledger's data model. Here's a quick cheat-+ sheet/overview, followed by detailed descriptions of each part.++ Journal cheatsheet+ # Here is the main syntax of hledger's journal format+ # (omitting extra Ledger compatibility syntax).++ ###############################################################################++ # 1. These are comment lines, for notes or temporarily disabling things.+ ; They begin with # or ;++ comment+ Or, lines can be enclosed within "comment" / "end comment".+ This is a block of+ commented lines.+ end comment++ # Some journal entries can have semicolon comments at end of line ; like this+ # Some of them require 2 or more spaces before the semicolon.++ ###############################################################################++ # 2. Directives customise processing or output in some way.+ # You don't need any directives to get started.+ # But they can add more error checking, or change how things are displayed.+ # They begin with a word, letter, or symbol.+ # They are most often placed at the top, before transactions.++ account assets ; Declare valid account names and display order.+ account assets:savings ; A subaccount. This one represents a bank account.+ account assets:checking ; Another. Note, 2+ spaces after the account name.+ account assets:receivable ; Accounting type is inferred from english names,+ account passifs ; or declared with a "type" tag, type:L+ account expenses ; type:X+ ; A follow-on comment line, indented.+ account expenses:rent ; Expense and revenue categories are also accounts.+ ; Subaccounts inherit their parent's type.++ commodity $0.00 ; Declare valid commodities and their display styles.+ commodity 1.000,00 EUR++ decimal-mark . ; The decimal mark used in this file (if ambiguous).++ payee Whole Foods ; Declare a valid payee name.++ tag trip ; Declare a valid tag name.++ P 2024-03-01 AAPL $179 ; Declare a market price for AAPL in $ on this date.++ include other.journal ; Include another journal file here.++ # Declare a recurring "periodic transaction", for budget/forecast reports+ ~ monthly set budget goals ; <- Note, 2+ spaces before the description.+ (expenses:rent) $1000+ (expenses:food) $500++ # Declare an auto posting rule, to modify existing transactions in reports+ = revenues:consulting+ liabilities:tax:2024:us *0.25 ; Add a tax liability & expense+ expenses:tax:2024:us *-0.25 ; for 25% of the revenue.++ ###############################################################################++ # 3. Transactions are what it's all about.+ # They are dated events, usually movements of money between 2 or more accounts.+ # They begin with a numeric date.+ # Here is their basic shape:+ #+ # DATE DESCRIPTION ; The transaction's date and optional description.+ # ACCOUNT1 AMOUNT ; A posting of an amount to/from this account, indented.+ # ACCOUNT2 AMOUNT ; A second posting, balancing the first.+ # ... ; More if needed. Amounts must sum to zero.+ # ; Note, 2+ spaces between account names and amounts.++ 2024-01-01 opening balances ; At the start, declare pre-existing balances this way.+ assets:savings $10000 ; Account names can be anything. lower case is easy to type.+ assets:checking $1000 ; assets, liabilities, equity, revenues, expenses are common.+ liabilities:credit card $-500 ; liabilities, equity, revenues balances are usually negative.+ equity:start ; One amount can be left blank. $-10500 is inferred here.+ ; Some of these accounts we didn't declare above,+ ; so -s/--strict would complain.++ 2024-01-03 ! (12345) pay rent+ ; Additional transaction comment lines, indented.+ ; There can be a ! or * after the date meaning "pending" or "cleared".+ ; There can be a parenthesised (code) after the date/status.+ ; Amounts' sign shows direction of flow.+ assets:checking $-500 ; Minus means removed from this account (credit).+ expenses:rent $500 ; Plus means added to this account (debit).++ ; Keeping transactions in date order is optional (but helps error checking).++ 2024-01-02 Gringott's Bank | withdrawal ; Description can be PAYEE | NOTE+ assets:bank:gold -10 gold+ assets:pouch 10 gold++ 2024-01-02 shopping+ expenses:clothing 1 gold+ expenses:wands 5 gold+ assets:pouch -6 gold++ 2024-01-02 receive gift+ revenues:gifts -3 "Chocolate Frogs" ; Complex commodity symbols+ assets:pouch 3 "Chocolate Frogs" ; must be in double quotes.++ 2024-01-15 buy some shares, in two lots ; Cost can be noted.+ assets:investments:2024-01-15 2.0 AAAA @ $1.50 ; @ means per-unit cost+ assets:investments:2024-01-15-02 3.0 AAAA @@ $4 ; @@ means total cost+ ; ^ Per-lot subaccounts are sometimes useful.+ assets:checking $-7++ 2024-01-15 assert some account balances on this date+ ; Balances can be asserted in any transaction, with =, for extra error checking.+ ; Assertion txns like this one can be made with hledger close --assert --show-costs+ ;+ assets:savings $0 = $10000+ assets:checking $0 = $493+ assets:bank:gold 0 gold = -10 gold+ assets:pouch 0 gold = 4 gold+ assets:pouch 0 "Chocolate Frogs" = 3 "Chocolate Frogs"+ assets:investments:2024-01-15 0.0 AAAA = 2.0 AAAA @ $1.50+ assets:investments:2024-01-15-02 0.0 AAAA = 3.0 AAAA @@ $4+ liabilities:credit card $0 = $-500++ 2024-02-01 note some event, or a transaction not yet fully entered, on this date+ ; Postings are not required.++ # Consistent YYYY-MM-DD date format is recommended,+ # but you can use . or / and omit leading zeros if you prefer.+ 2024.01.01+ 2024/1/1++ Comments+ Lines in the journal will be ignored if they begin with a hash (#) or a+ semicolon (;). (See also Other syntax.) hledger will also ignore regions+ beginning with a comment line and ending with an end comment line (or file+ end). Here's a suggestion for choosing between them:++ * # for top-level notes++ * ; for commenting out things temporarily++ * comment for quickly commenting large regions (remember it's there, or you+ might get confused)++ Eg:++ # a comment line+ ; another commentline+ comment+ A multi-line comment block,+ continuing until "end comment" directive+ or the end of the current file.+ end comment++ Some hledger entries can have same-line comments attached to them, from ;+ (semicolon) to end of line. See Transaction comments, Posting comments,+ and Account comments below.++ Transactions+ Transactions are the main unit of information in a journal file. They rep-+ resent events, typically a movement of some quantity of commodities between+ two or more named accounts.++ Each transaction is recorded as a journal entry, beginning with a simple+ date in column 0. This can be followed by any of the following optional+ fields, separated by spaces:++ * a status character (empty, !, or *)++ * a code (any short number or text, enclosed in parentheses)++ * a description (any remaining text until end of line or a semicolon)++ * a comment (any remaining text following a semicolon until end of line,+ and any following indented lines beginning with a semicolon)++ * 0 or more indented posting lines, describing what was transferred and the+ accounts involved (indented comment lines are also allowed, but not blank+ lines or non-indented lines).++ Here's a simple journal file containing one transaction:++ 2008/01/01 income+ assets:bank:checking $1+ income:salary $-1++ Dates+ Simple dates+ Dates in the journal file use simple dates format: YYYY-MM-DD or YYYY/MM/DD+ or YYYY.MM.DD, with leading zeros optional. The year may be omitted, in+ which case it will be inferred from the context: the current transaction,+ the default year set with a Y directive, or the current date when the com-+ mand is run. Some examples: 2010-01-31, 2010/01/31, 2010.1.31, 1/31.++ (The UI also accepts simple dates, as well as the more flexible smart dates+ documented in the hledger manual.)++ Posting dates+ You can give individual postings a different date from their parent trans-+ action, by adding a posting comment containing a tag (see below) like ;+ date:DATE. (There's also a Ledger-compatible syntax, ; [DATE], which can+ be convenient.)++ This is probably the best way to control posting dates precisely. Eg in+ this example the expense should appear in May reports, and the deduction+ from checking should be reported on 6/1 for easy bank reconciliation:++ 2015/5/30+ expenses:food $10 ; food purchased on saturday 5/30+ assets:checking ; bank cleared it on monday, date:6/1++ $ hledger -f t.j register food+ 2015-05-30 expenses:food $10 $10++ $ hledger -f t.j register checking+ 2015-06-01 assets:checking $-10 $-10++ DATE should be a simple date; if the year is not specified it will use the+ year of the transaction's date.+ The date: tag must have a valid simple date value if it is present, eg a+ date: tag with no value is not allowed.++ Status+ Transactions (or individual postings within a transaction) can have a sta-+ tus mark, which is a single character before the transaction description+ (or posting account name), separated from it by a space, indicating one of+ three statuses:++ mark status+ ------------------+ unmarked+ ! pending+ * cleared++ When reporting, you can filter by status with the -U/--unmarked, -P/--pend-+ ing, and -C/--cleared flags (and you can combine these, eg -UP to match all+ except cleared things). Or you can use the status:, status:!, and status:*+ queries, or the U, P, C keys in hledger-ui.++ (Note: in Ledger the "unmarked" state is called "uncleared"; in hledger we+ renamed it to "unmarked" for semantic clarity.)++ Status marks are optional, but can be helpful eg for reconciling with+ real-world accounts. Some editor modes provide highlighting and shortcuts+ for working with status. Eg in Emacs ledger-mode, you can toggle transac-+ tion status with C-c C-e, or posting status with C-c C-c.++ What "uncleared", "pending", and "cleared" actually mean is up to you.+ Here's one suggestion:++ status meaning+ --------------------------------------------------------------------------+ uncleared recorded but not yet reconciled; needs review+ pending tentatively reconciled (if needed, eg during a big reconcil-+ iation)+ cleared complete, reconciled as far as possible, and considered cor-+ rect++ With this scheme, you would use -PC to see the current balance at your+ bank, -U to see things which will probably hit your bank soon (like un-+ cashed checks), and no flags to see the most up-to-date state of your fi-+ nances.++ Code+ After the status mark, but before the description, you can optionally write+ a transaction "code", such as a check number or transaction id, enclosed in+ parentheses,++ This has a few limitations: The code must not contain a closing parenthesis+ (or it will be truncated). Codes tend to disrupt alignment of the register+ report, making it harder to scan visually. And you can't store more than+ one value there per transaction. For these reasons you might want to avoid+ the code field and use tags(#tags] instead.++ Description+ After the date, status mark and/or code fields, the rest of the line (or+ until a comment is begun with ;) is the transaction's description. Here+ you can describe the transaction (called the "narration" in traditional+ bookkeeping), or you can record a payee/payer name, or you can leave it+ empty.++ Transaction descriptions show up in print output and in register reports,+ and can be listed with the descriptions command.++ You can query by description with desc:DESCREGEX, or pivot on description+ with --pivot desc.++ Payee and note+ Sometimes people want a dedicated payee/payer field that can be queried and+ checked more strictly. If you want that, you can write a | (pipe) charac-+ ter in the description. This divides it into a "payee" field on the left,+ and a "note" field on the right. (Either can be empty.)++ You can query these with payee:PAYEEREGEX and note:NOTEREGEX, list their+ values with the payees and notes commands, or pivot on payee or note.++ Note: in transactions with no | character, description, payee, and note all+ have the same value. Once a | is added, they become distinct. (If you'd+ like to change this behaviour, please propose it on the mail list.)++ If you want more strict error checking, you can declare the valid payee+ names with payee directives, and then enforce these with hledger check pay-+ ees. (Note: because of the above, for this you'll need to ensure every+ transaction description contains a | and therefore a checkable payee name,+ even if it's empty.)++ Transaction comments+ Text following ;, after a transaction description, and/or on indented lines+ immediately below it, form comments for that transaction. They are repro-+ duced by print but otherwise ignored, except they may contain tags, which+ are not ignored.++ 2012-01-01 something ; a transaction comment+ ; a second line of transaction comment+ expenses 1+ assets++ Postings+ A posting is an addition of some amount to, or removal of some amount from,+ an account. Each posting line begins with at least one space or tab (2 or+ 4 spaces is common), followed by:++ * (optional) a status character (empty, !, or *), followed by a space++ * (required) an account name (any text, optionally including single spaces.+ If anything follows the account name on the same line, the account name+ must be ended by two or more spaces.)++ * (optional) an amount++ * (optional) a same-line posting comment, beginning with a semicolon (;).++ If the amount is positive, it is being added to the account; if negative,+ it is being removed from the account.++ The posting amounts in a transaction must sum up to zero, indicating that+ the inflows and outflows are equal. We call this a balanced transaction.+ (You can read more about the details of transaction balancing below.)++ If no amount is written, it will be calculated automatically from the other+ postings in the transaction, so as to balance the transaction. In other+ words, in any transaction you can leave one posting amountless to save typ-+ ing.++ Debits and credits+ The traditional accounting concepts of debit and credit of course exist in+ hledger, but we represent them with numeric sign. Positive and negative+ posting amounts represent debits and credits respectively.++ You don't need to remember that, but if you would like to - eg for helping+ newcomers or for talking with your accountant - here's a handy mnemonic:++ debit / plus / left / short words+ credit / minus / right / longer words++ Account names+ Accounts are the main way of categorising things in hledger. As in Double+ Entry Bookkeeping, they can represent real world accounts (such as a bank+ account), or more abstract categories such as "money spent on food" or+ "money borrowed from Frank".++ Account names are flexible. They may be capitalised or not; they may con-+ tain letters, numbers, punctuation, symbols, or single spaces; they may be+ in any language.++ Typically we use the five traditional accounting categories as the starting+ point for account names. In english they are:++ assets, liabilities, equity, revenues, expenses++ These will be discussed more in Account types below. In hledger docs you+ may see them referred to as A, L, E, R, X for short.++ Two space delimiter+ Note the two or more spaces delimiter that's sometimes required after ac-+ count names. hledger's account names, inherited from Ledger, are very+ permissive; they may contain pretty much any kind of text, including single+ spaces and semicolons. Because of this, they must be terminated by two or+ more spaces if there is anything following them on the same line. For ex-+ ample, if an amount, balance assignment, or same-line comment follows an+ account name, they must be preceded by two or more spaces, else they would+ be considered part of the account name:++ bad: assets:accounts receivable $10 ; <- too close!+ good: assets:accounts receivable $10++ bad: assets:accounts receivable =$1000 ; <- too close!+ good: assets:accounts receivable =$1000++ bad: assets:accounts receivable ; comment. <- too close!+ good: assets:accounts receivable ; comment++ This two-space delimiter appears in a few places in hledger, such as after+ account names in postings or account directives; also after the period ex-+ pression in periodic transaction rules. When you are starting out, expect+ it to catch you out at least once. It's annoying sometimes, but it lets us+ use expressive account names while still keeping the syntax light.++ Account hierarchy+ For more precise reporting, we usually divide accounts into more detailed+ subaccounts, subsubaccounts, and so on, by writing a full colon between ac-+ count name parts. For example, instead of writing assets and expenses, we+ might write assets:bank:checking and expenses:food. From these names+ hledger will infer this hierarchy of five accounts:++ assets+ assets:bank+ assets:bank:checking+ expenses+ expenses:food++ Or as an outline:++ assets+ bank+ checking+ expenses+ food++ hledger reports can summarise the account tree to any depth, so you can+ make your subcategories as detailed as you like. But don't go overboard,+ especially when getting started; simpler categories can be less work.++ Other account name features+ Enclosing the account name in parentheses or brackets, like (ex-+ penses:food), enables a non-standard bookkeeping feature: virtual postings.++ Account names can be rewritten and restructured, temporarily or perma-+ nently, by account aliases.++ Amounts+ After the account name, there is usually an amount. (Remember: between ac-+ count name and amount, there must be two or more spaces.)++ hledger's amount format is flexible, supporting several international for-+ mats. Here are some examples. Amounts have a number (the "quantity"):++ 1++ ..and usually a currency symbol or commodity name (more on this below), to+ the left or right of the quantity, with or without a separating space:++ $1+ 4000 AAPL+ 3 "green apples"++ Amounts can be preceded by a minus sign (or a plus sign, though plus is the+ default), The sign can be written before or after a left-side commodity+ symbol:++ -$1+ $-1++ One or more spaces between the sign and the number are acceptable when+ parsing (but they won't be displayed in output):++ + $1+ $- 1++ Scientific E notation is allowed:++ 1E-6+ EUR 1E3++ Decimal marks+ A decimal mark can be written as a period or a comma:++ 1.23+ 1,23++ Both of these are common in international number formats, so hledger is not+ biased towards one or the other. Because hledger also supports digit group+ marks (eg thousands separators), this means that a number like 1,000 or+ 1.000 containing just one period or comma is ambiguous. In such cases,+ hledger by default assumes it is a decimal mark, and will parse both of+ those as 1.++ To help hledger parse such ambiguous numbers more accurately, if you use+ digit group marks, we recommend declaring the decimal mark explicitly. The+ best way is to add a decimal-mark directive at the top of each data file,+ like this:++ decimal-mark .++ Or you can declare it per commodity with commodity directives, described+ below.++ hledger also accepts numbers like 10. with no digits after the decimal mark+ (and will sometimes display numbers that way to disambiguate them - see+ Trailing decimal marks).++ Digit group marks+ In the integer part of the amount quantity (left of the decimal mark),+ groups of digits can optionally be separated by a digit group mark - a+ comma or period (whichever is not used as decimal mark), or a space (sev-+ eral Unicode space variants, like no-break space, are also accepted). So+ these are all valid amounts in a journal file:++ $1,000,000.00+ EUR 2.000.000,00+ INR 9,99,99,999.00+ 1 000 000.00 ; <- ordinary space+ 1 000 000.00 ; <- no-break space++ Commodity+ Amounts in hledger have both a "quantity", which is a signed decimal num-+ ber, and a "commodity", which is a currency symbol, stock ticker, or any+ word or phrase describing something you are tracking.++ If the commodity name contains non-letters (spaces, numbers, or punctua-+ tion), you must always write it inside double quotes ("green apples",+ "ABC123").++ If you write just a bare number, that too will have a commodity, with name+ ""; we call that the "no-symbol commodity".++ Actually, hledger combines these single-commodity amounts into more power-+ ful multi-commodity amounts, which are what it works with most of the time.+ A multi-commodity amount could be, eg: 1 USD, 2 EUR, 3.456 TSLA. In prac-+ tice, you will only see multi-commodity amounts in hledger's output; you+ can't write them directly in the journal file.++ By default, the format of amounts in the journal influences how hledger+ displays them in output. This is explained in Commodity display style be-+ low.++ Costs+ In traditional double entry bookkeeping, to record a transaction where one+ commodity is exchanged for another, you add extra equity postings to bal-+ ance the two commodities. Eg:++ 2026-01-01 buy euros+ assets:dollars $-123+ equity:conversion $123+ equity:conversion a-100+ assets:euros a100++ hledger offers a more convenient @/@@ "cost notation" as an alternative:+ instead of equity postings, you can write the "conversion rate" or "trans-+ acted price" after a posting amount. hledger docs generically call this+ "cost", whether buying or selling. It can be written as either @ UNITPRICE+ or @@ TOTALPRICE. Eg you could write the above as:++ 2026-01-01 buy euros+ assets:dollars $-123+ assets:euros a100 @ $1.23 ; unit cost (exchange rate)++ or:++ 2026-01-01 buy euros+ assets:dollars $-123+ assets:euros a100 @@ $123 ; total cost++ The cost should normally be a positive amount. Negative costs are sup-+ ported, but can be confusing, as discussed at --infer-market-prices: market+ prices from transactions.++ Costs participate in transaction balancing. Amounts are converted to their+ cost before checking if the transaction is balanced. You could also write+ the above less redundantly, like so:++ 2026-01-01 buy euros+ assets:dollars ; $-123 is inferred+ assets:euros a100 @ $1.23++ or:++ 2026-01-01 buy euros+ assets:dollars ; $-123 is inferred+ assets:euros a100 @@ $123++ or even:++ 2026-01-01 buy euros+ assets:euros a100 ; @@ $123 is inferred+ assets:dollars $-123++ This last form works for transactions involving exactly two commodities,+ with neither cost notation nor equity postings. Note, the order of post-+ ings is significant: the cost will be attached to the first (top) posting.+ So we had to switch the order of postings, to get the same meaning as+ above. Also, this form is the easiest to make undetected errors with; so+ it is rejected by hledger check balanced, and by strict mode.++ Advantages of cost notation:++ 1. it's more compact and easier to read and write++ 2. hledger reports can show such amounts converted to their cost, when you+ add the -B/--cost flag (see Cost reporting).++ Advantages of equity postings++ 1. they help to keep the accounting equation balanced (if you care about+ that)++ 2. they translate easily to any other double entry accounting system.++ Most hledger users use cost notation and don't use equity postings.++ But you can always convert cost notation to equity postings by adding --in-+ fer-equity. Eg try hledger print -x --infer-equity.++ And you can usually convert equity postings to cost notation by adding+ --infer-costs (see Requirements for detecting equity conversion postings).+ Eg try hledger print -x --infer-costs.++ Finally: using both equity postings and cost notation at the same time is+ allowed, as long as the journal entry is well formed such that the equity+ postings / cost equivalences can be detected. (Otherwise you'll get an er-+ ror message saying that the transaction is unbalanced.):++ 2026-01-01 buy euros+ assets:dollars $-123+ equity:conversion $123+ equity:conversion a-100+ assets:euros a100 @ $1.23++ So in principle you could enable both --infer-equity and --infer-costs in+ your config file, and your reports would have the advantages of both.++ Cost basis / lot syntax+ If you are buying some commodity to hold as an investment, it may be impor-+ tant to keep track of++ 1. its original acquisition cost++ 2. its original acquisition date++ 3. and a sequence number or label, if needed, to disambiguate multiple ac-+ quisitions on the same day, or to serve as a mnemonic for easy refer-+ ence.++ In hledger we call these three the "cost basis"; and if an amount being ac-+ quired has a cost basis, we call it a "lot". Tax authorities often require+ that lots are tracked carefully and disposed of (sold) in a certain order.++ Note, though "cost basis" sounds similar to the "cost" (transacted price)+ discussed above, they are distinct concepts. In some transactions the+ transacted price and basis cost are the same, but in others they are not.++ So cost basis has its own syntax, also called "lot syntax". hledger's lot+ syntax is like Ledger's: one or more of the following annotations, follow-+ ing the main amount:++ * {LOTUNITCOST} or {{LOTTOTALCOST}} (see lot price)++ * [LOTDATE] (see lot date)++ * (LOTLABEL) (see lot note)++ hledger does not yet do anything with this lot syntax, except to preserve+ it and show it in print's txt, beancount, and json output. This means you+ can use this syntax in your hledger journals (plus an amountless extra+ posting to help transactions balance, if needed), then use the print com-+ mand to export to Ledger or Beancount or rustledger, to use their+ lots/gains reports (see Export Lots workflow).++ Balance assertions+ hledger supports Ledger-style balance assertions in journal files. These+ look like, for example, = EXPECTEDBALANCE following a posting's amount. Eg+ here we assert the expected dollar balance in accounts a and b after each+ posting:++ 2013/1/1+ a $1 = $1+ b = $-1++ 2013/1/2+ a $1 = $2+ b $-1 = $-2++ After reading a journal file, hledger will check all balance assertions and+ report an error if any of them fail. Balance assertions can protect you+ from, eg, inadvertently disrupting reconciled balances while cleaning up+ old entries. You can disable them temporarily with the -I/--ignore-asser-+ tions flag, which can be useful for troubleshooting or for reading Ledger+ files. (Note: this flag currently does not disable balance assignments,+ described below).++ Assertions and ordering+ hledger calculates and checks an account's balance assertions in date order+ (and when there are multiple assertions on the same day, in parse order).+ Note this is different from Ledger, which checks assertions always in parse+ order, ignoring dates.++ This means in hledger you can freely reorder transactions, postings, or+ files, and balance assertions will usually keep working. The exception is+ when you reorder multiple postings on the same day, to the same account,+ which have balance assertions; those will likely need updating.++ Assertions and multiple files+ If an account has transactions appearing in multiple files, balance asser-+ tions can still work - but only if those files are part of a hierarchy made+ by include directives.++ If the same files are specified with two -f options on the command line,+ the assertions in the second will not see the balances from the first.++ To work around this, arrange your files in a hierarchy with include. Or,+ you could concatenate the files temporarily, and process them like one big+ file.++ Why does it work this way ? It might be related to hledger's goal of sta-+ ble predictable reports. File hierarchy is considered "permanent", part of+ your data, while the order of command line options/arguments is not. We+ don't want transient changes to be able to change the meaning of the data.+ Eg it would be frustrating if tomorrow all your balance assertions broke+ because you wrote command line arguments in a different order. (Discussion+ welcome.)++ Assertions and costs+ Balance assertions ignore costs, and should normally be written without+ one:++ 2019/1/1+ (a) $1 @ a1 = $1++ We do allow costs to be written in balance assertion amounts, however, and+ print shows them, but they don't affect whether the assertion passes or+ fails. This is for backward compatibility (hledger's close command used to+ generate balance assertions with costs), and because balance assignments do+ use costs (see below).++ Assertions and commodities+ The balance assertions described so far are "single commodity balance as-+ sertions": they assert and check the balance in one commodity, ignoring any+ others that may be present. This is how balance assertions work in Ledger+ also.++ If an account contains multiple commodities, you can assert their balances+ by writing multiple postings with balance assertions, one for each commod-+ ity:++ 2013/1/1+ usd $-1+ eur a-1+ both++ 2013/1/2+ both 0 = $1+ both 0 = a1++ In hledger you can make a stronger "sole commodity balance assertion" by+ writing two equals signs (== EXPECTEDBALANCE). This also asserts that+ there are no other commodities in the account besides the asserted one (or+ at least, that their current balance is zero):++ 2013/1/1+ usd $-1 == $-1 ; these sole commodity assertions succeed+ eur a-1 == a-1+ both ;== $1 ; this one would fail because 'both' contains $ and a++ It's less easy to make a "sole commodities balance assertion" (note the+ plural) - ie, asserting that an account contains two or more specified com-+ modities and no others. It can be done by++ 1. isolating each commodity in a subaccount, and asserting those++ 2. and also asserting there are no commodities in the parent account it-+ self:++ 2013/1/1+ usd $-1+ eur a-1+ both 0 == 0 ; nothing up my sleeve+ both:usd $1 == $1 ; a dollar here+ both:eur a1 == a1 ; a euro there++ Assertions and subaccounts+ All of the balance assertions above (both = and ==) are "subaccount-exclu-+ sive balance assertions"; they ignore any balances that exist in deeper+ subaccounts.++ In hledger you can make "subaccount-inclusive balance assertions" by adding+ a star after the equals (=* or ==*):++ 2019/1/1+ equity:start+ assets:checking $10+ assets:savings $10+ assets $0 ==* $20 ; assets + subaccounts contains $20 and nothing else++ Assertions and status+ Balance assertions always consider postings of all statuses (unmarked,+ pending, or cleared); they are not affected by the -U/--unmarked /+ -P/--pending / -C/--cleared flags or the status: query.++ Assertions and virtual postings+ Balance assertions always consider both real and virtual postings; they are+ not affected by the --real/-R flag or real: query.++ Assertions and auto postings+ Balance assertions are affected by the --auto flag, which generates auto+ postings, which can alter account balances. Because auto postings are op-+ tional in hledger, accounts affected by them effectively have two balances.+ But balance assertions can only test one or the other of these. So to+ avoid making fragile assertions, either:++ * assert the balance calculated with --auto, and always use --auto with+ that file++ * or assert the balance calculated without --auto, and never use --auto+ with that file++ * or avoid balance assertions on accounts affected by auto postings (or+ avoid auto postings entirely).++ Assertions and precision+ Balance assertions compare the exactly calculated amounts, which are not+ always what is shown by reports. Eg a commodity directive may limit the+ display precision, but this will not affect balance assertions. Balance+ assertion failure messages show exact amounts.++ Assertions and hledger add+ Balance assertions can be included in the amounts given in add. All types+ of assertions are supported, and assertions can be used as in a normal+ journal file.++ All transactions, not just those that have an explicit assertion, are vali-+ dated against the existing assertions in the journal. This means it is+ possible for an added transaction to fail even if its assertions are cor-+ rect as of the transaction date.++ If this assertion checking is not desired, then it can be disabled with -I.++ However, balance assignments are currently not supported.++ Posting comments+ Text following ;, at the end of a posting line, and/or on indented lines+ immediately below it, form comments for that posting. They are reproduced+ by print but otherwise ignored, except they may contain tags, which are not+ ignored.++ 2012-01-01+ expenses 1 ; a comment for posting 1+ assets+ ; a comment for posting 2+ ; a second comment line for posting 2++ Transaction balancing+ How exactly does hledger decide when a transaction is balanced ? Espe-+ cially when it involves costs, which often are not exact, because of re-+ peating decimals, or imperfect data from financial institutions ? In each+ commodity, hledger sums the transaction's posting amounts, after converting+ any with costs; then it checks if that sum is zero, when rounded to a suit-+ able number of decimal digits - which we call the balancing precision.++ Since version 1.50, hledger infers balancing precision in each transaction+ from the amounts in that transaction's journal entry (like Ledger). Ie,+ when checking the balance of commodity A, it uses the highest decimal pre-+ cision seen for A in the journal entry (excluding cost amounts). This+ makes transaction balancing robust; any imbalances must be visibly ac-+ counted for in the journal entry, display precision can be freely increased+ with -c, and compatibility with Ledger and Beancount journals is good.++ Note that hledger versions before 1.50 worked differently: they allowed+ display precision to override the balancing precision. This masked small+ imbalances and caused fragility (see issue #2402). As a result, some jour-+ nal entries (or CSV rules) that worked with hledger <1.50, are now rejected+ with an "unbalanced transaction" error. If you hit this problem, it's easy+ to fix:++ * You can restore the old behaviour, by adding --txn-balancing=old to the+ command or to your ~/.hledger.conf file. This lets you keep using old+ journals unchanged, though without the above benefits.++ * Or you can fix the problem entries (recommended). There are three ways,+ use whichever seems best:++ 1. make cost amounts more precise (add more/better decimal digits)++ 2. or make non-cost amounts less precise (remove unnecessary decimal dig-+ its that are raising the precision)++ 3. or add a posting to absorb the imbalance (eg "expenses:rounding". Re-+ member that one posting may omit the amount; that's convenient here.)++ Tags+ Tags are a way to add extra labels or data fields to transactions, post-+ ings, or accounts, which you can match with a tag: query in reports. (See+ queries below.)++ Tags are a single word or hyphenated word, immediately followed by a full+ colon, written within a comment. (Yes, storing data in comments is+ slightly weird.) Here's a transaction with a tag:++ 2025-01-01 groceries ; some-tag:+ assets:checking+ expenses:food $1++ A tag can have a value, a single line of text written after the colon. Tag+ values can't contain newlines.:++ 2025-01-01 groceries ; tag1: this is tag1's value++ Multiple tags can be separated by comma. Tag values can't contain commas.:++ 2025-01-01 groceries ; tag1:value 1, tag2:value 2, comment text++ A tag can have multiple values:++ 2025-01-01 groceries ; tag1:value 1, tag1:value 2++ You can write each tag on its own line of you prefer (but they still can't+ contain commas):++ 2025-01-01 groceries+ ; tag1: value 1+ ; tag2: value 2++ Tags can be attached to individual postings, rather than the overall trans-+ action:++ 2025-01-01 rent+ assets:checking+ expenses:rent $1000 ; postingtag:++ Tags can be attached to accounts, in their account directive:++ account assets:checking ; acct-number: 123-45-6789++ Tag propagation+ In addition to what they are attached to, tags also affect related data in+ a few ways, allowing more powerful queries:++ 1. Accounts -> postings. Postings inherit tags from their account.++ 2. Transactions -> postings. Postings inherit tags from their transaction.++ 3. Postings -> transactions. Transactions also acquire the tags of their+ postings.++ So when you use a tag: query to match whole transactions, individual post-+ ings, or accounts, it's good to understand how tags behave. Here's an ex-+ ample showing all three kinds of propagation:++ account assets:checking+ account expenses:food ; atag:++ 2025-01-01 groceries ; ttag:+ assets:checking ; p1tag:+ expenses:food $1 ; p2tag:++ data part has tags explanation+ -----------------------------------------------------------------------------+ assets:check- no tags attached+ ing account+ expenses:food atag atag: in comment+ account+ assets:check- p1tag, ttag p1tag: in comment, ttag acquired from+ ing posting transaction+ expenses:food p2tag, atag, p2tag: in comment, atag from account, ttag+ posting ttag from transaction+ groceries ttag, p1tag, ttag: in comment, p1tag from first posting,+ transaction p2tag, atag p2tag and atag from second posting++ Displaying tags+ You can use the tags command to list tag names or values.++ The print command also shows tags.++ You can use --pivot to display tag values in other reports, in various ways+ (eg appended to account names, like pseudo subaccounts).++ When to use tags ?+ Tags provide more dimensions of categorisation, complementing accounts and+ transaction descriptions. When to use each of these is somewhat a matter+ of taste. Accounts have the most built-in support, and regex queries on+ descriptions are also quite powerful. So you may not need tags at all.+ But if you want to track multiple cross-cutting categories, they can be a+ good fit. For example, you could tag trip-related transactions with trip:+ YEAR:PLACE, without disturbing your usual account categories.++ Tag names+ What is allowed in a tag name ? Most non-whitespace characters. Eg : is a+ valid tag.++ For extra error checking, you can declare valid tag names with the tag di-+ rective, and then enforce these with the check command. But note that tags+ are detected quite loosely at present, sometimes where you didn't intend+ them. Eg a comment like ; see https://foo.com adds a https tag.++ There are several tag names which have special significance to hledger.+ They are explained elsewhere, but here's a quick reference:++ type -- declares an account's type+ date -- overrides a posting's date+ date2 -- overrides a posting's secondary date+ assert -- appears on txns generated by close --assert+ retain -- appears on txns generated by close --retain+ start -- appears on txns generated by close --migrate/--close/--open/--assign+ t -- appears on postings generated from timedot letters++ generated-transaction -- appears on txns generated by a periodic rule+ modified-transaction -- appears on txns which have had auto postings added+ generated-posting -- appears on generated postings+ cost-posting -- appears on postings which have (or could have) a cost,+ and which have equivalent conversion postings in the transaction+ conversion-posting -- appears on postings which are to a V/Conversion account+ and which have an equivalent cost posting in the transaction++ The second group above (generated-transaction, etc.) are normally hidden,+ with a _ prefix added. This means print doesn't show them by default; but+ you can still use them in queries. You can add the --verbose-tags flag to+ make them visible in print output, which can be useful for troubleshooting.++ Directives+ Besides transactions, there is something else you can put in a journal+ file: directives. These are declarations, beginning with a keyword, that+ modify hledger's behaviour. Some directives can have more specific subdi-+ rectives, indented below them. hledger's directives are similar to+ Ledger's in many cases, but there are also many differences. Directives+ are not required, but can be useful. Here are the main directives:++ purpose directive+ --------------------------------------------------------------------------+ READING DATA:+ Rewrite account names alias+ Comment out sections of the file comment+ Declare file's decimal mark, to help decimal-mark+ parse amounts accurately+ Include other data files include+ GENERATING DATA:+ Generate recurring transactions or bud- ~+ get goals+ Generate extra postings on existing =+ transactions+ CHECKING FOR ERRORS:+ Define valid entities to provide more account, commodity, payee, tag+ error checking+ REPORTING:+ Declare accounts' type and display order account+ Declare commodity display styles commodity+ Declare market prices P++ Directives and multiple files+ Directives vary in their scope, ie which journal entries and which input+ files they affect. Most often, a directive will affect the following en-+ tries and included files if any, until the end of the current file - and no+ further. You might find this inconvenient! For example, alias directives+ do not affect parent or sibling files. But there are usually workarounds;+ for example, put alias directives in your top-most file, before including+ other files.++ The restriction, though it may be annoying at first, is in a good cause; it+ allows reports to be stable and deterministic, independent of the order of+ input. Without it, reports could show different numbers depending on the+ order of -f options, or the positions of include directives in your files.++ Directive effects+ Here are all hledger's directives, with their effects and scope summarised+ - nine main directives, plus four others which we consider non-essential:++ di- what it does ends+ rec- at+ tive file+ end?+ --------------------------------------------------------------------------------------+ ac- Declares an account, for checking all entries in all files; and N+ count its display order and type. Subdirectives: any text, ignored.+ alias Rewrites account names, in following entries until end of cur- Y+ rent file or end aliases. Command line equivalent: --alias+ com- Ignores part of the journal file, until end of current file or Y+ ment end comment.+ com- Declares up to four things: 1. a commodity symbol, for checking N,N,Y,Y+ mod- all amounts in all files 2. the display style for all amounts+ ity of this commodity 3. the decimal mark for parsing amounts of+ this commodity, in the rest of this file and its children, if+ there is no decimal-mark directive 4. the precision to use for+ balanced-transaction checking in this commodity, in this file+ and its children. Takes precedence over D. Subdirectives:+ format (ignored). Command line equivalent: -c/--commodity-style+ deci- Declares the decimal mark, for parsing amounts of all commodi- Y+ mal-mark ties in following entries until next decimal-mark or end of cur-+ rent file. Included files can override. Takes precedence over+ commodity and D.+ include Includes entries and directives from another file, as if they N+ were written inline. Command line alternative: multiple+ -f/--file+ payee Declares a payee name, for checking all entries in all files. N+ P Declares the market price of a commodity on some date, for value N+ reports.+ ~ Declares a periodic transaction rule that generates future N+ (tilde) transactions with --forecast and budget goals with balance+ --budget.+ Other+ syntax:+ apply Prepends a common parent account to all account names, in fol- Y+ account lowing entries until end of current file or end apply account.+ D Sets a default commodity to use for no-symbol amounts;and, if Y,Y,N,N+ there is no commodity directive for this commodity: its decimal+ mark, balancing precision, and display style, as above.+ Y Sets a default year to use for any yearless dates, in following Y+ entries until end of current file.+ = Declares an auto posting rule that generates extra postings on partly+ (equals) matched transactions with --auto, in current, parent, and child+ files (but not sibling files, see #1212).+ Other Other directives from Ledger's file format are accepted but ig-+ Ledger nored.+ direc-+ tives++ account directive+ account directives can be used to declare accounts (ie, the places that+ amounts are transferred from and to). Though not required, these declara-+ tions can provide several benefits:++ * They can document your intended chart of accounts, providing a reference.++ * They can store additional account information as comments, or as tags+ which can be used to filter or pivot reports.++ * They can restrict which accounts may be posted to by transactions, eg in+ strict mode, which helps prevent errors.++ * They influence account display order in reports, allowing non-alphabetic+ sorting (eg Revenues to appear above Expenses).++ * They can help hledger know your accounts' types (asset, liability, eq-+ uity, revenue, expense), enabling reports like balancesheet and incomes-+ tatement.++ * They help with account name completion (in hledger add, hledger-web,+ hledger-iadd, ledger-mode, etc.)++ They are written as the word account followed by a hledger-style account+ name. Eg:++ account assets:bank:checking++ Ledger-style indented subdirectives are also accepted, but ignored:++ account assets:bank:checking+ format subdirective ; currently ignored++ Account comments+ Text following two or more spaces and ; at the end of an account directive+ line, and/or following ; on indented lines immediately below it, form com-+ ments for that account.++ Same-line account comments require two+ spaces before ; because that char-+ acter can appear in account names.++ account assets:bank:checking ; same-line comment, at least 2 spaces before the semicolon+ ; next-line comment+ ; some tags - type:A, acctnum:12345++ Account tags+ An account directive's comment may contain tags. These will be propagated+ to all postings using that account, as hidden but queryable posting tags,+ except where the posting already a tag of the same name. (Posting tags+ override account tags.)++ Account error checking+ By default, accounts need not be declared; they come into existence when a+ posting references them. This is convenient, but it means hledger can't+ warn you when you mis-spell an account name in the journal. Usually you'll+ find that error later, as an extra account in balance reports, or an incor-+ rect balance when reconciling.++ In strict mode, enabled with the -s/--strict flag, or when you run hledger+ check accounts, hledger will report an error if any transaction uses an ac-+ count name that has not been declared by an account directive. Some notes:++ * The declaration is case-sensitive; transactions must use the correct ac-+ count name capitalisation.++ * The account directive's scope is "whole file and below" (see directives).+ This means it affects all of the current file, and any files it includes,+ but not parent or sibling files. The position of account directives+ within the file does not matter, though it's usual to put them at the+ top.++ * Accounts can only be declared in journal files, but will affect included+ files of all types.++ * It's currently not possible to declare "all possible subaccounts" with a+ wildcard; every account posted to must be declared.++ * If you use the --infer-equity flag, you will also need declarations for+ the account names it generates.++ Account display order+ Account directives also cause hledger to display accounts in a particular+ order, not just alphabetically. Eg, here is a conventional ordering for+ the top-level accounts:++ account assets+ account liabilities+ account equity+ account revenues+ account expenses++ Now hledger displays them in that order:++ $ hledger accounts+ assets+ liabilities+ equity+ revenues+ expenses++ If there are undeclared accounts, those will be displayed last, in alpha-+ betical order.++ Sorting is done within each group of sibling accounts, at each level of the+ account tree. Eg, a declaration like account parent:child influences+ child's position among its siblings.++ Note, it does not affect parent's position; for that, you need an account+ parent declaration.++ Sibling accounts are always displayed together; hledger won't display x:y+ in between a:b and a:c.++ An account directive both declares an account as a valid posting target,+ and declares its display order; you can't easily do one without the other.++ Account types+ hledger knows that in accounting there are three main account types:++ Asset A things you own+ Liability L things you owe+ Equity E owner's investment,+ balances the two+ above++ and two more representing changes in these:++ Revenue R inflows (also known+ as Income)+ Expense X outflows++ hledger also uses a few subtypes:++ Cash C liquid assets (subtype+ of Asset)+ Conversion V commodity conversions+ equity (subtype of Eq-+ uity)+ Gain G capital gains/losses+ (subtype of Revenue)++ As a convenience, hledger will detect most of these types automatically+ from english account names. But it's better to declare them explicitly by+ adding a type: tag in the account directives. The tag's value can be any+ of the types or one-letter abbreviations above.++ Here is a typical set of account type declarations. Subaccounts will in-+ herit their parent's type, or can override it:++ account assets ; type: A+ account liabilities ; type: L+ account equity ; type: E+ account revenues ; type: R+ account expenses ; type: X++ account assets:bank ; type: C+ account assets:cash ; type: C++ account equity:conversion ; type: V++ account revenues:capital ; type: G++ This enables the easy balancesheet, balancesheetequity, cashflow and in-+ comestatement reports, and querying by type:.++ Tips:++ * You can list accounts and their types, for troubleshooting:++ $ hledger accounts --types [ACCTPAT] [type:TYPECODES] [-DEPTH] [--locations]++ * It's a good idea to declare at least one account for each account type.+ Having some types declared and some inferred can disrupt certain reports.++ * The rules for inferring types from account names are as follows (using+ Regular expressions).+ If they don't work for you, just ignore them and declare your types with+ type: tags.++ If account's name contains this case insensitive regular expression | its type is+ --------------------------------------------------------------------|-------------+ ^assets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|current)(:|$) | Cash+ ^assets?(:|$) | Asset+ ^(debts?|liabilit(y|ies))(:|$) | Liability+ ^equity:(trad(e|ing)|conversion)s?(:|$) | Conversion+ ^equity(:|$) | Equity+ ^(income|revenue)s?(:|$) | Revenue+ ^expenses?(:|$) | Expense++ * As mentioned above, subaccounts will inherit a type from their parent ac-+ count. To be precise, an account's type is decided by the first of these+ that exists:++ 1. A type: declaration for this account.++ 2. A type: declaration in the parent accounts above it, preferring the+ nearest.++ 3. An account type inferred from this account's name.++ 4. An account type inferred from a parent account's name, preferring the+ nearest parent.++ 5. Otherwise, it will have no type.++ * Account aliases can disrupt account types.++ alias directive+ You can define account alias rules which rewrite your account names, or+ parts of them, before generating reports. This can be useful for:++ * expanding shorthand account names to their full form, allowing easier+ data entry and a less verbose journal++ * adapting old journals to your current chart of accounts++ * experimenting with new account organisations, like a new hierarchy++ * combining two accounts into one, eg to see their sum or difference on one+ line++ * customising reports++ Account aliases also rewrite account names in account directives. They do+ not affect account names being entered via hledger add or hledger-web.++ Account aliases are very powerful. They are generally easy to use cor-+ rectly, but you can also generate invalid account names with them; more on+ this below.++ See also Rewrite account names.++ Basic aliases+ To set an account alias, use the alias directive in your journal file.+ This affects all subsequent journal entries in the current file or its in-+ cluded files (but note: not sibling or parent files). The spaces around+ the = are optional:++ alias OLD = NEW++ Or, you can use the --alias 'OLD=NEW' option on the command line. This af-+ fects all entries. It's useful for trying out aliases interactively.++ OLD and NEW are case sensitive full account names. hledger will replace+ any occurrence of the old account name with the new one. Subaccounts are+ also affected. Eg:++ alias checking = assets:bank:wells fargo:checking+ ; rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"++ Regex aliases+ There is also a more powerful variant that uses a regular expression, indi-+ cated by wrapping the pattern in forward slashes. (This is the only place+ where hledger requires forward slashes around a regular expression.)++ Eg:++ alias /REGEX/ = REPLACEMENT++ or:++ $ hledger --alias '/REGEX/=REPLACEMENT' ...++ Any part of an account name matched by REGEX will be replaced by REPLACE-+ MENT. REGEX is case-insensitive as usual.++ If you need to match a forward slash, escape it with a backslash, eg /\/=:.++ If REGEX contains parenthesised match groups, these can be referenced by+ the usual backslash and number in REPLACEMENT:++ alias /^(.+):bank:([^:]+):(.*)/ = \1:\2 \3+ ; rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"++ REPLACEMENT continues to the end of line (or on command line, to end of op-+ tion argument), so it can contain trailing whitespace.++ Combining aliases+ You can define as many aliases as you like, using journal directives and/or+ command line options.++ Recursive aliases - where an account name is rewritten by one alias, then+ by another alias, and so on - are allowed. Each alias sees the effect of+ previously applied aliases.++ In such cases it can be important to understand which aliases will be ap-+ plied and in which order. For (each account name in) each journal entry,+ we apply:++ 1. alias directives preceding the journal entry, most recently parsed first+ (ie, reading upward from the journal entry, bottom to top)++ 2. --alias options, in the order they appeared on the command line (left to+ right).++ In other words, for (an account name in) a given journal entry:++ * the nearest alias declaration before/above the entry is applied first++ * the next alias before/above that will be be applied next, and so on++ * aliases defined after/below the entry do not affect it.++ This gives nearby aliases precedence over distant ones, and helps provide+ semantic stability - aliases will keep working the same way independent of+ which files are being read and in which order.++ In case of trouble, adding --debug=6 to the command line will show which+ aliases are being applied when.++ Aliases and multiple files+ As explained at Directives and multiple files, alias directives do not af-+ fect parent or sibling files. Eg in this command,++ hledger -f a.aliases -f b.journal++ account aliases defined in a.aliases will not affect b.journal. Including+ the aliases doesn't work either:++ include a.aliases++ 2023-01-01 ; not affected by a.aliases+ foo 1+ bar++ This means that account aliases should usually be declared at the start of+ your top-most file, like this:++ alias foo=Foo+ alias bar=Bar++ 2023-01-01 ; affected by aliases above+ foo 1+ bar++ include c.journal ; also affected++ end aliases directive+ You can clear (forget) all currently defined aliases (seen in the journal+ so far, or defined on the command line) with this directive:++ end aliases++ Aliases can generate bad account names+ Be aware that account aliases can produce malformed account names, which+ could cause confusing reports or invalid print output. For example, you+ could erase all account names:++ 2021-01-01+ a:aa 1+ b++ $ hledger print --alias '/.*/='+ 2021-01-01+ 1++ The above print output is not a valid journal. Or you could insert an il-+ legal double space, causing print output that would give a different jour-+ nal when reparsed:++ 2021-01-01+ old 1+ other++ $ hledger print --alias old="new USD" | hledger -f- print+ 2021-01-01+ new USD 1+ other++ Aliases and account types+ If an account with a type declaration (see Declaring accounts > Account+ types) is renamed by an alias, normally the account type remains in effect.++ However, renaming in a way that reshapes the account tree (eg renaming par-+ ent accounts but not their children, or vice versa) could prevent child ac-+ counts from inheriting the account type of their parents.++ Secondly, if an account's type is being inferred from its name, renaming it+ by an alias could prevent or alter that.++ If you are using account aliases and the type: query is not matching ac-+ counts as you expect, try troubleshooting with the accounts command, eg+ something like:++ $ hledger accounts --types -1 --alias assets=bassetts++ commodity directive+ The commodity directive performs several functions:++ 1. It declares which commodity symbols may be used in the journal, enabling+ useful error checking with strict mode or the check command. See Com-+ modity error checking below.++ 2. It declares how all amounts in this commodity should be displayed, eg+ how many decimals to show. See Commodity display style above.++ 3. (If no decimal-mark directive is in effect:) It sets the decimal mark to+ expect (period or comma) when parsing amounts in this commodity, in this+ file and files it includes, from the directive until end of current+ file. See Decimal marks above.++ 4. It declares the precision with which this commodity's amounts should be+ compared when checking for balanced transactions, anywhere in this file+ and files it includes, until end of current file.++ Declaring commodities solves several common parsing/display problems, so we+ recommend it.++ Note that effects 3 and 4 above end at the end of the directive's file, and+ will not affect sibling or parent files. So if you are relying on them+ (especially 4) and using multiple files, placing your commodity directives+ in a top-level parent file might be important. Or, keep your decimal marks+ unambiguous and your entries well balanced and precise.++ Omitting the commodity symbol will set the display style for just the+ no-symbol commodity, not all commodities.++ Commodity styles can be overridden by the -c/--commodity-style command line+ option.++ (Related: #793)++ Commodity directive syntax+ A commodity directive is normally the word commodity followed by a sample+ amount, and optionally a comment. Only the amount's symbol and the num-+ ber's format is significant. Eg:++ commodity $1000.00+ commodity 1.000,00 EUR+ commodity 1 000 000.0000 ; the no-symbol commodity++ A commodity directive's sample amount must always include a period or comma+ decimal mark (this rule helps disambiguate decimal marks and digit group+ marks). If you don't want to show any decimal digits, write the decimal+ mark at the end:++ commodity 1000. AAAA ; show AAAA with no decimals++ Commodity symbols containing spaces, numbers, or punctuation must be en-+ closed in double quotes, as usual:++ commodity 1.0000 "AAAA 2023"++ Commodity directives normally include a sample amount, but can declare only+ a symbol (ie, just function 1 above):++ commodity $+ commodity INR+ commodity "AAAA 2023"+ commodity "" ; the no-symbol commodity++ Commodity directives may also be written with an indented format subdirec-+ tive, as in Ledger. The symbol is repeated and must be the same in both+ places. Other subdirectives are currently ignored:++ ; display indian rupees with currency name on the left,+ ; thousands, lakhs and crores comma-separated,+ ; period as decimal point, and two decimal places.+ commodity INR+ format INR 1,00,00,000.00+ an unsupported subdirective ; ignored by hledger++ Commodity tags+ A commodity directive's comment may contain tags. These will be propagated+ to all postings using that commodity in their main amount, as hidden but+ queryable posting tags, except where the posting already a tag of the same+ name. (Posting tags override account tags override commodity tags.)++ Commodity error checking+ In strict mode (-s/--strict) (or when you run hledger check commodities),+ hledger will report an error if an undeclared commodity symbol is used.+ (With one exception: zero amounts are always allowed to have no commodity+ symbol.) It works like account error checking (described above).++ decimal-mark directive+ You can use a decimal-mark directive - usually one per file, at the top of+ the file - to declare which character represents a decimal mark when pars-+ ing amounts in this file. It can look like++ decimal-mark .++ or++ decimal-mark ,++ This prevents any ambiguity when parsing numbers in the file, so we recom-+ mend it, especially if the file contains digit group marks (eg thousands+ separators).++ include directive+ You can pull in the content of additional files by writing an include di-+ rective, like this:++ include SOMEFILE++ This has the same effect as if SOMEFILE's content was inlined at this+ point. (With any include directives in SOMEFILE processed similarly, re-+ cursively.)++ Only journal files can include other files. They can include journal,+ timeclock or timedot files, but not CSV files.++ If the file path begins with a tilde, that means your home directory: in-+ clude ~/main.journal.++ If it begins with a slash, it is an absolute path: include+ /home/user/main.journal. Otherwise it is relative to the including file's+ folder: include ../finances/main.journal.++ Also, the path may have a file type prefix to force a specific file format,+ overriding the file extension(s) (as described in Data formats): include+ timedot:notes/2023.md.++ The path may contain glob patterns to match multiple files. hledger's+ globs are similar to zsh's: ? to match any character; [a-z] to match any+ character in a range; * to match zero or more characters that aren't a path+ separator (like /); ** to match zero or more subdirectories and/or zero or+ more characters at the start of a file name; etc. For convenience, include+ always excludes the current file. So, you can do++ * include *.journal to include all other journal files in the current di-+ rectory (excluding dot files)++ * include **.journal to include all other journal files in this directory+ and below (excluding dot files and top-level dot directories)++ * include timelogs/2???.timedot to include all timedot files named like a+ year number.++ Note * and ** usually won't match dot files or dot directories, with one+ exception: ** does search non-top-level dot directories. If this causes+ problems, make your glob pattern more specific (eg **.journal instead of+ **).++ If you are using many, or deeply nested, include files, and have an error+ that's hard to pinpoint: a good troubleshooting command is hledger files+ --debug=6 (or 7).++ P directive+ The P directive declares a market price, which is a conversion rate between+ two commodities on a certain date. This allows value reports to convert+ amounts of one commodity to their value in another, on or after that date.+ These prices are often obtained from a stock exchange, cryptocurrency ex-+ change, or the foreign exchange market.++ The format is:++ P DATE COMMODITY1SYMBOL COMMODITY2AMOUNT++ DATE is a simple date, COMMODITY1SYMBOL is the symbol of the commodity be-+ ing priced, and COMMODITY2AMOUNT is the amount (symbol and quantity) of+ commodity 2 that one unit of commodity 1 is worth on this date. Examples:++ # one euro was worth $1.35 from 2009-01-01 onward:+ P 2009-01-01 a $1.35++ # and $1.40 from 2010-01-01 onward:+ P 2010-01-01 a $1.40++ The -V, -X and --value flags use these market prices to show amount values+ in another commodity. See Value reporting.++ payee directive+ payee PAYEE NAME++ This directive can be used to declare a limited set of payees which may ap-+ pear in transaction descriptions. The "payees" check will report an error+ if any transaction refers to a payee that has not been declared. Eg:++ payee Whole Foods ; a comment++ Payees do not have tags (tags in the comment will be ignored).++ To declare the empty payee name, use "".++ payee ""++ Ledger-style indented subdirectives, if any, are currently ignored.++ tag directive+ tag TAGNAME++ This directive can be used to declare a limited set of tag names allowed in+ tags. TAGNAME should be a valid tag name (no spaces). Eg:++ tag item-id++ Any indented subdirectives are currently ignored.++ The "tags" check will report an error if any undeclared tag name is used.+ It is quite easy to accidentally create a tag through normal use of colons+ in comments; if you want to prevent this, you can declare and check your+ tags .++ Periodic transactions+ The ~ directive declares a "periodic rule" which generates temporary extra+ transactions, usually recurring at some interval, when hledger is run with+ the --forecast flag. These "forecast transactions" are useful for fore-+ casting future activity. They exist only for the duration of the report,+ and only when --forecast is used; they are not saved in the journal file by+ hledger.++ Periodic rules also have a second use: with the --budget flag they set bud-+ get goals for budgeting.++ Periodic rules can be a little tricky, so before you use them, read this+ whole section, or at least the following tips:++ 1. Two spaces accidentally added or omitted will cause you trouble - read+ about this below.++ 2. For troubleshooting, show the generated transactions with hledger print+ --forecast tag:generated or hledger register --forecast tag:generated.++ 3. Forecasted transactions will begin only after the last non-forecasted+ transaction's date.++ 4. Forecasted transactions will end 6 months from today, by default. See+ below for the exact start/end rules.++ 5. period expressions can be tricky. Their documentation needs improve-+ ment, but is worth studying.++ 6. Some period expressions with a repeating interval must begin on a nat-+ ural boundary of that interval. Eg in weekly from DATE, DATE must be a+ monday. ~ weekly from 2019/10/1 (a tuesday) will give an error.++ 7. Other period expressions with an interval are automatically expanded to+ cover a whole number of that interval. (This is done to improve re-+ ports, but it also affects periodic transactions. Yes, it's a bit in-+ consistent with the above.) Eg: ~ every 10th day of month from+ 2023/01, which is equivalent to ~ every 10th day of month from+ 2023/01/01, will be adjusted to start on 2019/12/10.++ Periodic rule syntax+ A periodic transaction rule looks like a normal journal entry, with the+ date replaced by a tilde (~) followed by a period expression (mnemonic: ~+ looks like a recurring sine wave.):++ # every first of month+ ~ monthly+ expenses:rent $2000+ assets:bank:checking++ # every 15th of month in 2023's first quarter:+ ~ monthly from 2023-04-15 to 2023-06-16+ expenses:utilities $400+ assets:bank:checking++ The period expression is the same syntax used for specifying multi-period+ reports, just interpreted differently; there, it specifies report periods;+ here it specifies recurrence dates (the periods' start dates).++ Periodic rules and relative dates+ Partial or relative dates (like 12/31, 25, tomorrow, last week, next quar-+ ter) are usually not recommended in periodic rules, since the results will+ change as time passes. If used, they will be interpreted relative to, in+ order of preference:++ 1. the first day of the default year specified by a recent Y directive++ 2. or the date specified with --today++ 3. or the date on which you are running the report.++ They will not be affected at all by report period or forecast period dates.++ Two spaces between period expression and description!+ If the period expression is followed by a transaction description, these+ must be separated by two or more spaces. This helps hledger know where the+ period expression ends, so that descriptions can not accidentally alter+ their meaning, as in this example:++ ; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2023"+ ; ||+ ; vv+ ~ every 2 months in 2023, we will review+ assets:bank:checking $1500+ income:acme inc++ So,++ * Do write two spaces between your period expression and your transaction+ description, if any.++ * Don't accidentally write two spaces in the middle of your period expres-+ sion.++ Auto postings+ The = directive declares an "auto posting rule", which adds extra postings+ to existing transactions. (Remember, postings are the account name &+ amount lines below a transaction's date & description.)++ In the journal, an auto posting rule looks quite like a transaction, but+ instead of date and description it has = (mnemonic: "match") and a query,+ like this:++ = QUERY+ ACCOUNT AMOUNT+ ...++ Queries are just like command line queries; an account name substring is+ most common. Query terms containing spaces should be enclosed in single or+ double quotes.++ Each = rule works like this: when hledger is run with the --auto flag,+ wherever the QUERY matches a posting in the journal, the rule's postings+ are added to that transaction, immediately below the matched posting. Note+ these generated postings are temporary, existing only for the duration of+ the report, and only when --auto is used; they are not saved in the journal+ file by hledger.++ The postings can contain the special string %account which will be expanded+ to the account name of the matched account.++ Generated postings' amounts can depend on the matched posting's amount. So+ auto postings can be useful for, eg, adding tax postings with a standard+ percentage. AMOUNT can be:++ * a number with no commodity symbol, like 2. The matched posting's commod-+ ity symbol will be added to this.++ * a normal amount with a commodity symbol, like $2. This will be used+ as-is.++ * an asterisk followed by a number, like *2. This will multiply the+ matched posting's amount (and total price, if any) by the number.++ * an asterisk followed by an amount with commodity symbol, like *$2. This+ multiplies and also replaces the commodity symbol with this new one.++ Some examples:++ ; every time I buy food, schedule a dollar donation+ = expenses:food+ (liabilities:charity) $-1++ ; when I buy a gift, also deduct that amount from a budget envelope subaccount+ = expenses:gifts+ assets:checking:gifts *-1+ assets:checking *1++ 2017/12/1+ expenses:food $10+ assets:checking++ 2017/12/14+ expenses:gifts $20+ assets:checking++ $ hledger print --auto+ 2017-12-01+ expenses:food $10+ assets:checking+ (liabilities:charity) $-1++ 2017-12-14+ expenses:gifts $20+ assets:checking+ assets:checking:gifts -$20+ assets:checking $20++ Note that depending fully on generated data such as this has some drawbacks+ - it's less portable, less future-proof, less auditable by others, and less+ robust (eg your balance assertions will depend on whether you use or don't+ use --auto). An alternative is to use auto postings in "one time" fashion+ - use them to help build a complex journal entry, view it with hledger+ print --auto, and then copy that output into the journal file to make it+ permanent.++ Auto postings and multiple files+ An auto posting rule can affect any transaction in the current file, or in+ any parent file or child file. Note, currently it will not affect sibling+ files (when multiple -f/--file are used - see #1212).++ Auto postings and dates+ A posting date (or secondary date) in the matched posting, or (taking+ precedence) a posting date in the auto posting rule itself, will also be+ used in the generated posting.++ Auto postings and transaction balancing / inferred amounts / balance asser-+ tions+ Currently, auto postings are added:++ * after missing amounts are inferred, and transactions are checked for bal-+ ancedness,++ * but before balance assertions are checked.++ Note this means that journal entries must be balanced both before and after+ auto postings are added. This changed in hledger 1.12+; see #893 for back-+ ground.++ This also means that you cannot have more than one auto-posting with a+ missing amount applied to a given transaction, as it will be unable to in-+ fer amounts.++ Auto posting tags+ Automated postings will have some extra tags:++ * generated-posting:= QUERY - shows this was generated by an auto posting+ rule, and the query++ * _generated-posting:= QUERY - a hidden tag, which does not appear in+ hledger's output. This can be used to match postings generated "just+ now", rather than generated in the past and saved to the journal.++ Also, any transaction that has been changed by auto posting rules will have+ these tags added:++ * modified: - this transaction was modified++ * _modified: - a hidden tag not appearing in the comment; this transaction+ was modified "just now".++ Auto postings on forecast transactions only+ Tip: you can can make auto postings that will apply to forecast transac-+ tions but not recorded transactions, by adding tag:_generated-transaction+ to their QUERY. This can be useful when generating new journal entries to+ be saved in the journal.++ Other syntax+ hledger journal format supports quite a few other features, mainly to make+ interoperating with or converting from Ledger easier. Note some of the+ features below are powerful and can be useful in special cases, but in gen-+ eral, features in this section are considered less important or even not+ recommended for most users. Downsides are mentioned to help you decide if+ you want to use them.++ Balance assignments+ Ledger-style balance assignments are also supported. These are like bal-+ ance assertions, but with no posting amount on the left side of the equals+ sign; instead it is calculated automatically so as to satisfy the asser-+ tion. This can be a convenience during data entry, eg when setting opening+ balances:++ ; starting a new journal, set asset account balances+ 2016/1/1 opening balances+ assets:checking = $409.32+ assets:savings = $735.24+ assets:cash = $42+ equity:opening balances++ or when adjusting a balance to reality:++ ; no cash left; update balance, record any untracked spending as a generic expense+ 2016/1/15+ assets:cash = $0+ expenses:misc++ The calculated amount depends on the account's balance in the commodity at+ that point (which depends on the previously-dated postings of the commodity+ to that account since the last balance assertion or assignment).++ Downsides: using balance assignments makes your journal less explicit; to+ know the exact amount posted, you have to run hledger or do the calcula-+ tions yourself, instead of just reading it. Also balance assignments'+ forcing of balances can hide errors. These things make your financial data+ less portable, less future-proof, and less trustworthy in an audit.++ Balance assignments and costs+ A cost in a balance assignment will cause the calculated amount to have+ that cost attached:++ 2019/1/1+ (a) = $1 @ a2++ $ hledger print --explicit+ 2019-01-01+ (a) $1 @ a2 = $1 @ a2++ Balance assignments and multiple files+ Balance assignments handle multiple files like balance assertions. They+ see balance from other files previously included from the current file, but+ not from previous sibling or parent files.++ Bracketed posting dates+ For setting posting dates and secondary posting dates, Ledger's bracketed+ date syntax is also supported: [DATE], [DATE=DATE2] or [=DATE2] in posting+ comments. hledger will attempt to parse any square-bracketed sequence of+ the 0123456789/-.= characters in this way. With this syntax, DATE infers+ its year from the transaction and DATE2 infers its year from DATE.++ Downsides: another syntax to learn, redundant with hledger's date:/date2:+ tags, and confusingly similar to Ledger's lot date syntax.++ D directive+ D AMOUNT++ This directive sets a default commodity, to be used for any subsequent com-+ modityless amounts (ie, plain numbers) seen while parsing the journal.+ This effect lasts until the next D directive, or the end of the current+ file.++ For compatibility/historical reasons, D also acts like a commodity direc-+ tive (setting the commodity's decimal mark for parsing and display style+ for output). So its argument is not just a commodity symbol, but a full+ amount demonstrating the style. The amount must include a decimal mark+ (either period or comma). Eg:++ ; commodity-less amounts should be treated as dollars+ ; (and displayed with the dollar sign on the left, thousands separators and two decimal places)+ D $1,000.00++ 1/1+ a 5 ; <- commodity-less amount, parsed as $5 and displayed as $5.00+ b++ Interactions with other directives:++ For setting a commodity's display style, a commodity directive has highest+ priority, then a D directive.++ For detecting a commodity's decimal mark during parsing, decimal-mark has+ highest priority, then commodity, then D.++ For checking commodity symbols with the check command, a commodity direc-+ tive is required (hledger check commodities ignores D directives).++ Downsides: omitting commodity symbols makes your financial data less ex-+ plicit, less portable, and less trustworthy in an audit. It is usually an+ unsustainable shortcut; sooner or later you will want to track multiple+ commodities. D is overloaded with functions redundant with commodity and+ decimal-mark. And it works differently from Ledger's D.++ apply account directive+ This directive sets a default parent account, which will be prepended to+ all accounts in following entries, until an end apply account directive or+ end of current file. Eg:++ apply account home++ 2010/1/1+ food $10+ cash++ end apply account++ is equivalent to:++ 2010/01/01+ home:food $10+ home:cash $-10++ account directives are also affected, and so is any included content.++ Account names entered via hledger add or hledger-web are not affected.++ Account aliases, if any, are applied after the parent account is prepended.++ Downsides: this can make your financial data less explicit, less portable,+ and less trustworthy in an audit.++ Y directive+ Y YEAR++ or (deprecated backward-compatible forms):++ year YEAR apply year YEAR++ The space is optional. This sets a default year to be used for subsequent+ dates which don't specify a year. Eg:++ Y2009 ; set default year to 2009++ 12/15 ; equivalent to 2009/12/15+ expenses 1+ assets++ year 2010 ; change default year to 2010++ 2009/1/30 ; specifies the year, not affected+ expenses 1+ assets++ 1/31 ; equivalent to 2010/1/31+ expenses 1+ assets++ Downsides: omitting the year (from primary transaction dates, at least)+ makes your financial data less explicit, less portable, and less trustwor-+ thy in an audit. Such dates can get separated from their corresponding Y+ directive, eg when evaluating a region of the journal in your editor. A+ missing Y directive makes reports dependent on today's date.++ Secondary dates+ A secondary date is written after the primary date, following an equals+ sign: DATE1=DATE2. If the year is omitted, the primary date's year is as-+ sumed. When running reports, the primary (left side) date is used by de-+ fault, but with the --date2 flag (--aux-date or--effective also work, for+ Ledger users), the secondary (right side) date will be used instead.++ The meaning of secondary dates is up to you. Eg it could be "primary is+ the bank's clearing date, secondary is the date the transaction was initi-+ ated, if different".++ In practice, this feature usually adds confusion:++ * You have to remember the primary and secondary dates' meaning, and follow+ that consistently.++ * It splits your bookkeeping into two modes, and you have to remember which+ mode is appropriate for a given report.++ * Usually your balance assertions will work with only one of these modes.++ * It makes your financial data more complicated, less portable, and less+ clear in an audit.++ * It interacts with every feature, creating an ongoing cost for implemen-+ tors.++ * It distracts new users and supporters.++ * Posting dates are simpler and work better.++ So secondary dates are officially deprecated in hledger, remaining only as+ a Ledger compatibility aid; we recommend using posting dates instead.++ Star comments+ Lines beginning with * (star/asterisk) are also comment lines. This fea-+ ture allows Emacs users to insert org headings in their journal, allowing+ them to fold/unfold/navigate it like an outline when viewed with org mode.++ Downsides: another, unconventional comment syntax to learn. Decreases your+ journal's portability. And switching to Emacs org mode just for fold-+ ing/unfolding meant losing the benefits of ledger mode; nowadays you can+ add outshine mode to ledger mode to get folding without losing ledger+ mode's features.++ Valuation expressions+ Ledger allows a valuation function or value to be written in double paren-+ theses after an amount. hledger ignores these.++ Virtual postings+ A posting with parentheses around the account name, like (some:account)+ 10, is called an unbalanced virtual posting. These postings do not partic-+ ipate in transaction balancing. (And if you write them without an amount,+ a zero amount is always inferred.) These can occasionally be convenient+ for special circumstances, but they violate double entry bookkeeping and+ make your data less portable across applications, so many people avoid us-+ ing them at all.++ A posting with brackets around the account name ([some:account]) is called+ a balanced virtual posting. The balanced virtual postings in a transaction+ must add up to zero, just like ordinary postings, but separately from them.+ These are not part of double entry bookkeeping either, but they are at+ least balanced. An example:++ 2022-01-01 buy food with cash, update budget envelope subaccounts, & something else+ assets:cash $-10 ; <- these balance each other+ expenses:food $7 ; <-+ expenses:food $3 ; <-+ [assets:checking:budget:food] $-10 ; <- and these balance each other+ [assets:checking:available] $10 ; <-+ (something:else) $5 ; <- this is not required to balance++ Ordinary postings, whose account names are neither parenthesised nor brack-+ eted, are called real postings. You can exclude virtual postings from re-+ ports with the -R/--real flag or a real:1 query.++ Other Ledger directives+ These other Ledger directives are currently accepted but ignored. This al-+ lows hledger to read more Ledger files, but be aware that hledger's reports+ may differ from Ledger's if you use these.++ apply fixed COMM AMT+ apply tag TAG+ assert EXPR+ bucket / A ACCT+ capture ACCT REGEX+ check EXPR+ define VAR=EXPR+ end apply fixed+ end apply tag+ end apply year+ end tag+ eval / expr EXPR+ python+ PYTHONCODE+ tag NAME+ value EXPR+ --command-line-flags++ See also https://hledger.org/ledger.html for a detailed hledger/Ledger syn-+ tax comparison.++ Ledger virtual costs+ In Ledger, (@) UNITCOST and (@@) TOTALCOST are virtual costs, which do not+ generate market prices. In hledger, these are equivalent to @ and @@.++ Ledger lot syntax+ In Ledger, these optional annotations after an amount help specify the cost+ basis of a newly acquired lot, or select existing lot(s) to dispose of:++ * {LOTUNITCOST} and {{LOTTOTALCOST}} (lot price)++ * [LOTDATE] (lot date)++ * (LOTNOTE) (lot note)++ hledger does not yet calculate lots itself, but it accepts these annota-+ tions and will show them in print's txt, beancount, and json output for-+ mats. This means you can use this syntax in your hledger journals (with an+ amountless extra posting to help transactions balance, when needed), and+ use the print command to export to Ledger or Beancount when you want to+ calculate lots and capital gains.++ Ledger fixed lot costs+ * {=UNITCOST} and {{=TOTALCOST}} (fixed price)++ * when buying, means "this cost is also the fixed value, don't let it+ fluctuate in value reports"++ Probably equivalent to @/@@, I'm not sure.++ Beancount has simpler notation and different behaviour:++ * @ UNITCOST and @@ TOTALCOST++ * expresses a cost without creating a lot, as in hledger++ * when buying (acquiring) or selling (disposing of) a lot, and combined+ with {...}: is not used except to document the cost/selling price++ * {UNITCOST} and {{TOTALCOST}}++ * when buying, expresses the cost for transaction balancing, and also+ creates a lot with this cost basis attached++ * when selling,++ * selects a lot by its cost basis++ * raises an error if that lot is not present or can not be selected un-+ ambiguously (depending on booking method configured)++ * expresses the selling price for transaction balancing++ * {}, {YYYY-MM-DD}, {"LABEL"}, {UNITCOST, "LABEL"}, {UNITCOST, YYYY-MM-DD,+ "LABEL"}++ * when selling, other combinations of date/cost/label, like the above,+ are accepted for selecting the lot.++ Currently, hledger++ * supports @ and @@++ * accepts the {UNITCOST}/{{TOTALCOST}} notation, but ignores it++ * and rejects the rest.++CSV+ hledger can read transactions from CSV (comma-separated values) files.+ More precisely, it can read DSV (delimiter-separated values), from a file+ or standard input. Comma-separated, semicolon-separated and tab-separated+ are the most common variants, and hledger will recognise these three auto-+ matically based on a .csv, .ssv or .tsv file name extension or a csv:, ssv:+ or tsv: file path prefix.++ (To learn about producing CSV or TSV output, see Output format.)++ Each CSV file must be described by a corresponding rules file. This con-+ tains rules describing the CSV data (header line, fields layout, date for-+ mat etc.), how to construct hledger transactions from it, and how to cate-+ gorise transactions based on description or other attributes.++ By default, hledger expects this rules file to be named like the CSV file,+ with an extra .rules extension added, in the same directory. Eg when asked+ to read foo/FILE.csv, hledger looks for foo/FILE.csv.rules. You can spec-+ ify a different rules file with the --rules option.++ At minimum, the rules file must identify the date and amount fields, and+ often it also specifies the date format and how many header lines there+ are. Here's a simple CSV file and a rules file for it:++ Date, Description, Id, Amount+ 12/11/2019, Foo, 123, 10.23++ # basic.csv.rules+ skip 1+ fields date, description, , amount+ date-format %d/%m/%Y++ $ hledger print -f basic.csv+ 2019-11-12 Foo+ expenses:unknown 10.23+ income:unknown -10.23++ There's an introductory Tutorial: Import CSV data on hledger.org, and more+ CSV rules examples below, and a larger collection at https://github.com/si-+ monmichael/hledger/tree/master/examples/csv.++ CSV rules cheatsheet+ The following kinds of rule can appear in the rules file, in any order.+ (Blank lines and lines beginning with # or ; or * are ignored.)++ source optionally declare which file to read data+ from+ archive optionally enable an archive of imported files+ encoding optionally declare which text encoding the+ data has+ separator declare the field separator, instead of rely-+ ing on file extension+ decimal-mark declare the decimal mark used in CSV amounts,+ when ambiguous+ date-format declare how to parse CSV dates/date-times+ timezone declare the time zone of ambiguous CSV+ date-times+ newest-first improve txn order when: there are multiple+ records, newest first, all with the same date+ intra-day-reversed improve txn order when: same-day txns are in+ opposite order to the overall file+ skip (at top level) skip header line(s) at start of+ file+ fields list name CSV fields for easy reference, and op-+ tionally assign their values to hledger fields+ Field assignment assign a CSV value or interpolated text value+ to a hledger field+ if block conditionally assign values to hledger fields,+ or skip a record or end (skip rest of file)+ if table conditionally assign values to hledger fields,+ using compact syntax+ skip (inside an if rule) skip current record(s)+ end (inside an if rule) skip all remaining records+ balance-type select which type of balance assertions/as-+ signments to generate+ include inline another CSV rules file++ Working with CSV tips can be found below, including How CSV rules are eval-+ uated.++ source+ If you tell hledger to read a csv file with -f foo.csv, it will look for+ rules in foo.csv.rules. Or, you can tell it to read the rules file, with+ -f foo.csv.rules, and it will look for data in foo.csv (since 1.30). These+ are mostly equivalent, but the second method provides some extra features.+ For one, the data file can be missing, without causing an error; it is just+ considered empty.++ For more flexibility, add a source rule, which lets you specify a different+ data file:++ source ./Checking1.csv++ If the file does not exist, it is just considered empty, without raising an+ error.++ If you specify just a file name with no path, hledger will look for it in+ the ~/Downloads folder:++ source Checking1.csv++ You can use a glob pattern, to avoid specifying the file name exactly:++ source Checking1*.csv++ This has another benefit: if the pattern matches multiple files, hledger+ will read the newest (most recently modified) one. This avoids problems if+ you have downloaded a file multiple times without cleaning up.++ All this enables a convenient workflow where can you just download CSV+ files, then run hledger import rules/*.++ See also "Working with CSV > Reading files specified by rule".++ Data cleaning / data generating commands+ After source's file pattern, you can write | (pipe) and a data cleaning+ command (or command pipeline). If hledger's CSV rules aren't enough, you+ can pre-process the downloaded data here with a shell command or script, to+ make it more suitable for conversion. The command will be executed by your+ default shell, in the directory of the rules file, will receive the data+ file's content as standard input, and should output zero or more lines of+ character-separated-values, suitable for conversion by the CSV rules.++ Examples:++ source ./paypal.json | paypalcsv+ source data/simplefin.json | simplefincsv - 'chase.*card'+ source OfxDownload*.csv | grep -vE '^(([^,]*,){6}[^,]*|)$' | sort -t, -n +2+ source History_for_Account_Z20144832*.csv # | grep -E '^([^,]*,){12}[^,]*$' | sed -E -e 's/^ //' -e 's/\.([0-9]),/.\10,/g' -e 's/,([0-9]+),/,\1.00,/g'++ Or, after source you can write | and a data generating command (with no+ file pattern before the |). This command receives no input, and should+ output zero or more lines of character-separated values, suitable for con-+ version by the CSV rules.++ Examples:++ source | paypaljson | paypalcsv+ source | paypalcsv data/paypal.json+ source | simplefinjson >data/simplefin.json && simplefincsv data/simplefin.json 'chase.*card'+ source | simplefincsv data/simplefin.json 'unify.*checking'++ (paypal* and simplefin* scripts are in bin/)++ Whenever hledger runs one of these commands, it will echo the command on+ stderr. If the command produces error output, but exits successfully,+ hledger will show the error output as a warning. If the command fails,+ hledger will fail and show the error output in the error message.++ Added in 1.50; experimental.++ archive+ With archive added to a rules file, the import command will archive each+ successfully processed data file or data command output in a nearby data/+ directory. The archive file name will be based on the rules file and the+ data file's modification date and extension (or for a data-generating com-+ mand, the current date and the ".csv" extension). The original data file,+ if any, will be removed.++ Also, in this mode import will prefer the oldest file matched by the source+ rule's glob pattern, not the newest. (So if there are multiple downloads,+ they will be imported and archived oldest first.)++ Archiving is optional, but it can be useful for troubleshooting your CSV+ rules, regenerating entries with improved rules, checking for variations in+ your bank's CSV, etc.++ Added in 1.50; experimental.++ encoding+ encoding ENCODING++ hledger normally expects non-ascii text to be using the system locale's+ text encoding. If you need to read CSV files which have some other encod-+ ing, you can do it by adding encoding ENCODING to your CSV rules. Eg: en-+ coding iso-8859-1.++ The following encodings are supported:++ ascii, utf-8, utf-16, utf-32, iso-8859-1, iso-8859-2, iso-8859-3,+ iso-8859-4, iso-8859-5, iso-8859-6, iso-8859-7, iso-8859-8, iso-8859-9,+ iso-8859-10, iso-8859-11, iso-8859-13, iso-8859-14, iso-8859-15,+ iso-8859-16, cp1250, cp1251, cp1252, cp1253, cp1254, cp1255, cp1256,+ cp1257, cp1258, koi8-r, koi8-u, gb18030, macintosh, jis-x-0201, jis-x-0208,+ iso-2022-jp, shift-jis, cp437, cp737, cp775, cp850, cp852, cp855, cp857,+ cp860, cp861, cp862, cp863, cp864, cp865, cp866, cp869, cp874, cp932.++ Added in 1.42.++ separator+ You can use the separator rule to read other kinds of character-separated+ data. The argument is any single separator character, or the words tab or+ space (case insensitive). Eg, for comma-separated values (CSV):++ separator ,++ or for semicolon-separated values (SSV):++ separator ;++ or for tab-separated values (TSV):++ separator TAB++ If the input file has a .csv, .ssv or .tsv file extension (or a csv:, ssv:,+ tsv: prefix), the appropriate separator will be inferred automatically, and+ you won't need this rule.++ skip+ skip N++ The word skip followed by a number (or no number, meaning 1) tells hledger+ to ignore this many non-empty lines at the start of the input data. You'll+ need this whenever your CSV data contains header lines. Note, empty and+ blank lines are skipped automatically, so you don't need to count those.++ skip has a second meaning: it can be used inside if blocks (described be-+ low), to skip one or more records whenever the condition is true. Records+ skipped in this way are ignored, except they are still required to be valid+ CSV.++ date-format+ date-format DATEFMT++ This is a helper for the date (and date2) fields. If your CSV dates are+ not formatted like YYYY-MM-DD, YYYY/MM/DD or YYYY.MM.DD, you'll need to add+ a date-format rule describing them with a strptime-style date parsing pat-+ tern - see https://hackage.haskell.org/package/time/docs/Data-Time-For-+ mat.html#v:formatTime. The pattern must parse the CSV date value com-+ pletely. Some examples:++ # MM/DD/YY+ date-format %m/%d/%y++ # D/M/YYYY+ # The - makes leading zeros optional.+ date-format %-d/%-m/%Y++ # YYYY-Mmm-DD+ date-format %Y-%h-%d++ # M/D/YYYY HH:MM AM some other junk+ # Note the time and junk must be fully parsed, though only the date is used.+ date-format %-m/%-d/%Y %l:%M %p some other junk++ Note currently there is no locale awareness for things like %b, and setting+ LC_TIME won't help.++ timezone+ timezone TIMEZONE++ When CSV contains date-times that are implicitly in some time zone other+ than yours, but containing no explicit time zone information, you can use+ this rule to declare the CSV's native time zone, which helps prevent+ off-by-one dates.++ When the CSV date-times do contain time zone information, you don't need+ this rule; instead, use %Z in date-format (or %z, %EZ, %Ez; see the format-+ Time link above).++ In either of these cases, hledger will do a time-zone-aware conversion, lo-+ calising the CSV date-times to your current system time zone. If you pre-+ fer to localise to some other time zone, eg for reproducibility, you can+ (on unix at least) set the output timezone with the TZ environment vari-+ able, eg:++ $ TZ=-1000 hledger print -f foo.csv # or TZ=-1000 hledger import foo.csv++ timezone currently does not understand timezone names, except "UTC", "GMT",+ "EST", "EDT", "CST", "CDT", "MST", "MDT", "PST", or "PDT". For others, use+ numeric format: +HHMM or -HHMM.++ newest-first+ hledger tries to ensure that the generated transactions will be ordered+ chronologically, including same-day transactions. Usually it can auto-de-+ tect how the CSV records are ordered. But if it encounters CSV where all+ records are on the same date, it assumes that the records are oldest first.+ If in fact the CSV's records are normally newest first, like:++ 2022-10-01, txn 3...+ 2022-10-01, txn 2...+ 2022-10-01, txn 1...++ you can add the newest-first rule to help hledger generate the transactions+ in correct order.++ # same-day CSV records are newest first+ newest-first++ intra-day-reversed+ If CSV records within a single day are ordered opposite to the overall+ record order, you can add the intra-day-reversed rule to improve the order+ of journal entries. Eg, here the overall record order is newest first, but+ same-day records are oldest first:++ 2022-10-02, txn 3...+ 2022-10-02, txn 4...+ 2022-10-01, txn 1...+ 2022-10-01, txn 2...++ # transactions within each day are reversed with respect to the overall date order+ intra-day-reversed++ decimal-mark+ decimal-mark .++ or:++ decimal-mark ,++ hledger automatically accepts either period or comma as a decimal mark when+ parsing numbers (cf Amounts). However if any numbers in the CSV contain+ digit group marks, such as thousand-separating commas, you should declare+ the decimal mark explicitly with this rule, to avoid misparsed numbers.++ CSV fields and hledger fields+ This can be confusing, so let's start with an overview:++ * CSV fields are provided by your data file. They are named by their posi-+ tion in the CSV record, starting with 1. You can also give them a read-+ able name.++ * hledger fields are predefined; date, description, account1, amount1, ac-+ count2 are some of them. They correspond to parts of a transaction's+ journal entry, mostly.++ * The CSV fields and hledger fields are the only fields you'll be working+ with; you can't define new fields, or variables as in a programming lan-+ guage. (But you could add extra CSV fields to the data in preprocessing,+ before running the rules.)++ * For each CSV record, you'll assign values to one or more of the hledger+ fields to build up a transaction (journal entry). Values can be static+ text, CSV field values from the current record, or a combination of+ these.++ * For simple cases, you can give a CSV field the same name as one of the+ hledger fields, then its value will be automatically assigned to that+ hledger field.++ * CSV fields can only be read, not written to. They'll be on the right+ hand side, with a % prefix. Eg++ * testing a CSV field's value: if %CSVFIELD ...++ * interpolating its value: HLEDGERFIELD %CSVFIELD++ * hledger fields can only be written to, not read. They'll be on the left+ hand side (or in a fields list), with no prefix. Eg++ * setting the transaction's description to a value: description VALUE++ * setting the transaction's description to the second CSV field's value:+ fields date, description, amount++ fields list+ fields FIELDNAME1, FIELDNAME2, ...++ A fields list (the word fields followed by comma-separated field names) is+ optional, but convenient. It does two things:++ 1. It names the CSV field in each column. This can be convenient if you+ are referencing them in other rules, so you can say %SomeField instead+ of remembering %13.++ 2. Whenever you use one of the special hledger field names (described be-+ low), it assigns the CSV value in this position to that hledger field.+ This is the quickest way to populate hledger's fields and build a trans-+ action.++ Here's an example that says "use the 1st, 2nd and 4th fields as the trans-+ action's date, description and amount; name the last two fields for later+ reference; and ignore the others":++ fields date, description, , amount, , , somefield, anotherfield++ In a fields list, the separator is always comma; it is unrelated to the CSV+ file's separator. Also:++ * There must be least two items in the list (at least one comma).++ * Field names may not contain spaces. Spaces before/after field names are+ optional.++ * Field names may contain _ (underscore) or - (hyphen).++ * Fields you don't care about can be given a dummy name or an empty name.++ If the CSV contains column headings, it's convenient to use these for your+ field names, suitably modified (eg lower-cased with spaces replaced by un-+ derscores).++ Sometimes you may want to alter a CSV field name to avoid assigning to a+ hledger field with the same name. Eg you could call the CSV's "balance"+ field balance_ to avoid directly setting hledger's balance field (and gen-+ erating a balance assertion).++ Field assignment+ HLEDGERFIELD FIELDVALUE++ Field assignments are the more flexible way to assign CSV values to hledger+ fields. They can be used instead of or in addition to a fields list (see+ above).++ To assign a value to a hledger field, write the field name (any of the+ standard hledger field/pseudo-field names, defined below), a space, fol-+ lowed by a text value on the same line. This text value may interpolate+ CSV fields, referenced either by their 1-based position in the CSV record+ (%N) or by the name they were given in the fields list (%CSVFIELD), and+ regular expression match groups (\N).++ Some examples:++ # set the amount to the 4th CSV field, with " USD" appended+ amount %4 USD++ # combine three fields to make a comment, containing note: and date: tags+ comment note: %somefield - %anotherfield, date: %1++ Tips:++ * Interpolation strips outer whitespace (so a CSV value like " 1 " becomes+ 1 when interpolated) (#1051).++ * Interpolations always refer to a CSV field - you can't interpolate a+ hledger field. (See Referencing other fields below).++ Field names+ Note the two kinds of field names mentioned here, and used only in hledger+ CSV rules files:++ 1. CSV field names (CSVFIELD in these docs): you can optionally name the+ CSV columns for easy reference (since hledger doesn't yet automatically+ recognise column headings in a CSV file), by writing arbitrary names in+ a fields list, eg:++ fields When, What, Some_Id, Net, Total, Foo, Bar++ 2. Special hledger field names (HLEDGERFIELD in these docs): you must set+ at least some of these to generate the hledger transaction from a CSV+ record, by writing them as the left hand side of a field assignment, eg:++ date %When+ code %Some_Id+ description %What+ comment %Foo %Bar+ amount1 $ %Total++ or directly in a fields list:++ fields date, description, code, , amount1, Foo, Bar+ currency $+ comment %Foo %Bar++ Here are all the special hledger field names available, and what happens+ when you assign values to them:++ date field+ Assigning to date sets the transaction date.++ date2 field+ date2 sets the transaction's secondary date, if any.++ status field+ status sets the transaction's status, if any.++ code field+ code sets the transaction's code, if any.++ description field+ description sets the transaction's description, if any.++ comment field+ comment sets the transaction's comment, if any.++ commentN, where N is a number, sets the Nth posting's comment.++ You can assign multi-line comments by writing literal \n in the code. A+ comment starting with \n will begin on a new line.++ Comments can contain tags, as usual.++ Posting comments can also contain a posting date. A secondary date, or a+ year-less date, will be ignored.++ account field+ Assigning to accountN, where N is 1 to 99, sets the account name of the Nth+ posting, and causes that posting to be generated.++ Most often there are two postings, so you'll want to set account1 and ac-+ count2. Typically account1 is associated with the CSV file, and is set+ once with a top-level assignment, while account2 is set based on each+ transaction's description, in conditional rules.++ If a posting's account name is left unset but its amount is set (see be-+ low), a default account name will be chosen (like "expenses:unknown" or+ "income:unknown").++ amount field+ There are several ways to set posting amounts from CSV, useful in different+ situations.++ 1. amount is the oldest and simplest. Assigning to this sets the amount of+ the first and second postings. In the second posting, the amount will+ be negated; also, if it has a cost attached, it will be converted to+ cost.++ 2. amount-in and amount-out work exactly like the above, but should be used+ when the CSV has two amount fields (such as "Debit" and "Credit", or+ "Inflow" and "Outflow"). Whichever field has a non-zero value will be+ used as the amount of the first and second postings. Here are some tips+ to avoid confusion:++ * It's not "amount-in for posting 1 and amount-out for posting 2", it+ is "extract a single amount from the amount-in or amount-out field,+ and use that for posting 1 and (negated) for posting 2".++ * Don't use both amount and amount-in/amount-out in the same rules+ file; choose based on whether the amount is in a single CSV field or+ spread across two fields.++ * In each record, at most one of the two CSV fields should contain a+ non-zero amount; the other field must contain a zero or nothing.++ * hledger assumes both CSV fields contain unsigned numbers, and it au-+ tomatically negates the amount-out values.++ * If the data doesn't fit these requirements, you'll probably need an+ if rule (see below).++ 3. amountN (where N is a number from 1 to 99) sets the amount of only a+ single posting: the Nth posting in the transaction. You'll usually need+ at least two such assignments to make a balanced transaction. You can+ also generate more than two postings, to represent more complex transac-+ tions. The posting numbers don't have to be consecutive; with if rules,+ higher posting numbers can be useful to ensure a certain order of post-+ ings.++ 4. amountN-in and amountN-out work exactly like the above, but should be+ used when the CSV has two amount fields. This is analogous to amount-in+ and amount-out, and those tips also apply here.++ 5. Remember that a fields list can also do assignments. So in a fields+ list if you name a CSV field "amount", that counts as assigning to+ amount. (If you don't want that, call it something else in the fields+ list, like "amount_".)++ 6. The above don't handle every situation; if you need more flexibility,+ use an if rule to set amounts conditionally. See "Working with CSV >+ Setting amounts" below for more on this and on amount-setting generally.++ currency field+ currency sets a currency symbol, to be prepended to all postings' amounts.+ You can use this if the CSV amounts do not have a currency symbol, eg if it+ is in a separate column.++ currencyN prepends a currency symbol to just the Nth posting's amount.++ balance field+ balanceN sets a balance assertion amount (or if the posting amount is left+ empty, a balance assignment) on posting N.++ balance is a compatibility spelling for hledger <1.17; it is equivalent to+ balance1.++ You can adjust the type of assertion/assignment with the balance-type rule+ (see below).++ See the Working with CSV tips below for more about setting amounts and cur-+ rency.++ if block+ Rules can be applied conditionally, depending on patterns in the CSV data.+ This allows flexibility; in particular, it is how you can categorise trans-+ actions, selecting an appropriate account name based on their description+ (for example). There are two ways to write conditional rules: "if blocks",+ described here, and "if tables", described below.++ An if block is the word if and one or more "matcher" expressions (can be a+ word or phrase), one per line, starting either on the same or next line;+ followed by one or more indented rules. Eg,++ if MATCHER+ RULE++ or++ if+ MATCHER+ MATCHER+ MATCHER+ RULE+ RULE++ If any of the matchers succeeds, all of the indented rules will be applied.+ They are usually field assignments, but the following special rules may+ also be used within an if block:++ * skip - skips the matched CSV record (generating no transaction from it)++ * end - skips the rest of the current CSV file.++ Some examples:++ # if the record contains "groceries", set account2 to "expenses:groceries"+ if groceries+ account2 expenses:groceries++ # if the record contains any of these phrases, set account2 and a transaction comment as shown+ if+ monthly service fee+ atm transaction fee+ banking thru software+ account2 expenses:business:banking+ comment XXX deductible ? check it++ # if an empty record is seen (assuming five fields), ignore the rest of the CSV file+ if ,,,,+ end++ Matchers+ There are two kinds of matcher:++ 1. A whole record matcher is simplest: it is just a word, single-line text+ fragment, or other regular expression, which hledger will try to match+ case-insensitively anywhere within the CSV record.+ Eg: whole foods.++ 2. A field matcher has a percent-prefixed CSV field number or name before+ the pattern.+ Eg: %3 whole foods or %description whole foods.+ hledger will try to match the pattern just within the named CSV field.++ When using these, there's two things to be aware of:++ 1. Whole record matchers don't see the exact original record; they see a+ reconstruction of it, in which values are comma-separated, and quotes+ enclosing values and whitespace outside those quotes are removed.+ Eg when reading an SSV record like: 2023-01-01 ; "Acme, Inc. " ; 1,000+ the whole record matcher sees instead: 2023-01-01,Acme, Inc. ,1,000++ 2. Field matchers expect either a CSV field number, or a CSV field name de-+ clared with fields. Anything else will cause it to match against the+ empty string, and probably fail silently (this makes it easier to reuse+ common rules with different CSV files). Don't use a hledger field name+ here (see CSV fields and hledger fields).++ You can also prefix a matcher with ! (and optional space) to negate it. Eg+ ! whole foods, ! %3 whole foods, !%description whole foods will match if+ "whole foods" is NOT present. Added in 1.32.++ The pattern is, as usual in hledger, a POSIX extended regular expression+ that also supports GNU word boundaries (\b, \B, \<, \>) and nothing else.+ For more details and tips, see Regular expressions in CSV rules below.++ Multiple matchers+ When an if block has multiple matchers, each on its own line,++ * By default they are OR'd (any of them can match).++ * Matcher lines beginning with & (or &&, since 1.42) are AND'ed with the+ matcher above (all in the AND'ed group must match).++ * Matcher lines beginning with & ! (since 1.41, or && !, since 1.42) are+ first negated and then AND'ed with the matcher above.++ You can also combine multiple matchers one the same line separated by &&+ (AND) or && ! (AND NOT). Eg %description amazon && %date 2025-01-01 will+ match only when the description field contains "amazon" and the date field+ contains "2025-01-01". Added in 1.42.++ Match groups+ Added in 1.32++ Matchers can define match groups: parenthesised portions of the regular ex-+ pression which are available for reference in field assignments. Groups+ are enclosed in regular parentheses (( and )) and can be nested. Each+ group is available in field assignments using the token \N, where N is an+ index into the match groups for this conditional block (e.g. \1, \2,+ etc.).++ Example: Warp credit card payment postings to the beginning of the billing+ period (Month start), to match how they are presented in statements, using+ posting dates:++ if %date (....-..)-..+ comment2 date:\1-01++ Another example: Read the expense account from the CSV field, but throw+ away a prefix:++ if %account1 liabilities:family:(expenses:.*)+ account1 \1++ if table+ "if tables" are an alternative to if blocks; they can express many matchers+ and field assignments in a more compact tabular format, like this:++ if,HLEDGERFIELD1,HLEDGERFIELD2,...+ MATCHERA,VALUE1,VALUE2,...+ MATCHERB && MATCHERC,VALUE1,VALUE2,... (*since 1.42*)+ ; Comment line that explains MATCHERD+ MATCHERD,VALUE1,VALUE2,...+ <empty line>++ The first character after if is taken to be this if table's field separa-+ tor. It is unrelated to the separator used in the CSV file. It should be+ a non-alphanumeric character like , or | that does not appear anywhere else+ in the table (it should not be used in field names or matchers or values,+ and it cannot be escaped with a backslash).++ Each line must contain the same number of separators; empty values are al-+ lowed. Whitespace can be used in the matcher lines for readability (but+ not in the if line, currently). You can use the comment lines in the table+ body. The table must be terminated by an empty line (or end of file).++ An if table like the above is interpreted as follows: try all of the lines+ with matchers; whenever a line with matchers succeeds, assign all of the+ values on that line to the corresponding hledger fields; If multiple lines+ match, later lines will override fields assigned by the earlier ones - just+ like the sequence of if blocks would behave.++ If table presented above is equivalent to this sequence of if blocks:++ if MATCHERA+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++ if MATCHERB && MATCHERC+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++ ; Comment line which explains MATCHERD+ if MATCHERD+ HLEDGERFIELD1 VALUE1+ HLEDGERFIELD2 VALUE2+ ...++ Example:++ if,account2,comment+ atm transaction fee,expenses:business:banking,deductible? check it+ %description groceries,expenses:groceries,+ ;; Comment line that desribes why this particular date is special+ 2023/01/12.*Plumbing LLC,expenses:house:upkeep,emergency plumbing call-out++ balance-type+ Balance assertions generated by assigning to balanceN are of the simple =+ type by default, which is a single-commodity, subaccount-excluding asser-+ tion. You may find the subaccount-including variants more useful, eg if+ you have created some virtual subaccounts of checking to help with budget-+ ing. You can select a different type of assertion with the balance-type+ rule:++ # balance assertions will consider all commodities and all subaccounts+ balance-type ==*++ Here are the balance assertion types for quick reference:++ = single commodity, exclude subaccounts+ =* single commodity, include subaccounts+ == multi commodity, exclude subaccounts+ ==* multi commodity, include subaccounts++ include+ include RULESFILE++ This includes the contents of another CSV rules file at this point. RULES-+ FILE is an absolute file path or a path relative to the current file's di-+ rectory. This can be useful for sharing common rules between several rules+ files, eg:++ # someaccount.csv.rules++ ## someaccount-specific rules+ fields date,description,amount+ account1 assets:someaccount+ account2 expenses:misc++ ## common rules+ include categorisation.rules++ Working with CSV+ Some tips:++ Rapid feedback+ 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:++ $ 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. "bash -c" is used to run multiple commands, so we can echo a+ separator each time the command re-runs, making it easier to read the out-+ put.++ Valid CSV+ Note that hledger will only accept valid CSV conforming to RFC 4180, and+ equivalent SSV and TSV formats (like RFC 4180 but with semicolon or tab as+ separators). This means, eg:++ * Values may be enclosed in double quotes, or not. Enclosing in single+ quotes is not allowed. (Eg 'A','B' is rejected.)++ * When values are enclosed in double quotes, spaces outside the quotes are+ not allowed. (Eg "A", "B" is rejected.)++ * When values are not enclosed in quotes, they may not contain double+ quotes. (Eg A"A, B is rejected.)++ If your CSV/SSV/TSV is not valid in this sense, you'll need to transform it+ before reading with hledger. Try using sed, or a more permissive CSV+ parser like python's csv lib.++ File Extension+ To help hledger choose the CSV file reader and show the right error mes-+ sages (and choose the right field separator character by default), it's+ best if CSV/SSV/TSV files are named with a .csv, .ssv or .tsv filename ex-+ tension. (More about this at Data formats.)++ 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:++ $ hledger -f ssv:foo.dat print++ You can also override the default field separator with a separator rule if+ needed.++ Reading CSV from standard input+ You'll need the file format prefix when reading CSV from stdin also, since+ hledger assumes journal format by default. Eg:++ $ cat foo.dat | hledger -f ssv:- print++ Reading multiple CSV files+ If you use multiple -f options to read multiple CSV files at once, hledger+ will look for a correspondingly-named rules file for each CSV file. But if+ you specify a rules file with --rules, that rules file will be used for all+ the CSV files.++ Reading files specified by rule+ Instead of specifying a CSV file in the command line, you can specify a+ rules file, as in hledger -f foo.csv.rules CMD. By default this will read+ data from foo.csv in the same directory, but you can add a source rule to+ specify a different data file, perhaps located in your web browser's down-+ load directory.++ This feature was added in hledger 1.30, so you won't see it in most CSV+ rules examples. But it helps remove some of the busywork of managing CSV+ downloads. Most of your financial institutions's default CSV filenames are+ different and can be recognised by a glob pattern. So you can put a rule+ like source Checking1*.csv in foo-checking.csv.rules, and then periodically+ follow a workflow like:++ 1. Download CSV from Foo's website, using your browser's defaults++ 2. Run hledger import foo-checking.csv.rules to import any new transactions++ After import, you can: discard the CSV, or leave it where it is for a+ while, or move it into your archives, as you prefer. If you do nothing,+ next time your browser will save something like Checking1-2.csv, and+ hledger will use that because of the * wild card and because it is the most+ recent.++ Valid transactions+ After reading a CSV file, hledger post-processes and validates the gener-+ ated journal entries as it would for a journal file - balancing them, ap-+ plying balance assignments, and canonicalising amount styles. Any errors+ at this stage will be reported in the usual way, displaying the problem en-+ try.++ 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:++ $ hledger -f file.csv print | hledger -f- print++ Deduplicating, importing+ When you download a CSV file periodically, eg to get your latest bank+ transactions, the new file may overlap with the old one, containing some of+ the same records.++ The import command will (a) detect the new transactions, and (b) append+ just those transactions to your main 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:++ # download the latest CSV files, then run this command.+ # Note, no -f flags needed here.+ $ hledger import *.csv [--dry]++ This method works for most CSV files. (Where records have a stable chrono-+ logical order, and new records appear only at the new end.)++ A number of other tools and workflows, hledger-specific and otherwise, ex-+ ist for converting, deduplicating, classifying and managing CSV data. See:++ * https://hledger.org/cookbook.html#setups-and-workflows++ * https://plaintextaccounting.org -> data import/conversion++ Regular expressions in CSV rules+ Regular expressions in if conditions (AKA matchers) are POSIX extended reg-+ ular expressions, that also support GNU word boundaries (\b, \B, \<, \>),+ and nothing else. (For more detail, see Regular expressions.)++ Here are some examples that might be useful in CSV rules:++ * Is field "foo" truly empty ? if %foo ^$++ * Is it empty or containing only whitespace ? if %foo ^ *$++ * Is it non-empty ? if %foo .++ * Does it contain non-whitespace ? if %foo [^ ]++ Testing the value of numeric fields is a little harder. You can't use+ hledger queries like amt:0 or amt:>10 in CSV rules. But you can often+ achieve the same thing with a regular expression.++ Note the content and layout of number fields in CSV varies, and can change+ over time (eg if you switch data providers). So numeric regexps are always+ somewhat specific to your particular CSV data; and it's a good idea to make+ them defensive and robust if you can.++ Here are some examples:++ * Does foo contain a non-zero number ? if %foo [1-9]++ * Is it negative ? if %foo -++ * Is it non-negative ? if ! %foo -++ * Is it >= 10 ? if %foo [1-9][0-9]+\. (assuming a decimal period and no+ leading zeros)++ * Is it >= 10 and < 20 ? if %foo \b1[0-9]\.++ Setting amounts+ Continuing from amount field above, here are more tips for amount-setting:++ 1. If the amount is in a single CSV field:++ a. If its sign indicates direction of flow:+ Assign it to amountN, to set the Nth posting's amount. N is usually 1+ or 2 but can go up to 99.++ b. If another field indicates direction of flow:+ Use one or more conditional rules to set the appropriate amount sign.+ Eg:++ # assume a withdrawal unless Type contains "deposit":+ amount1 -%Amount+ if %Type deposit+ amount1 %Amount++ 2. If the amount is in two CSV fields (such as Debit and Credit, or In and+ Out):++ a. If both fields are unsigned:+ Assign one field to amountN-in and the other to amountN-out. hledger+ will automatically negate the "out" field, and will use whichever field+ value is non-zero as posting N's amount.++ b. If either field is signed:+ You will probably need to override hledger's sign for one or the other+ field, as in the following example:++ # Negate the -out value, but only if it is not empty:+ fields date, description, amount1-in, amount1-out+ if %amount1-out [1-9]+ amount1-out -%amount1-out++ c. If both fields can contain a non-zero value (or both can be empty):+ The -in/-out rules normally choose the value which is+ non-zero/non-empty. Some value pairs can be ambiguous, such as 1 and+ none. For such cases, use conditional rules to help select the amount.+ Eg, to handle the above you could select the value containing non-zero+ digits:++ fields date, description, in, out+ if %in [1-9]+ amount1 %in+ if %out [1-9]+ amount1 %out++ 3. If you want posting 2's amount converted to cost:+ Use the unnumbered amount (or amount-in and amount-out) syntax.++ 4. If the CSV has only balance amounts, not transaction amounts:+ Assign to balanceN, to set a balance assignment on the Nth posting, causing+ the posting's amount to be calculated automatically. balance with no num-+ ber is equivalent to balance1. In this situation hledger is more likely to+ guess the wrong default account name, so you may need to set that explic-+ itly.++ Amount signs+ There is some special handling making it easier to parse and to reverse+ amount signs. (This only works for whole amounts, not for cost amounts+ such as COST in amount1 AMT @ COST):++ * If an amount value begins with a plus sign:+ that will be removed: +AMT becomes AMT++ * If an amount value is parenthesised:+ it will be de-parenthesised and sign-flipped: (AMT) becomes -AMT++ * If an amount value has two minus signs (or two sets of parentheses, or a+ minus sign and parentheses):+ they cancel out and will be removed: --AMT or -(AMT) becomes AMT++ * If an amount value contains just a sign (or just a set of parentheses):+ that is removed, making it an empty value. "+" or "-" or "()" becomes "".++ It's not possible (without preprocessing the CSV) to set an amount to its+ absolute value, ie discard its sign.++ Setting currency/commodity+ If the currency/commodity symbol is included in the CSV's amount field(s):++ 2023-01-01,foo,$123.00++ you don't have to do anything special for the commodity symbol, it will be+ assigned as part of the amount. Eg:++ fields date,description,amount++ 2023-01-01 foo+ expenses:unknown $123.00+ income:unknown $-123.00++ If the currency is provided as a separate CSV field:++ 2023-01-01,foo,USD,123.00++ You can assign that to the currency pseudo-field, which has the special ef-+ fect of prepending itself to every amount in the transaction (on the left,+ with no separating space):++ fields date,description,currency,amount++ 2023-01-01 foo+ expenses:unknown USD123.00+ income:unknown USD-123.00++ Or, you can use a field assignment to construct the amount yourself, with+ more control. Eg to put the symbol on the right, and separated by a space:++ fields date,description,cur,amt+ amount %amt %cur++ 2023-01-01 foo+ expenses:unknown 123.00 USD+ income:unknown -123.00 USD++ Note we used a temporary field name (cur) that is not currency - that would+ trigger the prepending effect, which we don't want here.++ Amount decimal places+ When you are reading CSV data, eg with a command like hledger -f foo.csv+ print, hledger will infer each commodity's decimal precision (and other+ commodity display styles) from the amounts - much as when reading a journal+ file without commodity directives (see the link).++ Note, the commodity styles are not inferred from the numbers in the origi-+ nal CSV data; rather, they are inferred from the amounts generated by the+ CSV rules.++ When you are importing CSV data with the import command, eg hledger import+ foo.csv, there's another step: import tries to make the new entries conform+ to the journal's existing styles. So for each commodity - let's say it's+ EUR - import will choose:++ 1. the style declared for EUR by a commodity directive in the journal++ 2. otherwise, the style inferred from EUR amounts in the journal++ 3. otherwise, the style inferred from EUR amounts generated by the CSV+ rules.++ TLDR: if import is not generating the precisions or styles you want, add a+ commodity directive to specify them.++ Referencing other fields+ In field assignments, you can interpolate only CSV fields, not hledger+ fields. In the example below, there's both a CSV field and a hledger field+ named amount1, but %amount1 always means the CSV field, not the hledger+ field:++ # Name the third CSV field "amount1"+ fields date,description,amount1++ # Set hledger's amount1 to the CSV amount1 field followed by USD+ amount1 %amount1 USD++ # Set comment to the CSV amount1 (not the amount1 assigned above)+ comment %amount1++ Here, since there's no CSV amount1 field, %amount1 will produce a literal+ "amount1":++ fields date,description,csvamount+ amount1 %csvamount USD+ # Can't interpolate amount1 here+ comment %amount1++ When there are multiple field assignments to the same hledger field, only+ the last one takes effect. Here, comment's value will be be B, or C if+ "something" is matched, but never A:++ comment A+ comment B+ if something+ comment C++ How CSV rules are evaluated+ Here's how to think of CSV rules being evaluated. If you get a confusing+ error while reading a CSV file, it may help to try to understand which of+ these steps is failing:++ 1. Any included rules files are inlined, from top to bottom, depth first+ (scanning each included file for further includes, recursively, before+ proceeding).++ 2. Top level rules (date-format, fields, newest-first, skip etc) are read,+ top to bottom. "Top level rules" means non-conditional rules. If a+ rule occurs more than once, the last one wins; except for skip/end+ rules, where the first one wins.++ 3. The CSV file is read as text. Any non-ascii characters will be decoded+ using the text encoding specified by the encoding rule, otherwise the+ system locale's text encoding.++ 4. Any top-level skip or end rule is applied. skip [N] immediately skips+ the current or next N CSV records; end immediately skips all remaining+ CSV records (not normally used at top level).++ 5. Now any remaining CSV records are processed. For each CSV record, in+ file order:++ * Is there a conditional skip/end rule that applies for this record ?+ Search the if blocks, from top to bottom, for a succeeding one con-+ taining a skip or end rule. If found, skip the specified number of+ CSV records, then continue at 5.+ Otherwise...++ * Do some basic validation on this CSV record (eg, check that it has at+ least two fields).++ * For each hledger field (date, description, account1, etc.):++ 1. Get the field's assigned value, first searching top level assign-+ ments, made directly or by the fields rule, then assignments made+ inside succeeding if blocks. If there are more than one, the last+ one wins.++ 2. Compute the field's actual value (as text), by interpolating any+ %CSVFIELD references within the assigned value; or by choosing a+ default value if there was no assignment.++ * Generate a hledger transaction from the hledger field values, parsing+ them if needed (eg from text to an amount).++ This is all done by the CSV reader, one of several readers hledger can use+ to read transactions from an input file. When all input files have been+ read successfully, their transactions are passed to whichever hledger com-+ mand the user specified.++ Well factored rules+ Some things than can help reduce duplication and complexity in rules files:++ * Extracting common rules usable with multiple CSV files into a com-+ mon.rules, and adding include common.rules to each CSV's rules file.++ * Splitting if blocks into smaller if blocks, extracting the frequently+ used parts.++ CSV rules examples+ Bank of Ireland+ Here's a CSV with two amount fields (Debit and Credit), and a balance+ field, which we can use to add balance assertions, which is not necessary+ but provides extra error checking:++ Date,Details,Debit,Credit,Balance+ 07/12/2012,LODGMENT 529898,,10.0,131.21+ 07/12/2012,PAYMENT,5,,126++ # bankofireland-checking.csv.rules++ # skip the header line+ skip++ # name the csv fields, and assign some of them as journal entry fields+ fields date, description, amount-out, amount-in, balance++ # We generate balance assertions by assigning to "balance"+ # above, but you may sometimes need to remove these because:+ #+ # - the CSV balance differs from the true balance,+ # by up to 0.0000000000005 in my experience+ #+ # - it is sometimes calculated based on non-chronological ordering,+ # eg when multiple transactions clear on the same day++ # date is in UK/Ireland format+ date-format %d/%m/%Y++ # set the currency+ currency EUR++ # set the base account for all txns+ account1 assets:bank:boi:checking++ $ hledger -f bankofireland-checking.csv print+ 2012-12-07 LODGMENT 529898+ assets:bank:boi:checking EUR10.0 = EUR131.2+ income:unknown EUR-10.0++ 2012-12-07 PAYMENT+ assets:bank:boi:checking EUR-5.0 = EUR126.0+ expenses:unknown EUR5.0++ The balance assertions don't raise an error above, because we're reading+ directly from CSV, but they will be checked if these entries are imported+ into a journal file.++ Coinbase+ A simple example with some CSV from Coinbase. The spot price is recorded+ using cost notation. The legacy amount field name conveniently sets amount+ 2 (posting 2's amount) to the total cost.++ # Timestamp,Transaction Type,Asset,Quantity Transacted,Spot Price Currency,Spot Price at Transaction,Subtotal,Total (inclusive of fees and/or spread),Fees and/or Spread,Notes+ # 2021-12-30T06:57:59Z,Receive,USDC,100,GBP,0.740000,"","","","Received 100.00 USDC from an external account"++ # coinbase.csv.rules+ skip 1+ fields Timestamp,Transaction_Type,Asset,Quantity_Transacted,Spot_Price_Currency,Spot_Price_at_Transaction,Subtotal,Total,Fees_Spread,Notes+ date %Timestamp+ date-format %Y-%m-%dT%T%Z+ description %Notes+ account1 assets:coinbase:cc+ amount %Quantity_Transacted %Asset @ %Spot_Price_at_Transaction %Spot_Price_Currency++ $ hledger print -f coinbase.csv+ 2021-12-30 Received 100.00 USDC from an external account+ assets:coinbase:cc 100 USDC @ 0.740000 GBP+ income:unknown -74.000000 GBP++ Amazon+ Here we convert amazon.com order history, and use an if block to generate a+ third posting if there's a fee. (In practice you'd probably get this data+ from your bank instead, but it's an example.)++ "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID"+ "Jul 29, 2012","Payment","To","Foo.","Completed","$20.00","$0.00","16000000000000DGLNJPI1P9B8DKPVHL"+ "Jul 30, 2012","Payment","To","Adapteva, Inc.","Completed","$25.00","$1.00","17LA58JSKRD4HDGLNJPI1P9B8DKPVHL"++ # amazon-orders.csv.rules++ # skip one header line+ skip 1++ # name the csv fields, and assign the transaction's date, amount and code.+ # Avoided the "status" and "amount" hledger field names to prevent confusion.+ fields date, _, toorfrom, name, amzstatus, amzamount, fees, code++ # how to parse the date+ date-format %b %-d, %Y++ # combine two fields to make the description+ description %toorfrom %name++ # save the status as a tag+ comment status:%amzstatus++ # set the base account for all transactions+ account1 assets:amazon+ # leave amount1 blank so it can balance the other(s).+ # I'm assuming amzamount excludes the fees, don't remember++ # set a generic account2+ account2 expenses:misc+ amount2 %amzamount+ # and maybe refine it further:+ #include categorisation.rules++ # add a third posting for fees, but only if they are non-zero.+ if %fees [1-9]+ account3 expenses:fees+ amount3 %fees++ $ hledger -f amazon-orders.csv print+ 2012-07-29 (16000000000000DGLNJPI1P9B8DKPVHL) To Foo. ; status:Completed+ assets:amazon+ expenses:misc $20.00++ 2012-07-30 (17LA58JSKRD4HDGLNJPI1P9B8DKPVHL) To Adapteva, Inc. ; status:Completed+ assets:amazon+ expenses:misc $25.00+ expenses:fees $1.00++ Paypal+ Here's a real-world rules file for (customised) Paypal CSV, with some Pay-+ pal-specific rules, and a second rules file included:++ "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note"+ "10/01/2019","03:46:20","PDT","Calm Radio","Subscription Payment","Completed","USD","-6.99","0.00","-6.99","simon@joyful.com","memberships@calmradio.com","60P57143A8206782E","MONTHLY - $1 for the first 2 Months: Me - Order 99309. Item total: $1.00 USD first 2 months, then $6.99 / Month","","I-R8YLY094FJYR","","-6.99",""+ "10/01/2019","03:46:20","PDT","","Bank Deposit to PP Account ","Pending","USD","6.99","0.00","6.99","","simon@joyful.com","0TU1544T080463733","","","60P57143A8206782E","","0.00",""+ "10/01/2019","08:57:01","PDT","Patreon","PreApproved Payment Bill User Payment","Completed","USD","-7.00","0.00","-7.00","simon@joyful.com","support@patreon.com","2722394R5F586712G","Patreon* Membership","","B-0PG93074E7M86381M","","-7.00",""+ "10/01/2019","08:57:01","PDT","","Bank Deposit to PP Account ","Pending","USD","7.00","0.00","7.00","","simon@joyful.com","71854087RG994194F","Patreon* Membership","","2722394R5F586712G","","0.00",""+ "10/19/2019","03:02:12","PDT","Wikimedia Foundation, Inc.","Subscription Payment","Completed","USD","-2.00","0.00","-2.00","simon@joyful.com","tle@wikimedia.org","K9U43044RY432050M","Monthly donation to the Wikimedia Foundation","","I-R5C3YUS3285L","","-2.00",""+ "10/19/2019","03:02:12","PDT","","Bank Deposit to PP Account ","Pending","USD","2.00","0.00","2.00","","simon@joyful.com","3XJ107139A851061F","","","K9U43044RY432050M","","0.00",""+ "10/22/2019","05:07:06","PDT","Noble Benefactor","Subscription Payment","Completed","USD","10.00","-0.59","9.41","noble@bene.fac.tor","simon@joyful.com","6L8L1662YP1334033","Joyful Systems","","I-KC9VBGY2GWDB","","9.41",""++ # paypal-custom.csv.rules++ # Tips:+ # Export from Activity -> Statements -> Custom -> Activity download+ # Suggested transaction type: "Balance affecting"+ # Paypal's default fields in 2018 were:+ # "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Shipping Address","Address Status","Item Title","Item ID","Shipping and Handling Amount","Insurance Amount","Sales Tax","Option 1 Name","Option 1 Value","Option 2 Name","Option 2 Value","Reference Txn ID","Invoice Number","Custom Number","Quantity","Receipt ID","Balance","Address Line 1","Address Line 2/District/Neighborhood","Town/City","State/Province/Region/County/Territory/Prefecture/Republic","Zip/Postal Code","Country","Contact Phone Number","Subject","Note","Country Code","Balance Impact"+ # This rules file assumes the following more detailed fields, configured in "Customize report fields":+ # "Date","Time","TimeZone","Name","Type","Status","Currency","Gross","Fee","Net","From Email Address","To Email Address","Transaction ID","Item Title","Item ID","Reference Txn ID","Receipt ID","Balance","Note"++ fields date, time, timezone, description_, type, status_, currency, grossamount, feeamount, netamount, fromemail, toemail, code, itemtitle, itemid, referencetxnid, receiptid, balance, note++ skip 1++ date-format %-m/%-d/%Y++ # ignore some paypal events+ if+ In Progress+ Temporary Hold+ Update to+ skip++ # add more fields to the description+ description %description_ %itemtitle++ # save some other fields as tags+ comment itemid:%itemid, fromemail:%fromemail, toemail:%toemail, time:%time, type:%type, status:%status_++ # convert to short currency symbols+ if %currency USD+ currency $+ if %currency EUR+ currency E+ if %currency GBP+ currency P++ # generate postings++ # the first posting will be the money leaving/entering my paypal account+ # (negative means leaving my account, in all amount fields)+ account1 assets:online:paypal+ amount1 %netamount++ # the second posting will be money sent to/received from other party+ # (account2 is set below)+ amount2 -%grossamount++ # if there's a fee, add a third posting for the money taken by paypal.+ if %feeamount [1-9]+ account3 expenses:banking:paypal+ amount3 -%feeamount+ comment3 business:++ # choose an account for the second posting++ # override the default account names:+ # if the amount is positive, it's income (a debit)+ if %grossamount ^[^-]+ account2 income:unknown+ # if negative, it's an expense (a credit)+ if %grossamount ^-+ account2 expenses:unknown++ # apply common rules for setting account2 & other tweaks+ include common.rules++ # apply some overrides specific to this csv++ # Transfers from/to bank. These are usually marked Pending,+ # which can be disregarded in this case.+ if+ Bank Account+ Bank Deposit to PP Account+ description %type for %referencetxnid %itemtitle+ account2 assets:bank:wf:pchecking+ account1 assets:online:paypal++ # Currency conversions+ if Currency Conversion+ account2 equity:currency conversion++ # common.rules++ if+ darcs+ noble benefactor+ account2 revenues:foss donations:darcshub+ comment2 business:++ if+ Calm Radio+ account2 expenses:online:apps++ if+ electronic frontier foundation+ Patreon+ wikimedia+ Advent of Code+ account2 expenses:dues++ if Google+ account2 expenses:online:apps+ description google | music++ $ 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+ expenses:online:apps $6.99++ 2019-10-01 (0TU1544T080463733) Bank Deposit to PP Account for 60P57143A8206782E ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:46:20, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $6.99 = $0.00+ assets:bank:wf:pchecking $-6.99++ 2019-10-01 (2722394R5F586712G) Patreon Patreon* Membership ; itemid:, fromemail:simon@joyful.com, toemail:support@patreon.com, time:08:57:01, type:PreApproved Payment Bill User Payment, status:Completed+ assets:online:paypal $-7.00 = $-7.00+ expenses:dues $7.00++ 2019-10-01 (71854087RG994194F) Bank Deposit to PP Account for 2722394R5F586712G Patreon* Membership ; itemid:, fromemail:, toemail:simon@joyful.com, time:08:57:01, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $7.00 = $0.00+ assets:bank:wf:pchecking $-7.00++ 2019-10-19 (K9U43044RY432050M) Wikimedia Foundation, Inc. Monthly donation to the Wikimedia Foundation ; itemid:, fromemail:simon@joyful.com, toemail:tle@wikimedia.org, time:03:02:12, type:Subscription Payment, status:Completed+ assets:online:paypal $-2.00 = $-2.00+ expenses:dues $2.00+ expenses:banking:paypal ; business:++ 2019-10-19 (3XJ107139A851061F) Bank Deposit to PP Account for K9U43044RY432050M ; itemid:, fromemail:, toemail:simon@joyful.com, time:03:02:12, type:Bank Deposit to PP Account, status:Pending+ assets:online:paypal $2.00 = $0.00+ assets:bank:wf:pchecking $-2.00++ 2019-10-22 (6L8L1662YP1334033) Noble Benefactor Joyful Systems ; itemid:, fromemail:noble@bene.fac.tor, toemail:simon@joyful.com, time:05:07:06, type:Subscription Payment, status:Completed+ assets:online:paypal $9.41 = $9.41+ revenues:foss donations:darcshub $-10.00 ; business:+ expenses:banking:paypal $0.59 ; business:++Timeclock+ hledger can read time logs in the timeclock time logging format of time-+ clock.el. As with Ledger, hledger's timeclock format is a subset/variant+ of timeclock.el's.++ hledger's timeclock format was updated in hledger 1.43 and 1.50. If your+ old time logs are rejected, you should adapt them to modern hledger; for+ now, you can restore the pre-1.43 behaviour with the --old-timeclock flag.++ Here the timeclock format in hledger 1.50+:++ # Comment lines like these, and blank lines, are ignored:+ # comment line+ ; comment line+ * comment line++ # Lines beginning with b, h, or capital O are also ignored, for compatibility:+ b SIMPLEDATE HH:MM[:SS][+-ZZZZ][ TEXT]+ h SIMPLEDATE HH:MM[:SS][+-ZZZZ][ TEXT]+ O SIMPLEDATE HH:MM[:SS][+-ZZZZ][ TEXT]++ # Lines beginning with i or o are are clock-in / clock-out entries:+ i SIMPLEDATE HH:MM[:SS][+-ZZZZ] ACCOUNT[ DESCRIPTION][;COMMENT]]+ o SIMPLEDATE HH:MM[:SS][+-ZZZZ][ ACCOUNT][;COMMENT]++ The date is a hledger simple date (YYYY-MM-DD or similar). The time parts+ must use two digits. The seconds are optional. A + or - four-digit time+ zone is accepted for compatibility, but currently ignored; times are always+ interpreted as a local time.++ In clock-in entries (i), the account name is required. A transaction de-+ scription, separated from the account name by 2+ spaces, is optional. A+ transaction comment, beginning with ;, is also optional. (Indented follow-+ ing comment lines are also allowed, as in journal format.)++ In clock-out entries (o) have no description, but can have a comment if you+ wish. A clock-in and clock-out pair form a "transaction" posting some num-+ ber of hours to an account - also known as a session. Eg:++ i 2015/03/30 09:00:00 session1+ o 2015/03/30 10:00:00++ $ hledger -f a.timeclock print+ 2015-03-30 * 09:00-10:00+ (session1) 1.00h++ Clock-ins and clock-outs are matched by their account/session name. If a+ clock-out does not specify a name, the most recent unclosed clock-in is+ closed. You can have multiple sessions active simultaneously. Entries are+ processed in the order they are parsed. Sessions spanning more than one+ day are automatically split at day boundaries.++ Eg, the following time log:++ i 2015/03/30 09:00:00 some account optional description after 2 spaces ; optional comment, tags:+ o 2015/03/30 09:20:00+ i 2015/03/31 22:21:45 another:account+ o 2015/04/01 02:00:34+ i 2015/04/02 12:00:00 another:account ; this demonstrates multple sessions being clocked in+ i 2015/04/02 13:00:00 some account+ o 2015/04/02 14:00:00+ o 2015/04/02 15:00:00 another:account++ generates these transactions:++ $ hledger -f t.timeclock print+ 2015-03-30 * optional description after 2 spaces ; optional comment, tags:+ (some account) 0.33h++ 2015-03-31 * 22:21-23:59+ (another:account) 1.64h++ 2015-04-01 * 00:00-02:00+ (another:account) 2.01h++ 2015-04-02 * 12:00-15:00 ; this demonstrates multiple sessions being clocked in+ (another:account) 3.00h++ 2015-04-02 * 13:00-14:00+ (some account) 1.00h++ Here is a sample.timeclock to download and some queries to try:++ $ 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++ To generate time logs, ie to clock in and clock out, you could:++ * use these shell aliases at the command line:++ alias ti='echo i `date "+%Y-%m-%d %H:%M:%S"` $* >>$TIMELOG'+ alias to='echo o `date "+%Y-%m-%d %H:%M:%S"` >>$TIMELOG'++ * or Emacs's built-in timeclock.el, or the extended timeclock-x.el, and+ perhaps the extras in ledgerutils.el++ * or use the old ti and to scripts in the ledger 2.x repository. These+ rely on a "timeclock" executable which I think is just the ledger 2 exe-+ cutable renamed.++Timedot+ timedot format is hledger's human-friendly time logging format. Compared+ to timeclock format, it is more convenient for quick, approximate, and+ retroactive time logging, and more human-readable (you can see at a glance+ where time was spent). A quick example:++ 2023-05-01+ hom:errands .... .... ; two hours; the space is ignored+ fos:hledger:timedot .. ; half an hour+ per:admin:finance ; no time spent yet++ hledger reads this as a transaction on this day with three (unbalanced)+ postings, where each dot represents "0.25". No commodity symbol is as-+ sumed, but we typically interpret it as hours.++ $ hledger -f a.timedot print # .timedot file extension (or timedot: prefix) is required+ 2023-05-01 *+ (hom:errands) 2.00 ; two hours+ (fos:hledger:timedot) 0.50 ; half an hour+ (per:admin:finance) 0++ A timedot file contains a series of transactions (usually one per day).+ Each begins with a simple date (Y-M-D, Y/M/D, or Y.M.D), optionally be fol-+ lowed on the same line by a transaction description, and/or a transaction+ comment following a semicolon.++ After the date line are zero or more time postings, consisting of:++ * An account name - any hledger-style account name, optionally indented.++ * Two or more spaces - required if there is an amount (as in journal for-+ mat).++ * A timedot amount, which can be++ * empty (representing zero)++ * a number, optionally followed by a unit s, m, h, d, w, mo, or y, repre-+ senting a precise number of seconds, minutes, hours, days weeks, months+ or years (hours is assumed by default), which will be converted to+ hours according to 60s = 1m, 60m = 1h, 24h = 1d, 7d = 1w, 30d = 1mo,+ 365d = 1y.++ * one or more dots (period characters), each representing 0.25. These+ are the dots in "timedot". Spaces are ignored and can be used for+ grouping/alignment.++ * Added in 1.32 one or more letters. These are like dots but they also+ generate a tag t: (short for "type") with the letter as its value, and+ a separate posting for each of the values. This provides a second di-+ mension of categorisation, viewable in reports with --pivot t.++ * An optional comment following a semicolon (a hledger-style posting com-+ ment).++ There is some flexibility to help with keeping time log data and notes in+ the same file:++ * Blank lines and lines beginning with # or ; are ignored.++ * After the first date line, lines which do not contain a double space are+ parsed as postings with zero amount. (hledger's register reports will+ show these if you add -E).++ * Before the first date line, lines beginning with * (eg org headings) are+ ignored. And from the first date line onward, Emacs org mode heading+ prefixes at the start of lines (one or more *'s followed by a space) will+ be ignored. This means the time log can also be a org outline.++ Timedot files don't support directives like journal files. So a common+ pattern is to have a main journal file (eg time.journal) that contains any+ needed directives, and then includes the timedot file (include time.time-+ dot).++ Timedot examples+ Numbers:++ 2016/2/3+ inc:client1 4+ fos:hledger 3h+ biz:research 60m++ Dots:++ # on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.+ 2016/2/1+ inc:client1 .... .... .... .... .... ....+ fos:haskell .... ..+ biz:research .++ 2016/2/2+ inc:client1 .... ....+ biz:research .++ $ hledger -f a.timedot print date:2016/2/2+ 2016-02-02 *+ (inc:client1) 2.00++ 2016-02-02 *+ (biz:research) 0.25++ $ hledger -f a.timedot bal --daily --tree+ Balance changes in 2016-02-01-2016-02-03:++ || 2016-02-01d 2016-02-02d 2016-02-03d+ ============++========================================+ biz || 0.25 0.25 1.00+ research || 0.25 0.25 1.00+ fos || 1.50 0 3.00+ haskell || 1.50 0 0+ hledger || 0 0 3.00+ inc || 6.00 2.00 4.00+ client1 || 6.00 2.00 4.00+ ------------++----------------------------------------+ || 7.75 2.25 8.00++ Letters:++ # Activity types:+ # c cleanup/catchup/repair+ # e enhancement+ # s support+ # l learning/research++ 2023-11-01+ work:adm ccecces++ $ hledger -f a.timedot print+ 2023-11-01+ (work:adm) 1 ; t:c+ (work:adm) 0.5 ; t:e+ (work:adm) 0.25 ; t:s++ $ hledger -f a.timedot bal+ 1.75 work:adm+ --------------------+ 1.75++ $ hledger -f a.timedot bal --pivot t+ 1.00 c+ 0.50 e+ 0.25 s+ --------------------+ 1.75++ Org:++ * 2023 Work Diary+ ** Q1+ *** 2023-02-29+ **** DONE+ 0700 yoga+ **** UNPLANNED+ **** BEGUN+ hom:chores+ cleaning ...+ water plants+ outdoor - one full watering can+ indoor - light watering+ **** TODO+ adm:planning: trip+ *** LATER++ Using . as account name separator:++ 2016/2/4+ fos.hledger.timedot 4h+ fos.ledger ..++ $ hledger -f a.timedot --alias '/\./=:' bal -t+ 4.50 fos+ 4.00 hledger:timedot+ 0.50 ledger+ --------------------+ 4.50++PART 3: REPORTING CONCEPTS+Time periods+ Report start & end date+ Most hledger reports will by default show the full time period represented+ by the journal. The report start date will be the earliest transaction or+ posting date, and the report end date will be the latest transaction, post-+ ing, or market price date.++ Often you will want to see a shorter period, such as the current month.+ You can specify a start and/or end date with the -b/--begin, -e/--end, or+ -p/--period options, or a date: query argument, described below. All of+ these accept the smart date syntax, also described below.++ End dates are exclusive; specify the day after the last day you want to see+ in the report.++ When dates are specified by multiple options, the last (right-most) option+ wins. And when date: queries and date options are combined, the report pe-+ riod will be their intersection.++ Examples:++ -b 2016/3/17+ beginning on St. Patrick's day 2016++ -e 12/1+ ending at the start of December 1st in the current year++ -p 'this month'+ during the current month++ -p thismonth+ same as above, spaces are optional++ -b 2023+ beginning on the first day of 2023++ date:2023.. or date:2023-+ same as above++ -b 2024 -e 2025 -p '2000 to 2030' date:2020-01 date:2020 :+ during January 2020 (the smallest common period, with the -p overriding -b+ and -e)++ Smart dates+ In hledger's user interfaces (though not in the journal file), you can op-+ tionally use "smart date" syntax. Smart dates can be written with english+ words, can be relative, and can have parts omitted. Missing parts are in-+ ferred as 1, when needed. Smart dates can be interpreted as dates or peri-+ ods depending on the context.++ Examples:++ 2004-01-01, 2004/10/1, 2004.9.1, 20240504, 2024Q1 :+ Exact dates. The year must have at least four digits, the month must be+ 1-12, the day must be 1-31, the separator can be - or / or . or nothing.+ The q can be upper or lower case and the quarter number must be 1-4.++ 2004-10+ start of month++ 2004q3+ start of third quarter of 2004++ q3 start of third quarter of current year++ 2004 start of year++ 10/1 or oct or october+ October 1st in current year++ 21 21st day in current month++ yesterday, today, tomorrow+ -1, 0, 1 days from today++ last/this/next day/week/month/quarter/year+ -1, 0, 1 periods from the current period++ last/this/next tuesday+ the previous occurrence of the named day, or the next occurrence af-+ ter today++ last/this/next february+ the previous occurrence of 1st of the named month, or the next oc-+ currence after the current month++ in n days/weeks/months/quarters/years+ n periods from the current period++ n days/weeks/months/quarters/years ahead+ n periods from the current period++ n days/weeks/months/quarters/years ago+ -n periods from the current period++ 20181201+ 8 digit YYYYMMDD with valid year month and day++ 201812+ 6 digit YYYYMM with valid year and month++ Dates with no separators are allowed but might give surprising results if+ mistyped:++ * 20181301 (YYYYMMDD with an invalid month) is parsed as an eight-digit+ year++ * 20181232 (YYYYMMDD with an invalid day) gives a parse error++ * 201801012 (a valid YYYYMMDD followed by additional digits) gives a parse+ error++ The meaning of relative dates depends on today's date. If you need to test+ or reproduce old reports, you can use the --today option to override that.+ (Except for periodic transaction rules, which are not affected by --today.)++ Report intervals+ A report interval can be specified so that reports like register, balance+ or activity become multi-period, showing each subperiod as a separate row+ or column.++ The following standard intervals can be enabled with command-line flags:++ * -D/--daily++ * -W/--weekly++ * -M/--monthly++ * -Q/--quarterly++ * -Y/--yearly++ More complex intervals can be specified using -p/--period, described below.++ Date adjustments+ Start date adjustment+ If you let hledger infer a report's start date, it will adjust the date to+ the previous natural boundary of the report interval, for convenient peri-+ odic reports. (If you don't want that, specify a start date.)++ For example, if the journal's first transaction is on january 10th,++ * hledger register (no report interval) will start the report on january+ 10th.++ * hledger register --monthly will start the report on the previous month+ boundary, january 1st.++ * hledger register --monthly --begin 1/5 will start the report on january+ 5th [1].++ Also if you are generating transactions or budget goals with periodic+ transaction rules, their start date may be adjusted in a similar way (in+ certain situations).++ End date adjustment+ A report's end date is always adjusted to include a whole number of inter-+ vals, so that the last subperiod has the same length as the others.++ For example, if the journal's last transaction is on february 20th,++ * hledger register will end the report on february 20th.++ * hledger register --monthly will end the report at the end of february.++ * hledger register --monthly --end 2/14 also will end the report at the end+ of february (overriding the requested end date).++ * hledger register --monthly --begin 1/5 --end 2/14 will end the report on+ march 4th [1].++ [1] Since hledger 1.29.++ Period headings+ With non-standard subperiods, hledger will show "STARTDATE..ENDDATE" head-+ ings. With standard subperiods (ie, starting on a natural interval bound-+ ary), you'll see more compact headings, which are usually preferable.+ (Though month names will be in english, currently.)++ So if you are specifying a start date and you want compact headings: choose+ a start of year for yearly reports, a start of quarter for quarterly re-+ ports, a start of month for monthly reports, etc. (Remember, you can write+ eg -b 2024 or 1/1 as a shortcut for a start of year, or 2024-04 or 202404+ or Apr for a start of month or quarter.)++ For weekly reports, choose a date that's a Monday. (You can try different+ dates until you see the short headings, or write eg -b '3 weeks ago'.)++ Period expressions+ The -p/--period option specifies a period expression, which is a compact+ way of expressing a start date, end date, and/or report interval.++ Here's a period expression with a start and end date (specifying the first+ quarter of 2009):++ -p "from 2009/1/1 to 2009/4/1"++ Several keywords like "from" and "to" are supported for readability; these+ are optional. "to" can also be written as ".." or "-". The spaces are+ also optional, as long as you don't run two dates together. So the follow-+ ing are equivalent to the above:++ -p "2009/1/1 2009/4/1"+ -p2009/1/1to2009/4/1+ -p2009/1/1..2009/4/1++ Dates are smart dates, so if the current year is 2009, these are also+ equivalent to the above:++ -p "1/1 4/1"+ -p "jan-apr"+ -p "this year to 4/1"++ If you specify only one date, the missing start or end date will be the+ earliest or latest transaction date in the journal:++ -p "from 2009/1/1" everything after january 1,+ 2009+ -p "since 2009/1" the same, since is a syn-+ onym+ -p "from 2009" the same+ -p "to 2009" everything before january+ 1, 2009++ You can also specify a period by writing a single partial or full date:++ -p "2009" the year 2009; equivalent to "2009/1/1 to 2010/1/1"+ -p "2009/1" the month of january 2009; equivalent to "2009/1/1 to+ 2009/2/1"+ -p "2009/1/1" the first day of 2009; equivalent to "2009/1/1 to+ 2009/1/2"++ or by using the "Q" quarter-year syntax (case insensitive):++ -p "2009Q1" first quarter of 2009, equivalent to "2009/1/1 to+ 2009/4/1"+ -p "q4" fourth quarter of the current year++ Period expressions with a report interval+ A period expression can also begin with a report interval, separated from+ the start/end dates (if any) by a space or the word in:++ -p "weekly from 2009/1/1 to 2009/4/1"+ -p "monthly in 2008"+ -p "quarterly"++ More complex report intervals+ Some more complex intervals can be specified within period expressions,+ such as:++ * biweekly (every two weeks)++ * fortnightly++ * bimonthly (every two months)++ * every day|week|month|quarter|year++ * every N days|weeks|months|quarters|years++ Weekly on a custom day:++ * every Nth day of week (th, nd, rd, or st are all accepted after the num-+ ber)++ * every WEEKDAYNAME (full or three-letter english weekday name, case insen-+ sitive)++ Monthly on a custom day:++ * every Nth day [of month] (31st day will be adjusted to each month's last+ day)++ * every Nth WEEKDAYNAME [of month]++ Yearly on a custom month and day:++ * every MM/DD [of year] (month number and day of month number)++ * every MONTHNAME DDth [of year] (full or three-letter english month name,+ case insensitive, and day of month number)++ * every DDth MONTHNAME [of year] (equivalent to the above)++ Examples:++ -p "bimonthly from 2008"+ -p "every 2 weeks"+ -p "every 5 months from+ 2009/03"+ -p "every 2nd day of week" periods will go from Tue to Tue+ -p "every Tue" same+ -p "every 15th day" period boundaries will be on 15th of each+ month+ -p "every 2nd Monday" period boundaries will be on second Monday+ of each month+ -p "every 11/05" yearly periods with boundaries on 5th of+ November+ -p "every 5th November" same+ -p "every Nov 5th" same++ Show historical balances at end of the 15th day of each month (N is an end+ date, exclusive as always):++ $ hledger balance -H -p "every 16th day"++ Group postings from the start of wednesday to end of the following tuesday+ (N is both (inclusive) start date and (exclusive) end date):++ $ hledger register checking -p "every 3rd day of week"++ Multiple weekday intervals+ This special form is also supported:++ * every WEEKDAYNAME,WEEKDAYNAME,... (full or three-letter english weekday+ names, case insensitive)++ Also, weekday and weekendday are shorthand for mon,tue,wed,thu,fri and+ sat,sun.++ This is mainly intended for use with --forecast, to generate periodic+ transactions on arbitrary days of the week. It may be less useful with -p,+ since it divides each week into subperiods of unequal length, which is un-+ usual. (Related: #1632)++ Examples:++ -p "every dates will be Mon, Wed, Fri; periods will be+ mon,wed,fri" Mon-Tue, Wed-Thu, Fri-Sun+ -p "every weekday" dates will be Mon, Tue, Wed, Thu, Fri; periods will+ be Mon, Tue, Wed, Thu, Fri-Sun+ -p "every weekend- dates will be Sat, Sun; periods will be Sat, Sun-Fri+ day"++Depth+ With the --depth NUM option (short form, usually preferred: -NUM), reports+ will show accounts only to the specified depth, hiding deeper subaccounts.+ Use this when you want a summary with less detail. This flag has the same+ effect as a depth: query argument. So all of these are equivalent:+ depth:2, --depth=2, -2.++ You can also provide custom depths for specific accounts, by providing a+ REGEX=NUM argument instead of just NUM (since 1.41). For example, --depth+ assets=2 (or depth:assets=2) will collapse accounts matching the regular+ expression "assets" to depth 2. So assets:bank:savings would be collapsed+ to assets:bank, but liabilities:bank:credit card would not be affected.++ If REGEX contains spaces or other special characters, enclose it in quotes+ in the usual way. Eg: --depth 'credit card=2'++ Combining depth options+ If a command line contains multiple general depth options, the last one+ wins. (Useful for overriding a depth specified by scripts.)++ Or a command may contain a combination of general and custom depth options.+ In this case, the most specifically (deepest) matching option wins. Some+ examples:++ * --depth assets=3 --depth expenses=2 --depth 1 would collapse accounts+ containing "assets" to depth 3, accounts containing "expenses" to depth+ 2, and all other accounts to depth 1.++ * --depth assets=1 --depth savings=2 would collapse assets:bank:savings to+ depth 2 (not depth 1; because "savings" matches a deeper part of the ac-+ count name than "assets").++ Note currently, to override a custom depth option --depth REGEX=NUM with a+ later option, the later option must use the same REGEX.++Queries+ Many hledger commands accept query arguments, which restrict their scope+ and let you report on a precise subset of your data. Here's a quick+ overview of hledger's queries:++ * By default, a query argument is treated as a case-insensitive substring+ pattern for matching account names. Eg:++ dining groceries+ car:fuel++ * Patterns containing spaces or other special characters must be enclosed+ in single or double quotes:++ 'personal care'++ * Patterns are actually regular expressions, so you can add regexp+ metacharacters for more precision (or you may need to backslash-escape+ certain characters; see "Regular expressions" above):++ '^expenses\b'+ 'food$'+ 'fuel|repair'+ 'accounts (payable|receivable)'++ * To match something other than the account name, you can add a query type+ prefix, such as:++ date:202312-+ status:+ desc:amazon+ cur:USD+ cur:\\$+ amt:'>0'+ acct:groceries (but acct: is the default, so we usually don't bother+ writing it)++ * To negate a query, add a not: prefix:++ not:status:'*'+ not:desc:'opening|closing'+ not:cur:USD++ * Multiple query terms can be combined, as space-separated queries Eg:+ hledger print date:2022 desc:amazon desc:amzn (show transactions dated in+ 2022 whose description contains "amazon" or "amzn").++ * Or more flexibly as boolean queries. Eg: hledger print expr:'date:2022+ and (desc:amazon or desc:amzn) and not date:202210'++ All hledger commands use the same query language, but different commands+ may interpret the query in different ways. We haven't described the com-+ mands yet (that's coming in PART 4: COMMANDS below) but here's the gist of+ it:++ * Transaction-oriented commands (print, aregister, close, import, descrip-+ tions..) try to match transactions (including the transaction's post-+ ings).++ * Posting-oriented commands (register, balance, balancesheet, incomestate-+ ment, accounts..) try to match postings. Postings inherit their trans-+ action's attributes for querying purposes, so transaction fields like+ date or description can still be referenced in a posting query.++ * A few commands match in more specific ways. (Eg aregister, which has a+ special first argument.)++ Query types+ Here are the query types available:++ acct: query+ acct:REGEX, or just REGEX+ Match account names containing this case insensitive regular expression.+ This is the default query type, so we usually don't bother writing the+ "acct:" prefix.++ amt: query+ amt:N, amt:'<N', amt:'<=N', amt:'>N', amt:'>=N'+ Match postings with a single-commodity amount equal to, less than, or+ greater than N. (Postings with multi-commodity amounts are not tested and+ will always match.) amt: needs quotes to hide the less than/greater than+ sign from the command line shell.++ The comparison has two modes: if N is preceded by a + or - sign (or is 0),+ the two signed numbers are compared. Otherwise, the absolute magnitudes+ are compared, ignoring sign.++ Keep in mind that amt: matches posting amounts, not account balances.++ code: query+ code:REGEX+ Match by transaction code (eg check number).++ cur: query+ cur:REGEX+ Match postings or transactions including any amounts whose currency/commod-+ ity symbol is fully matched by REGEX. (Contrary to hledger's usual infix+ matching. To do infix matching, write .*REGEX.*.) Note, to match special+ characters which are regex-significant, you need to escape them with \.+ And for characters which are significant to your shell you will usually+ need one more level of escaping. Eg to match the dollar sign: cur:\\$ or+ cur:'\$'++ desc: query+ desc:REGEX+ Match transaction descriptions.++ date: query+ date:PERIODEXPR+ Match dates (or with the --date2 flag, secondary dates) within the speci-+ fied period. PERIODEXPR is a period expression. Examples:+ date:2016, date:thismonth, date:2/1-2/15, date:2021-07-27..nextquarter.++ PERIODEXPR may include a report interval (since 1.52). On the command+ line, this is equivalent to specifying a report interval with a command+ line option. In other contexts (hledger-ui, hledger-web), the report in-+ terval may be ignored.++ date2: query+ date2:PERIODEXPR+ If you use secondary dates: this matches secondary dates within the speci-+ fied period. It is not affected by the --date2 flag. A report interval in+ PERIODEXPR will be ignored.++ depth: query+ depth:[REGEXP=]N+ Match (or display, depending on command) accounts at or above this depth,+ optionally only for accounts matching a provided regular expression. See+ Depth for detailed rules.++ note: query+ note:REGEX+ Match transaction notes (the part of the description right of |, or the+ whole description if there's no |).++ payee: query+ payee:REGEX+ Match transaction payee/payer names (the part of the description left of |,+ or the whole description if there's no |).++ real: query+ real:, real:0+ Match real or virtual postings respectively.++ status: query+ status:, status:!, status:*+ Match unmarked, pending, or cleared transactions respectively.++ type: query+ type:TYPECODES+ Match by account type (see Declaring accounts > Account types). TYPECODES+ is one or more of the single-letter account type codes ALERXCVG, case in-+ sensitive. Note type:A, type:E, and type:R will also match their respec-+ tive subtypes C (Cash), V (Conversion), and G (Gain). Certain kinds of ac-+ count alias can disrupt account types, see Rewriting accounts > Aliases and+ account types.++ tag: query+ tag:NAMEREGEX[=VALREGEX]+ Match by tag name, and optionally also by tag value. Note:++ * Both regular expressions do infix matching. If you need a complete+ match, use ^ and $.+ Eg: tag:'^fullname$', tag:'^fullname$=^fullvalue$++ * To match values, ignoring names, do tag:.=VALREGEX++ * Accounts also inherit the tags of their parent accounts.++ * Postings also inherit the tags of their account and their transaction .++ * Transactions also acquire the tags of their postings.++ Negative queries+ not: query+ not:QUERY+ You can prepend not: to a query to negate the match.+ Eg: not:equity, not:desc:apple+ (Also, a trick: not:not:... can sometimes solve query problems conve-+ niently.)++ Space-separated queries+ When given multiple space-separated query terms, most commands select+ things which match:++ * any of the description terms AND++ * any of the account terms AND++ * any of the status terms AND++ * all the other terms.++ The print command is a little different, showing transactions which:++ * match any of the description terms AND++ * have any postings matching any of the positive account terms AND++ * have no postings matching any of the negative account terms AND++ * match all the other terms.++ Boolean queries+ You can write more complicated "boolean" query expressions, enclosed in+ quotes and prefixed with expr:. These can combine subqueries with NOT,+ AND, OR operators (case insensitive), and parentheses for grouping. Eg, to+ show transactions involving both cash and expense accounts:++ hledger print expr:'cash AND expenses'++ The prefix and enclosing quotes are required, so don't write hledger print+ cash AND expenses. That would be a space-separated query showing transac-+ tions involving accounts with any of "cash", "and", "expenses" in their+ names.++ You can write space-separated queries inside a boolean query, and they will+ combine as described above, but it might be confusing and best avoided. Eg+ these are equivalent, showing transactions involving cash or expenses ac-+ counts:++ hledger print expr:'cash expenses'+ hledger print cash expenses++ There is a restriction with date: queries: they may not be used inside OR+ expressions.++ Actually, there are three types of boolean query: expr: for general use,+ and any: and all: variants which can be useful with print.++ expr: query+ expr:'QUERYEXPR'+ For example, expr:'date:lastmonth AND NOT (food OR rent)' means "match+ things which are dated in the last month and do not have food or rent in+ the account name".++ When using expr: with transaction-oriented commands like print, post-+ ing-oriented query terms like acct: and amt: are considered to match the+ transaction if they match any of its postings.+ So, hledger print expr:'cash and amt:>0' means "show transactions with (at+ least one posting involving a cash account) and (at least one posting with+ a positive amount)".++ any: query+ any:'QUERYEXPR'+ Like expr:, but when used with transaction-oriented commands like print, it+ matches the transaction only if a posting can be matched by all of QUERY-+ EXPR.+ So, hledger print any:'cash and amt:>0' means "show transactions where at+ least one posting posts a positive amount to a cash account".++ all: query+ all:'QUERYEXPR'+ Like expr:, but when used with transaction-oriented commands like print, it+ matches the transaction only if all postings are matched by all of QUERY-+ EXPR (and there is at least one posting).+ So, hledger print all:'cash and amt:0' means "show transactions where all+ postings involve a cash account and have a zero amount".+ Or, hledger print all:'cash or checking' means "show transactions which+ touch only cash and/or checking accounts".++ Queries and command options+ Some queries can also be expressed as command-line options: depth:2 is+ equivalent to --depth 2, date:2023 is equivalent to -p 2023, etc. When you+ mix command options and query arguments, generally the resulting query is+ their intersection.++ Queries and account aliases+ When account names are rewritten with --alias or alias, acct: will match+ either the old or the new account name.++ Queries and valuation+ When amounts are converted to other commodities in cost or value reports,+ cur: and amt: match the old commodity symbol and the old amount quantity,+ not the new ones. (Except in hledger 1.22, #1625.)++Pivoting+ Normally, hledger groups amounts and displays their totals by account+ (name). With --pivot PIVOTEXPR, some other field's (or multiple fields')+ value is used as a synthetic account name, causing different grouping and+ display. PIVOTEXPR can be++ * any of these standard transaction or posting fields (their value is sub-+ stituted): status, code, desc, payee, note, acct, comm/cur, amt, cost++ * or a tag name++ * or any combination of these, colon-separated.++ Some special cases:++ * Colons appearing in PIVOTEXPR or in a pivoted tag value will generate ac-+ count hierarchy.++ * When pivoting a posting that has multiple values for a tag, the tag's+ first value will be used as the pivoted value.++ * When a posting has multiple commodities, the pivoted value of+ "comm"/"cur" will be "". Also when an unrecognised tag name or field is+ provided, its pivoted value will be "". (If this causes confusing out-+ put, consider excluding those postings from the report.)++ Examples:++ 2016/02/16 Yearly Dues Payment+ assets:bank account 2 EUR+ income:dues -2 EUR ; member: John Doe, kind: Lifetime++ Normal balance report showing account names:++ $ hledger balance+ 2 EUR assets:bank account+ -2 EUR income:dues+ --------------------+ 0++ Pivoted balance report, using member: tag values instead:++ $ hledger balance --pivot member+ 2 EUR+ -2 EUR John Doe+ --------------------+ 0++ One way to show only amounts with a member: value (using a query):++ $ hledger balance --pivot member tag:member=.+ -2 EUR John Doe+ --------------------+ -2 EUR++ Another way (the acct: query matches against the pivoted "account name"):++ $ hledger balance --pivot member acct:.+ -2 EUR John Doe+ --------------------+ -2 EUR++ Hierarchical reports can be generated with multiple pivot values:++ $ hledger balance Income:Dues --pivot kind:member+ -2 EUR Lifetime:John Doe+ --------------------+ -2 EUR++Generating data+ hledger can enrich the data provided to it, or generate new data, in a num-+ ber of ways. Mostly, this is done only if you request it:++ * Missing amounts or missing costs in transactions are inferred automati-+ cally when possible.++ * The --infer-equity flag infers missing conversion equity postings from+ @/@@ costs.++ * The --infer-costs flag infers missing costs from conversion equity post-+ ings.++ * The --infer-market-prices flag infers P price directives from costs.++ * The --auto flag adds extra postings to transactions matched by auto post-+ ing rules.++ * The --forecast option generates transactions from periodic transaction+ rules.++ * The balance --budget report infers budget goals from periodic transaction+ rules.++ * Commands like close, rewrite, and hledger-interest generate transactions+ or postings.++ * CSV data is converted to transactions by applying CSV conversion rules..+ etc.++ Such generated data is temporary, existing only at report time. You can+ convert it to permanent recorded data by, eg, capturing the output of+ hledger print and saving it in your journal file. This can sometimes be+ useful as a data entry aid.++ If you are curious what data is being generated and why, run hledger print+ -x --verbose-tags. -x/--explicit shows inferred amounts and --verbose-tags+ adds tags like generated-transaction (from periodic rules) and gener-+ ated-posting, modified (from auto posting rules). Similar hidden tags+ (with an underscore prefix) are always present, also, so you can always+ match such data with queries like tag:generated or tag:modified.++Forecasting+ Forecasting, or speculative future reporting, can be useful for estimating+ future balances, or for exploring different future scenarios.++ The simplest and most flexible way to do it with hledger is to manually+ record a bunch of future-dated transactions. You could keep these in a+ separate future.journal and include that with -f only when you want to see+ them.++ --forecast+ There is another way: with the --forecast option, hledger can generate tem-+ porary "forecast transactions" for reporting purposes, according to peri-+ odic transaction rules defined in the journal. Each rule can generate mul-+ tiple recurring transactions, so by changing one rule you can change many+ forecasted transactions.++ Forecast transactions usually start after ordinary transactions end. By+ default, they begin after your latest-dated ordinary transaction, or today,+ whichever is later, and they end six months from today. (The exact rules+ are a little more complicated, and are given below.)++ This is the "forecast period", which need not be the same as the report pe-+ riod. You can override it - eg to forecast farther into the future, or to+ force forecast transactions to overlap your ordinary transactions - by giv-+ ing the --forecast option a period expression argument, like --fore-+ cast=..2099 or --forecast=2023-02-15... Note that the = is required.++ Inspecting forecast transactions+ print is the best command for inspecting and troubleshooting forecast+ transactions. Eg:++ ~ monthly from 2022-12-20 rent+ assets:bank:checking+ expenses:rent $1000++ $ hledger print --forecast --today=2023/4/21+ 2023-05-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++ 2023-06-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++ 2023-07-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++ 2023-08-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++ 2023-09-20 rent+ ; generated-transaction: ~ monthly from 2022-12-20+ assets:bank:checking+ expenses:rent $1000++ Here there are no ordinary transactions, so the forecasted transactions be-+ gin on the first occurrence after today's date. (You won't normally use+ --today; it's just to make these examples reproducible.)++ Forecast reports+ Forecast transactions affect all reports, as you would expect. Eg:++ $ hledger areg rent --forecast --today=2023/4/21+ Transactions in expenses:rent and subaccounts:+ 2023-05-20 rent as:ba:checking $1000 $1000+ 2023-06-20 rent as:ba:checking $1000 $2000+ 2023-07-20 rent as:ba:checking $1000 $3000+ 2023-08-20 rent as:ba:checking $1000 $4000+ 2023-09-20 rent as:ba:checking $1000 $5000++ $ hledger bal -M expenses --forecast --today=2023/4/21+ Balance changes in 2023-05-01..2023-09-30:++ || May Jun Jul Aug Sep+ ===============++===================================+ expenses:rent || $1000 $1000 $1000 $1000 $1000+ ---------------++-----------------------------------+ || $1000 $1000 $1000 $1000 $1000++ Forecast tags+ Forecast transactions generated by --forecast have a hidden tag, _gener-+ ated-transaction. So if you ever need to match forecast transactions, you+ could use tag:_generated-transaction (or just tag:generated) in a query.++ For troubleshooting, you can add the --verbose-tags flag. Then, visible+ generated-transaction tags will be added also, so you can view them with+ the print command. Their value indicates which periodic rule was responsi-+ ble.++ Forecast period, in detail+ Forecast start/end dates are chosen so as to do something useful by default+ in almost all situations, while also being flexible. Here are (with luck)+ the exact rules, to help with troubleshooting:++ The forecast period starts on:++ * the later of++ * the start date in the periodic transaction rule++ * the start date in --forecast's argument++ * otherwise (if those are not available): the later of++ * the report start date specified with -b/-p/date:++ * the day after the latest ordinary transaction in the journal++ * otherwise (if none of these are available): today.++ The forecast period ends on:++ * the earlier of++ * the end date in the periodic transaction rule++ * the end date in --forecast's argument++ * otherwise: the report end date specified with -e/-p/date:++ * otherwise: 180 days (~6 months) from today.++ Forecast troubleshooting+ When --forecast is not doing what you expect, one of these tips should+ help:++ * Remember to use the --forecast option.++ * Remember to have at least one periodic transaction rule in your journal.++ * Test with print --forecast.++ * Check for typos or too-restrictive start/end dates in your periodic+ transaction rule.++ * Leave at least 2 spaces between the rule's period expression and descrip-+ tion fields.++ * Check for future-dated ordinary transactions suppressing forecasted+ transactions.++ * Try setting explicit report start and/or end dates with -b, -e, -p or+ date:++ * Try adding the -E flag to encourage display of empty periods/zero trans-+ actions.++ * Try setting explicit forecast start and/or end dates with --fore-+ cast=START..END++ * Consult Forecast period, in detail, above.++ * Check inside the engine: add --debug=2 (eg).++Budgeting+ With the balance command's --budget report, each periodic transaction rule+ generates recurring budget goals in specified accounts, and goals and ac-+ tual performance can be compared. See the balance command's doc below.++ You can generate budget goals and forecast transactions at the same time,+ from the same or different periodic transaction rules: hledger bal -M+ --budget --forecast ...++ See also: Budgeting and Forecasting.++Amount formatting+ Commodity display style+ For the amounts in each commodity, hledger chooses a consistent display+ style (symbol placement, decimal mark and digit group marks, number of dec-+ imal digits) to use in most reports. This is inferred as follows:++ First, if there's a D directive declaring a default commodity, that commod-+ ity symbol and amount format is applied to all no-symbol amounts in the+ journal.++ Then each commodity's display style is determined from its commodity direc-+ tive. We recommend always declaring commodities with commodity directives,+ since they help ensure consistent display styles and precisions, and bring+ other benefits such as error checking for commodity symbols. Here's an ex-+ ample:++ # Set display styles (and decimal marks, for parsing, if there is no decimal-mark directive)+ # for the $, EUR, INR and no-symbol commodities:+ commodity $1,000.00+ commodity EUR 1.000,00+ commodity INR 9,99,99,999.00+ commodity 1 000 000.9455++ But for convenience, if a commodity directive is not present, hledger in-+ fers a commodity's display styles from its amounts as they are written in+ the journal (excluding cost amounts and amounts in periodic transaction+ rules or auto posting rules). It uses++ * the symbol placement and decimal mark of the first amount seen++ * the digit group marks of the first amount with digit group marks++ * and the maximum number of decimal digits seen across all amounts.++ And as fallback if no applicable amounts are found, it would use a default+ style, like $1000.00 (symbol on the left with no space, period as decimal+ mark, and two decimal digits).++ Finally, commodity styles can be overridden by the -c/--commodity-style+ command line option.++ Rounding+ Amounts are stored internally as decimal numbers with up to 255 decimal+ places. They are displayed with their original journal precisions by print+ and print-like reports, and rounded to their display precision (the number+ of decimal digits specified by the commodity display style) by other re-+ ports. When rounding, hledger uses banker's rounding (it rounds to the+ nearest even digit). So eg 0.5 displayed with zero decimal digits appears+ as "0".++ Trailing decimal marks+ If you're wondering why your print report sometimes shows trailing decimal+ marks, with no decimal digits; it does this when showing amounts that have+ digit group marks but no decimal digits, to disambiguate them and allow+ them to be re-parsed reliably (see Decimal marks). Eg:++ commodity $1,000.00++ 2023-01-02+ (a) $1000++ $ hledger print+ 2023-01-02+ (a) $1,000.++ If this is a problem (eg when exporting to Ledger), you can avoid it by+ disabling digit group marks, eg with -c/--commodity (for each affected com-+ modity):++ $ hledger print -c '$1000.00'+ 2023-01-02+ (a) $1000++ or by forcing print to always show decimal digits, with --round:++ $ hledger print -c '$1,000.00' --round=soft+ 2023-01-02+ (a) $1,000.00++ Amount parseability+ More generally, hledger output falls into three rough categories, which+ format amounts a little bit differently to suit different consumers:++ 1. "hledger-readable output" - should be readable by hledger (and by hu-+ mans)++ * This is produced by reports that show full journal entries: print, im-+ port, close, rewrite etc.++ * It shows amounts with their original journal precisions, which may not be+ consistent from one amount to the next.++ * It adds a trailing decimal mark when needed to avoid showing ambiguous+ amounts.++ * It can be parsed reliably (by hledger and ledger2beancount at least, but+ perhaps not by Ledger..)++ 2. "human-readable output" - usually for humans++ * This is produced by all other reports.++ * It shows amounts with standard display precisions, which will be consis-+ tent within each commodity.++ * It shows ambiguous amounts unmodified.++ * It can be parsed reliably in the context of a known report (when you know+ decimals are consistently not being shown, you can assume a single mark+ is a digit group mark).++ 3. "machine-readable output" - usually for other software++ * This is produced by all reports when an output format like csv, tsv,+ json, or sql is selected.++ * It shows amounts as 1 or 2 do, but without digit group marks.++ * It can be parsed reliably (if needed, the decimal mark can be changed+ with -c/--commodity-style).++Cost reporting+ In some transactions - for example a currency conversion, or a purchase or+ sale of stock - one commodity is exchanged for another. In these transac-+ tions there is a conversion rate, also called the cost (when buying) or+ selling price (when selling). (In hledger docs we just say "cost" generi-+ cally for convenience.) With the -B/--cost flag, hledger can show amounts+ "at cost", converted to the cost's commodity.++ Recording costs+ We'll explore several ways of recording transactions involving costs.+ These are also summarised at hledger Cookbook > Cost notation.++ Costs can be recorded explicitly in the journal, using the @ UNITCOST or @@+ TOTALCOST notation described in Journal > Costs:++ Variant 1++ 2022-01-01+ assets:dollars $-135+ assets:euros a100 @ $1.35 ; $1.35 per euro (unit cost)++ Variant 2++ 2022-01-01+ assets:dollars $-135+ assets:euros a100 @@ $135 ; $135 total cost++ Typically, writing the unit cost (variant 1) is preferable; it can be more+ effort, requiring more attention to decimal digits; but it reveals the+ per-unit cost basis, and makes stock sales easier.++ Costs can also be left implicit, and hledger will infer the cost that is+ consistent with a balanced transaction:++ Variant 3++ 2022-01-01+ assets:dollars $-135+ assets:euros a100++ Here, hledger will attach a @@ a100 cost to the first amount (you can see+ it with hledger print -x). This form looks convenient, but there are down-+ sides:++ * It sacrifices some error checking. For example, if you accidentally+ wrote a10 instead of a100, hledger would not be able to detect the mis-+ take.++ * It is sensitive to the order of postings - if they were reversed, a dif-+ ferent entry would be inferred and reports would be different.++ * The per-unit cost basis is not easy to read.++ So generally this kind of entry is not recommended. You can make sure you+ have none of these by using -s (strict mode), or by running hledger check+ balanced.++ Reporting at cost+ Now when you add the -B/--cost flag to reports ("B" is from Ledger's+ -B/--basis/--cost flag), any amounts which have been annotated with costs+ will be converted to their cost's commodity (in the report output). Ie+ they will be displayed "at cost" or "at sale price".++ Some things to note:++ * Costs are attached to specific posting amounts in specific transactions,+ and once recorded they do not change. This contrasts with market prices,+ which are ambient and fluctuating.++ * Conversion to cost is performed before conversion to market value (de-+ scribed below).++ Equity conversion postings+ There is a problem with the entries above - they are not conventional Dou-+ ble Entry Bookkeeping (DEB) notation, and because of the "magical" trans-+ formation of one commodity into another, they cause an imbalance in the Ac-+ counting Equation. This shows up as a non-zero grand total in balance re-+ ports like hledger bse.++ For most hledger users, this doesn't matter in practice and can safely be+ ignored ! But if you'd like to learn more, keep reading.++ Conventional DEB uses an extra pair of equity postings to balance the+ transaction. Of course you can do this in hledger as well:++ Variant 4++ 2022-01-01+ assets:dollars $-135+ assets:euros a100+ equity:conversion $135+ equity:conversion a-100++ Now the transaction is perfectly balanced according to standard DEB, and+ hledger bse's total will not be disrupted.++ And, hledger can still infer the cost for cost reporting, but it's not done+ by default - you must add the --infer-costs flag like so:++ $ hledger print --infer-costs+ 2022-01-01 one hundred euros purchased at $1.35 each+ assets:dollars $-135 @@ a100+ assets:euros a100+ equity:conversion $135+ equity:conversion a-100++ $ hledger bal --infer-costs -B+ a-100 assets:dollars+ a100 assets:euros+ --------------------+ 0++ Here are some downsides of this kind of entry:++ * The per-unit cost basis is not easy to read.++ * Instead of -B you must remember to type -B --infer-costs.++ * --infer-costs works only where hledger can identify the two equity:con-+ version postings and match them up with the two non-equity postings. So+ writing the journal entry in a particular format becomes more important.+ More on this below.++ Inferring equity conversion postings+ Can we go in the other direction ? Yes, if you have transactions written+ with the @/@@ cost notation, hledger can infer the missing equity postings,+ if you add the --infer-equity flag. Eg:++ 2022-01-01+ assets:dollars -$135+ assets:euros a100 @ $1.35++ $ hledger print --infer-equity+ 2022-01-01+ assets:dollars $-135+ assets:euros a100 @ $1.35+ equity:conversion:$-a:a a-100+ equity:conversion:$-a:$ $135.00++ The equity account names will be "equity:conversion:A-B:A" and "equity:con-+ version:A-B:B" where A is the alphabetically first commodity symbol. You+ can customise the "equity:conversion" part by declaring an account with the+ V/Conversion account type.++ Note you will need to add account declarations for these to your journal,+ if you use check accounts or check --strict. (And unlike normal postings,+ generated equity postings do not inherit tags from account declarations.)++ Combining costs and equity conversion postings+ Finally, you can use both the @/@@ cost notation and equity postings at the+ same time. This in theory gives the best of all worlds - preserving the+ accounting equation, revealing the per-unit cost basis, and providing more+ flexibility in how you write the entry:++ Variant 5++ 2022-01-01 one hundred euros purchased at $1.35 each+ assets:dollars $-135+ equity:conversion $135+ equity:conversion a-100+ assets:euros a100 @ $1.35++ All the other variants above can (usually) be rewritten to this final form+ with:++ $ hledger print -x --infer-costs --infer-equity++ Downsides:++ * The precise format of the journal entry becomes more important. If+ hledger can't detect and match up the cost and equity postings, it will+ give a transaction balancing error.++ * The add command does not yet accept this kind of entry (#2056).++ * This is the most verbose form.++ Requirements for detecting equity conversion postings+ --infer-costs has certain requirements (unlike --infer-equity, which always+ works). It will infer costs only in transactions with:++ * Two non-equity postings, in different commodities. Their order is sig-+ nificant: the cost will be added to the first of them.++ * Two postings to equity conversion accounts, next to one another, which+ balance the two non-equity postings. This balancing is checked to the+ same precision (number of decimal places) used in the conversion post-+ ing's amount. Equity conversion accounts are:++ * any accounts declared with account type V/Conversion, or their subac-+ counts++ * otherwise, accounts named equity:conversion, equity:trade, or eq-+ uity:trading, or their subaccounts.++ And multiple such four-posting groups can coexist within a single transac-+ tion. When --infer-costs fails, it does not infer a cost in that transac-+ tion, and does not raise an error (ie, it infers costs where it can).++ Reading variant 5 journal entries, combining cost notation and equity post-+ ings, has all the same requirements. When reading such an entry fails,+ hledger raises an "unbalanced transaction" error.++ Infer cost and equity by default ?+ Should --infer-costs and --infer-equity be enabled by default ? Try using+ them always, eg with a shell alias:++ alias h="hledger --infer-equity --infer-costs"++ and let us know what problems you find.++Value reporting+ hledger can also show amounts "at market value", converted to some other+ commodity using the market price or conversion rate on a certain date.++ This is controlled by the --value=TYPE[,COMMODITY] option. We also provide+ simpler -V and -X COMMODITY aliases for this, which are often sufficient.+ The market prices are declared with a special P directive, and/or they can+ be inferred from the costs recorded in transactions, by using the --in-+ fer-market-prices flag.++ -X: Value in specified commodity+ The -X COMM (or --exchange=COMM) option converts amounts to their market+ value in the specified commodity, using the market prices in effect on the+ valuation date(s), if any. (More on these in a minute.)++ Use this when you want to (eg) show everything in your base currency as far+ as possible. (Commodities for which no conversion rate can be found, will+ not be converted.)++ COMM should be the full commodity symbol or name. Remember to quote spe-+ cial shell characters, if needed. Some examples:++ * -Xa++ * -X$ (nothing after $, no quoting needed)++ * -X CNY (the space after -X is optional)++ * -X 'red apples'++ * -X 'r&r'++ -V: Value in default commodity(s)+ The -V/--market flag is a variant of -X where you don't have to specify+ COMM. Instead it tries to guess a default valuation commodity for each+ original commodity, based on the market prices in effect on the valuation+ date(s).++ -V can often be a convenient shortcut for -X MYCURRENCY, but not always;+ depending on your data it could guess multiple valuation commodities. Usu-+ ally you want to convert to a single commodity, so it's better to use -X,+ unless you're sure -V is doing what you want.++ Valuation date+ Market prices can change from day to day. hledger will use the prices on a+ particular valuation date (or on more than one date). By default hledger+ uses "end" dates for valuation. More specifically:++ * For single period reports (including normal print and register reports):++ * If an explicit report end date is specified, that is used.++ * Otherwise the latest transaction date or non-future P directive date is+ used.++ * For multiperiod reports, each period is valued on its last day.++ This can be customised with the --value option described below, which can+ select either "then", "end", "now", or "custom" dates.++ Finding market price+ To convert a commodity A to its market value in another commodity B,+ hledger looks for a suitable market price (exchange rate) as follows, in+ this order of preference:++ 1. A declared market price or inferred market price: A's latest market+ price in B on or before the valuation date as declared by a P directive,+ or (with the --infer-market-prices flag) inferred from costs.++ 2. A reverse market price: the inverse of a declared or inferred market+ price from B to A.++ 3. A forward chain of market prices: a synthetic price formed by combining+ the shortest chain of "forward" (only 1 above) market prices, leading+ from A to B.++ 4. Any chain of market prices: a chain of any market prices, including both+ forward and reverse prices (1 and 2 above), leading from A to B.++ There is a limit to the length of these price chains; if hledger reaches+ that length without finding a complete chain or exhausting all possibili-+ ties, it will give up (with a "gave up" message visible in --debug=2 out-+ put). That limit is currently 1000.++ Amounts for which no suitable market price can be found, are not converted.++ --infer-market-prices: market prices from transactions+ Normally, market value in hledger is fully controlled by, and requires, P+ directives in your journal. Since adding and updating those can be a+ chore, and since transactions usually take place at close to market value,+ why not use the recorded costs as additional market prices (as Ledger does)+ ? Adding the --infer-market-prices flag to -V, -X or --value enables this.++ So for example, hledger bs -V --infer-market-prices will get market prices+ both from P directives and from transactions. If both occur on the same+ day, the P directive takes precedence.++ There is a downside: value reports can sometimes be affected in confus-+ ing/undesired ways by your journal entries. If this happens to you, read+ all of this Value reporting section carefully, and try adding --debug or+ --debug=2 to troubleshoot.++ --infer-market-prices can infer market prices from:++ * multicommodity transactions with explicit prices (@/@@)++ * multicommodity transactions with implicit prices (no @, two commodities,+ unbalanced). (With these, the order of postings matters. hledger print+ -x can be useful for troubleshooting.)++ * multicommodity transactions with equity postings, if cost is inferred+ with --infer-costs.++ There is a limitation (bug) currently: when a valuation commodity is not+ specified, prices inferred with --infer-market-prices do not help select a+ default valuation commodity, as P prices would. So conversion might not+ happen because no valuation commodity was detected (--debug=2 will show+ this). To be safe, specify the valuation commmodity, eg:++ * -X EUR --infer-market-prices, not -V --infer-market-prices++ * --value=then,EUR --infer-market-prices, not --value=then --infer-mar-+ ket-prices++ Signed costs and market prices can be confusing. For reference, here is+ the current behaviour, since hledger 1.25. (If you think it should work+ differently, see #1870.)++ 2022-01-01 Positive Unit prices+ a A 1+ b B -1 @ A 1++ 2022-01-01 Positive Total prices+ a A 1+ b B -1 @@ A 1+++ 2022-01-02 Negative unit prices+ a A 1+ b B 1 @ A -1++ 2022-01-02 Negative total prices+ a A 1+ b B 1 @@ A -1+++ 2022-01-03 Double Negative unit prices+ a A -1+ b B -1 @ A -1++ 2022-01-03 Double Negative total prices+ a A -1+ b B -1 @@ A -1++ All of the transactions above are considered balanced (and on each day, the+ two transactions are considered equivalent). Here are the market prices+ inferred for B:++ $ hledger -f- --infer-market-prices prices+ P 2022-01-01 B A 1+ P 2022-01-01 B A 1.0+ P 2022-01-02 B A -1+ P 2022-01-02 B A -1.0+ P 2022-01-03 B A -1+ P 2022-01-03 B A -1.0++ Valuation commodity+ When you specify a valuation commodity (-X COMM or --value TYPE,COMM):+ hledger will convert all amounts to COMM, wherever it can find a suitable+ market price (including by reversing or chaining prices).++ When you leave the valuation commodity unspecified (-V or --value TYPE):+ For each commodity A, hledger picks a default valuation commodity as fol-+ lows, in this order of preference:++ 1. The price commodity from the latest P-declared market price for A on or+ before valuation date.++ 2. The price commodity from the latest P-declared market price for A on any+ date. (Allows conversion to proceed when there are inferred prices be-+ fore the valuation date.)++ 3. If there are no P directives at all (any commodity or date) and the+ --infer-market-prices flag is used: the price commodity from the latest+ transaction-inferred price for A on or before valuation date.++ This means:++ * If you have P directives, they determine which commodities -V will con-+ vert, and to what.++ * If you have no P directives, and use the --infer-market-prices flag,+ costs determine it.++ Amounts for which no valuation commodity can be found are not converted.++ --value: Flexible valuation+ -V and -X are special cases of the more general --value option:++ --value=TYPE[,COMM] TYPE is then, end, now or YYYY-MM-DD.+ COMM is an optional commodity symbol.+ Shows amounts converted to:+ - default valuation commodity (or COMM) using market prices at posting dates+ - default valuation commodity (or COMM) using market prices at period end(s)+ - default valuation commodity (or COMM) using current market prices+ - default valuation commodity (or COMM) using market prices at some date++ The TYPE part selects cost or value and valuation date:++ --value=then+ Convert amounts to their value in the default valuation commodity,+ using market prices on each posting's date.++ --value=end+ Convert amounts to their value in the default valuation commodity,+ using market prices on the last day of the report period (or if un-+ specified, the journal's end date); or in multiperiod reports, mar-+ ket prices on the last day of each subperiod.++ --value=now+ Convert amounts to their value in the default valuation commodity+ using current market prices (as of when report is generated).++ --value=YYYY-MM-DD+ Convert amounts to their value in the default valuation commodity+ using market prices on this date.++ To select a different valuation commodity, add the optional ,COMM part: a+ comma, then the target commodity's symbol. Eg: --value=now,EUR. hledger+ will do its best to convert amounts to this commodity, deducing market+ prices as described above.++ Valuation examples+ Here are some quick examples of -V:++ ; one euro is worth this many dollars from nov 1+ P 2016/11/01 a $1.10++ ; purchase some euros on nov 3+ 2016/11/3+ assets:euros a100+ assets:checking++ ; the euro is worth fewer dollars by dec 21+ P 2016/12/21 a $1.03++ How many euros do I have ?++ $ hledger -f t.j bal -N euros+ a100 assets:euros++ What are they worth at end of nov 3 ?++ $ 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, de-+ faults to today)++ $ hledger -f t.j bal -N euros -V+ $103.00 assets:euros++ Here are some examples showing the effect of --value, as seen with print:++ P 2000-01-01 A 1 B+ P 2000-02-01 A 2 B+ P 2000-03-01 A 3 B+ P 2000-04-01 A 4 B++ 2000-01-01+ (a) 1 A @ 5 B++ 2000-02-01+ (a) 1 A @ 6 B++ 2000-03-01+ (a) 1 A @ 7 B++ Show the cost of each posting:++ $ hledger -f- print --cost+ 2000-01-01+ (a) 5 B++ 2000-02-01+ (a) 6 B++ 2000-03-01+ (a) 7 B++ Show the value as of the last day of the report period (2000-02-29):++ $ hledger -f- print --value=end date:2000/01-2000/03+ 2000-01-01+ (a) 2 B++ 2000-02-01+ (a) 2 B++ With no report period specified, the latest transaction date or price date+ is used as valuation date (2000-04-01):++ $ hledger -f- print --value=end+ 2000-01-01+ (a) 3 B++ 2000-02-01+ (a) 3 B++ 2000-03-01+ (a) 3 B++ The value today is the same (the 2000-04-01 price is still in effect):++ $ hledger -f- print --value=now+ 2000-01-01+ (a) 4 B++ 2000-02-01+ (a) 4 B++ 2000-03-01+ (a) 4 B++ Show the value on 2000/01/15:++ $ hledger -f- print --value=2000-01-15+ 2000-01-01+ (a) 1 B++ 2000-02-01+ (a) 1 B++ 2000-03-01+ (a) 1 B++ Interaction of valuation and queries+ When matching postings based on queries in the presence of valuation, the+ following happens:++ 1. The query is separated into two parts:++ 1. the currency (cur:) or amount (amt:).++ 2. all other parts.++ 2. The postings are matched to the currency and amount queries based on+ pre-valued amounts.++ 3. Valuation is applied to the postings.++ 4. The postings are matched to the other parts of the query based on+ post-valued amounts.++ Related: #1625++ Effect of valuation on reports+ Here is a reference for how valuation is supposed to affect each part of+ hledger's reports. It may be useful when troubleshooting. If you find+ problems, please report them, ideally with a reproducible example. Re-+ lated: #329, #1083.++ First, a quick glossary:++ cost calculated using price(s) recorded in the transaction(s).++ value market value using available market price declarations, or the un-+ changed amount if no conversion rate can be found.++ report start+ the first day of the report period specified with -b or -p or date:,+ otherwise today.++ report or journal start+ the first day of the report period specified with -b or -p or date:,+ otherwise the earliest transaction date in the journal, otherwise+ today.++ report end+ the last day of the report period specified with -e or -p or date:,+ otherwise today.++ report or journal end+ the last day of the report period specified with -e or -p or date:,+ otherwise the latest transaction date in the journal, otherwise to-+ day.++ report interval+ a flag (-D/-W/-M/-Q/-Y) or period expression that activates the re-+ port's multi-period mode (whether showing one or many subperiods).++ Report -B, --cost -V, -X --value=then --value=end --value=DATE,+ type --value=now+ --------------------------------------------------------------------------------------------+ print+ posting cost value at re- value at posting value at re- value at+ amounts port end or date port or DATE/today+ today journal end+ balance unchanged unchanged unchanged unchanged unchanged+ asser-+ tions/as-+ signments++ register+ starting cost value at re- valued at day value at re- value at+ balance port or each historical port or DATE/today+ (-H) journal end posting was made journal end+ starting cost value at day valued at day value at day value at+ balance before re- each historical before re- DATE/today+ (-H) with port or posting was made port or+ report journal journal+ interval start start+ posting cost value at re- value at posting value at re- value at+ amounts port or date port or DATE/today+ journal end journal end+ summary summarised value at pe- sum of postings value at pe- value at+ posting cost riod ends in interval, val- riod ends DATE/today+ amounts ued at interval+ with re- start+ port in-+ terval+ running sum/average sum/average sum/average of sum/average sum/average+ total/av- of displayed of displayed displayed values of displayed of displayed+ erage values values values values++ balance+ (bs, bse,+ cf, is)+ balance sums of value at re- value at posting value at re- value at+ changes costs port end or date port or DATE/today of+ today of journal end sums of post-+ sums of of sums of ings+ postings postings+ budget like balance like balance like balance like bal- like balance+ amounts changes changes changes ances changes+ (--bud-+ get)+ grand to- sum of dis- sum of dis- sum of displayed sum of dis- sum of dis-+ tal played val- played val- valued played val- played values+ ues ues ues++ balance+ (bs, bse,+ cf, is)+ with re-+ port in-+ terval+ starting sums of value at re- sums of values of value at re- sums of post-+ balances costs of port start postings before port start ings before+ (-H) postings be- of sums of report start at of sums of report start+ fore report all postings respective post- all postings+ start before re- ing dates before re-+ port start port start+ balance sums of same as sums of values of balance value at+ changes costs of --value=end postings in pe- change in DATE/today of+ (bal, is, postings in riod at respec- each period, sums of post-+ bs period tive posting valued at ings+ --change, dates period ends+ cf+ --change)+ end bal- sums of same as sums of values of period end value at+ ances costs of --value=end postings from be- balances, DATE/today of+ (bal -H, postings fore period start valued at sums of post-+ is --H, from before to period end at period ends ings+ bs, cf) report start respective post-+ to period ing dates+ end+ budget like balance like balance like balance like bal- like balance+ amounts changes/end changes/end changes/end bal- ances changes/end+ (--bud- balances balances ances balances+ get)+ row to- sums, aver- sums, aver- sums, averages of sums, aver- sums, aver-+ tals, row ages of dis- ages of dis- displayed values ages of dis- ages of dis-+ averages played val- played val- played val- played values+ (-T, -A) ues ues ues+ column sums of dis- sums of dis- sums of displayed sums of dis- sums of dis-+ totals played val- played val- values played val- played values+ ues ues ues+ grand to- sum, average sum, average sum, average of sum, average sum, average+ tal, of column of column column totals of column of column to-+ grand av- totals totals totals tals+ erage+++ --cumulative is omitted to save space, it works like -H but with a zero+ starting balance.++PART 4: COMMANDS+ Here are hledger's standard subcommands. You can list these by running+ hledger. If you have installed more add-on commands, they also will be+ listed.++ In the following command docs, each command's specific options are shown.+ Most commands also support the general options described above, though some+ of them might have no effect. (Usually if there's a sensible way for a+ general option to affect a command, it will.) You can list all of a com-+ mand's options by running hledger CMD -h.++ Help commands++ * commands - show the hledger commands list (default)++ * demo - show small hledger demos in the terminal++ * help - show the hledger manual with info, man, or pager++ User interface commands++ * repl - run commands from an interactive prompt++ * run - run commands from a script++ * ui - (if installed) run hledger's terminal UI++ * web - (if installed) run hledger's web UI++ Data entry commands++ * add - add transactions using terminal prompts++ * import - add new transactions from other files, eg CSV files++ Basic report commands++ * accounts - show account names++ * codes - show transaction codes++ * commodities - show commodity/currency symbols++ * descriptions - show transaction descriptions++ * files - show input file paths++ * notes - show note parts of transaction descriptions++ * payees - show payee parts of transaction descriptions++ * prices - show market prices++ * stats - show journal statistics++ * tags - show tag names++ Standard report commands++ * print - show transactions or export journal data++ * aregister (areg) - show transactions in a particular account++ * register (reg) - show postings in one or more accounts & running total++ * balancesheet (bs) - show assets, liabilities and net worth++ * balancesheetequity (bse) - show assets, liabilities and equity++ * cashflow (cf) - show changes in liquid assets++ * incomestatement (is) - show revenues and expenses++ Advanced report commands++ * balance (bal) - show balance changes, end balances, budgets, gains..++ * roi - show return on investments++ Chart commands++ * activity - show bar charts of posting counts per period++ Data generation commands++ * close - generate balance-zeroing/restoring transactions++ * rewrite - generate auto postings, like print --auto++ Maintenance commands++ * check - check for various kinds of error in the data++ * diff - compare account transactions in two journal files++ * setup - check and show the status of the hledger installation++ * test - run self tests++ Next, these commands are described in detail.++Help commands+ commands+ Show the hledger commands list.++ Flags:+ --builtin show only builtin commands, not addons++ demo+ Play demos of hledger usage in the terminal, if asciinema is installed.++ Flags:+ -s --speed=SPEED playback speed (1 is original speed, .5 is half, 2+ is double, etc (default: 2))++ Run this command with no argument to list the demos. To play a demo, write+ its number or a prefix or substring of its title. Tips:++ Make your terminal window large enough to see the demo clearly.++ Use the -s/--speed SPEED option to set your preferred playback speed, eg+ -s4 to play at 4x original speed or -s.5 to play at half speed. The de-+ fault speed is 2x.++ During playback, several keys are available: SPACE to pause/unpause, . to+ step forward (while paused), CTRL-c quit.++ Examples:++ $ hledger demo # list available demos+ $ hledger demo 1 # play the first demo at default speed (2x)+ $ hledger demo install -s4 # play the "install" demo at 4x speed++ This command is experimental: there aren't many useful demos yet.++ help+ Show the hledger user manual with info, man, or a pager. With a (case in-+ sensitive) TOPIC argument, try to open it at that section heading.++ Flags:+ -i show the manual with info+ -m show the manual with man+ -p show the manual with $PAGER or less+ (less is always used if TOPIC is specified)++ This command shows the hledger manual built in to your hledger executable.+ It can be useful when offline, or when you prefer the terminal to a web+ browser, or when the appropriate hledger manual or viewers are not in-+ stalled properly on your system.++ By default it chooses the best viewer found in $PATH, trying in this order:+ info, man, $PAGER, less, more, stdout. (If a TOPIC is specified, $PAGER+ and more are not tried.) You can force the use of info, man, or a pager+ with the -i, -m, or -p flags. If no viewer can be found, or if running+ non-interactively, it just prints the manual to stdout.++ When using info, TOPIC can match either the full heading or a prefix. If+ your info --version is < 6, you'll need to upgrade it, eg with 'brew in-+ stall texinfo' on mac.++ When using man or less, TOPIC must match the full heading. For a prefix+ match, you can write 'TOPIC.*'.++ Examples++ $ hledger help -h # show the help command's usage+ $ hledger help # show the manual with info, man or $PAGER+ $ hledger help 'time periods' # show the manual's "Time periods" topic+ $ hledger help 'time periods' -m # use man, even if info is installed++User interface commands+ repl+ Start an interactive prompt, where you can run any of hledger's commands.+ Data files are parsed just once, so the commands run faster.++ Flags:+ no command-specific flags++ This command is experimental and could change in the future.++ hledger repl starts a read-eval-print loop (REPL) where you can enter com-+ mands interactively. As with the run command, each input file (or each in-+ put file/input options combination) is parsed just once, so commands will+ run more quickly than if you ran them individually at the command line.++ Also like run, the input file(s) specified for the repl command will be the+ default input for all interactive commands. You can override this tem-+ porarily by specifying an -f option in particular commands. But note that+ commands will not see any changes made to input files (eg by add) until you+ exit and restart the REPL.++ The command syntax is the same as with run:++ * enter one hledger command at a time, without the usual hledger first word++ * empty lines and comment text from # to end of line are ignored++ * use single or double quotes to quote arguments when needed++ * type exit or quit or control-D to exit the REPL.++ While it is running, the REPL remembers your command history, and you can+ navigate in the usual ways:++ * Keypad or Emacs navigation keys to edit the current command line++ * UP/DOWN or control-P/control-N to step back/forward through history++ * control-R to search for a past command++ * TAB to complete file paths.++ Generally repl command lines should feel much like the normal hledger CLI,+ but you may find differences. repl is a little stricter; eg it requires+ full command names or official abbreviations (as seen in the commands+ list).++ The commands and help commands, and the command help flags (CMD --tldr, CMD+ -h/--help, CMD --info, CMD --man), can be useful.++ You can type control-C to cancel a long-running command (but only once;+ typing it a second time will exit the REPL).++ And in most shells you can type control-Z to temporarily exit to the shell+ (and then fg to return to the REPL).++ Examples+ Start the REPL and enter some commands:++ $ hledger repl+ Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.+ % stats+ Main file : .../2025.journal+ ...+ % stats -f 2024/2024.journal+ Main file : .../2024.journal+ ...+ % stats+ Main file : .../2025.journal+ ...++ or:++ $ hledger repl -f some.journal+ Enter hledger commands. To exit, enter 'quit' or 'exit', or send EOF.+ % bs+ ...+ % print -b 'last week'+ ...+ % bs -f other.journal+ ...++ run+ Run a sequence of hledger commands, provided as files or command line argu-+ ments. Data files are parsed just once, so the commands run faster.++ Flags:+ no command-specific flags++ This command is experimental and could change in the future.++ You can use run in three ways:++ * hledger run -- CMD1 -- CMD2 -- CMD3 - read commands from the command+ line, separated by --++ * hledger run SCRIPTFILE1 SCRIPTFILE2 - read commands from one or more+ files++ * cat SCRIPTFILE1 | hledger run - read commands from standard input.++ run first loads the input file(s) specified by LEDGER_FILE or by -f op-+ tions, in the usual way. Then it runs each command in turn, each using the+ same input data. But if you want a particular command to use different in-+ put, you can specify an -f option within that command. This will override+ (not add to) the default input, just for that command.++ Each input file (more precisely, each combination of input file and input+ options) is parsed only once. This means that commands will not see any+ changes made to these files, until the next run. But the commands will run+ more quickly than if run individually (typically about twice as fast).++ Command scripts, whether in a file or written on the command line, have a+ simple syntax:++ * each line may contain a single hledger command and its arguments, without+ the usual hledger first word++ * empty lines are ignored++ * text from # to end of line is a comment, and ignored++ * you can use single or double quotes to quote arguments when needed, as on+ the command line++ * these extra commands are available: echo TEXT prints some text, and exit+ or quit ends the run.++ On unix systems you can use #!/usr/bin/env hledger run in the first line of+ a command file to make it a runnable script. If that gives an error, use+ #!/usr/bin/env -S hledger run.++ It's ok to use the run command recursively within a command script.++ You may find some differences in behaviour between run command lines and+ normal hledger command lines. run is a little stricter; eg it requires+ full command names or official abbreviations (as seen in the commands+ list), and command options must be written after the command name.++ Examples+ Run commands from the command line:++ hledger -f some.journal run -- balance assets --depth 2 -- balance liabilities -f /some/other.journal --depth 3 --transpose -- stats++ This would load some.journal, run balance assets --depth 2 on it, then run+ balance liabilities --depth 3 --transpose on /some/other.journal, and fi-+ nally run stats on some.journal++ Run commands from standard input:++ (echo "files"; echo "stats") | hledger -f some.journal run++ Run commands as a script:++ $ cat report+ #!/usr/bin/env -S hledger run -f some.journal++ echo "List of accounts in some.journal"+ accounts++ echo "Assets of some.journal"+ balance assets --depth 2++ echo "Liabilities from /some/other.journal"+ balance liabilities -f /some/other.journal --depth 3 --transpose++ echo "Commands from another.script, applied to another.journal"+ run -f another.journal another.script++ $ chmod +x report+ $ ./report+ List of accounts in some.journal+ ...++ ui+ Runs hledger-ui (if installed).++ web+ Runs hledger-web (if installed).++Data entry commands+ add+ Add new transactions to a journal file, with interactive prompting.++ Flags:+ --no-new-accounts don't allow creating new accounts++ Many hledger users edit their journals directly with a text editor, or gen-+ erate them from CSV. For more interactive data entry, there is the add+ command, which prompts interactively on the console for new transactions,+ and appends them to the main journal file (which should be in journal for-+ mat). Existing transactions are not changed. This is one of the few+ hledger commands that writes to the journal file (see also import).++ To use it, just run hledger add and follow the prompts. You can add as+ many transactions as you like; when you are finished, enter . or press con-+ trol-d or control-c to exit.++ Features:++ * add tries to provide useful defaults, using the most similar (by descrip-+ tion) recent transaction (filtered by the query, if any) as a template.++ * You can also set the initial defaults with command line arguments.++ * Readline-style edit keys can be used during data entry.++ * The tab key will auto-complete whenever possible - accounts, payees/de-+ scriptions, dates (yesterday, today, tomorrow). If the input area is+ empty, it will insert the default value.++ * A parenthesised transaction code may be entered following a date.++ * Comments and tags may be entered following a description or amount.++ * If you make a mistake, enter < at any prompt to go one step backward.++ * Input prompts are displayed in a different colour when the terminal sup-+ ports it.++ Notes:++ * If you enter a number with no commodity symbol, and you have declared a+ default commodity with a D directive, you might expect add to add this+ symbol for you. It does not do this; we assume that if you are using a D+ directive you prefer not to see the commodity symbol repeated on amounts+ in the journal.++ * add creates entries in journal format; it won't work with timeclock or+ timedot files.++ * There is a known issue on Windows if this hledger version is built from+ stackage: the prompts will show ANSI junk instead of colours (#2410).+ You can avoid this by using official hledger release binaries or by+ building it with haskeline >=0.8.4; or by running add with --color=no,+ perhaps configured in your config file.++ Examples:++ * Record new transactions, saving to the default journal file:++ hledger add++ * Add transactions to 2024.journal, but also load 2023.journal for comple-+ tions:++ hledger add --file 2024.journal --file 2023.journal++ * Provide answers for the first four prompts:++ hledger add today 'best buy' expenses:supplies '$20'++ There is a detailed tutorial at https://hledger.org/add.html.++ add and balance assertions+ Since hledger 1.43, you can add a balance assertion by writing AMOUNT =+ BALANCE when asked for an amount. Eg 100 = 500.++ Also, each time you enter a new amount, hledger re-checks all balance as-+ sertions in the journal and rejects the new amount if it would make any of+ them fail. You can run add with -I/--ignore-assertions to disable balance+ assertion checking.++ add and balance assignments+ Since hledger 1.51, you can add a balance assignment by writing = BALANCE+ (or ==, =* etc) when asked for an amount. The missing amount will be cal-+ culated automatically.++ add normally won't let you add a new posting which is dated earlier than an+ existing balance assignment. (Because when add runs, existing balance as-+ signments have already been calculated and converted to amounts and balance+ assertions.) You can allow it by disabling balance assertion checking with+ -I.++ import+ Import new transactions from one or more data files to the main journal.++ Flags:+ --catchup just mark all transactions as already imported+ --dry-run just show the transactions to be imported++ This command detects new transactions in one or more data files specified+ as arguments, and appends them to the main journal.++ You can import from any input file format hledger supports, but CSV/SSV/TSV+ files, downloaded from financial institutions, are the most common import+ source.++ The import destination is the default journal file, or another specified in+ the usual way with $LEDGER_FILE or -f/--file. It should be in journal for-+ mat.++ Examples:++ $ hledger import bank1-checking.csv bank1-savings.csv++ $ hledger import *.csv++ Import dry run+ It's useful to preview the import by running first with --dry-run, to san-+ ity check the range of dates being imported, and to check the effect of+ your conversion rules if converting from CSV. Eg:++ $ hledger import bank.csv --dry-run++ The dry run output is valid journal format, so hledger can re-parse it. If+ the output is large, you could show just the uncategorised transactions+ like so:++ $ hledger import --dry-run bank.csv | hledger -f- -I print unknown++ You could also run this repeatedly to see the effect of edits to your con-+ version rules:++ $ watchexec -- "hledger import --dry-run bank.csv | hledger -f- -I print unknown"++ Once the conversion and dates look good enough to import to your journal,+ perhaps with some manual fixups to follow, you would do the actual import:++ $ hledger import bank.csv++ Overlap detection+ Reading CSV files is built in to hledger, and not specific to import; so+ you could also import by doing hledger -f bank.csv print >>$LEDGER_FILE.++ But import is easier and provides some advantages. The main one is that it+ avoids re-importing transactions it has seen on previous runs. This means+ you don't have to worry about overlapping data in successive downloads of+ your bank CSV; just download and import as often as you like, and only the+ new transactions will be imported each time.++ We don't call this "deduplication", as it's generally not possible to reli-+ ably detect duplicates in bank CSV. Instead, import remembers the latest+ date processed previously in each CSV file (saving it in a hidden file),+ and skips any records prior to that date. This works well for most+ real-world CSV, where:++ 1. the data file name is stable (does not change) across imports++ 2. the item dates are stable across imports++ 3. the order of same-date items is stable across imports++ 4. the newest items have the newest dates++ (Occasional violations of 2-4 are often harmless; you can reduce the chance+ of disruption by downloading and importing more often.)++ Overlap detection is automatic, and shouldn't require much attention from+ you, except perhaps at first import (see below). But here's how it works:++ * For each FILE being imported from:++ 1. hledger reads a file named .latest.FILE file in the same directory, if+ any. This file contains the latest record date previously imported+ from FILE, in YYYY-MM-DD format. If multiple records with that date+ were imported, the date is repeated on N lines.++ 2. hledger reads records from FILE. If a latest date was found in step+ 1, any records before that date, and the first N records on that date,+ are skipped.++ * After a successful import from all FILEs, without error and without+ --dry-run, hledger updates each FILE's .latest.FILE for next time.++ If this goes wrong, it's relatively easy to repair:++ * You'll notice it before import when you preview with import --dry-run.++ * Or after import when you try to reconcile your hledger account balances+ with your bank.++ * hledger print -f FILE.csv will show all recently downloaded transactions.+ Compare these with your journal. Copy/paste if needed.++ * Update your conversion rules and print again, if needed.++ * You can manually update or remove the .latest file, or use import+ --catchup FILE.++ * Download and import more often, eg twice a week, at least while you are+ learning. It's easier to review and troubleshoot when there are fewer+ transactions.++ First import+ The first time you import from a file, when no corresponding .latest file+ has been created yet, all of the records will be imported.++ But perhaps you have been entering the data manually, so you know that all+ of these transactions are already recorded in the journal. In this case+ you can run hledger import --catchup once. This will create a .latest file+ containing the latest CSV record date, so that none of those records will+ be re-imported.++ Or, if you know that some but not all of the transactions are in the jour-+ nal, you can create the .latest file yourself. Eg, let's say you previ-+ ously recorded foobank transactions up to 2024-10-31 in the journal. Then+ in the directory where you'll be saving foobank.csv, you would create a+ .latest.foobank.csv file containing++ 2024-10-31++ Or if you had three foobank transactions recorded with that date, you would+ repeat the date that many times:++ 2024-10-31+ 2024-10-31+ 2024-10-31++ Then hledger import foobank.csv [--dry-run] will import only the newer+ records.++ Importing balance assignments+ Journal entries added by import will have all posting amounts made explicit+ (like print -x).++ This means that any balance assignments in the imported entries would need+ to be evaluated. But this generally isn't possible, as the main file's ac-+ count balances are not visible during import. So try to avoid generating+ balance assignments with your CSV rules, or importing from a journal that+ contains balance assignments. (Balance assignments are best avoided any-+ way.)++ But if you must use them, eg because your CSV includes only balances: you+ can import with print, which leaves implicit amounts implicit. (print can+ also do overlap detection like import, with the --new flag):++ $ hledger print --new -f bank.csv >> $LEDGER_FILE++ (If you think import should preserve implicit balances, please test that+ and send a pull request.)++ Import and commodity styles+ Amounts in entries added by import will be formatted according to the jour-+ nal's canonical commodity styles, as declared by commodity directives or+ inferred from the journal's amounts.++ Related: CSV > Amount decimal places.++ Import archiving+ When importing from a CSV rules file (hledger import bank.rules), you can+ use the archive rule to enable automatic archiving of the data file. After+ a successful import, the data file (specified by source) will be moved to+ an archive folder (data/, next to the rules file, auto-created), and re-+ named similar to the rules file, with a date. This can be useful for trou-+ bleshooting, detecting variations in your banks' CSV data, regenerating en-+ tries with improved rules, etc.++ The archive rule also causes import to handle source glob patterns differ-+ ently: when there are multiple matched files, it will pick the oldest, not+ the newest.++ Import special cases+ Deduplication+ Here are two kinds of "deduplication" which import does not handle (and+ should not, because these can happen legitimately in financial data):++ * Two or more of the new CSV records are identical, and generate identical+ new journal entries.++ * A new CSV record generates a journal entry identical to one(s) already in+ the journal.++ Varying file name+ If you have a download whose file name varies, you could rename it to a+ fixed name after each download. Or you could use a CSV source rule with a+ suitable glob pattern, and import from the .rules file.++ Multiple versions+ Say you download bank.csv, import it, but forget to delete it from your+ downloads folder. The next time you download it, your web browser will+ save it as (eg) bank (2).csv. The source rule's glob patterns are for just+ this situation: instead of specifying source bank.csv, specify source+ bank*.csv. Then hledger -f bank.rules CMD or hledger import bank.rules+ will automatically pick the newest matched file (bank (2).csv).++ Alternately, what if you download, but forget to import or delete, then+ download again ? Now each of bank.csv and bank (2).csv might contain data+ that's not in the other, and not in your journal. In this case, it's best+ to import each of them in turn, oldest first (otherwise, overlap detection+ could cause new records to be skipped). Enabling import archiving ensures+ this. Then hledger import bank.rules; hledger import bank.rules will im-+ port and archive first bank.csv, then bank (2).csv.++Basic report commands+ accounts+ List the account names used or declared in the journal.++ Flags:+ -u --used list accounts used+ -d --declared list accounts declared+ --undeclared list accounts used but not declared+ --unused list accounts declared but not used+ --find list the first account matched by the first+ argument (a case-insensitive infix regexp)+ --directives show as account directives, for use in journals+ --locations also show where accounts were declared+ --types also show account types when known+ -l --flat list/tree mode: show accounts as a flat list+ (default)+ -t --tree list/tree mode: show accounts as a tree+ --drop=N flat mode: omit N leading account name parts++ This command lists account names - all of them by default, or just the ones+ which have been used in transactions (-u/--used), or declared with account+ directives (-d/--declared), or used but not declared (--undeclared), or de-+ clared but not used (--unused), or just the first one matched by a pattern+ (--find, returning a non-zero exit code if it fails).++ You can add query arguments to select a subset of transactions or accounts.++ With --directives, it shows valid account directives which could be pasted+ into a journal file. This is useful together with --undeclared when updat-+ ing your account declarations to satisfy hledger check accounts.++ With --locations, it also shows the file and line number of each account's+ declaration, if any, and the account's overall declaration order; these may+ be useful when troubleshooting account display order.++ With --types, it also shows each account's type, if it's known. (See De-+ claring accounts > Account types.)++ It shows a flat list by default. With --tree, it uses indentation to show+ the account hierarchy. In flat mode you can add --drop N to omit the first+ few account name components. Account names can be depth-clipped with+ depth:N or --depth N or -N.++ Examples:++ $ hledger accounts+ assets:bank:checking+ assets:bank:saving+ assets:cash+ expenses:food+ expenses:supplies+ income:gifts+ income:salary+ liabilities:debts++ $ hledger accounts --undeclared --directives >> $LEDGER_FILE+ $ hledger check accounts++ codes+ List the codes seen in transactions, in the order parsed.++ Flags:+ no command-specific flags++ This command prints the value of each transaction's code field, in the or-+ der transactions were parsed. The transaction code is an optional value+ written in parentheses between the date and description, often used to+ store a cheque number, order number or similar.++ Transactions aren't required to have a code, and missing or empty codes+ will not be shown by default. With the -E/--empty flag, they will be+ printed as blank lines.++ You can add a query to select a subset of transactions.++ Examples:++ 2022/1/1 (123) Supermarket+ Food $5.00+ Checking++ 2022/1/2 (124) Post Office+ Postage $8.32+ Checking++ 2022/1/3 Supermarket+ Food $11.23+ Checking++ 2022/1/4 (126) Post Office+ Postage $3.21+ Checking++ $ hledger codes+ 123+ 124+ 126++ $ hledger codes -E+ 123+ 124++ 126++ commodities+ List the commodity symbols used or declared in the journal.++ Flags:+ --used list commodities used+ --declared list commodities declared+ --undeclared list commodities used but not declared+ --unused list commodities declared but not used+ --find list the first commodity matched by the first+ argument (a case-insensitive infix regexp)++ This command lists commodity symbols/names - all of them by default, or+ just the ones which have been used in transactions or P directives, or de-+ clared with commodity directives, or used but not declared, or declared but+ not used, or just the first one matched by a pattern (with --find, return-+ ing a non-zero exit code if it fails).++ You can add cur: query arguments to further limit the commodities.++ descriptions+ List the unique descriptions used in transactions.++ Flags:+ no command-specific flags++ This command lists the unique descriptions that appear in transactions, in+ alphabetic order. You can add a query to select a subset of transactions.++ Example:++ $ hledger descriptions+ Store Name+ Gas Station | Petrol+ Person A++ files+ List all files included in the journal. With a REGEX argument, only file+ names matching the regular expression (case sensitive) are shown.++ Flags:+ no command-specific flags++ notes+ List the unique notes that appear in transactions.++ Flags:+ no command-specific flags++ This command lists the unique notes that appear in transactions, in alpha-+ betic order. You can add a query to select a subset of transactions. The+ note is the part of the transaction description after a | character (or if+ there is no |, the whole description).++ Example:++ $ hledger notes+ Petrol+ Snacks++ payees+ List the payee/payer names used or declared in the journal.++ Flags:+ --used list payees used+ --declared list payees declared+ --undeclared list payees used but not declared+ --unused list payees declared but not used+ --find list the first payee matched by the first+ argument (a case-insensitive infix regexp)++ This command lists unique payee/payer names - all of them by default, or+ just the ones which have been used in transaction descriptions, or declared+ with payee directives, or used but not declared, or declared but not used,+ or just the first one matched by a pattern (with --find, returning a+ non-zero exit code if it fails).++ The payee/payer name is the part of the transaction description before a |+ character (or if there is no |, the whole description).++ You can add query arguments to select a subset of transactions or payees.++ Example:++ $ hledger payees+ Store Name+ Gas Station+ Person A++ prices+ Print the market prices declared with P directives. With --infer-mar-+ ket-prices, also show any additional prices inferred from costs. With+ --show-reverse, also show additional prices inferred by reversing known+ prices.++ Flags:+ --show-reverse also show the prices inferred by reversing known+ prices++ Price amounts are always displayed with their full precision, except for+ reverse prices which are limited to 8 decimal digits.++ Prices can be filtered by a date:, cur: or amt: query.++ Generally if you run this command with --infer-market-prices --show-re-+ verse, it will show the same prices used internally to calculate value re-+ ports. But if in doubt, you can inspect those directly by running the+ value report with --debug=2.++ stats+ Show journal and performance statistics.++ Flags:+ -1 show a single line of output+ -v --verbose show more detailed output+ -o --output-file=FILE write output to FILE.++ The stats command shows summary information for the whole journal, or a+ matched part of it. With a reporting interval, it shows a report for each+ report period.++ It also shows some performance statistics:++ * how long the program ran for++ * the number of transactions processed per second++ * the peak live memory in use by the program to do its work++ * the peak allocated memory as seen by the program++ By default, the output is reasonably discreet; it reveals the main file+ name, your activity level, and the speed of your machine.++ With -v/--verbose, more details are shown: the full paths of all files, and+ the names of the commodities you work with.++ With -1, only one line of output is shown, in a machine-friendly tab-sepa-+ rated format: the program version, the main journal file name, and the per-+ formance stats,++ The run time of stats is similar to that of a balance report.++ Example:++ $ hledger stats -f examples/1ktxns-1kaccts.journal+ Main file : .../1ktxns-1kaccts.journal+ Included files : 0+ Txns span : 2000-01-01 to 2002-09-27 (1000 days)+ Last txn : 2002-09-26 (7827 days ago)+ Txns : 1000 (1.0 per day)+ Txns last 30 days : 0 (0.0 per day)+ Txns last 7 days : 0 (0.0 per day)+ Payees/descriptions : 1000+ Accounts : 1000 (depth 10)+ Commodities : 26+ Market prices : 1000+ Runtime stats : 0.12 s elapsed, 8266 txns/s, 4 MB live, 16 MB alloc++ $ hledger stats -1 -f examples/10ktxns-1kaccts.journal+ 1.50.99-g0835a2485-20251119, mac-aarch64 10ktxns-1kaccts.journal 0.66 s elapsed 15244 txns/s 28 MB live 86 MB alloc++ This command supports the -o/--output-file option (but not -O/--output-for-+ mat).++ tags+ List the tag names used or declared in the journal, or their values.++ Flags:+ --used list tags used+ --declared list tags declared+ --undeclared list tags used but not declared+ --unused list tags declared but not used+ --find list the first tag whose name is matched by the+ first argument (a case-insensitive infix regexp)+ --values list tag values instead of tag names+ --parsed show them in the order they were parsed (mostly),+ including duplicates++ This command lists tag names - all of them by default, or just the ones+ which have been used on transactions/postings/accounts, or declared with+ tag directives, or used but not declared, or declared but not used, or just+ the first one matched by a pattern (with --find, returning a non-zero exit+ code if it fails).++ Note this command's non-standard first argument: it is a case-insensitive+ infix regular expression for matching tag names, which limits the tags+ shown. Any additional arguments are standard query arguments, which limit+ the transactions, postings, or accounts providing tags.++ With --values, the tags' unique non-empty values are listed instead.++ With -E/--empty, blank/empty values are also shown.++ With --parsed, tags or values are shown in the order they were parsed, with+ duplicates included. (Except, tags from account declarations are always+ shown first.)++ Remember that accounts also acquire tags from their parents; postings also+ acquire tags from their account and transaction; and transactions also ac-+ quire tags from their postings.++Standard report commands+ print+ Show full journal entries, representing transactions.++ Flags:+ -x --explicit show all amounts explicitly+ --invert display all amounts with reversed sign+ --locations add tags showing file paths and line numbers+ -m --match=DESC fuzzy search for one recent transaction with+ description closest to DESC+ --new show only newer-dated transactions added in each+ file since last run+ --round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none - show original decimal digits,+ as in journal (default)+ soft - just add or remove decimal zeros+ to match precision+ hard - round posting amounts to precision+ (can unbalance transactions)+ all - also round cost amounts to precision+ (can unbalance transactions)+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, beancount, csv, tsv, html, fods, json, sql.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ The print command displays full journal entries (transactions) from the+ journal file, sorted by date (or with --date2, by secondary date).++ Directives and inter-transaction comments are not shown, currently. This+ means the print command is somewhat lossy, and if you are using it to re-+ format/regenerate your journal you should take care to also copy over the+ directives and inter-transaction comments.++ Eg:++ $ hledger print -f examples/sample.journal date:200806+ 2008/06/01 gift+ assets:bank:checking $1+ income:gifts $-1++ 2008/06/02 save+ assets:bank:saving $1+ assets:bank:checking $-1++ 2008/06/03 * eat & shop+ expenses:food $1+ expenses:supplies $1+ assets:cash $-2++ print amount explicitness+ Normally, whether posting amounts are implicit or explicit is preserved.+ For example, when an amount is omitted in the journal, it will not appear+ in the output. Similarly, if a conversion cost is implied but not written,+ it will not appear in the output.++ You can use the -x/--explicit flag to force explicit display of all amounts+ and costs. This can be useful for troubleshooting or for making your jour-+ nal more readable and robust against data entry errors. -x is also implied+ by using any of -B,-V,-X,--value.++ The -x/--explicit flag will cause any postings with a multi-commodity+ amount (which can arise when a multi-commodity transaction has an implicit+ amount) to be split into multiple single-commodity postings, keeping the+ output parseable.++ print alignment+ Amounts are shown right-aligned within each transaction (but not aligned+ across all transactions; you can achieve that with ledger-mode in Emacs).++ print amount style+ Amounts will be displayed mostly in their commodity's display style, with+ standardised symbol placement, decimal mark, and digit group marks. This+ does not apply to their decimal digits; print normally shows the same deci-+ mal digits that are recorded in each journal entry.++ You can override the decimal precisions with print's special --round option+ (since 1.32). --round tries to show amounts with their commodities' stan-+ dard decimal precisions, increasingly strongly:++ * --round=none show amounts with original precisions (default)++ * --round=soft add/remove decimal zeros in amounts (except costs)++ * --round=hard round amounts (except costs), possibly hiding significant+ digits++ * --round=all round all amounts and costs++ soft is good for non-lossy cleanup, displaying more consistent decimals+ where possible, without making entries unbalanced.++ hard or all can be good for stronger cleanup, when decimal rounding is+ wanted. Note rounding can produce unbalanced journal entries, perhaps re-+ quiring manual fixup.++ print parseability+ Normally, print's output is a valid hledger journal, which you can "pipe"+ to a second hledger command for further processing. This is sometimes con-+ venient for achieving certain kinds of query (though less needed now that+ queries have become more powerful):++ # Show running total of food expenses paid from cash.+ # -f- reads from stdin. -I/--ignore-assertions is sometimes needed.+ $ hledger print assets:cash | hledger -f- -I reg expenses:food++ But here are some things which can cause print's output to become un-+ parseable:++ * --round (see above) can disrupt transaction balancing.++ * Account aliases or pivoting can disrupt account names, balance asser-+ tions, or balance assignments.++ * Value reporting also can disrupt balance assertions or balance assign-+ ments.++ * Auto postings can generate too many amountless postings.++ * --infer-costs or --infer-equity can generate too-complex redundant costs.++ * Because print always shows transactions in date order, balance assertions+ involving non-date-ordered transactions (and same-day postings) could be+ disrupted.++ print, other features+ With -B/--cost, amounts with costs are shown converted to cost.++ With --invert, posting amounts are shown with their sign flipped. It could+ be useful if you have accidentally recorded some transactions with the+ wrong signs.++ With --new, print shows only transactions it has not seen on a previous+ run. This uses the same deduplication system as the import command. (See+ import's docs for details.)++ With -m DESC/--match=DESC, print shows one recent transaction whose de-+ scription is most similar to DESC. DESC should contain at least two char-+ acters. If there is no similar-enough match, no transaction will be shown+ and the program exit code will be non-zero.++ With --locations, print adds the source file and line number to every+ transaction, as a tag.++ print output format+ This command also supports the output destination and output format options+ The output formats supported are txt, beancount (Added in 1.32), csv, tsv+ (Added in 1.32), json and sql.++ The beancount format tries to produce Beancount-compatible output, as fol-+ lows:++ * Transaction and postings with unmarked status are converted to cleared+ (*) status.++ * Transactions' payee and note are backslash-escaped and double-quote-es-+ caped and wrapped in double quotes.++ * Transaction tags are copied to Beancount #tag format.++ * Commodity symbols are converted to upper case, and a small number of cur-+ rency symbols like $ are converted to the corresponding currency names.++ * Account name parts are capitalised and unsupported characters are re-+ placed with -. If an account name part does not begin with a letter, or+ if the first part is not Assets, Liabilities, Equity, Income, or Ex-+ penses, an error is raised. (Use --alias options to bring your accounts+ into compliance.)++ * An open directive is generated for each account used, on the earliest+ transaction date.++ Some limitations:++ * Balance assertions are removed.++ * Balance assignments become missing amounts.++ * Virtual and balanced virtual postings become regular postings.++ * Directives are not converted.++ Here's an example of print's CSV output:++ $ hledger print -Ocsv+ "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"+ "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""+ "1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""+ "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""+ "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""+ "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""+ "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""+ "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""+ "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""+ "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""+ "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""+ "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""++ * There is one CSV record per posting, with the parent transaction's fields+ repeated.++ * The "txnidx" (transaction index) field shows which postings belong to the+ same transaction. (This number might change if transactions are re-+ ordered within the file, files are parsed/included in a different order,+ etc.)++ * The amount is separated into "commodity" (the symbol) and "amount" (nu-+ meric quantity) fields.++ * The numeric amount is repeated in either the "credit" or "debit" column,+ for convenience. (Those names are not accurate in the accounting sense;+ it just puts negative amounts under credit and zero or greater amounts+ under debit.)++ aregister+ (areg)++ Show the transactions and running balances in one account, with each trans-+ action on one line.++ Flags:+ --txn-dates filter strictly by transaction date, not posting+ date. Warning: this can show a wrong running+ balance.+ --no-elide don't show only 2 commodities per amount+ --cumulative accumulation mode: show running total from report+ start date+ -H --historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date) (default)+ --invert display all amounts with reversed sign+ --drop=N omit N leading account name parts+ --heading=YN show heading row above table: yes (default) or no+ -w --width=N set output width (default: terminal width). -wN,M+ sets description width as well.+ --align-all guarantee alignment across all lines (slower)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ aregister shows the overall transactions affecting a particular account+ (and any subaccounts). Each report line represents one transaction in this+ account. Transactions before the report start date are included in the+ running balance (--historical mode is the default). You can suppress this+ behaviour using the --cumulative option.++ This is a more "real world", bank-like view than the register command+ (which shows individual postings, possibly from multiple accounts, not nec-+ essarily in historical mode). As a quick rule of thumb:++ * aregister is best when reconciling real-world asset/liability accounts++ * register is best when reviewing individual revenues/expenses.++ Note this command's non-standard, and required, first argument; it speci-+ fies the account whose register will be shown. You can write the account's+ name, or (to save typing) a case-insensitive infix regular expression+ matching the name, which selects the alphabetically first matched account.+ (For example, if you have assets:personal checking and assets:business+ checking, hledger areg checking would select assets:business checking.)++ Transactions involving subaccounts of this account will also be shown.+ aregister ignores depth limits, so its final total will always match a his-+ torical balance report with similar arguments.++ Any additional arguments are standard query arguments, which will limit the+ transactions shown. Note some queries will disturb the running balance,+ causing it to be different from the account's real-world running balance.++ An example: this shows the transactions and historical running balance dur-+ ing july, in the first account whose name contains "checking":++ $ hledger areg checking date:jul++ Each aregister line item shows:++ * the transaction's date (or the relevant posting's date if different, see+ below)++ * the names of all the other account(s) involved in this transaction (prob-+ ably abbreviated)++ * the total change to this account's balance from this transaction++ * the account's historical running balance after this transaction.++ Transactions making a net change of zero are not shown by default; add the+ -E/--empty flag to show them.++ For performance reasons, column widths are chosen based on the first 1000+ lines; this means unusually wide values in later lines can cause visual+ discontinuities as column widths are adjusted. If you want to ensure per-+ fect alignment, at the cost of more time and memory, use the --align-all+ flag.++ By default, aregister shows a heading above the data. However, when re-+ porting in a language different from English, it is easier to omit this+ heading and prepend your own one. For this purpose, use the --heading=no+ option.++ This command also supports the output destination and output format op-+ tions. The output formats supported are txt, csv, tsv (Added in 1.32),+ html, fods (Added in 1.41) and json.++ aregister and posting dates+ aregister always shows one line (and date and amount) per transaction. But+ sometimes transactions have postings with different dates. Also, not all+ of a transaction's postings may be within the report period. To resolve+ this, aregister shows the earliest of the transaction's date and posting+ dates that is in-period, and the sum of the in-period postings. In other+ words it will show a combined line item with just the earliest date, and+ the running balance will (temporarily, until the transaction's last post-+ ing) be inaccurate. Use register -H if you need to see the individual+ postings.++ There is also a --txn-dates flag, which filters strictly by transaction+ date, ignoring posting dates. This too can cause an inaccurate running+ balance.++ register+ (reg)++ Show postings and their running total.++ Flags:+ --cumulative accumulation mode: show running total from report+ start date (default)+ -H --historical accumulation mode: show historical running+ total/balance (includes postings before report+ start date)+ -A --average show running average of posting amounts instead+ of total (implies --empty)+ -m --match=DESC fuzzy search for one recent posting with+ description closest to DESC+ -r --related show postings' siblings instead+ --invert display all amounts with reversed sign+ --drop=N omit N leading account name parts+ --sort=FIELDS sort by: date, desc, account, amount, absamount,+ or a comma-separated combination of these. For a+ descending sort, prefix with -. (Default: date)+ -w --width=N set output width (default: terminal width). -wN,M+ sets description width as well.+ --align-all guarantee alignment across all lines (slower)+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, csv, tsv, html, fods, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ The register command displays matched postings, across all accounts, in+ date order, with their running total or running historical balance. (See+ also the aregister command, which shows matched transactions in a specific+ account.)++ register normally shows line per posting, but note that multi-commodity+ amounts will occupy multiple lines (one line per commodity).++ It is typically used with a query selecting a particular account, to see+ that account's activity:++ $ hledger register checking+ 2008/01/01 income assets:bank:checking $1 $1+ 2008/06/01 gift assets:bank:checking $1 $2+ 2008/06/02 save assets:bank:checking $-1 $1+ 2008/12/31 pay off assets:bank:checking $-1 0++ With --date2, it shows and sorts by secondary date instead.++ For performance reasons, column widths are chosen based on the first 1000+ lines; this means unusually wide values in later lines can cause visual+ discontinuities as column widths are adjusted. If you want to ensure per-+ fect alignment, at the cost of more time and memory, use the --align-all+ flag.++ The --historical/-H flag adds the balance from any undisplayed prior post-+ ings to the running total. This is useful when you want to see only recent+ activity, with a historically accurate running balance:++ $ hledger register checking -b 2008/6 --historical+ 2008/06/01 gift assets:bank:checking $1 $2+ 2008/06/02 save assets:bank:checking $-1 $1+ 2008/12/31 pay off assets:bank:checking $-1 0++ The --depth option limits the amount of sub-account detail displayed.++ The --drop option will trim leading segments from account names.++ The --average/-A flag shows the running average posting amount instead of+ the running total (so, the final number displayed is the average for the+ whole report period). This flag implies --empty (see below). It is af-+ fected by --historical. It works best when showing just one account and+ one commodity.++ The --related/-r flag shows the other postings in the transactions of the+ postings which would normally be shown.++ The --invert flag negates all amounts. For example, it can be used on an+ income account where amounts are normally displayed as negative numbers.+ It's also useful to show postings on the checking account together with the+ related account:++ The --sort=FIELDS flag sorts by the fields given, which can be any of ac-+ count, amount, absamount, date, or desc/description, optionally separated+ by commas. For example, --sort account,amount will group all transactions+ in each account, sorted by transaction amount. Each field can be negated+ by a preceding -, so --sort -amount will show transactions ordered from+ smallest amount to largest amount.++ $ hledger register --related --invert assets:checking++ With a reporting interval, register shows summary postings, one per inter-+ val, aggregating the postings to each account:++ $ hledger register --monthly income+ 2008/01 income:salary $-1 $-1+ 2008/06 income:gifts $-1 $-2++ Periods with no activity, and summary postings with a zero amount, are not+ shown by default; use the --empty/-E flag to see them:++ $ hledger register --monthly income -E+ 2008/01 income:salary $-1 $-1+ 2008/02 0 $-1+ 2008/03 0 $-1+ 2008/04 0 $-1+ 2008/05 0 $-1+ 2008/06 income:gifts $-1 $-2+ 2008/07 0 $-2+ 2008/08 0 $-2+ 2008/09 0 $-2+ 2008/10 0 $-2+ 2008/11 0 $-2+ 2008/12 0 $-2++ Often, you'll want to see just one line per interval. The --depth option+ helps with this, causing subaccounts to be aggregated:++ $ hledger register --monthly assets --depth 1+ 2008/01 assets $1 $1+ 2008/06 assets $-1 0+ 2008/12 assets $-1 $-1++ Note when using report intervals, if you specify start/end dates these will+ be adjusted outward if necessary to contain a whole number of intervals.+ This ensures that the first and last intervals are full length and compara-+ ble to the others in the report.++ If you have a deeply nested account tree some reports might benefit from+ trimming leading segments from the account names using --drop.++ $ hledger register --monthly income --drop 1+ 2008/01 salary $-1 $-1+ 2008/06 gifts $-1 $-2++ With -m DESC/--match=DESC, register does a fuzzy search for one recent+ posting whose description is most similar to DESC. DESC should contain at+ least two characters. If there is no similar-enough match, no posting will+ be shown and the program exit code will be non-zero.++ Custom register output+ register normally uses the full terminal width (or 80 columns if it can't+ detect that). You can override this with the --width/-w option.++ The description and account columns normally share the space equally (about+ half of (width - 40) each). You can adjust this by adding a description+ width as part of --width's argument, comma-separated: --width W,D . Here's+ a diagram (won't display correctly in --help):++ <--------------------------------- width (W) ---------------------------------->+ date (10) description (D) account (W-41-D) amount (12) balance (12)+ DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA++ and some examples:++ $ hledger reg # use terminal width (or 80 on windows)+ $ hledger reg -w 100 # use width 100+ $ hledger reg -w 100,40 # set overall width 100, description width 40++ This command also supports the output destination and output format options+ The output formats supported are txt, csv, tsv (Added in 1.32), and json.++ balancesheet+ (bs)++ Show the end balances in asset and liability accounts. Amounts are shown+ with normal positive sign, as in conventional financial statements.++ Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This command displays a balance sheet, showing historical ending balances+ of asset and liability accounts. (To see equity as well, use the bal-+ ancesheetequity command.)++ Accounts declared with the Asset, Cash or Liability type are shown (see ac-+ count types). Or if no such accounts are declared, it shows top-level ac-+ counts named asset or liability (case insensitive, plurals allowed) and+ their subaccounts.++ Example:++ $ hledger balancesheet+ Balance Sheet 2008-12-31++ || 2008-12-31+ ====================++============+ Assets ||+ --------------------++------------+ assets:bank:saving || $1+ assets:cash || $-2+ --------------------++------------+ || $-1+ ====================++============+ Liabilities ||+ --------------------++------------+ liabilities:debts || $-1+ --------------------++------------+ || $-1+ ====================++============+ Net: || 0++ This command is a higher-level variant of the balance command, and supports+ many of that command's features, such as multi-period reports. It is simi-+ lar to hledger balance -H assets liabilities, but with smarter account de-+ tection, and liabilities displayed with their sign flipped.++ This command also supports the output destination and output format options+ The output formats supported are txt, csv, tsv (Added in 1.32), html, and+ json.++ balancesheetequity+ (bse)++ This command displays a balance sheet, showing historical ending balances+ of asset, liability and equity accounts. Amounts are shown with normal+ positive sign, as in conventional financial statements.++ Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date) (default)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This report shows accounts declared with the Asset, Cash, Liability or Eq-+ uity type (see account types). Or if no such accounts are declared, it+ shows top-level accounts named asset, liability or equity (case insensi-+ tive, plurals allowed) and their subaccounts.++ Example:++ $ hledger balancesheetequity+ Balance Sheet With Equity 2008-12-31++ || 2008-12-31+ ====================++============+ Assets ||+ --------------------++------------+ assets:bank:saving || $1+ assets:cash || $-2+ --------------------++------------+ || $-1+ ====================++============+ Liabilities ||+ --------------------++------------+ liabilities:debts || $-1+ --------------------++------------+ || $-1+ ====================++============+ Equity ||+ --------------------++------------+ --------------------++------------+ || 0+ ====================++============+ Net: || 0++ This command is a higher-level variant of the balance command, and supports+ many of that command's features, such as multi-period reports. It is simi-+ lar to hledger balance -H assets liabilities equity, but with smarter ac-+ count detection, and liabilities/equity displayed with their sign flipped.++ This report is the easiest way to see if the accounting equation (A+L+E =+ 0) is satisfied (after you have done a close --retain to merge revenues and+ expenses with equity, and perhaps added --infer-equity to balance your com-+ modity conversions).++ This command also supports the output destination and output format options+ The output formats supported are txt, csv, tsv, html, and json.++ cashflow+ (cf)++ This command displays a (simple) cashflow statement, showing the inflows+ and outflows affecting "cash" (ie, liquid, easily convertible) assets.+ Amounts are shown with normal positive sign, as in conventional financial+ statements.++ Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This report shows accounts declared with the Cash type (see account types).+ Or if no such accounts are declared, it shows accounts++ * under a top-level account named asset (case insensitive, plural allowed)++ * whose name contains some variation of cash, bank, checking or saving.++ More precisely: all accounts matching this case insensitive regular expres-+ sion:++ ^assets?(:.+)?:(cash|bank|che(ck|que?)(ing)?|savings?|currentcash)(:|$)++ and their subaccounts.++ An example cashflow report:++ $ hledger cashflow+ Cashflow Statement 2008++ || 2008+ ====================++======+ Cash flows ||+ --------------------++------+ assets:bank:saving || $1+ assets:cash || $-2+ --------------------++------+ || $-1++ This command is a higher-level variant of the balance command, and supports+ many of that command's features, such as multi-period reports. It is simi-+ lar to hledger balance assets not:fixed not:investment not:receivable, but+ with smarter account detection.++ This command also supports the output destination and output format options+ The output formats supported are txt, csv, tsv (Added in 1.32), html, and+ json.++ incomestatement+ (is)++ Show revenue inflows and expense outflows during the report period.+ Amounts are shown with normal positive sign, as in conventional financial+ statements.++ Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports)+ (default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name+ -% --percent express values in percentage of each column's+ total+ --layout=ARG how to show multi-commodity amounts:+ 'wide[,WIDTH]': all commodities on one line+ 'tall' : each commodity on a new line+ 'bare' : bare numbers, symbols in a column+ --base-url=URLPREFIX in html output, generate hyperlinks to+ hledger-web, with this prefix. (Usually the base+ url shown by hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ This command displays an income statement, showing revenues and expenses+ during one or more periods.++ It shows accounts declared with the Revenue or Expense type (see account+ types). Or if no such accounts are declared, it shows top-level accounts+ named revenue or income or expense (case insensitive, plurals allowed) and+ their subaccounts.++ Example:++ $ hledger incomestatement+ Income Statement 2008++ || 2008+ ===================++======+ Revenues ||+ -------------------++------+ income:gifts || $1+ income:salary || $1+ -------------------++------+ || $2+ ===================++======+ Expenses ||+ -------------------++------+ expenses:food || $1+ expenses:supplies || $1+ -------------------++------+ || $2+ ===================++======+ Net: || 0++ This command is a higher-level variant of the balance command, and supports+ many of that command's features, such as multi-period reports. It is simi-+ lar to hledger balance '(revenues|income)' expenses, but with smarter ac-+ count detection, and revenues/income displayed with their sign flipped.++ This command also supports the output destination and output format options+ The output formats supported are txt, csv, tsv (Added in 1.32), html, and+ json.++Advanced report commands+ balance+ (bal)++ A flexible, general purpose "summing" report that shows accounts with some+ kind of numeric data. This can be balance changes per period, end bal-+ ances, budget performance, unrealised capital gains, etc.++ Flags:+ --sum calculation mode: show sum of posting amounts+ (default)+ --valuechange calculation mode: show total change of value of+ period-end historical balances (caused by deposits,+ withdrawals, market price fluctuations)+ --gain calculation mode: show unrealised capital+ gain/loss (historical balance value minus cost+ basis)+ --budget[=DESCPAT] calculation mode: show sum of posting amounts+ together with budget goals defined by periodic+ transactions. With a DESCPAT argument (must be+ separated by = not space),+ use only periodic transactions with matching+ description+ (case insensitive substring match).+ --count calculation mode: show the count of postings+ --change accumulation mode: accumulate amounts from column+ start to column end (in multicolumn reports,+ default)+ --cumulative accumulation mode: accumulate amounts from report+ start (specified by e.g. -b/--begin) to column end+ -H --historical accumulation mode: accumulate amounts from+ journal start to column end (includes postings+ before report start date)+ -l --flat list/tree mode: show accounts as a flat list+ (default). Amounts exclude subaccount amounts,+ except where the account is depth-clipped.+ -t --tree list/tree mode: show accounts as a tree. Amounts+ include subaccount amounts.+ --drop=N in list mode, omit N leading account name parts+ --declared include non-parent declared accounts (best used+ with -E)+ -A --average show a row average column (in multicolumn+ reports)+ -T --row-total show a row total column (in multicolumn reports)+ --summary-only display only row summaries (e.g. row total,+ average) (in multicolumn reports)+ -N --no-total omit the final total row+ --no-elide in tree mode, don't squash boring parent accounts+ --format=FORMATSTR use this custom line format (in simple reports)+ -S --sort-amount sort by amount instead of account code/name (in+ flat mode). With multiple columns, sorts by the row+ total, or by row average if that is displayed.+ -% --percent express values in percentage of each column's+ total+ -r --related show the other accounts transacted with, instead+ --invert display all amounts with reversed sign+ --transpose switch rows and columns (use vertical time axis)+ --layout=ARG how to lay out multi-commodity amounts and the+ overall table:+ 'wide[,W]': commodities on same line, up to W wide+ 'tall' : commodities on separate lines+ 'bare' : commodity symbols in a separate column+ 'tidy' : each data field in its own column+ --base-url=URLPREFIX in html output, generate links to hledger-web,+ with this prefix. (Usually the base url shown by+ hledger-web; can also be relative.)+ -O --output-format=FMT select the output format. Supported formats:+ txt, html, csv, tsv, json, fods.+ -o --output-file=FILE write output to FILE. A file extension matching+ one of the above formats selects that format.++ balance is one of hledger's oldest and most versatile commands, for listing+ account balances, balance changes, values, value changes and more, during+ one time period or many. Generally it shows a table, with rows represent-+ ing accounts, and columns representing periods.++ Note there are some variants of the balance command with convenient de-+ faults, which are simpler to use: balancesheet, balancesheetequity, cash-+ flow and incomestatement. When you need more control, then use balance.++ balance features+ Here's a quick overview of the balance command's features, followed by more+ detailed descriptions and examples. Many of these work with the other bal-+ ance-like commands as well (bs, cf, is..).++ balance can show..++ * accounts as a list (-l) or a tree (-t)++ * optionally depth-limited (-[1-9])++ * sorted by declaration order and name, or by amount++ ..and their..++ * balance changes (the default)++ * or actual and planned balance changes (--budget)++ * or value of balance changes (-V)++ * or change of balance values (--valuechange)++ * or unrealised capital gain/loss (--gain)++ * or balance changes from sibling postings (--related/-r)++ * or postings count (--count)++ ..in..++ * one time period (the whole journal period by default)++ * or multiple periods (-D, -W, -M, -Q, -Y, -p INTERVAL)++ ..either..++ * per period (the default)++ * or accumulated since report start date (--cumulative)++ * or accumulated since account creation (--historical/-H)++ ..possibly converted to..++ * cost (--value=cost[,COMM]/--cost/-B)++ * or market value, as of transaction dates (--value=then[,COMM])++ * or at period ends (--value=end[,COMM])++ * or now (--value=now)++ * or at some other date (--value=YYYY-MM-DD)++ ..with..++ * totals (-T), averages (-A), percentages (-%), inverted sign (--invert)++ * rows and columns swapped (--transpose)++ * another field used as account name (--pivot)++ * custom-formatted line items (single-period reports only) (--format)++ * commodities displayed on the same line or multiple lines (--layout)++ This command supports the output destination and output format options,+ with output formats txt, csv, tsv (Added in 1.32), json, and (multi-period+ reports only:) html, fods (Added in 1.40). In txt output in a colour-sup-+ porting terminal, negative amounts are shown in red.++ Simple balance report+ With no arguments, balance shows a list of all accounts and their change of+ balance - ie, the sum of posting amounts, both inflows and outflows - dur-+ ing the entire period of the journal. ("Simple" here means just one column+ of numbers, covering a single period. You can also have multi-period re-+ ports, described later.)++ For real-world accounts, these numbers will normally be their end balance+ at the end of the journal period; more on this below.++ Accounts are sorted by declaration order if any, and then alphabetically by+ account name. For instance (using examples/sample.journal):++ $ hledger -f examples/sample.journal bal+ $1 assets:bank:saving+ $-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $-1 income:gifts+ $-1 income:salary+ $1 liabilities:debts+ --------------------+ 0++ 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):++ $ hledger -f examples/sample.journal bal -E+ 0 assets:bank:checking+ $1 assets:bank:saving+ $-2 assets:cash+ $1 expenses:food+ $1 expenses:supplies+ $-1 income:gifts+ $-1 income:salary+ $1 liabilities:debts+ --------------------+ 0++ The total of the amounts displayed is shown as the last line, unless+ -N/--no-total is used.++ Balance report line format+ 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:++ $ hledger -f examples/sample.journal balance --format "%20(account) %12(total)"+ assets $-1+ bank:saving $1+ cash $-2+ expenses $2+ food $1+ supplies $1+ income $-2+ gifts $-1+ salary $-1+ liabilities:debts $1+ ---------------------------------+ 0++ The FMT format string specifies the formatting applied to each account/bal-+ ance pair. It may contain any suitable text, with data fields interpolated+ like so:++ %[MIN][.MAX](FIELDNAME)++ * MIN pads with spaces to at least this width (optional)++ * MAX truncates at this width (optional)++ * FIELDNAME must be enclosed in parentheses, and can be one of:++ * depth_spacer - a number of spaces equal to the account's depth, or if+ MIN is specified, MIN * depth spaces.++ * account - the account's name++ * total - the account's balance/posted total, right justified++ Also, FMT can begin with an optional prefix to control how multi-commodity+ amounts are rendered:++ * %_ - render on multiple lines, bottom-aligned (the default)++ * %^ - render on multiple lines, top-aligned++ * %, - render on one line, comma-separated++ There are some quirks. Eg in one-line mode, %(depth_spacer) has no effect,+ instead %(account) has indentation built in. Experimentation may be+ needed to get pleasing results.++ Some example formats:++ * %(total) - the account's total++ * %-20.20(account) - the account's name, left justified, padded to 20 char-+ acters and clipped at 20 characters++ * %,%-50(account) %25(total) - account name padded to 50 characters, total+ padded to 20 characters, with multiple commodities rendered on one line++ * %20(total) %2(depth_spacer)%-(account) - the default format for the sin-+ gle-column balance report++ Filtered balance report+ You can show fewer accounts, a different time period, totals from cleared+ transactions only, etc. by using query arguments or options to limit the+ postings being matched. Eg:++ $ hledger -f examples/sample.journal bal --cleared assets date:200806+ $-2 assets:cash+ --------------------+ $-2++ List or tree mode+ By default, or with -l/--flat, accounts are shown as a flat list 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:++ $ hledger -f examples/sample.journal balance+ $-1 assets+ $1 bank:saving+ $-2 cash+ $2 expenses+ $1 food+ $1 supplies+ $-2 income+ $-1 gifts+ $-1 salary+ $1 liabilities:debts+ --------------------+ 0++ Notes:++ * "Boring" accounts are combined with their subaccount for more compact+ output, unless --no-elide is used. Boring accounts have no balance of+ their own and just one subaccount (eg assets:bank and liabilities above).++ * All balances shown are "inclusive", ie including the balances from all+ subaccounts. Note this means some repetition in the output, which re-+ quires explanation when sharing reports with non-plaintextaccount-+ ing-users. A tree mode report's final total is the sum of the top-level+ balances shown, not of all the balances shown.++ * Each group of sibling accounts (ie, under a common parent) is sorted sep-+ arately.++ Depth limiting+ With a depth:NUM query, or --depth NUM option, or just -NUM (eg: -3) bal-+ ance reports will show accounts only to the specified depth, hiding the+ deeper subaccounts. This can be useful for getting an overview without too+ much detail.++ Account balances at the depth limit always include the balances from any+ deeper subaccounts (even in list mode). Eg, limiting to depth 1:++ $ hledger -f examples/sample.journal balance -1+ $-1 assets+ $2 expenses+ $-2 income+ $1 liabilities+ --------------------+ 0++ Dropping top-level accounts+ 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:++ $ hledger -f examples/sample.journal bal expenses --drop 1+ $1 food+ $1 supplies+ --------------------+ $2++ Showing declared accounts+ With --declared, accounts which have been declared with an account direc-+ tive will be included in the balance report, even if they have no transac-+ tions. (Since they will have a zero balance, you will also need -E/--empty+ to see them.)++ More precisely, leaf declared accounts (with no subaccounts) will be in-+ cluded, since those are usually the more useful in reports.++ The idea of this is to be able to see a useful "complete" balance report,+ even when you don't have transactions in all of your declared accounts yet.++ Sorting by amount+ With -S/--sort-amount, accounts with the largest (most positive) balances+ are shown first. Eg: hledger bal expenses -MAS shows your biggest averaged+ monthly expenses first. When more than one commodity is present, they will+ be sorted by the alphabetically earliest commodity first, and then by sub-+ sequent commodities (if an amount is missing a commodity, it is treated as+ 0).++ Revenues and liability balances are typically negative, however, so -S+ shows these in reverse order. To work around this, you can add --invert to+ flip the signs. Or you could use one of the higher-level balance reports+ (bs, is..), which flip the sign automatically (eg: hledger is -MAS).++ Percentages+ With -%/--percent, balance reports show each account's value expressed as a+ percentage of the (column) total.++ 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:++ $ hledger bal -% amt:`>0`+ $ hledger bal -% amt:`<0`++ 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:++ $ hledger bal -% cur:\\$+ $ hledger bal -% cur:a++ Multi-period balance report+ With a report interval (set by the -D/--daily, -W/--weekly, -M/--monthly,+ -Q/--quarterly, -Y/--yearly, or -p/--period flag), balance shows a tabular+ report, with columns representing successive time periods (and a title):++ $ hledger -f examples/sample.journal bal --quarterly income expenses -E+ Balance changes in 2008:++ || 2008q1 2008q2 2008q3 2008q4+ ===================++=================================+ expenses:food || 0 $1 0 0+ expenses:supplies || 0 $1 0 0+ income:gifts || 0 $-1 0 0+ income:salary || $-1 0 0 0+ -------------------++---------------------------------+ || $-1 $1 0 0++ Notes:++ * The report's start/end dates will be expanded, if necessary, to fully en-+ compass the displayed subperiods (so that the first and last subperiods+ have the same duration as the others).++ * Leading and trailing periods (columns) containing all zeroes are not+ shown, unless -E/--empty is used.++ * Accounts (rows) containing all zeroes are not shown, unless -E/--empty is+ used.++ * Amounts with many commodities are shown in abbreviated form, unless+ --no-elide is used.++ * Average and/or total columns can be added with the -A/--average and+ -T/--row-total flags.++ * The --transpose flag can be used to exchange rows and columns.++ * The --pivot FIELD option causes a different transaction field to be used+ as "account name". See PIVOTING.++ * The --summary-only flag (--summary also works) hides all but the Total+ and Average columns (those should be enabled with --row-total and+ -A/--average).++ Multi-period reports with many periods can be too wide for easy viewing in+ the terminal. Here are some ways to handle that:++ * Hide the totals row with -N/--no-total++ * Filter to a single currency with cur:++ * Convert to a single currency with -V [--infer-market-price]++ * Use a more compact layout like --layout=bare++ * Maximize the terminal window++ * Reduce the terminal's font size++ * View with a pager like less, eg: hledger bal -D --color=yes | less -RS++ * Output as CSV and use a CSV viewer like visidata (hledger bal -D -O csv |+ vd -f csv), Emacs' csv-mode (M-x csv-mode, C-c C-a), or a spreadsheet+ (hledger bal -D -o a.csv && open a.csv)++ * Output as HTML and view with a browser: hledger bal -D -o a.html && open+ a.html++ Balance change, end balance+ It's important to be clear on the meaning of the numbers shown in balance+ reports. Here is some terminology we use:++ A balance change is the net amount added to, or removed from, an account+ during some period.++ An end balance is the amount accumulated in an account as of some date (and+ some time, but hledger doesn't store that; assume end of day in your time-+ zone). It is the sum of previous balance changes.++ We call it a historical end balance if it includes all balance changes+ since the account was created. For a real world account, this means it+ will match the "historical record", eg the balances reported in your bank+ statements or bank web UI. (If they are correct!)++ In general, balance changes are what you want to see when reviewing rev-+ enues and expenses, and historical end balances are what you want to see+ when reviewing or reconciling asset, liability and equity accounts.++ balance shows balance changes by default. To see accurate historical end+ balances:++ 1. Initialise account starting balances with an "opening balances" transac-+ tion (a transfer from equity to the account), unless the journal covers+ the account's full lifetime.++ 2. Include all of of the account's prior postings in the report, by not+ specifying a report start date, or by using the -H/--historical flag.+ (-H causes report start date to be ignored when summing postings.)++ Balance report modes+ The balance command is quite flexible; here is the full detail on how to+ control what it reports. If the following seems complicated, don't worry -+ this is for advanced reporting, and it does take time and experimentation+ to get familiar with all the report modes.++ There are three important option groups:++ hledger balance [CALCULATIONMODE] [ACCUMULATIONMODE] [VALUATIONMODE] ...++ Calculation mode+ The basic calculation to perform for each table cell. It is one of:++ * --sum : sum the posting amounts (default)++ * --budget : sum the amounts, but also show the budget goal amount (for+ each account/period)++ * --valuechange : show the change in period-end historical balance values+ (caused by deposits, withdrawals, and/or market price fluctuations)++ * --gain : show the unrealised capital gain/loss, (the current valued bal-+ ance minus each amount's original cost)++ * --count : show the count of postings++ Accumulation mode+ How amounts should accumulate across a report's subperiods/columns. An-+ other way to say it: which time period's postings should contribute to each+ cell's calculation. It is one of:++ * --change : calculate with postings from column start to column end, ie+ "just this column". Typically used to see revenues/expenses. (default+ for balance, cashflow, incomestatement)++ * --cumulative : calculate with postings from report start to column end,+ ie "previous columns plus this column". Typically used to show changes+ accumulated since the report's start date. Not often used.++ * --historical/-H : calculate with postings from journal start to column+ end, ie "all postings from before report start date until this column's+ end". Typically used to see historical end balances of assets/liabili-+ ties/equity. (default for balancesheet, balancesheetequity)++ Valuation mode+ Which kind of value or cost conversion should be applied, if any, before+ displaying the report. See Cost reporting and Value reporting for more+ about conversions.++ A valuation (or cost) mode can be selected with the --value option:++ * no conversion : don't convert to cost or value (default)++ * --value=cost[,COMM] : convert amounts to cost (then optionally to some+ other commodity)++ * --value=then[,COMM] : convert amounts to market value on transaction+ dates++ * --value=end[,COMM] : convert amounts to market value on period end+ date(s)+ (default with --valuechange, --gain)++ * --value=now[,COMM] : convert amounts to market value on today's date++ * --value=YYYY-MM-DD[,COMM] : convert amounts to market value on another+ date++ or with the legacy -B/-V/-X options, which are equivalent and easier to+ type:++ * -B/--cost : like --value=cost++ * -V/--market : like --value=end++ * -X COMM/--exchange COMM : like --value=end,COMM++ Note that --value can also convert to cost, as a convenience; but actually+ --cost and --value are independent options, and could be used together.++ Combining balance report modes+ Most combinations of these modes should produce reasonable reports, but if+ you find any that seem wrong or misleading, let us know. The following re-+ strictions are applied:++ * --valuechange implies --value=end++ * --valuechange makes --change the default when used with the bal-+ ancesheet/balancesheetequity commands++ * --cumulative or --historical disables --row-total/-T++ For reference, here is what the combinations of accumulation and valuation+ show:++ Valua- no valuation --value= then --value= end --value=+ tion:> YYYY-MM-DD+ Accumu- /now+ lation:v+ -----------------------------------------------------------------------------------+ --change change in period sum of post- period-end DATE-value of+ ing-date market value of change change in pe-+ values in period in period riod+ --cumu- change from re- sum of post- period-end DATE-value of+ lative port start to ing-date market value of change change from+ period end values from re- from report report start+ port start to pe- start to period to period end+ riod end end+ --his- change from sum of post- period-end DATE-value of+ torical journal start to ing-date market value of change change from+ /-H period end (his- values from jour- from journal journal start+ torical end bal- nal start to pe- start to period to period end+ ance) riod end end++ Budget report+ The --budget report is like a regular balance report, but with two main+ differences:++ * Budget goals and performance percentages are also shown, in brackets++ * Accounts which don't have budget goals are hidden by default.++ This is useful for comparing planned and actual income, expenses, time us-+ age, etc.++ Periodic transaction rules are used to define budget goals. For example,+ here's a periodic rule defining monthly goals for bus travel and food ex-+ penses:++ ;; Budget+ ~ monthly+ (expenses:bus) $30+ (expenses:food) $400++ After recording some actual expenses,++ ;; Two months worth of expenses+ 2017-11-01+ income $-1950+ expenses:bus $35+ expenses:food:groceries $310+ expenses:food:dining $42+ expenses:movies $38+ assets:bank:checking++ 2017-12-01+ income $-2100+ expenses:bus $53+ expenses:food:groceries $380+ expenses:food:dining $32+ expenses:gifts $100+ assets:bank:checking++ we can see a budget report like this:++ $ hledger bal -M --budget+ Budget performance in 2017-11-01..2017-12-31:++ || Nov Dec+ ===============++============================================+ <unbudgeted> || $-425 $-565+ expenses || $425 [ 99% of $430] $565 [131% of $430]+ expenses:bus || $35 [117% of $30] $53 [177% of $30]+ expenses:food || $352 [ 88% of $400] $412 [103% of $400]+ ---------------++--------------------------------------------+ || 0 [ 0% of $430] 0 [ 0% of $430]++ This is "goal-based budgeting"; you define goals for accounts and periods,+ often recurring, and hledger shows performance relative to the goals. This+ contrasts with "envelope budgeting", which is more detailed and strict -+ useful when cash is tight, but also quite a bit more work. https://plain-+ textaccounting.org/Budgeting has more on this topic.++ Using the budget report+ Historically this report has been confusing and fragile. hledger's version+ should be relatively robust and intuitive, but you may still find sur-+ prises. Here are more notes to help with learning and troubleshooting.++ * In the above example, expenses:bus and expenses:food are shown because+ they have budget goals during the report period.++ * Their parent expenses is also shown, with budget goals aggregated from+ the children.++ * The subaccounts expenses:food:groceries and expenses:food:dining are not+ shown since they have no budget goal of their own, but they contribute to+ expenses:food's actual amount.++ * Unbudgeted accounts expenses:movies and expenses:gifts are also not+ shown, but they contribute to expenses's actual amount.++ * The other unbudgeted accounts income and assets:bank:checking are grouped+ as <unbudgeted>.++ * --depth or depth: can be used to limit report depth in the usual way (but+ will not reveal unbudgeted subaccounts).++ * Amounts are always inclusive of subaccounts (even in -l/--list mode).++ * Numbers displayed in a --budget report will not always agree with the to-+ tals, because of hidden unbudgeted accounts; this is normal. -E/--empty+ can be used to reveal the hidden accounts.++ * In the periodic rules used for setting budget goals, unbalanced postings+ are convenient.++ * You can filter budget reports with the usual queries, eg to focus on par-+ ticular accounts. It's common to restrict them to just expenses. (The+ <unbudgeted> account is occasionally hard to exclude; this is because of+ date surprises, discussed below.)++ * When you have multiple currencies, you may want to convert them to one+ (-X COMM --infer-market-prices) and/or show just one at a time+ (cur:COMM). If you do need to show multiple currencies at once, --layout+ bare can be helpful.++ * You can "roll over" amounts (actual and budgeted) to the next period with+ --cumulative.++ See also: https://hledger.org/budgeting.html.++ Budget date surprises+ With small data, or when starting out, some of the generated budget goal+ transaction dates might fall outside the report periods. Eg with the fol-+ lowing journal and report, the first period appears to have no ex-+ penses:food budget. (Also the <unbudgeted> account should be excluded by+ the expenses query, but isn't.):++ ~ monthly in 2020+ (expenses:food) $500++ 2020-01-15+ expenses:food $400+ assets:checking++ $ hledger bal --budget expenses+ Budget performance in 2020-01-15:++ || 2020-01-15+ ===============++====================+ <unbudgeted> || $400+ expenses:food || 0 [ 0% of $500]+ ---------------++--------------------+ || $400 [80% of $500]++ In this case, the budget goal transactions are generated on first days of+ of month (this can be seen with hledger print --forecast tag:generated ex-+ penses). Whereas the report period defaults to just the 15th day of janu-+ ary (this can be seen from the report table's column headings).++ To fix this kind of thing, be more explicit about the report period (and/or+ the periodic rules' dates). In this case, adding -b 2020 does the trick.++ Selecting budget goals+ By default, the budget report uses all available periodic transaction rules+ to generate goals. This includes rules with a different report interval+ from your report. Eg if you have daily, weekly and monthly periodic rules,+ all of these will contribute to the goals in a monthly budget report.++ You can select a subset of periodic rules by providing an argument to the+ --budget flag. --budget=DESCPAT will match all periodic rules whose de-+ scription contains DESCPAT, a case-insensitive substring (not a regular ex-+ pression or query). This means you can give your periodic rules descrip-+ tions (remember that two spaces are needed between period expression and+ description), and then select from multiple budgets defined in your jour-+ nal.++ Budgeting vs forecasting+ --forecast and --budget both use the periodic transaction rules in the+ journal to generate temporary transactions for reporting purposes. However+ they are separate features - though you can use both at the same time if+ you want. Here are some differences between them:++ --forecast --budget+ --------------------------------------------------------------------------+ is a general option; it enables fore- is a balance command option; it+ casting with all reports selects the balance report's+ budget mode+ generates visible transactions which generates invisible transactions+ appear in reports which produce goal amounts+ generates forecast transactions from generates budget goal transac-+ after the last regular transaction, to tions throughout the report pe-+ the end of the report period; or with riod, optionally restricted by+ an argument --forecast=PERIODEXPR gen- periods specified in the peri-+ erates them throughout the specified odic transaction rules+ period, both optionally restricted by+ periods specified in the periodic+ transaction rules+ uses all periodic rules uses all periodic rules; or with+ an argument --budget=DESCPAT+ uses just the rules matched by+ DESCPAT++ Balance report layout+ The --layout option affects how balance and the other balance-like commands+ show multi-commodity amounts and commodity symbols. It can improve read-+ ability, for humans and/or machines (other software). It has four possible+ values:++ * --layout=wide[,WIDTH]: commodities are shown on a single line, optionally+ elided to WIDTH++ * --layout=tall: each commodity is shown on a separate line++ * --layout=bare: commodity symbols are in their own column, amounts are+ bare numbers++ * --layout=tidy: data is normalised to easily-consumed "tidy" form, with+ one row per data value. (This one is currently supported only by the+ balance command.)++ Here are the --layout modes supported by each output format Only CSV output+ supports all of them:++ - txt csv html json sql+ -------------------------------------+ wide Y Y Y+ tall Y Y Y+ bare Y Y Y+ tidy Y++ Examples:++ Wide layout+ With many commodities, reports can be very wide:++ $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide+ Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total+ ==================++====================================================================================================================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT+ ------------------++--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ || 10.00 ITOT, 337.18 USD, 12.00 VEA, 106.00 VHT 70.00 GLD, 18.00 ITOT, -98.12 USD, 10.00 VEA, 18.00 VHT -11.00 ITOT, 4881.44 USD, 14.00 VEA, 170.00 VHT 70.00 GLD, 17.00 ITOT, 5120.50 USD, 36.00 VEA, 294.00 VHT++ A width limit reduces the width, but some commodities will be hidden:++ $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=wide,32+ Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total+ ==================++===========================================================================================================================+ Assets:US:ETrade || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more..+ ------------------++---------------------------------------------------------------------------------------------------------------------------+ || 10.00 ITOT, 337.18 USD, 2 more.. 70.00 GLD, 18.00 ITOT, 3 more.. -11.00 ITOT, 3 more.. 70.00 GLD, 17.00 ITOT, 3 more..++ Tall layout+ Each commodity gets a new line (may be different in each column), and ac-+ count names are repeated:++ $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=tall+ Balance changes in 2012-01-01..2014-12-31:++ || 2012 2013 2014 Total+ ==================++==================================================+ Assets:US:ETrade || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD+ Assets:US:ETrade || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT+ Assets:US:ETrade || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD+ Assets:US:ETrade || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA+ Assets:US:ETrade || 18.00 VHT 294.00 VHT+ ------------------++--------------------------------------------------+ || 10.00 ITOT 70.00 GLD -11.00 ITOT 70.00 GLD+ || 337.18 USD 18.00 ITOT 4881.44 USD 17.00 ITOT+ || 12.00 VEA -98.12 USD 14.00 VEA 5120.50 USD+ || 106.00 VHT 10.00 VEA 170.00 VHT 36.00 VEA+ || 18.00 VHT 294.00 VHT++ Bare layout+ Commodity symbols are kept in one column, each commodity has its own row,+ amounts are bare numbers, account names are repeated:++ $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -T -Y --layout=bare+ Balance changes in 2012-01-01..2014-12-31:++ || Commodity 2012 2013 2014 Total+ ==================++=============================================+ Assets:US:ETrade || GLD 0 70.00 0 70.00+ Assets:US:ETrade || ITOT 10.00 18.00 -11.00 17.00+ Assets:US:ETrade || USD 337.18 -98.12 4881.44 5120.50+ Assets:US:ETrade || VEA 12.00 10.00 14.00 36.00+ Assets:US:ETrade || VHT 106.00 18.00 170.00 294.00+ ------------------++---------------------------------------------+ || GLD 0 70.00 0 70.00+ || ITOT 10.00 18.00 -11.00 17.00+ || USD 337.18 -98.12 4881.44 5120.50+ || VEA 12.00 10.00 14.00 36.00+ || VHT 106.00 18.00 170.00 294.00++ Bare layout also affects CSV output, which is useful for producing data+ that is easier to consume, eg for making charts:++ $ hledger -f examples/bcexample.hledger bal assets:us:etrade -3 -O csv --layout=bare+ "account","commodity","balance"+ "Assets:US:ETrade","GLD","70.00"+ "Assets:US:ETrade","ITOT","17.00"+ "Assets:US:ETrade","USD","5120.50"+ "Assets:US:ETrade","VEA","36.00"+ "Assets:US:ETrade","VHT","294.00"+ "Total:","GLD","70.00"+ "Total:","ITOT","17.00"+ "Total:","USD","5120.50"+ "Total:","VEA","36.00"+ "Total:","VHT","294.00"++ Bare layout will sometimes display an extra row for the no-symbol commod-+ ity, because of zero amounts (hledger treats zeroes as commodity-less, usu-+ ally). This can break hledger-bar confusingly (workaround: add a cur:+ query to exclude the no-symbol row).++ Tidy layout+ This produces normalised "tidy data" (see+ https://cran.r-project.org/web/packages/tidyr/vignettes/tidy-data.html)+ where every variable has its own column and each row represents a single+ data point. This is the easiest kind of data for other software to con-+ sume:++ $ 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"+ "Assets:US:ETrade","2012","2012-01-01","2012-12-31","ITOT","10.00"+ "Assets:US:ETrade","2012","2012-01-01","2012-12-31","USD","337.18"+ "Assets:US:ETrade","2012","2012-01-01","2012-12-31","VEA","12.00"+ "Assets:US:ETrade","2012","2012-01-01","2012-12-31","VHT","106.00"+ "Assets:US:ETrade","2013","2013-01-01","2013-12-31","GLD","70.00"+ "Assets:US:ETrade","2013","2013-01-01","2013-12-31","ITOT","18.00"+ "Assets:US:ETrade","2013","2013-01-01","2013-12-31","USD","-98.12"+ "Assets:US:ETrade","2013","2013-01-01","2013-12-31","VEA","10.00"+ "Assets:US:ETrade","2013","2013-01-01","2013-12-31","VHT","18.00"+ "Assets:US:ETrade","2014","2014-01-01","2014-12-31","GLD","0"+ "Assets:US:ETrade","2014","2014-01-01","2014-12-31","ITOT","-11.00"+ "Assets:US:ETrade","2014","2014-01-01","2014-12-31","USD","4881.44"+ "Assets:US:ETrade","2014","2014-01-01","2014-12-31","VEA","14.00"+ "Assets:US:ETrade","2014","2014-01-01","2014-12-31","VHT","170.00"++ Balance report output+ As noted in Output format, if you choose HTML output (by using -O html or+ -o somefile.html), you can create a hledger.css file in the same directory+ to customise the report's appearance.++ The HTML and FODS output formats can generate hyperlinks to a hledger-web+ register view for each account and period. E.g. if your hledger-web+ server is reachable at http://localhost:5000 then you might run the balance+ command with the extra option --base-url=http://localhost:5000. You can+ also produce relative links, like --base-url="some/path" or --base-url="".)++ Some useful balance reports+ Some frequently used balance options/reports are:++ * bal -M revenues expenses+ Show revenues/expenses in each month. Also available as the incomestate-+ ment command.++ * bal -M -H assets liabilities+ Show historical asset/liability balances at each month end. Also available+ as the balancesheet command.++ * bal -M -H assets liabilities equity+ Show historical asset/liability/equity balances at each month end. Also+ available as the balancesheetequity command.++ * bal -M assets not:receivable+ Show changes to liquid assets in each month. Also available as the cash-+ flow command.++ Also:++ * bal -M expenses -2 -SA+ Show monthly expenses summarised to depth 2 and sorted by average amount.++ * bal -M --budget expenses+ Show monthly expenses and budget goals.++ * bal -M --valuechange investments+ Show monthly change in market value of investment assets.++ * bal investments --valuechange -D date:lastweek amt:'>1000' -STA [--in-+ vert]+ Show top gainers [or losers] last week++ roi+ Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on+ your investments.++ Flags:+ --cashflow show all amounts that were used to compute+ returns+ --investment=QUERY query to select your investment transactions+ --profit-loss=QUERY --pnl query to select profit-and-loss or+ appreciation/valuation transactions++ At a minimum, you need to supply a query (which could be just an account+ name) to select your investment(s) with --inv, and another query to iden-+ tify your profit and loss transactions with --pnl.++ If you do not record changes in the value of your investment manually, or+ do not require computation of time-weighted return (TWR), --pnl could be an+ empty query (--pnl "" or --pnl STR where STR does not match any of your ac-+ counts).++ This command will compute and display the internalized rate of return (IRR,+ also known as money-weighted rate of return) and time-weighted rate of re-+ turn (TWR) for your investments for the time period requested. IRR is al-+ ways annualized due to the way it is computed, but TWR is reported both as+ a rate over the chosen reporting period and as an annual rate.++ Price directives will be taken into account if you supply appropriate+ --cost or --value flags (see VALUATION).++ Note, in some cases this report can fail, for these reasons:++ * Error (NotBracketed): No solution for Internal Rate of Return (IRR).+ Possible causes: IRR is huge (>1000000%), balance of investment becomes+ negative at some point in time.++ * Error (SearchFailed): Failed to find solution for Internal Rate of Return+ (IRR). Either search does not converge to a solution, or converges too+ slowly.++ Examples:++ * Using roi to compute total return of investment in stocks:+ https://github.com/simonmichael/hledger/blob/master/examples/invest-+ ing/roi-unrealised.ledger++ * Cookbook > Return on Investment: https://hledger.org/roi.html++ Spaces and special characters in --inv and --pnl+ Note that --inv and --pnl's argument is a query, and queries could have+ several space-separated terms (see QUERIES).++ To indicate that all search terms form single command-line argument, you+ will need to put them in quotes (see Special characters):++ $ hledger roi --inv 'term1 term2 term3 ...'++ If any query terms contain spaces themselves, you will need an extra level+ of nested quoting, eg:++ $ hledger roi --inv="'Assets:Test 1'" --pnl="'Equity:Unrealized Profit and Loss'"++ Semantics of --inv and --pnl+ Query supplied to --inv has to match all transactions that are related to+ your investment. Transactions not matching --inv will be ignored.++ In these transactions, ROI will conside postings that match --inv to be+ "investment postings" and other postings (not matching --inv) will be+ sorted into two categories: "cash flow" and "profit and loss", as ROI needs+ to know which part of the investment value is your contributions and which+ is due to the return on investment.++ * "Cash flow" is depositing or withdrawing money, buying or selling assets,+ or otherwise converting between your investment commodity and any other+ commodity. Example:++ 2019-01-01 Investing in Snake Oil+ assets:cash -$100+ investment:snake oil++ 2020-01-01 Selling my Snake Oil+ assets:cash $10+ investment:snake oil = 0++ * "Profit and loss" is change in the value of your investment:++ 2019-06-01 Snake Oil falls in value+ investment:snake oil = $57+ equity:unrealized profit or loss++ All non-investment postings are assumed to be "cash flow", unless they+ match --pnl query. Changes in value of your investment due to "profit and+ loss" postings will be considered as part of your investment return.++ Example: if you use --inv snake --pnl equity:unrealized, then postings in+ the example below would be classifed as:++ 2019-01-01 Snake Oil #1+ assets:cash -$100 ; cash flow posting+ investment:snake oil ; investment posting++ 2019-03-01 Snake Oil #2+ equity:unrealized pnl -$100 ; profit and loss posting+ snake oil ; investment posting++ 2019-07-01 Snake Oil #3+ equity:unrealized pnl ; profit and loss posting+ cash -$100 ; cash flow posting+ snake oil $50 ; investment posting++ IRR and TWR explained+ "ROI" stands for "return on investment". Traditionally this was computed+ as a difference between current value of investment and its initial value,+ expressed in percentage of the initial value.++ However, this approach is only practical in simple cases, where investments+ receives no in-flows or out-flows of money, and where rate of growth is+ fixed over time. For more complex scenarios you need different ways to+ compute rate of return, and this command implements two of them: IRR and+ TWR.++ Internal rate of return, or "IRR" (also called "money-weighted rate of re-+ turn") takes into account effects of in-flows and out-flows, and the time+ between them. Investment at a particular fixed interest rate is going to+ give you more interest than the same amount invested at the same interest+ rate, but made later in time. If you are withdrawing from your investment,+ your future gains would be smaller (in absolute numbers), and will be a+ smaller percentage of your initial investment, so your IRR will be smaller.+ And if you are adding to your investment, you will receive bigger absolute+ gains, which will be a bigger percentage of your initial investment, so+ your IRR will be larger.++ As mentioned before, in-flows and out-flows would be any cash that you per-+ sonally put in or withdraw, and for the "roi" command, these are the post-+ ings that match the query in the--inv argument and NOT match the query in+ the--pnl argument.++ If you manually record changes in the value of your investment as transac-+ tions that balance them against "profit and loss" (or "unrealized gains")+ account or use price directives, then in order for IRR to compute the pre-+ cise effect of your in-flows and out-flows on the rate of return, you will+ need to record the value of your investement on or close to the days when+ in- or out-flows occur.++ In technical terms, IRR uses the same approach as computation of net+ present value, and tries to find a discount rate that makes net present+ value of all the cash flows of your investment to add up to zero. This+ could be hard to wrap your head around, especially if you haven't done dis-+ counted cash flow analysis before. Implementation of IRR in hledger should+ produce results that match the =XIRR formula in Excel.++ Second way to compute rate of return that roi command implements is called+ "time-weighted rate of return" or "TWR". Like IRR, it will account for the+ effect of your in-flows and out-flows, but unlike IRR it will try to com-+ pute the true rate of return of the underlying asset, compensating for the+ effect that deposits and withdrawas have on the apparent rate of growth of+ your investment.++ TWR represents your investment as an imaginary "unit fund" where in-flows/+ out-flows lead to buying or selling "units" of your investment and changes+ in its value change the value of "investment unit". Change in "unit price"+ over the reporting period gives you rate of return of your investment, and+ make TWR less sensitive than IRR to the effects of cash in-flows and+ out-flows.++ References:++ * Explanation of rate of return++ * Explanation of IRR++ * Explanation of TWR++ * IRR vs TWR++ * Examples of computing IRR and TWR and discussion of the limitations of+ both metrics++Chart commands+ activity+ Show an ascii barchart of posting counts per interval.++ Flags:+ no command-specific flags++ The activity command displays an ascii histogram showing transaction counts+ by day, week, month or other reporting interval (by day is the default).+ With query arguments, it counts only matched transactions.++ Examples:++ $ hledger activity --quarterly+ 2008-01-01 **+ 2008-04-01 *******+ 2008-07-01+ 2008-10-01 **++Data generation commands+ close+ (equity)++ close prints several kinds of "closing" and/or "opening" transactions, use-+ ful in various situations: migrating balances to a new journal file, re-+ taining earnings into equity, consolidating balances, viewing lot costs..+ Like print, it prints valid journal entries. You can copy these into your+ journal file(s) when you are happy with how they look.++ Flags:+ --clopen[=TAGVAL] show closing and opening balances transactions,+ for AL accounts by default+ --close[=TAGVAL] show just a closing balances transaction+ --open[=TAGVAL] show just an opening balances transaction+ --assert[=TAGVAL] show a balance assertions transaction+ --assign[=TAGVAL] show a balance assignments transaction+ --retain[=TAGVAL] show a retain earnings transaction, for RX+ accounts by default+ -x --explicit show all amounts explicitly+ --show-costs show amounts with different costs separately+ --interleaved show source and destination postings together+ --assertion-type=TYPE =, ==, =* or ==*+ --close-desc=DESC set closing transaction's description+ --close-acct=ACCT set closing transaction's destination account+ --open-desc=DESC set opening transaction's description+ --open-acct=ACCT set opening transaction's source account+ --round=TYPE how much rounding or padding should be done when+ displaying amounts ?+ none - show original decimal digits,+ as in journal (default)+ soft - just add or remove decimal zeros+ to match precision+ hard - round posting amounts to precision+ (can unbalance transactions)+ all - also round cost amounts to precision+ (can unbalance transactions)++ close has six modes, selected by choosing one of the mode flags: --clopen,+ --close (default), --open, --assert, --assign, or --retain. They are all+ doing the same kind of operation, but with different defaults for different+ situations.++ The journal entries generated by close will have a clopen: tag, which is+ helpful when you want to exclude them from reports. If the main journal+ file name contains a number, the tag's value will be that base file name+ with the number incremented. Eg if the journal file is 2025.journal, the+ tag will be clopen:2026. Or you can set the tag value by providing an ar-+ gument to the mode flag. Eg --close=foo or --clopen=2025-main.++ close --clopen+ This is useful if migrating balances to a new journal file at the start of+ a new year. It prints a "closing balances" transaction that zeroes out ac-+ count balances (Asset and Liability accounts, by default), and an opposite+ "opening balances" transaction that restores them again. Typically, you+ would run++ hledger close --clopen -e NEWYEAR >> $LEDGER_FILE++ and then move the opening transaction from the old file to the new file+ (and probably also update your LEDGER_FILE environment variable).++ Why might you do this ? If your reports are fast, you may not need it.+ But at some point you will probably want to partition your data by time,+ for performance or data integrity or regulatory reasons. A new file or set+ of files per year is common. Then, having each file/fileset "bookended"+ with opening and closing balance transactions will allow you to freely pick+ and choose which files to read - just the current year, any past year, any+ sequence of years, or all of them - while showing correct account balances+ in each case. The earliest opening balances transaction sets correct+ starting balances, and any later closing/opening pairs will harmlessly can-+ cel each other out.++ The balances will be transferred to and from equity:opening/closing bal-+ ances by default. You can override this by using --close-acct and/or+ --open-acct.++ You can select a different set of accounts to close/open by providing an+ account query. Eg to add Equity accounts, provide arguments like assets+ liabilities equity or type:ALE. When migrating to a new file, you'll usu-+ ally want to bring along the AL or ALE accounts, but not the RX accounts+ (Revenue, Expense).++ Assertions will be added indicating and checking the new balances of the+ closed/opened accounts.++ close --close+ This prints just the closing balances transaction of --clopen. It is the+ default if you don't specify a mode.++ More customisation options are described below. Among other things, you+ can use close --close to generate a transaction moving the balances from+ any set of accounts, to a different account. (If you need to move just a+ portion of the balance, see hledger-move.)++ close --open+ This prints just the opening balances transaction of --clopen. (It is sim-+ ilar to Ledger's equity command.)++ close --assert+ This prints a transaction that asserts the account balances as they are on+ the end date (and adds an assert: tag). It could be useful as documention+ and to guard against changes.++ close --assign+ This prints a transaction that assigns the account balances as they are on+ the end date (and adds an "assign:" tag). Unlike balance assertions, as-+ signments will post changes to balances as needed to reach the specified+ amounts.++ This is another way to set starting balances when migrating to a new file,+ and it will set them correctly even in the presence of earlier files which+ do not have a closing balances transaction. However, it can hide errors,+ and disturb the accounting equation, so --clopen is usually recommended.++ close --retain+ This is like --close, but it closes Revenue and Expense account balances by+ default. They will be transferred to equity:retained earnings, or another+ account specified with --close-acct.++ Revenues and expenses correspond to changes in equity. They are cate-+ gorised separately for reporting purposes, but traditionally at the end of+ each accounting period, businesses consolidate them into equity, This is+ called "retaining earnings", or "closing the books".++ In personal accounting, there's not much reason to do this, and most people+ don't. (One reason to do it is to help the balancesheetequity report show+ a zero total, demonstrating that the accounting equation (A-L=E) is satis-+ fied.)++ close customisation+ In all modes, the following things can be overridden:++ * the accounts to be closed/opened, with account query arguments++ * the closing/opening dates, with -e OPENDATE++ * the balancing account, with --close-acct=ACCT and/or --open-acct=ACCT++ * the transaction descriptions, with --close-desc=DESC and --open-desc=DESC++ * the transactions' clopen tag value, with a TAGVAL argument for the mode+ flag (see above).++ By default, the closing date is yesterday, or the journal's end date,+ whichever is later; and the opening date is always one day after the clos-+ ing date. You can change these by specifying a report end date; the clos-+ ing date will be the last day of the report period. Eg -e 2024 means+ "close on 2023-12-31, open on 2024-01-01".++ With --x/--explicit, the balancing amount will be shown explicitly, and if+ it involves multiple commodities, a separate posting will be generated for+ each of them (similar to print -x).++ With --interleaved, each individual transfer is shown with source and des-+ tination postings next to each other (perhaps useful for troubleshooting).++ With --show-costs, balances' costs are also shown, with different costs+ kept separate. This may generate very large journal entries, if you have+ many currency conversions or investment transactions. close --show-costs+ is currently the best way to view investment lots with hledger. (To move+ or dispose of lots, see the more capable hledger-move script.)++ close and balance assertions+ close adds balance assertions verifying that the accounts have been reset+ to zero in a closing transaction or restored to their previous balances in+ an opening transaction. These provide useful error checking, but you can+ ignore them temporarily with -I, or remove them if you prefer.++ Single-commodity, subaccount-exclusive balance assertions (=) are generated+ by default. This can be changed with --assertion-type='==*' (eg).++ When running close you should probably avoid using -C, -R, status: (filter-+ ing by status or realness) or --auto (generating postings), since the gen-+ erated balance assertions would then require these.++ Transactions with multiple dates (eg posting dates) spanning the file+ boundary also can disrupt the balance assertions:++ 2023-12-30 a purchase made in december, cleared in january+ expenses:food 5+ assets:bank:checking -5 ; date: 2023-01-02++ To solve this you can transfer the money to and from a temporary account,+ splitting the multi-day transaction into two single-day transactions:++ ; in 2022.journal:+ 2022-12-30 a purchase made in december, cleared in january+ expenses:food 5+ equity:pending -5++ ; in 2023.journal:+ 2023-01-02 last year's transaction cleared+ equity:pending 5 = 0+ assets:bank:checking -5++ close examples+ Retain earnings+ Record 2022's revenues/expenses as retained earnings on 2022-12-31, append-+ ing the generated transaction to the journal:++ $ hledger close --retain -f 2022.journal -p 2022 >> 2022.journal++ After this, to see 2022's revenues and expenses you must exclude the retain+ earnings transaction:++ $ hledger -f 2022.journal is not:desc:'retain earnings'++ Migrate balances to a new file+ Close assets/liabilities on 2022-12-31 and re-open them on 2023-01-01:++ $ hledger close --clopen -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++ After this, to see 2022's end-of-year balances you must exclude the closing+ balances transaction:++ $ hledger -f 2022.journal bs not:desc:'closing balances'++ For more flexibility, it helps to tag closing and opening transactions with+ eg clopen:NEWYEAR, then you can ensure correct balances by excluding all+ opening/closing transactions except the first, like so:++ $ hledger bs -Y -f 2021.j -f 2022.j -f 2023.j expr:'tag:clopen=2021 or not tag:clopen'+ $ hledger bs -Y -f 2021.j -f 2022.j expr:'tag:clopen=2021 or not tag:clopen'+ $ hledger bs -Y -f 2022.j -f 2023.j expr:'tag:clopen=2022 or not tag:clopen'+ $ hledger bs -Y -f 2021.j expr:'tag:clopen=2021 or not tag:clopen'+ $ hledger bs -Y -f 2022.j expr:'tag:clopen=2022 or not tag:clopen'+ $ hledger bs -Y -f 2023.j # unclosed file, no query needed++ More detailed close examples+ See examples/multi-year.++ rewrite+ Print all transactions, rewriting the postings of matched transactions.+ For now the only rewrite available is adding new postings, like print+ --auto.++ Flags:+ --add-posting='ACCT AMTEXPR' add a posting to ACCT, which may be+ parenthesised. AMTEXPR is either a literal+ amount, or *N which means the transaction's+ first matched amount multiplied by N (a+ decimal number). Two spaces separate ACCT+ and AMTEXPR.+ --diff generate diff suitable as an input for+ patch tool++ This is a start at a generic rewriter of transaction entries. It reads the+ default journal and prints the transactions, like print, 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++ rewrites.hledger may consist of entries like:++ = ^income amt:<0 date:2017+ (liabilities:tax) *0.33 ; tax on income+ (reserve:grocery) *0.25 ; reserve 25% for grocery+ (reserve:) *0.25 ; reserve 25% for grocery++ Note the single quotes to protect the dollar sign from bash, and the two+ spaces between account and amount.++ More:++ $ hledger rewrite [QUERY] --add-posting "ACCT AMTEXPR" ...+ $ hledger rewrite ^income --add-posting '(liabilities:tax) *.33'+ $ hledger rewrite expenses:gifts --add-posting '(budget:gifts) *-1"'+ $ hledger rewrite ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'++ Argument for --add-posting option is a usual posting of transaction with an+ exception for amount specification. More precisely, you can use '*' (star+ symbol) before the amount to indicate that that this is a factor for an+ amount of original matched posting. If the amount includes a commodity+ name, the new posting amount will be in the new commodity; otherwise, it+ will be in the matched posting amount's commodity.++ Re-write rules in a file+ During the run this tool will execute so called "Automated Transactions"+ found in any journal it process. I.e instead of specifying this operations+ in command line you can put them in a journal file.++ $ rewrite-rules.journal++ Make contents look like this:++ = ^income+ (liabilities:tax) *.33++ = expenses:gifts+ budget:gifts *-1+ assets:budget *1++ Note that '=' (equality symbol) that is used instead of date in transac-+ tions you usually write. It indicates the query by which you want to match+ the posting to add new ones.++ $ hledger rewrite -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal++ This is something similar to the commands pipeline:++ $ hledger rewrite -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \+ | hledger rewrite -f - expenses:gifts --add-posting 'budget:gifts *-1' \+ --add-posting 'assets:budget *1' \+ > rewritten-tidy-output.journal++ It is important to understand that relative order of such entries in jour-+ nal is important. You can re-use result of previously added postings.++ Diff output format+ To use this tool for batch modification of your journal files you may find+ useful output in form of unified diff.++ $ hledger rewrite --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33'++ Output might look like:++ --- /tmp/examples/sample.journal+ +++ /tmp/examples/sample.journal+ @@ -18,3 +18,4 @@+ 2008/01/01 income+ - assets:bank:checking $1+ + assets:bank:checking $1+ income:salary+ + (liabilities:tax) 0+ @@ -22,3 +23,4 @@+ 2008/06/01 gift+ - assets:bank:checking $1+ + assets:bank:checking $1+ income:gifts+ + (liabilities:tax) 0++ If you'll pass this through patch tool you'll get transactions containing+ the posting that matches your query be updated. Note that multiple files+ might be update according to list of input files specified via --file op-+ tions and include directives inside of these files.++ Be careful. Whole transaction being re-formatted in a style of output from+ hledger print.++ See also:++ https://github.com/simonmichael/hledger/issues/99++ rewrite vs. print --auto+ This command predates print --auto, and currently does much the same thing,+ but with these differences:++ * with multiple files, rewrite lets rules in any file affect all other+ files. print --auto uses standard directive scoping; rules affect only+ child files.++ * rewrite's query limits which transactions can be rewritten; all are+ printed. print --auto's query limits which transactions are printed.++ * rewrite applies rules specified on command line or in the journal. print+ --auto applies rules specified in the journal.++Maintenance commands+ check+ Check for various kinds of errors in your data.++ Flags:+ no command-specific flags++ hledger provides a number of built-in correctness checks to help validate+ your data and prevent errors. Some are run automatically, some when you+ enable --strict mode; or you can run any of them on demand by providing+ them as arguments to the check command. check produces no output and a+ zero exit code if all is well. Eg:++ hledger check # run basic checks+ hledger check -s # run basic and strict checks+ hledger check ordereddates payees # run basic checks and two others++ If you are an Emacs user, you can also configure flycheck-hledger to run+ these checks, providing instant feedback as you edit the journal.++ Here are the checks currently available. They are generally checked in the+ order they are shown here, and only the first failure will be reported.++ Basic checks+ These important checks are performed by default, by almost all hledger com-+ mands:++ * parseable - data files are in a supported format, with no syntax errors+ and no invalid include directives. This ensures that all files exist and+ are readable.++ * autobalanced - all transactions are balanced, after automatically infer-+ ring missing amounts and conversion rates and then converting amounts to+ cost. This ensures that each transaction's journal entry is well formed.++ * assertions - all balance assertions in the journal are passing. Balance+ assertions are a strong defense against errors, catching many problems.+ This check is on by default, but if it gets in your way, you can disable+ it temporarily with -I/--ignore-assertions, or as a default by adding+ that flag to your config file. (Then use -s/--strict or hledger check+ assertions when you want to enable it).++ Strict checks+ When the -s/--strict flag is used (AKA strict mode), all commands will per-+ form the following additional checks (and assertions, above). These pro-+ vide extra error-catching power to help you keep your data clean and cor-+ rect:++ * balanced - like autobalanced, but implicit conversions between commodi-+ ties are not allowed; all conversion transactions must use cost notation+ or equity postings. This prevents wrong conversions caused by typos.++ * commodities - all commodity symbols used must be declared. This guards+ against mistyping or omitting commodity symbols.++ * accounts - all account names used must be declared. This prevents the+ use of mis-spelled or outdated account names.++ Other checks+ These are not wanted by everyone, but can be run using the check command:++ * tags - all tags used must be declared. This prevents mis-spelled tag+ names. Note hledger fairly often finds unintended tags in comments.++ * payees - all payees used in transactions must be declared. This will+ force you to declare any new payee name before using it. Most people+ will probably find this a bit too strict.++ * ordereddates - within each file, transactions must be ordered by date.+ This is a simple and effective error catcher. It's not included in+ strict mode, but you can add it by running hledger check -s ordereddates.+ If enabled, this check is performed before balance assertions.++ * recentassertions - all accounts with balance assertions must have one+ that's within the 7 days before their latest posting. This will encour-+ age adding balance assertions for your active asset/liability accounts,+ which in turn should encourage you to reconcile regularly with those real+ world balances - another strong defense against errors. (hledger close+ --assert >>$LEDGER_FILE is a convenient way to add new balance asser-+ tions. Later these become quite redundant, and you might choose to re-+ move them to reduce clutter.)++ * uniqueleafnames - no two accounts may have the same last account name+ part (eg the checking in assets:bank:checking). This ensures each ac-+ count can be matched by a unique short name, easier to remember and to+ type.++ Custom checks+ You can build your own custom checks with add-on command scripts. See also+ Cookbook > Scripting. Here are some examples from hledger/bin/:++ * hledger-check-tagfiles - all tag values containing / exist as file paths++ * hledger-check-fancyassertions - more complex balance assertions are pass-+ ing++ diff+ Compares a particular account's transactions in two input files. It shows+ any transactions to this account which are in one file but not in the+ other.++ Flags:+ no command-specific flags++ More precisely: for each posting affecting this account in either file,+ this command looks for a corresponding posting in the other file which+ posts the same amount to the same account (ignoring date, description,+ etc).++ Since it compares postings, not transactions, this also works when multiple+ bank transactions have been combined into a single journal entry.++ This command is useful eg if you have downloaded an account's transactions+ from your bank (eg as CSV data): when hledger and your bank disagree about+ the account balance, you can compare the bank data with your journal to+ find out the cause.++ Examples:++ $ hledger diff -f $LEDGER_FILE -f bank.csv assets:bank:giro+ These transactions are in the first file only:++ 2014/01/01 Opening Balances+ assets:bank:giro EUR ...+ ...+ equity:opening balances EUR -...++ These transactions are in the second file only:++ setup+ Check the status of the hledger installation.++ Flags:+ no command-specific flags++ setup tests your hledger installation and prints a list of results, some-+ times with helpful hints. This is a good first command to run after in-+ stalling hledger. Also after upgrading, or when something's not working,+ or just when you want a reminder of where things are.++ It makes one network request to detect the latest hledger release version.+ It's ok if this fails or times out. It will use ANSI color by default, un-+ less disabled by NO_COLOR or --color=n. It does not use a pager or a con-+ fig file.++ It expects that the hledger version you are running is installed in your+ PATH. If not, it will stop until you have done that (to keep things sim-+ ple).++ Example:++ $ hledger setup+ Checking your hledger setup..+ Legend: good, neutral, unknown, warning++ hledger+ * is a released version ? no hledger 1.42.99-gbca4b39c5-20250425, mac-aarch64+ * is up to date ? yes 1.42.99 installed, latest is 1.42.1+ * is a native binary for this machine ? yes aarch64+ * is installed in PATH ? yes /Users/simon/.local/bin/hledger+ * has a system text encoding configured ? yes UTF-8, data files should use this encoding+ * has a user config file ? (optional) no+ * current directory has a local config ? yes /Users/simon/src/hledger/hledger.conf+ * the config file is readable ? yes /Users/simon/src/hledger/hledger.conf++ terminal+ * the NO_COLOR variable is defined ? no+ * --color is configured by config file ? no+ * hledger will use color by default ? yes+ * the PAGER variable is defined ? yes less+ * --pager is configured by config file ? no+ * hledger will use a pager when needed ? yes /opt/homebrew/bin/less+ * the LESS variable is defined ? yes+ * the HLEDGER_LESS variable is defined ? no+ * adjusting LESS variable for color etc. ? yes+ * --pretty is enabled by config file ? no tables will use ASCII characters+ * bash shell completions are installed ? ?+ * zsh shell completions are installed ? ?++ journal+ * the LEDGER_FILE variable is defined ? yes /Users/simon/finance/2025/2025.journal+ * a default journal file is readable ? yes /Users/simon/finance/2025/2025.journal+ * it includes additional files ? yes 15+ * all commodities are declared ? yes 10+ * all accounts are declared ? yes 160+ * all accounts have types ? no 14 untyped+ * accounts of each type were detected ? yes ALERXCV+ * commodities/accounts are checked ? no use -s to check commodities/accounts+ * balance assertions are checked ? yes use -I to ignore assertions++ test+ Run built-in unit tests.++ Flags:+ no command-specific flags++ This command runs the unit tests built in to hledger and hledger-lib,+ printing the results on stdout. If any test fails, the exit code will be+ non-zero.++ This is mainly used by hledger developers, but you can also use it to san-+ ity-check the installed hledger executable on your platform. All tests are+ expected to pass - if you ever see a failure, please report as a bug!++ Any arguments before a -- argument will be passed to the tasty test runner+ as test-selecting -p patterns, and any arguments after -- will be passed to+ tasty unchanged.++ Examples:++ $ hledger test # run all unit tests+ $ hledger test balance # run tests with "balance" in their name+ $ hledger test -- -h # show tasty's options++PART 5: COMMON TASKS+ Here are some quick examples of how to do some basic tasks with hledger.++ Getting help+ Here's how to list commands and view options and command docs:++ $ hledger # show available commands+ $ hledger --help # show common options+ $ hledger CMD --help # show CMD's options, common options and CMD's documentation++ You can also view your hledger version's manual in several formats by using+ the help command. Eg:++ $ hledger help # show the hledger manual with info, man or $PAGER (best available)+ $ hledger help journal # show the journal topic in the hledger manual+ $ hledger help --help # find out more about the help command++ To view manuals and introductory docs on the web, visit+ https://hledger.org. Chat and mail list support and discussion archives+ can be found at https://hledger.org/support.++ Constructing command lines+ hledger has a flexible command line interface. We strive to keep it simple+ and ergonomic, but if you run into one of the sharp edges described in OP-+ TIONS, here are some tips that might help:++ * command-specific options must go after the command (it's fine to put com-+ mon options there too: hledger CMD OPTS ARGS)++ * you can run addon commands via hledger (hledger ui [ARGS]) or directly+ (hledger-ui [ARGS])++ * enclose "problematic" arguments in single quotes++ * if needed, also add a backslash to hide regular expression metacharacters+ from the shell++ * to see how a misbehaving command line is being parsed, add --debug=2.++ Starting a journal file+ hledger looks for your accounting data in a journal file,+ $HOME/.hledger.journal by default:++ $ hledger stats+ The hledger journal file "/Users/simon/.hledger.journal" was not found.+ Please create it first, eg with "hledger add" or a text editor.+ Or, specify an existing journal file with -f or LEDGER_FILE.++ You can override this by setting the LEDGER_FILE environment variable (see+ below). It's a good practice to keep this important file under version+ control, and to start a new file each year. So you could do something like+ this:++ $ mkdir ~/finance+ $ cd ~/finance+ $ git init+ Initialized empty Git repository in /Users/simon/finance/.git/+ $ touch 2023.journal+ $ echo "export LEDGER_FILE=$HOME/finance/2023.journal" >> ~/.profile+ $ source ~/.profile+ $ hledger stats+ Main file : /Users/simon/finance/2023.journal+ Included files :+ Transactions span : to (0 days)+ Last transaction : none+ Transactions : 0 (0.0 per day)+ Transactions last 30 days: 0 (0.0 per day)+ Transactions last 7 days : 0 (0.0 per day)+ Payees/descriptions : 0+ Accounts : 0 (depth 0)+ Commodities : 0 ()+ Market prices : 0 ()++ Setting LEDGER_FILE+ Set LEDGER_FILE on unix+ It depends on your shell, but running these commands in the terminal will+ work for many people; adapt if needed:++ $ echo 'export LEDGER_FILE=~/finance/main.journal' >> ~/.profile+ $ source ~/.profile++ When correctly configured:++ * env | grep LEDGER_FILE will show your new setting++ * and so should hledger setup and hledger files.++ Set LEDGER_FILE on mac+ In a terminal window, follow the unix procedure above.++ Also, this optional step may be helpful for GUI applications:++ 1. Add an entry to ~/.MacOSX/environment.plist like++ {+ "LEDGER_FILE" : "~/finance/main.journal"+ }++ 2. Run killall Dock in a terminal window (or restart the machine), to com-+ plete the change.++ When correctly configured for GUI applications:++ * apps started from the dock or a spotlight search, such as a GUI Emacs,+ will be aware of the new LEDGER_FILE setting.++ Set LEDGER_FILE on Windows+ It can be easier to create a default file at C:\Users\USER\.hledger.jour-+ nal, and have it include your other files. See I'm on Windows, how do I+ keep my files in AppData?++ Otherwise: using the gui is easiest:++ 1. In task bar, search for environment variables, and choose "Edit environ-+ ment variables for your account".++ 2. Create or change a LEDGER_FILE setting in the User variables pane. A+ typical value would be C:\Users\USER\finance\main.journal.++ 3. Click OK to complete the change.++ 4. And open a new powershell window. (Existing windows won't see the+ change.)++ Or at the command line, you can do it this way:++ 1. In a powershell window, run [Environment]::SetEnvironmentVari-+ able("LEDGER_FILE", "C:\User\USER\finance\main.journal", [System.Envi-+ ronmentVariableTarget]::User)++ 2. And open a new powershell window. (Existing windows won't see the+ change.)++ Warning, doing this from the Windows command line can be tricky; other+ methods you may find online:++ * may not affect the current window++ * may not be persistent++ * may not work unless you are an administrator++ * may limit values to 1024 characters++ * may break dynamic references to other variables++ * may require a new-enough version of powershell++ * or may be intended for the older command window.++ * If you still have trouble, see eg Setting Windows PowerShell environment+ variables or Adding path permanently to windows using powershell doesn't+ appear to work.++ When correctly configured:++ * in a new powershell window, $env:LEDGER_FILE will show your new setting++ * and so should hledger setup and (once the file exists) hledger files.++ Setting opening balances+ Pick a starting date for which you can look up the balances of some+ real-world assets (bank accounts, wallet..) and liabilities (credit+ cards..).++ To avoid a lot of data entry, you may want to start with just one or two+ accounts, like your checking account or cash wallet; and pick a recent+ starting date, like today or the start of the week. You can always come+ back later and add more accounts and older transactions, eg going back to+ january 1st.++ Add an opening balances transaction to the journal, declaring the balances+ on this date. Here are two ways to do it:++ * The first way: open the journal in any text editor and save an entry like+ this:++ 2023-01-01 * opening balances+ assets:bank:checking $1000 = $1000+ assets:bank:savings $2000 = $2000+ assets:cash $100 = $100+ liabilities:creditcard $-50 = $-50+ equity:opening/closing balances++ These are start-of-day balances, ie whatever was in the account at the+ end of the previous day.++ The * after the date is an optional status flag. Here it means "cleared+ & confirmed".++ The currency symbols are optional, but usually a good idea as you'll be+ dealing with multiple currencies sooner or later.++ The = amounts are optional balance assertions, providing extra error+ checking.++ * The second way: run hledger add and follow the prompts to record a simi-+ lar transaction:++ $ hledger add+ Adding transactions to journal file /Users/simon/finance/2023.journal+ Any command line arguments will be used as defaults.+ Use tab key to complete, readline keys to edit, enter to accept defaults.+ An optional (CODE) may follow transaction dates.+ An optional ; COMMENT may follow descriptions or amounts.+ If you make a mistake, enter < at any prompt to go one step backward.+ To end a transaction, enter . when prompted.+ To quit, enter . at a date prompt or press control-d or control-c.+ Date [2023-02-07]: 2023-01-01+ Description: * opening balances+ Account 1: assets:bank:checking+ Amount 1: $1000+ Account 2: assets:bank:savings+ Amount 2 [$-1000]: $2000+ Account 3: assets:cash+ Amount 3 [$-3000]: $100+ Account 4: liabilities:creditcard+ Amount 4 [$-3100]: $-50+ Account 5: equity:opening/closing balances+ Amount 5 [$-3050]:+ Account 6 (or . or enter to finish this transaction): .+ 2023-01-01 * opening balances+ assets:bank:checking $1000+ assets:bank:savings $2000+ assets:cash $100+ liabilities:creditcard $-50+ equity:opening/closing balances $-3050++ Save this transaction to the journal ? [y]:+ Saved.+ Starting the next transaction (. or ctrl-D/ctrl-C to quit)+ Date [2023-01-01]: .++ If you're using version control, this could be a good time to commit the+ journal. Eg:++ $ git commit -m 'initial balances' 2023.journal++ Recording transactions+ As you spend or receive money, you can record these transactions using one+ of the methods above (text editor, hledger add) or by using the+ hledger-iadd or hledger-web add-ons, or by using the import command to con-+ vert CSV data downloaded from your bank.++ Here are some simple transactions, see the hledger_journal(5) manual and+ hledger.org for more ideas:++ 2023/1/10 * gift received+ assets:cash $20+ income:gifts++ 2023.1.12 * farmers market+ expenses:food $13+ assets:cash++ 2023-01-15 paycheck+ income:salary+ assets:bank:checking $1000++ Reconciling+ Periodically you should reconcile - compare your hledger-reported balances+ against external sources of truth, like bank statements or your bank's web-+ site - to be sure that your ledger accurately represents the real-world+ balances (and, that the real-world institutions have not made a mistake!).+ This gets easy and fast with (1) practice and (2) frequency. If you do it+ daily, it can take 2-10 minutes. If you let it pile up, expect it to take+ longer as you hunt down errors and discrepancies.++ A typical workflow:++ 1. Reconcile cash. Count what's in your wallet. Compare with what hledger+ reports (hledger bal cash). If they are different, try to remember the+ missing transaction, or look for the error in the already-recorded+ transactions. A register report can be helpful (hledger reg cash). If+ you can't find the error, add an adjustment transaction. Eg if you have+ $105 after the above, and can't explain the missing $2, it could be:++ 2023-01-16 * adjust cash+ assets:cash $-2 = $105+ expenses:misc++ 2. Reconcile checking. Log in to your bank's website. Compare today's+ (cleared) balance with hledger's cleared balance (hledger bal checking+ -C). If they are different, track down the error or record the missing+ transaction(s) or add an adjustment transaction, similar to the above.+ Unlike the cash case, you can usually compare the transaction history+ and running balance from your bank with the one reported by hledger reg+ checking -C. This will be easier if you generally record transaction+ dates quite similar to your bank's clearing dates.++ 3. Repeat for other asset/liability accounts.++ Tip: instead of the register command, use hledger-ui to see a live-updating+ register while you edit the journal: hledger-ui --watch --register checking+ -C++ After reconciling, it could be a good time to mark the reconciled transac-+ tions' status as "cleared and confirmed", if you want to track that, by+ adding the * marker. Eg in the paycheck transaction above, insert * be-+ tween 2023-01-15 and paycheck++ If you're using version control, this can be another good time to commit:++ $ git commit -m 'txns' 2023.journal++ Reporting+ Here are some basic reports.++ Show all transactions:++ $ hledger print+ 2023-01-01 * opening balances+ assets:bank:checking $1000+ assets:bank:savings $2000+ assets:cash $100+ liabilities:creditcard $-50+ equity:opening/closing balances $-3050++ 2023-01-10 * gift received+ assets:cash $20+ income:gifts++ 2023-01-12 * farmers market+ expenses:food $13+ assets:cash++ 2023-01-15 * paycheck+ income:salary+ assets:bank:checking $1000++ 2023-01-16 * adjust cash+ assets:cash $-2 = $105+ expenses:misc++ Show account names, and their hierarchy:++ $ hledger accounts --tree+ assets+ bank+ checking+ savings+ cash+ equity+ opening/closing balances+ expenses+ food+ misc+ income+ gifts+ salary+ liabilities+ creditcard++ Show all account totals:++ $ hledger balance+ $4105 assets+ $4000 bank+ $2000 checking+ $2000 savings+ $105 cash+ $-3050 equity:opening/closing balances+ $15 expenses+ $13 food+ $2 misc+ $-1020 income+ $-20 gifts+ $-1000 salary+ $-50 liabilities:creditcard+ --------------------+ 0++ Show only asset and liability balances, as a flat list, limited to depth 2:++ $ hledger bal assets liabilities -2+ $4000 assets:bank+ $105 assets:cash+ $-50 liabilities:creditcard+ --------------------+ $4055++ Show the same thing without negative numbers, formatted as a simple balance+ sheet:++ $ hledger bs -2+ Balance Sheet 2023-01-16++ || 2023-01-16+ ========================++============+ Assets ||+ ------------------------++------------+ assets:bank || $4000+ assets:cash || $105+ ------------------------++------------+ || $4105+ ========================++============+ Liabilities ||+ ------------------------++------------+ liabilities:creditcard || $50+ ------------------------++------------+ || $50+ ========================++============+ Net: || $4055++ The final total is your "net worth" on the end date. (Or use bse for a+ full balance sheet with equity.)++ Show income and expense totals, formatted as an income statement:++ hledger is+ Income Statement 2023-01-01-2023-01-16++ || 2023-01-01-2023-01-16+ ===============++=======================+ Revenues ||+ ---------------++-----------------------+ income:gifts || $20+ income:salary || $1000+ ---------------++-----------------------+ || $1020+ ===============++=======================+ Expenses ||+ ---------------++-----------------------+ expenses:food || $13+ expenses:misc || $2+ ---------------++-----------------------+ || $15+ ===============++=======================+ Net: || $1005++ The final total is your net income during this period.++ Show transactions affecting your wallet, with running total:++ $ hledger register cash+ 2023-01-01 opening balances assets:cash $100 $100+ 2023-01-10 gift received assets:cash $20 $120+ 2023-01-12 farmers market assets:cash $-13 $107+ 2023-01-16 adjust cash assets:cash $-2 $105++ Show weekly posting counts as a bar chart:++ $ hledger activity -W+ 2019-12-30 *****+ 2023-01-06 ****+ 2023-01-13 ****++ Migrating to a new file+ At the end of the year, you may want to continue your journal in a new+ file, so that old transactions don't slow down or clutter your reports, and+ to help ensure the integrity of your accounting history. See the close+ command.++ If using version control, don't forget to git add the new file.++BUGS+ We welcome bug reports in the hledger issue tracker+ (https://bugs.hledger.org), or on the hledger chat or mail list+ (https://hledger.org/support).++ Some known issues and limitations:++ hledger uses the system's text encoding when reading non-ascii text. If no+ system encoding is configured, or if the data's encoding is different,+ hledger will give an error. (See Text encoding, Troubleshooting.)++ On Microsoft Windows, depending what kind of terminal window you use,+ non-ascii characters, ANSI text formatting, and/or the add command's TAB+ key, may not be fully supported. (For best results, try a powershell win-+ dow.)++ When processing large data files, hledger uses more memory than Ledger.++ Troubleshooting+ Here are some common issues you might encounter when you run hledger, and+ how to resolve them (and remember also you can usually get quick Support):++ PATH issues: I get an error like "No command 'hledger' found"+ Depending how you installed hledger, the executables may not be in your+ shell's PATH. Eg on unix systems, stack installs hledger in ~/.local/bin+ and cabal installs it in ~/.cabal/bin. You may need to add one of these+ directories to your shell's PATH, and/or open a new terminal window.++ LEDGER_FILE issues: I configured LEDGER_FILE but hledger is not using it++ * LEDGER_FILE should be a real environment variable, not just a shell vari-+ able. Eg on unix, the command env | grep LEDGER_FILE should show it.+ You may need to use export (see https://stackoverflow.com/a/7411509). On+ Windows, $env:LEDGER_FILE should show it.++ * You may need to force your shell to see the new configuration. A simple+ way is to close your terminal window and open a new one.++ Text decoding issues: I get errors like "Illegal byte sequence" or "Invalid+ or incomplete multibyte or wide character" or "commitAndReleaseBuffer: in-+ valid argument (invalid character)"+ hledger usually needs its input to be decodable with the system locale's+ text encoding. See Text encoding and Install: Text encoding.++ COMPATIBILITY ISSUES: hledger gives an error with my Ledger file+ Not all of Ledger's journal file syntax or feature set is supported. See+ hledger and Ledger for full details.++++AUTHORS+ Simon Michael <simon@joyful.com> and contributors.+ See http://hledger.org/CREDITS.html+++COPYRIGHT+ Copyright 2007-2023 Simon Michael and contributors.+++LICENSE+ Released under GNU GPL v3 or later.+++SEE ALSO+ hledger(1), hledger-ui(1), hledger-web(1), ledger(1)++hledger-1.52 March 2026 HLEDGER(1)
− embeddedfiles/hledger_csv.5
@@ -1,335 +0,0 @@--.TH "hledger_csv" "5" "March 2019" "hledger 1.14" "hledger User Manuals"----.SH NAME-.PP-CSV \- how hledger reads CSV data, and the CSV rules file format-.SH DESCRIPTION-.PP-hledger can read CSV (comma\-separated value) files as if they were-journal files, automatically converting each CSV record into a-transaction.-(To learn about \f[I]writing\f[] CSV, see CSV output.)-.PP-Converting CSV to transactions requires some special conversion rules.-These do several things:-.IP \[bu] 2-they describe the layout and format of the CSV data-.IP \[bu] 2-they can customize the generated journal entries using a simple-templating language-.IP \[bu] 2-they can add refinements based on patterns in the CSV data, eg-categorizing transactions with more detailed account names.-.PP-When reading a CSV file named \f[C]FILE.csv\f[], hledger looks for a-conversion rules file named \f[C]FILE.csv.rules\f[] in the same-directory.-You can override this with the \f[C]\-\-rules\-file\f[] option.-If the rules file does not exist, hledger will auto\-create one with-some example rules, which you\[aq]ll need to adjust.-.PP-At minimum, the rules file must identify the \f[C]date\f[] and-\f[C]amount\f[] fields.-It may also be necessary to specify the date format, and the number of-header lines to skip.-Eg:-.IP-.nf-\f[C]-fields\ date,\ _,\ _,\ amount-date\-format\ \ %d/%m/%Y-skip\ 1-\f[]-.fi-.PP-A more complete example:-.IP-.nf-\f[C]-#\ hledger\ CSV\ rules\ for\ amazon.com\ order\ history--#\ sample:-#\ "Date","Type","To/From","Name","Status","Amount","Fees","Transaction\ ID"-#\ "Jul\ 29,\ 2012","Payment","To","Adapteva,\ Inc.","Completed","$25.00","$0.00","17LA58JSK6PRD4HDGLNJQPI1PB9N8DKPVHL"--#\ skip\ one\ header\ line-skip\ 1--#\ name\ the\ csv\ fields\ (and\ assign\ the\ transaction\[aq]s\ date,\ amount\ and\ code)-fields\ date,\ _,\ toorfrom,\ name,\ amzstatus,\ amount,\ fees,\ code--#\ how\ to\ parse\ the\ date-date\-format\ %b\ %\-d,\ %Y--#\ combine\ two\ fields\ to\ make\ the\ description-description\ %toorfrom\ %name--#\ save\ these\ fields\ as\ tags-comment\ \ \ \ \ status:%amzstatus,\ fees:%fees--#\ set\ the\ base\ account\ for\ all\ transactions-account1\ \ \ \ assets:amazon--#\ flip\ the\ sign\ on\ the\ amount-amount\ \ \ \ \ \ \-%amount-\f[]-.fi-.PP-For more examples, see Convert CSV files.-.SH CSV RULES-.PP-The following seven kinds of rule can appear in the rules file, in any-order.-Blank lines and lines beginning with \f[C]#\f[] or \f[C];\f[] are-ignored.-.SS skip-.PP-\f[C]skip\f[]\f[I]\f[CI]N\f[I]\f[]-.PP-Skip this number of CSV records at the beginning.-You\[aq]ll need this whenever your CSV data contains header lines.-Eg:-.IP-.nf-\f[C]-#\ ignore\ the\ first\ CSV\ line-skip\ 1-\f[]-.fi-.SS date\-format-.PP-\f[C]date\-format\f[]\f[I]\f[CI]DATEFMT\f[I]\f[]-.PP-When your CSV date fields are not formatted like \f[C]YYYY/MM/DD\f[] (or-\f[C]YYYY\-MM\-DD\f[] or \f[C]YYYY.MM.DD\f[]), you\[aq]ll need to-specify the format.-DATEFMT is a strptime\-like date parsing pattern, which must parse the-date field values completely.-Examples:-.IP-.nf-\f[C]-#\ for\ dates\ like\ "11/06/2013":-date\-format\ %m/%d/%Y-\f[]-.fi-.IP-.nf-\f[C]-#\ for\ dates\ like\ "6/11/2013"\ (note\ the\ \-\ to\ make\ leading\ zeros\ optional):-date\-format\ %\-d/%\-m/%Y-\f[]-.fi-.IP-.nf-\f[C]-#\ for\ dates\ like\ "2013\-Nov\-06":-date\-format\ %Y\-%h\-%d-\f[]-.fi-.IP-.nf-\f[C]-#\ for\ dates\ like\ "11/6/2013\ 11:32\ PM":-date\-format\ %\-m/%\-d/%Y\ %l:%M\ %p-\f[]-.fi-.SS field list-.PP-\f[C]fields\f[]\f[I]\f[CI]FIELDNAME1\f[I]\f[],-\f[I]\f[CI]FIELDNAME2\f[I]\f[]...-.PP-This (a) names the CSV fields, in order (names may not contain-whitespace; uninteresting names may be left blank), and (b) assigns them-to journal entry fields if you use any of these standard field names:-\f[C]date\f[], \f[C]date2\f[], \f[C]status\f[], \f[C]code\f[],-\f[C]description\f[], \f[C]comment\f[], \f[C]account1\f[],-\f[C]account2\f[], \f[C]amount\f[], \f[C]amount\-in\f[],-\f[C]amount\-out\f[], \f[C]currency\f[], \f[C]balance\f[].-Eg:-.IP-.nf-\f[C]-#\ use\ the\ 1st,\ 2nd\ and\ 4th\ CSV\ fields\ as\ the\ entry\[aq]s\ date,\ description\ and\ amount,-#\ and\ give\ the\ 7th\ and\ 8th\ fields\ meaningful\ names\ for\ later\ reference:-#-#\ CSV\ field:-#\ \ \ \ \ \ 1\ \ \ \ \ 2\ \ \ \ \ \ \ \ \ \ \ \ 3\ 4\ \ \ \ \ \ \ 5\ 6\ 7\ \ \ \ \ \ \ \ \ \ 8-#\ entry\ field:-fields\ date,\ description,\ ,\ amount,\ ,\ ,\ somefield,\ anotherfield-\f[]-.fi-.SS field assignment-.PP-\f[I]\f[CI]ENTRYFIELDNAME\f[I]\f[] \f[I]\f[CI]FIELDVALUE\f[I]\f[]-.PP-This sets a journal entry field (one of the standard names above) to the-given text value, which can include CSV field values interpolated by-name (\f[C]%CSVFIELDNAME\f[]) or 1\-based position (\f[C]%N\f[]).- Eg:-.IP-.nf-\f[C]-#\ set\ the\ amount\ to\ the\ 4th\ CSV\ field\ with\ "USD\ "\ prepended-amount\ USD\ %4-\f[]-.fi-.IP-.nf-\f[C]-#\ combine\ three\ fields\ to\ make\ a\ comment\ (containing\ two\ tags)-comment\ note:\ %somefield\ \-\ %anotherfield,\ date:\ %1-\f[]-.fi-.PP-Field assignments can be used instead of or in addition to a field list.-.SS conditional block-.PP-\f[C]if\f[] \f[I]\f[CI]PATTERN\f[I]\f[]-.PD 0-.P-.PD-\ \ \ \ \f[I]\f[CI]FIELDASSIGNMENTS\f[I]\f[]...-.PP-\f[C]if\f[]-.PD 0-.P-.PD-\f[I]\f[CI]PATTERN\f[I]\f[]-.PD 0-.P-.PD-\f[I]\f[CI]PATTERN\f[I]\f[]...-.PD 0-.P-.PD-\ \ \ \ \f[I]\f[CI]FIELDASSIGNMENTS\f[I]\f[]...-.PP-This applies one or more field assignments, only to those CSV records-matched by one of the PATTERNs.-The patterns are case\-insensitive regular expressions which match-anywhere within the whole CSV record (it\[aq]s not yet possible to match-within a specific field).-When there are multiple patterns they can be written on separate lines,-unindented.-The field assignments are on separate lines indented by at least one-space.-Examples:-.IP-.nf-\f[C]-#\ if\ the\ CSV\ record\ contains\ "groceries",\ set\ account2\ to\ "expenses:groceries"-if\ groceries-\ account2\ expenses:groceries-\f[]-.fi-.IP-.nf-\f[C]-#\ if\ the\ CSV\ record\ contains\ any\ of\ these\ patterns,\ set\ account2\ and\ comment\ as\ shown-if-monthly\ service\ fee-atm\ transaction\ fee-banking\ thru\ software-\ account2\ expenses:business:banking-\ comment\ \ XXX\ deductible\ ?\ check\ it-\f[]-.fi-.SS include-.PP-\f[C]include\f[]\f[I]\f[CI]RULESFILE\f[I]\f[]-.PP-Include another rules file at this point.-\f[C]RULESFILE\f[] is either an absolute file path or a path relative to-the current file\[aq]s directory.-Eg:-.IP-.nf-\f[C]-#\ rules\ reused\ with\ several\ CSV\ files-include\ common.rules-\f[]-.fi-.SS newest\-first-.PP-\f[C]newest\-first\f[]-.PP-Consider adding this rule if all of the following are true: you might be-processing just one day of data, your CSV records are in reverse-chronological order (newest first), and you care about preserving the-order of same\-day transactions.-It usually isn\[aq]t needed, because hledger autodetects the CSV order,-but when all CSV records have the same date it will assume they are-oldest first.-.SH CSV TIPS-.SS CSV ordering-.PP-The generated journal entries will be sorted by date.-The order of same\-day entries will be preserved (except in the special-case where you might need \f[C]newest\-first\f[], see above).-.SS CSV accounts-.PP-Each journal entry will have two postings, to \f[C]account1\f[] and-\f[C]account2\f[] respectively.-It\[aq]s not yet possible to generate entries with more than two-postings.-It\[aq]s conventional and recommended to use \f[C]account1\f[] for the-account whose CSV we are reading.-.SS CSV amounts-.PP-The \f[C]amount\f[] field sets the amount of the \f[C]account1\f[]-posting.-.PP-If the CSV has debit/credit amounts in separate fields, assign to the-\f[C]amount\-in\f[] and \f[C]amount\-out\f[] pseudo fields instead.-(Whichever one has a value will be used, with appropriate sign.-If both contain a value, it may not work so well.)-.PP-If an amount value is parenthesised, it will be de\-parenthesised and-sign\-flipped.-.PP-If an amount value begins with a double minus sign, those will cancel-out and be removed.-.PP-If the CSV has the currency symbol in a separate field, assign that to-the \f[C]currency\f[] pseudo field to have it prepended to the amount.-Or, you can use a field assignment to \f[C]amount\f[] that interpolates-both CSV fields (giving more control, eg to put the currency symbol on-the right).-.SS CSV balance assertions-.PP-If the CSV includes a running balance, you can assign that to the-\f[C]balance\f[] pseudo field; whenever the running balance value is-non\-empty, it will be asserted as the balance after the-\f[C]account1\f[] posting.-.SS Reading multiple CSV files-.PP-You can read multiple CSV files at once using multiple \f[C]\-f\f[]-arguments on the command line, and hledger will look for a-correspondingly\-named rules file for each.-Note if you use the \f[C]\-\-rules\-file\f[] option, this one rules file-will be used for all the CSV files being read.---.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)--.SH AUTHORS-Simon Michael <simon@joyful.com> and contributors--.SH COPYRIGHT--Copyright (C) 2007-2016 Simon Michael.-.br-Released under GNU GPL v3 or later.--.SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org
− embeddedfiles/hledger_csv.info
@@ -1,349 +0,0 @@-This is hledger_csv.info, produced by makeinfo version 6.5 from stdin.---File: hledger_csv.info, Node: Top, Next: CSV RULES, Up: (dir)--hledger_csv(5) hledger 1.14-***************************--hledger can read CSV (comma-separated value) files as if they were-journal files, automatically converting each CSV record into a-transaction. (To learn about _writing_ CSV, see CSV output.)-- Converting CSV to transactions requires some special conversion-rules. These do several things:-- * they describe the layout and format of the CSV data- * they can customize the generated journal entries using a simple- templating language- * they can add refinements based on patterns in the CSV data, eg- categorizing transactions with more detailed account names.-- When reading a CSV file named 'FILE.csv', hledger looks for a-conversion rules file named 'FILE.csv.rules' in the same directory. You-can override this with the '--rules-file' option. If the rules file-does not exist, hledger will auto-create one with some example rules,-which you'll need to adjust.-- At minimum, the rules file must identify the 'date' and 'amount'-fields. It may also be necessary to specify the date format, and the-number of header lines to skip. Eg:--fields date, _, _, amount-date-format %d/%m/%Y-skip 1-- A more complete example:--# hledger CSV rules for amazon.com order history--# sample:-# "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID"-# "Jul 29, 2012","Payment","To","Adapteva, Inc.","Completed","$25.00","$0.00","17LA58JSK6PRD4HDGLNJQPI1PB9N8DKPVHL"--# skip one header line-skip 1--# name the csv fields (and assign the transaction's date, amount and code)-fields date, _, toorfrom, name, amzstatus, amount, fees, code--# how to parse the date-date-format %b %-d, %Y--# combine two fields to make the description-description %toorfrom %name--# save these fields as tags-comment status:%amzstatus, fees:%fees--# set the base account for all transactions-account1 assets:amazon--# flip the sign on the amount-amount -%amount-- For more examples, see Convert CSV files.-* Menu:--* CSV RULES::-* CSV TIPS::---File: hledger_csv.info, Node: CSV RULES, Next: CSV TIPS, Prev: Top, Up: Top--1 CSV RULES-***********--The following seven kinds of rule can appear in the rules file, in any-order. Blank lines and lines beginning with '#' or ';' are ignored.-* Menu:--* skip::-* date-format::-* field list::-* field assignment::-* conditional block::-* include::-* newest-first::---File: hledger_csv.info, Node: skip, Next: date-format, Up: CSV RULES--1.1 skip-========--'skip'_'N'_-- Skip this number of CSV records at the beginning. You'll need this-whenever your CSV data contains header lines. Eg:--# ignore the first CSV line-skip 1---File: hledger_csv.info, Node: date-format, Next: field list, Prev: skip, Up: CSV RULES--1.2 date-format-===============--'date-format'_'DATEFMT'_-- When your CSV date fields are not formatted like 'YYYY/MM/DD' (or-'YYYY-MM-DD' or 'YYYY.MM.DD'), you'll need to specify the format.-DATEFMT is a strptime-like date parsing pattern, which must parse the-date field values completely. Examples:--# for dates like "11/06/2013":-date-format %m/%d/%Y--# for dates like "6/11/2013" (note the - to make leading zeros optional):-date-format %-d/%-m/%Y--# for dates like "2013-Nov-06":-date-format %Y-%h-%d--# for dates like "11/6/2013 11:32 PM":-date-format %-m/%-d/%Y %l:%M %p---File: hledger_csv.info, Node: field list, Next: field assignment, Prev: date-format, Up: CSV RULES--1.3 field list-==============--'fields'_'FIELDNAME1'_, _'FIELDNAME2'_...-- This (a) names the CSV fields, in order (names may not contain-whitespace; uninteresting names may be left blank), and (b) assigns them-to journal entry fields if you use any of these standard field names:-'date', 'date2', 'status', 'code', 'description', 'comment', 'account1',-'account2', 'amount', 'amount-in', 'amount-out', 'currency', 'balance'.-Eg:--# use the 1st, 2nd and 4th CSV fields as the entry's date, description and amount,-# and give the 7th and 8th fields meaningful names for later reference:-#-# CSV field:-# 1 2 3 4 5 6 7 8-# entry field:-fields date, description, , amount, , , somefield, anotherfield---File: hledger_csv.info, Node: field assignment, Next: conditional block, Prev: field list, Up: CSV RULES--1.4 field assignment-====================--_'ENTRYFIELDNAME'_ _'FIELDVALUE'_-- This sets a journal entry field (one of the standard names above) to-the given text value, which can include CSV field values interpolated by-name ('%CSVFIELDNAME') or 1-based position ('%N'). Eg:--# set the amount to the 4th CSV field with "USD " prepended-amount USD %4--# combine three fields to make a comment (containing two tags)-comment note: %somefield - %anotherfield, date: %1-- Field assignments can be used instead of or in addition to a field-list.---File: hledger_csv.info, Node: conditional block, Next: include, Prev: field assignment, Up: CSV RULES--1.5 conditional block-=====================--'if' _'PATTERN'_- _'FIELDASSIGNMENTS'_...-- 'if'-_'PATTERN'_-_'PATTERN'_...- _'FIELDASSIGNMENTS'_...-- This applies one or more field assignments, only to those CSV records-matched by one of the PATTERNs. The patterns are case-insensitive-regular expressions which match anywhere within the whole CSV record-(it's not yet possible to match within a specific field). When there-are multiple patterns they can be written on separate lines, unindented.-The field assignments are on separate lines indented by at least one-space. Examples:--# if the CSV record contains "groceries", set account2 to "expenses:groceries"-if groceries- account2 expenses:groceries--# if the CSV record contains any of these patterns, set account2 and comment as shown-if-monthly service fee-atm transaction fee-banking thru software- account2 expenses:business:banking- comment XXX deductible ? check it---File: hledger_csv.info, Node: include, Next: newest-first, Prev: conditional block, Up: CSV RULES--1.6 include-===========--'include'_'RULESFILE'_-- Include another rules file at this point. 'RULESFILE' is either an-absolute file path or a path relative to the current file's directory.-Eg:--# rules reused with several CSV files-include common.rules---File: hledger_csv.info, Node: newest-first, Prev: include, Up: CSV RULES--1.7 newest-first-================--'newest-first'-- Consider adding this rule if all of the following are true: you might-be processing just one day of data, your CSV records are in reverse-chronological order (newest first), and you care about preserving the-order of same-day transactions. It usually isn't needed, because-hledger autodetects the CSV order, but when all CSV records have the-same date it will assume they are oldest first.---File: hledger_csv.info, Node: CSV TIPS, Prev: CSV RULES, Up: Top--2 CSV TIPS-**********--* Menu:--* CSV ordering::-* CSV accounts::-* CSV amounts::-* CSV balance assertions::-* Reading multiple CSV files::---File: hledger_csv.info, Node: CSV ordering, Next: CSV accounts, Up: CSV TIPS--2.1 CSV ordering-================--The generated journal entries will be sorted by date. The order of-same-day entries will be preserved (except in the special case where you-might need 'newest-first', see above).---File: hledger_csv.info, Node: CSV accounts, Next: CSV amounts, Prev: CSV ordering, Up: CSV TIPS--2.2 CSV accounts-================--Each journal entry will have two postings, to 'account1' and 'account2'-respectively. It's not yet possible to generate entries with more than-two postings. It's conventional and recommended to use 'account1' for-the account whose CSV we are reading.---File: hledger_csv.info, Node: CSV amounts, Next: CSV balance assertions, Prev: CSV accounts, Up: CSV TIPS--2.3 CSV amounts-===============--The 'amount' field sets the amount of the 'account1' posting.-- If the CSV has debit/credit amounts in separate fields, assign to the-'amount-in' and 'amount-out' pseudo fields instead. (Whichever one has-a value will be used, with appropriate sign. If both contain a value,-it may not work so well.)-- If an amount value is parenthesised, it will be de-parenthesised and-sign-flipped.-- If an amount value begins with a double minus sign, those will cancel-out and be removed.-- If the CSV has the currency symbol in a separate field, assign that-to the 'currency' pseudo field to have it prepended to the amount. Or,-you can use a field assignment to 'amount' that interpolates both CSV-fields (giving more control, eg to put the currency symbol on the-right).---File: hledger_csv.info, Node: CSV balance assertions, Next: Reading multiple CSV files, Prev: CSV amounts, Up: CSV TIPS--2.4 CSV balance assertions-==========================--If the CSV includes a running balance, you can assign that to the-'balance' pseudo field; whenever the running balance value is non-empty,-it will be asserted as the balance after the 'account1' posting.---File: hledger_csv.info, Node: Reading multiple CSV files, Prev: CSV balance assertions, Up: CSV TIPS--2.5 Reading multiple CSV files-==============================--You can read multiple CSV files at once using multiple '-f' arguments on-the command line, and hledger will look for a correspondingly-named-rules file for each. Note if you use the '--rules-file' option, this-one rules file will be used for all the CSV files being read.---Tag Table:-Node: Top72-Node: CSV RULES2163-Ref: #csv-rules2271-Node: skip2533-Ref: #skip2627-Node: date-format2799-Ref: #date-format2926-Node: field list3476-Ref: #field-list3613-Node: field assignment4318-Ref: #field-assignment4473-Node: conditional block4977-Ref: #conditional-block5131-Node: include6027-Ref: #include6157-Node: newest-first6388-Ref: #newest-first6502-Node: CSV TIPS6913-Ref: #csv-tips7007-Node: CSV ordering7125-Ref: #csv-ordering7243-Node: CSV accounts7424-Ref: #csv-accounts7562-Node: CSV amounts7816-Ref: #csv-amounts7962-Node: CSV balance assertions8737-Ref: #csv-balance-assertions8919-Node: Reading multiple CSV files9124-Ref: #reading-multiple-csv-files9294--End Tag Table
− embeddedfiles/hledger_csv.txt
@@ -1,252 +0,0 @@--hledger_csv(5) hledger User Manuals hledger_csv(5)----NAME- CSV - how hledger reads CSV data, and the CSV rules file format--DESCRIPTION- hledger can read CSV (comma-separated value) files as if they were- journal files, automatically converting each CSV record into a transac-- tion. (To learn about writing CSV, see CSV output.)-- Converting CSV to transactions requires some special conversion rules.- These do several things:-- o they describe the layout and format of the CSV data-- o they can customize the generated journal entries using a simple tem-- plating language-- o they can add refinements based on patterns in the CSV data, eg cate-- gorizing transactions with more detailed account names.-- When reading a CSV file named FILE.csv, hledger looks for a conversion- rules file named FILE.csv.rules in the same directory. You can over-- ride this with the --rules-file option. If the rules file does not- exist, hledger will auto-create one with some example rules, which- you'll need to adjust.-- At minimum, the rules file must identify the date and amount fields.- It may also be necessary to specify the date format, and the number of- header lines to skip. Eg:-- fields date, _, _, amount- date-format %d/%m/%Y- skip 1-- A more complete example:-- # hledger CSV rules for amazon.com order history-- # sample:- # "Date","Type","To/From","Name","Status","Amount","Fees","Transaction ID"- # "Jul 29, 2012","Payment","To","Adapteva, Inc.","Completed","$25.00","$0.00","17LA58JSK6PRD4HDGLNJQPI1PB9N8DKPVHL"-- # skip one header line- skip 1-- # name the csv fields (and assign the transaction's date, amount and code)- fields date, _, toorfrom, name, amzstatus, amount, fees, code-- # how to parse the date- date-format %b %-d, %Y-- # combine two fields to make the description- description %toorfrom %name-- # save these fields as tags- comment status:%amzstatus, fees:%fees-- # set the base account for all transactions- account1 assets:amazon-- # flip the sign on the amount- amount -%amount-- For more examples, see Convert CSV files.--CSV RULES- The following seven kinds of rule can appear in the rules file, in any- order. Blank lines and lines beginning with # or ; are ignored.-- skip- skipN-- Skip this number of CSV records at the beginning. You'll need this- whenever your CSV data contains header lines. Eg:-- # ignore the first CSV line- skip 1-- date-format- date-formatDATEFMT-- When your CSV date fields are not formatted like YYYY/MM/DD (or- YYYY-MM-DD or YYYY.MM.DD), you'll need to specify the format. DATEFMT- is a strptime-like date parsing pattern, which must parse the date- field values completely. Examples:-- # for dates like "11/06/2013":- date-format %m/%d/%Y-- # for dates like "6/11/2013" (note the - to make leading zeros optional):- date-format %-d/%-m/%Y-- # for dates like "2013-Nov-06":- date-format %Y-%h-%d-- # for dates like "11/6/2013 11:32 PM":- date-format %-m/%-d/%Y %l:%M %p-- field list- fieldsFIELDNAME1, FIELDNAME2...-- This (a) names the CSV fields, in order (names may not contain white-- space; uninteresting names may be left blank), and (b) assigns them to- journal entry fields if you use any of these standard field names:- date, date2, status, code, description, comment, account1, account2,- amount, amount-in, amount-out, currency, balance. Eg:-- # use the 1st, 2nd and 4th CSV fields as the entry's date, description and amount,- # and give the 7th and 8th fields meaningful names for later reference:- #- # CSV field:- # 1 2 3 4 5 6 7 8- # entry field:- fields date, description, , amount, , , somefield, anotherfield-- field assignment- ENTRYFIELDNAME FIELDVALUE-- This sets a journal entry field (one of the standard names above) to- the given text value, which can include CSV field values interpolated- by name (%CSVFIELDNAME) or 1-based position (%N).- Eg:-- # set the amount to the 4th CSV field with "USD " prepended- amount USD %4-- # combine three fields to make a comment (containing two tags)- comment note: %somefield - %anotherfield, date: %1-- Field assignments can be used instead of or in addition to a field- list.-- conditional block- if PATTERN- FIELDASSIGNMENTS...-- if- PATTERN- PATTERN...- FIELDASSIGNMENTS...-- This applies one or more field assignments, only to those CSV records- matched by one of the PATTERNs. The patterns are case-insensitive reg-- ular expressions which match anywhere within the whole CSV record (it's- not yet possible to match within a specific field). When there are- multiple patterns they can be written on separate lines, unindented.- The field assignments are on separate lines indented by at least one- space. Examples:-- # if the CSV record contains "groceries", set account2 to "expenses:groceries"- if groceries- account2 expenses:groceries-- # if the CSV record contains any of these patterns, set account2 and comment as shown- if- monthly service fee- atm transaction fee- banking thru software- account2 expenses:business:banking- comment XXX deductible ? check it-- include- includeRULESFILE-- Include another rules file at this point. RULESFILE is either an abso-- lute file path or a path relative to the current file's directory. Eg:-- # rules reused with several CSV files- include common.rules-- newest-first- newest-first-- Consider adding this rule if all of the following are true: you might- be processing just one day of data, your CSV records are in reverse- chronological order (newest first), and you care about preserving the- order of same-day transactions. It usually isn't needed, because- hledger autodetects the CSV order, but when all CSV records have the- same date it will assume they are oldest first.--CSV TIPS- CSV ordering- The generated journal entries will be sorted by date. The order of- same-day entries will be preserved (except in the special case where- you might need newest-first, see above).-- CSV accounts- Each journal entry will have two postings, to account1 and account2- respectively. It's not yet possible to generate entries with more than- two postings. It's conventional and recommended to use account1 for- the account whose CSV we are reading.-- CSV amounts- The amount field sets the amount of the account1 posting.-- If the CSV has debit/credit amounts in separate fields, assign to the- amount-in and amount-out pseudo fields instead. (Whichever one has a- value will be used, with appropriate sign. If both contain a value, it- may not work so well.)-- If an amount value is parenthesised, it will be de-parenthesised and- sign-flipped.-- If an amount value begins with a double minus sign, those will cancel- out and be removed.-- If the CSV has the currency symbol in a separate field, assign that to- the currency pseudo field to have it prepended to the amount. Or, you- can use a field assignment to amount that interpolates both CSV fields- (giving more control, eg to put the currency symbol on the right).-- CSV balance assertions- If the CSV includes a running balance, you can assign that to the bal-- ance pseudo field; whenever the running balance value is non-empty, it- will be asserted as the balance after the account1 posting.-- Reading multiple CSV files- You can read multiple CSV files at once using multiple -f arguments on- the command line, and hledger will look for a correspondingly-named- rules file for each. Note if you use the --rules-file option, this one- rules file will be used for all the CSV files being read.----REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)---AUTHORS- Simon Michael <simon@joyful.com> and contributors---COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.---SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org----hledger 1.14 March 2019 hledger_csv(5)
− embeddedfiles/hledger_journal.5
@@ -1,1772 +0,0 @@-.\"t--.TH "hledger_journal" "5" "March 2019" "hledger 1.14" "hledger User Manuals"----.SH NAME-.PP-Journal \- hledger\[aq]s default file format, representing a General-Journal-.SH DESCRIPTION-.PP-hledger\[aq]s usual data source is a plain text file containing journal-entries in hledger journal format.-This file represents a standard accounting general journal.-I use file names ending in \f[C]\&.journal\f[], but that\[aq]s not-required.-The journal file contains a number of transaction entries, each-describing a transfer of money (or any commodity) between two or more-named accounts, in a simple format readable by both hledger and humans.-.PP-hledger\[aq]s journal format is a compatible subset, mostly, of-ledger\[aq]s journal format, so hledger can work with compatible ledger-journal files as well.-It\[aq]s safe, and encouraged, to run both hledger and ledger on the-same journal file, eg to validate the results you\[aq]re getting.-.PP-You can use hledger without learning any more about this file; just use-the add or web commands to create and update it.-Many users, though, also edit the journal file directly with a text-editor, perhaps assisted by the helper modes for emacs or vim.-.PP-Here\[aq]s an example:-.IP-.nf-\f[C]-;\ A\ sample\ journal\ file.\ This\ is\ a\ comment.--2008/01/01\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ transaction\[aq]s\ first\ line\ starts\ in\ column\ 0,\ contains\ date\ and\ description-\ \ \ \ assets:bank:checking\ \ $1\ \ \ \ ;\ <\-\ posting\ lines\ start\ with\ whitespace,\ each\ contains\ an\ account\ name-\ \ \ \ income:salary\ \ \ \ \ \ \ \ $\-1\ \ \ \ ;\ \ \ \ followed\ by\ at\ least\ two\ spaces\ and\ an\ amount--2008/06/01\ gift-\ \ \ \ assets:bank:checking\ \ $1\ \ \ \ ;\ <\-\ at\ least\ two\ postings\ in\ a\ transaction-\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ ;\ <\-\ their\ amounts\ must\ balance\ to\ 0--2008/06/02\ save-\ \ \ \ assets:bank:saving\ \ \ \ $1-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ ;\ <\-\ one\ amount\ may\ be\ omitted;\ here\ $\-1\ is\ inferred--2008/06/03\ eat\ &\ shop\ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ description\ can\ be\ anything-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ $1-\ \ \ \ expenses:supplies\ \ \ \ \ $1\ \ \ \ ;\ <\-\ this\ transaction\ debits\ two\ expense\ accounts-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ $\-2\ inferred--2008/10/01\ take\ a\ loan-\ \ \ \ assets:bank:checking\ \ $1-\ \ \ \ liabilities:debts\ \ \ \ $\-1--2008/12/31\ *\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ ;\ <\-\ an\ optional\ *\ or\ !\ after\ the\ date\ means\ "cleared"\ (or\ anything\ you\ want)-\ \ \ \ liabilities:debts\ \ \ \ \ $1-\ \ \ \ assets:bank:checking-\f[]-.fi-.SH FILE FORMAT-.SS Transactions-.PP-Transactions are movements of some quantity of commodities between named-accounts.-Each transaction is represented by a journal entry beginning with a-simple date in column 0.-This can be followed by any of the following, separated by spaces:-.IP \[bu] 2-(optional) a status character (empty, \f[C]!\f[], or \f[C]*\f[])-.IP \[bu] 2-(optional) a transaction code (any short number or text, enclosed in-parentheses)-.IP \[bu] 2-(optional) a transaction description (any remaining text until end of-line or a semicolon)-.IP \[bu] 2-(optional) a transaction comment (any remaining text following a-semicolon until end of line)-.PP-Then comes zero or more (but usually at least 2) indented lines-representing...-.SS Postings-.PP-A posting is an addition of some amount to, or removal of some amount-from, an account.-Each posting line begins with at least one space or tab (2 or 4 spaces-is common), followed by:-.IP \[bu] 2-(optional) a status character (empty, \f[C]!\f[], or \f[C]*\f[]),-followed by a space-.IP \[bu] 2-(required) an account name (any text, optionally containing \f[B]single-spaces\f[], until end of line or a double space)-.IP \[bu] 2-(optional) \f[B]two or more spaces\f[] or tabs followed by an amount.-.PP-Positive amounts are being added to the account, negative amounts are-being removed.-.PP-The amounts within a transaction must always sum up to zero.-As a convenience, one amount may be left blank; it will be inferred so-as to balance the transaction.-.PP-Be sure to note the unusual two\-space delimiter between account name-and amount.-This makes it easy to write account names containing spaces.-But if you accidentally leave only one space (or tab) before the amount,-the amount will be considered part of the account name.-.SS Dates-.SS Simple dates-.PP-Within a journal file, transaction dates use Y/M/D (or Y\-M\-D or Y.M.D)-Leading zeros are optional.-The year may be omitted, in which case it will be inferred from the-context \- the current transaction, the default year set with a default-year directive, or the current date when the command is run.-Some examples: \f[C]2010/01/31\f[], \f[C]1/31\f[],-\f[C]2010\-01\-31\f[], \f[C]2010.1.31\f[].-.SS Secondary dates-.PP-Real\-life transactions sometimes involve more than one date \- eg the-date you write a cheque, and the date it clears in your bank.-When you want to model this, eg for more accurate balances, you can-specify individual posting dates, which I recommend.-Or, you can use the secondary dates (aka auxiliary/effective dates)-feature, supported for compatibility with Ledger.-.PP-A secondary date can be written after the primary date, separated by an-equals sign.-The primary date, on the left, is used by default; the secondary date,-on the right, is used when the \f[C]\-\-date2\f[] flag is specified-(\f[C]\-\-aux\-date\f[] or \f[C]\-\-effective\f[] also work).-.PP-The meaning of secondary dates is up to you, but it\[aq]s best to follow-a consistent rule.-Eg write the bank\[aq]s clearing date as primary, and when needed, the-date the transaction was initiated as secondary.-.PP-Here\[aq]s an example.-Note that a secondary date will use the year of the primary date if-unspecified.-.IP-.nf-\f[C]-2010/2/23=2/19\ movie\ ticket-\ \ expenses:cinema\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10-\ \ assets:checking-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ register\ checking-2010/02/23\ movie\ ticket\ \ \ \ \ \ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ $\-10-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ register\ checking\ \-\-date2-2010/02/19\ movie\ ticket\ \ \ \ \ \ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ $\-10-\f[]-.fi-.PP-Secondary dates require some effort; you must use them consistently in-your journal entries and remember whether to use or not use the-\f[C]\-\-date2\f[] flag for your reports.-They are included in hledger for Ledger compatibility, but posting dates-are a more powerful and less confusing alternative.-.SS Posting dates-.PP-You can give individual postings a different date from their parent-transaction, by adding a posting comment containing a tag (see below)-like \f[C]date:DATE\f[].-This is probably the best way to control posting dates precisely.-Eg in this example the expense should appear in May reports, and the-deduction from checking should be reported on 6/1 for easy bank-reconciliation:-.IP-.nf-\f[C]-2015/5/30-\ \ \ \ expenses:food\ \ \ \ \ $10\ \ \ ;\ food\ purchased\ on\ saturday\ 5/30-\ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ ;\ bank\ cleared\ it\ on\ monday,\ date:6/1-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ register\ food-2015/05/30\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ \ \ \ \ \ \ \ \ \ $10-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ register\ checking-2015/06/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ \ $\-10-\f[]-.fi-.PP-DATE should be a simple date; if the year is not specified it will use-the year of the transaction\[aq]s date.-You can set the secondary date similarly, with \f[C]date2:DATE2\f[].-The \f[C]date:\f[] or \f[C]date2:\f[] tags must have a valid simple date-value if they are present, eg a \f[C]date:\f[] tag with no value is not-allowed.-.PP-Ledger\[aq]s earlier, more compact bracketed date syntax is also-supported: \f[C][DATE]\f[], \f[C][DATE=DATE2]\f[] or \f[C][=DATE2]\f[].-hledger will attempt to parse any square\-bracketed sequence of the-\f[C]0123456789/\-.=\f[] characters in this way.-With this syntax, DATE infers its year from the transaction and DATE2-infers its year from DATE.-.SS Status-.PP-Transactions, or individual postings within a transaction, can have a-status mark, which is a single character before the transaction-description or posting account name, separated from it by a space,-indicating one of three statuses:-.PP-.TS-tab(@);-l l.-T{-mark \ -T}@T{-status-T}-_-T{-\ -T}@T{-unmarked-T}-T{-\f[C]!\f[]-T}@T{-pending-T}-T{-\f[C]*\f[]-T}@T{-cleared-T}-.TE-.PP-When reporting, you can filter by status with the-\f[C]\-U/\-\-unmarked\f[], \f[C]\-P/\-\-pending\f[], and-\f[C]\-C/\-\-cleared\f[] flags; or the \f[C]status:\f[],-\f[C]status:!\f[], and \f[C]status:*\f[] queries; or the U, P, C keys in-hledger\-ui.-.PP-Note, in Ledger and in older versions of hledger, the "unmarked" state-is called "uncleared".-As of hledger 1.3 we have renamed it to unmarked for clarity.-.PP-To replicate Ledger and old hledger\[aq]s behaviour of also matching-pending, combine \-U and \-P.-.PP-Status marks are optional, but can be helpful eg for reconciling with-real\-world accounts.-Some editor modes provide highlighting and shortcuts for working with-status.-Eg in Emacs ledger\-mode, you can toggle transaction status with C\-c-C\-e, or posting status with C\-c C\-c.-.PP-What "uncleared", "pending", and "cleared" actually mean is up to you.-Here\[aq]s one suggestion:-.PP-.TS-tab(@);-lw(9.9n) lw(60.1n).-T{-status-T}@T{-meaning-T}-_-T{-uncleared-T}@T{-recorded but not yet reconciled; needs review-T}-T{-pending-T}@T{-tentatively reconciled (if needed, eg during a big reconciliation)-T}-T{-cleared-T}@T{-complete, reconciled as far as possible, and considered correct-T}-.TE-.PP-With this scheme, you would use \f[C]\-PC\f[] to see the current balance-at your bank, \f[C]\-U\f[] to see things which will probably hit your-bank soon (like uncashed checks), and no flags to see the most-up\-to\-date state of your finances.-.SS Description-.PP-A transaction\[aq]s description is the rest of the line following the-date and status mark (or until a comment begins).-Sometimes called the "narration" in traditional bookkeeping, it can be-used for whatever you wish, or left blank.-Transaction descriptions can be queried, unlike comments.-.SS Payee and note-.PP-You can optionally include a \f[C]|\f[] (pipe) character in a-description to subdivide it into a payee/payer name on the left and-additional notes on the right.-This may be worthwhile if you need to do more precise querying and-pivoting by payee.-.SS Account names-.PP-Account names typically have several parts separated by a full colon,-from which hledger derives a hierarchical chart of accounts.-They can be anything you like, but in finance there are traditionally-five top\-level accounts: \f[C]assets\f[], \f[C]liabilities\f[],-\f[C]income\f[], \f[C]expenses\f[], and \f[C]equity\f[].-.PP-Account names may contain single spaces, eg:-\f[C]assets:accounts\ receivable\f[].-Because of this, they must always be followed by \f[B]two or more-spaces\f[] (or newline).-.PP-Account names can be aliased.-.SS Amounts-.PP-After the account name, there is usually an amount.-Important: between account name and amount, there must be \f[B]two or-more spaces\f[].-.PP-Amounts consist of a number and (usually) a currency symbol or commodity-name.-Some examples:-.PP-\f[C]2.00001\f[]-.PD 0-.P-.PD-\f[C]$1\f[]-.PD 0-.P-.PD-\f[C]4000\ AAPL\f[]-.PD 0-.P-.PD-\f[C]3\ "green\ apples"\f[]-.PD 0-.P-.PD-\f[C]\-$1,000,000.00\f[]-.PD 0-.P-.PD-\f[C]INR\ 9,99,99,999.00\f[]-.PD 0-.P-.PD-\f[C]EUR\ \-2.000.000,00\f[]-.PD 0-.P-.PD-\f[C]1\ 999\ 999.9455\f[]-.PD 0-.P-.PD-\f[C]EUR\ 1E3\f[]-.PD 0-.P-.PD-\f[C]1000E\-6s\f[]-.PP-As you can see, the amount format is somewhat flexible:-.IP \[bu] 2-amounts are a number (the "quantity") and optionally a currency-symbol/commodity name (the "commodity").-.IP \[bu] 2-the commodity is a symbol, word, or phrase, on the left or right, with-or without a separating space.-If the commodity contains numbers, spaces or non\-word punctuation it-must be enclosed in double quotes.-.IP \[bu] 2-negative amounts with a commodity on the left can have the minus sign-before or after it-.IP \[bu] 2-digit groups (thousands, or any other grouping) can be separated by-space or comma or period and should be used as separator between all-groups-.IP \[bu] 2-decimal part can be separated by comma or period and should be different-from digit groups separator-.IP \[bu] 2-scientific E\-notation is allowed.-Be careful not to use a digit group separator character in scientific-notation, as it\[aq]s not supported and it might get mistaken for a-decimal point.-(Declaring the digit group separator character explicitly with a-commodity directive will prevent this.)-.PP-You can use any of these variations when recording data.-However, there is some ambiguous way of representing numbers like-\f[C]$1.000\f[] and \f[C]$1,000\f[] both may mean either one thousand or-one dollar.-By default hledger will assume that this is sole delimiter is used only-for decimals.-On the other hand commodity format declared prior to that line will help-to resolve that ambiguity differently:-.IP-.nf-\f[C]-commodity\ $1,000.00--2017/12/25\ New\ life\ of\ Scrooge-\ \ \ \ expenses:gifts\ \ $1,000-\ \ \ \ assets-\f[]-.fi-.PP-Though journal may contain mixed styles to represent amount, when-hledger displays amounts, it will choose a consistent format for each-commodity.-(Except for price amounts, which are always formatted as written).-The display format is chosen as follows:-.IP \[bu] 2-if there is a commodity directive specifying the format, that is used-.IP \[bu] 2-otherwise the format is inferred from the first posting amount in that-commodity in the journal, and the precision (number of decimal places)-will be the maximum from all posting amounts in that commmodity-.IP \[bu] 2-or if there are no such amounts in the journal, a default format is used-(like \f[C]$1000.00\f[]).-.PP-Price amounts and amounts in \f[C]D\f[] directives usually don\[aq]t-affect amount format inference, but in some situations they can do so-indirectly.-(Eg when D\[aq]s default commodity is applied to a commodity\-less-amount, or when an amountless posting is balanced using a price\[aq]s-commodity, or when \-V is used.) If you find this causing problems, set-the desired format with a commodity directive.-.SS Virtual Postings-.PP-When you parenthesise the account name in a posting, we call that a-\f[I]virtual posting\f[], which means:-.IP \[bu] 2-it is ignored when checking that the transaction is balanced-.IP \[bu] 2-it is excluded from reports when the \f[C]\-\-real/\-R\f[] flag is used,-or the \f[C]real:1\f[] query.-.PP-You could use this, eg, to set an account\[aq]s opening balance without-needing to use the \f[C]equity:opening\ balances\f[] account:-.IP-.nf-\f[C]-1/1\ special\ unbalanced\ posting\ to\ set\ initial\ balance-\ \ (assets:checking)\ \ \ $1000-\f[]-.fi-.PP-When the account name is bracketed, we call it a \f[I]balanced virtual-posting\f[].-This is like an ordinary virtual posting except the balanced virtual-postings in a transaction must balance to 0, like the real postings (but-separately from them).-Balanced virtual postings are also excluded by \f[C]\-\-real/\-R\f[] or-\f[C]real:1\f[].-.IP-.nf-\f[C]-1/1\ buy\ food\ with\ cash,\ and\ update\ some\ budget\-tracking\ subaccounts\ elsewhere-\ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10-\ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10-\ \ [assets:checking:available]\ \ \ \ \ $10-\ \ [assets:checking:budget:food]\ \ $\-10-\f[]-.fi-.PP-Virtual postings have some legitimate uses, but those are few.-You can usually find an equivalent journal entry using real postings,-which is more correct and provides better error checking.-.SS Balance Assertions-.PP-hledger supports Ledger\-style balance assertions in journal files.-These look like, for example, \f[C]=\ EXPECTEDBALANCE\f[] following a-posting\[aq]s amount.-Eg here we assert the expected dollar balance in accounts a and b after-each posting:-.IP-.nf-\f[C]-2013/1/1-\ \ a\ \ \ $1\ \ =$1-\ \ b\ \ \ \ \ \ \ =$\-1--2013/1/2-\ \ a\ \ \ $1\ \ =$2-\ \ b\ \ $\-1\ \ =$\-2-\f[]-.fi-.PP-After reading a journal file, hledger will check all balance assertions-and report an error if any of them fail.-Balance assertions can protect you from, eg, inadvertently disrupting-reconciled balances while cleaning up old entries.-You can disable them temporarily with the-\f[C]\-I/\-\-ignore\-assertions\f[] flag, which can be useful for-troubleshooting or for reading Ledger files.-.SS Assertions and ordering-.PP-hledger sorts an account\[aq]s postings and assertions first by date and-then (for postings on the same day) by parse order.-Note this is different from Ledger, which sorts assertions only by parse-order.-(Also, Ledger assertions do not see the accumulated effect of repeated-postings to the same account within a transaction.)-.PP-So, hledger balance assertions keep working if you reorder-differently\-dated transactions within the journal.-But if you reorder same\-dated transactions or postings, assertions-might break and require updating.-This order dependence does bring an advantage: precise control over the-order of postings and assertions within a day, so you can assert-intra\-day balances.-.SS Assertions and included files-.PP-With included files, things are a little more complicated.-Including preserves the ordering of postings and assertions.-If you have multiple postings to an account on the same day, split-across different files, and you also want to assert the account\[aq]s-balance on the same day, you\[aq]ll have to put the assertion in the-right file.-.SS Assertions and multiple \-f options-.PP-Balance assertions don\[aq]t work well across files specified with-multiple \-f options.-Use include or concatenate the files instead.-.SS Assertions and commodities-.PP-The asserted balance must be a simple single\-commodity amount, and in-fact the assertion checks only this commodity\[aq]s balance within the-(possibly multi\-commodity) account balance.-.PD 0-.P-.PD-This is how assertions work in Ledger also.-We could call this a "partial" balance assertion.-.PP-To assert the balance of more than one commodity in an account, you can-write multiple postings, each asserting one commodity\[aq]s balance.-.PP-You can make a stronger "total" balance assertion by writing a double-equals sign (\f[C]==\ EXPECTEDBALANCE\f[]).-This asserts that there are no other unasserted commodities in the-account (or, that their balance is 0).-.IP-.nf-\f[C]-2013/1/1-\ \ a\ \ \ $1-\ \ a\ \ \ \ 1€-\ \ b\ \ $\-1-\ \ c\ \ \ \-1€--2013/1/2\ \ ;\ These\ assertions\ succeed-\ \ a\ \ \ \ 0\ \ =\ \ $1-\ \ a\ \ \ \ 0\ \ =\ \ \ 1€-\ \ b\ \ \ \ 0\ ==\ $\-1-\ \ c\ \ \ \ 0\ ==\ \ \-1€--2013/1/3\ \ ;\ This\ assertion\ fails\ as\ \[aq]a\[aq]\ also\ contains\ 1€-\ \ a\ \ \ \ 0\ ==\ \ $1-\f[]-.fi-.PP-It\[aq]s not yet possible to make a complete assertion about a balance-that has multiple commodities.-One workaround is to isolate each commodity into its own subaccount:-.IP-.nf-\f[C]-2013/1/1-\ \ a:usd\ \ \ $1-\ \ a:euro\ \ \ 1€-\ \ b--2013/1/2-\ \ a\ \ \ \ \ \ \ \ 0\ ==\ \ 0-\ \ a:usd\ \ \ \ 0\ ==\ $1-\ \ a:euro\ \ \ 0\ ==\ \ 1€-\f[]-.fi-.SS Assertions and prices-.PP-Balance assertions ignore transaction prices, and should normally be-written without one:-.IP-.nf-\f[C]-2019/1/1-\ \ (a)\ \ \ \ \ $1\ \@\ €1\ =\ $1-\f[]-.fi-.PP-We do allow prices to be written there, however, and print shows them,-even though they don\[aq]t affect whether the assertion passes or fails.-This is for backward compatibility (hledger\[aq]s close command used to-generate balance assertions with prices), and because balance-\f[I]assignments\f[] do use them (see below).-.SS Assertions and subaccounts-.PP-The balance assertions above (\f[C]=\f[] and \f[C]==\f[]) do not count-the balance from subaccounts; they check the account\[aq]s exclusive-balance only.-You can assert the balance including subaccounts by writing \f[C]=*\f[]-or \f[C]==*\f[], eg:-.IP-.nf-\f[C]-2019/1/1-\ \ equity:opening\ balances-\ \ checking:a\ \ \ \ \ \ \ 5-\ \ checking:b\ \ \ \ \ \ \ 5-\ \ checking\ \ \ \ \ \ \ \ \ 1\ \ ==*\ 11-\f[]-.fi-.SS Assertions and virtual postings-.PP-Balance assertions are checked against all postings, both real and-virtual.-They are not affected by the \f[C]\-\-real/\-R\f[] flag or-\f[C]real:\f[] query.-.SS Assertions and precision-.PP-Balance assertions compare the exactly calculated amounts, which are not-always what is shown by reports.-Eg a commodity directive may limit the display precision, but this will-not affect balance assertions.-Balance assertion failure messages show exact amounts.-.SS Balance Assignments-.PP-Ledger\-style balance assignments are also supported.-These are like balance assertions, but with no posting amount on the-left side of the equals sign; instead it is calculated automatically so-as to satisfy the assertion.-This can be a convenience during data entry, eg when setting opening-balances:-.IP-.nf-\f[C]-;\ starting\ a\ new\ journal,\ set\ asset\ account\ balances\ -2016/1/1\ opening\ balances-\ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ =\ $409.32-\ \ assets:savings\ \ \ \ \ \ \ \ \ \ \ \ \ =\ $735.24-\ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ =\ $42-\ \ equity:opening\ balances-\f[]-.fi-.PP-or when adjusting a balance to reality:-.IP-.nf-\f[C]-;\ no\ cash\ left;\ update\ balance,\ record\ any\ untracked\ spending\ as\ a\ generic\ expense-2016/1/15-\ \ assets:cash\ \ \ \ =\ $0-\ \ expenses:misc-\f[]-.fi-.PP-The calculated amount depends on the account\[aq]s balance in the-commodity at that point (which depends on the previously\-dated postings-of the commodity to that account since the last balance assertion or-assignment).-Note that using balance assignments makes your journal a little less-explicit; to know the exact amount posted, you have to run hledger or do-the calculations yourself, instead of just reading it.-.SS Balance assignments and prices-.PP-A transaction price in a balance assignment will cause the calculated-amount to have that price attached:-.IP-.nf-\f[C]-2019/1/1-\ \ (a)\ \ \ \ \ \ \ \ \ \ \ \ \ =\ $1\ \@\ €2-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ print\ \-\-explicit-2019/01/01-\ \ \ \ (a)\ \ \ \ \ \ \ \ \ $1\ \@\ €2\ =\ $1\ \@\ €2-\f[]-.fi-.SS Transaction prices-.PP-Within a transaction, you can note an amount\[aq]s price in another-commodity.-This can be used to document the cost (in a purchase) or selling price-(in a sale).-For example, transaction prices are useful to record purchases of a-foreign currency.-Note transaction prices are fixed at the time of the transaction, and do-not change over time.-See also market prices, which represent prevailing exchange rates on a-certain date.-.PP-There are several ways to record a transaction price:-.IP "1." 3-Write the price per unit, as \f[C]\@\ UNITPRICE\f[] after the amount:-.RS 4-.IP-.nf-\f[C]-2009/1/1-\ \ assets:euros\ \ \ \ \ €100\ \@\ $1.35\ \ ;\ one\ hundred\ euros\ purchased\ at\ $1.35\ each-\ \ assets:dollars\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ balancing\ amount\ is\ \-$135.00-\f[]-.fi-.RE-.IP "2." 3-Write the total price, as \f[C]\@\@\ TOTALPRICE\f[] after the amount:-.RS 4-.IP-.nf-\f[C]-2009/1/1-\ \ assets:euros\ \ \ \ \ €100\ \@\@\ $135\ \ ;\ one\ hundred\ euros\ purchased\ at\ $135\ for\ the\ lot-\ \ assets:dollars-\f[]-.fi-.RE-.IP "3." 3-Specify amounts for all postings, using exactly two commodities, and let-hledger infer the price that balances the transaction:-.RS 4-.IP-.nf-\f[C]-2009/1/1-\ \ assets:euros\ \ \ \ \ €100\ \ \ \ \ \ \ \ \ \ ;\ one\ hundred\ euros\ purchased-\ \ assets:dollars\ \ $\-135\ \ \ \ \ \ \ \ \ \ ;\ for\ $135-\f[]-.fi-.RE-.PP-(Ledger users: Ledger uses a different syntax for fixed prices,-\f[C]{=UNITPRICE}\f[], which hledger currently ignores).-.PP-Use the \f[C]\-B/\-\-cost\f[] flag to convert amounts to their-transaction price\[aq]s commodity, if any.-(mnemonic: "B" is from "cost Basis", as in Ledger).-Eg here is how \-B affects the balance report for the example above:-.IP-.nf-\f[C]-$\ hledger\ bal\ \-N\ \-\-flat-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-135\ \ assets:dollars-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros-$\ hledger\ bal\ \-N\ \-\-flat\ \-B-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-135\ \ assets:dollars-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $135\ \ assets:euros\ \ \ \ #\ <\-\ the\ euros\[aq]\ cost-\f[]-.fi-.PP-Note \-B is sensitive to the order of postings when a transaction price-is inferred: the inferred price will be in the commodity of the last-amount.-So if example 3\[aq]s postings are reversed, while the transaction is-equivalent, \-B shows something different:-.IP-.nf-\f[C]-2009/1/1-\ \ assets:dollars\ \ $\-135\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ 135\ dollars\ sold-\ \ assets:euros\ \ \ \ \ €100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ;\ for\ 100\ euros-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ bal\ \-N\ \-\-flat\ \-B-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €\-100\ \ assets:dollars\ \ #\ <\-\ the\ dollars\[aq]\ selling\ price-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros-\f[]-.fi-.SS Comments-.PP-Lines in the journal beginning with a semicolon (\f[C];\f[]) or hash-(\f[C]#\f[]) or star (\f[C]*\f[]) are comments, and will be ignored.-(Star comments cause org\-mode nodes to be ignored, allowing emacs users-to fold and navigate their journals with org\-mode or orgstruct\-mode.)-.PP-You can attach comments to a transaction by writing them after the-description and/or indented on the following lines (before the-postings).-Similarly, you can attach comments to an individual posting by writing-them after the amount and/or indented on the following lines.-Transaction and posting comments must begin with a semicolon-(\f[C];\f[]).-.PP-Some examples:-.IP-.nf-\f[C]-#\ a\ file\ comment--;\ also\ a\ file\ comment--comment-This\ is\ a\ multiline\ file\ comment,-which\ continues\ until\ a\ line-where\ the\ "end\ comment"\ string-appears\ on\ its\ own\ (or\ end\ of\ file).-end\ comment--2012/5/14\ something\ \ ;\ a\ transaction\ comment-\ \ \ \ ;\ the\ transaction\ comment,\ continued-\ \ \ \ posting1\ \ 1\ \ ;\ a\ comment\ for\ posting\ 1-\ \ \ \ posting2-\ \ \ \ ;\ a\ comment\ for\ posting\ 2-\ \ \ \ ;\ another\ comment\ line\ for\ posting\ 2-;\ a\ file\ comment\ (because\ not\ indented)-\f[]-.fi-.PP-You can also comment larger regions of a file using \f[C]comment\f[] and-\f[C]end\ comment\f[] directives.-.SS Tags-.PP-Tags are a way to add extra labels or labelled data to postings and-transactions, which you can then search or pivot on.-.PP-A simple tag is a word (which may contain hyphens) followed by a full-colon, written inside a transaction or posting comment line:-.IP-.nf-\f[C]-2017/1/16\ bought\ groceries\ \ \ \ ;\ sometag:-\f[]-.fi-.PP-Tags can have a value, which is the text after the colon, up to the next-comma or end of line, with leading/trailing whitespace removed:-.IP-.nf-\f[C]-\ \ \ \ expenses:food\ \ \ \ $10\ \ \ ;\ a\-posting\-tag:\ the\ tag\ value-\f[]-.fi-.PP-Note this means hledger\[aq]s tag values can not contain commas or-newlines.-Ending at commas means you can write multiple short tags on one line,-comma separated:-.IP-.nf-\f[C]-\ \ \ \ assets:checking\ \ \ \ \ \ \ ;\ a\ comment\ containing\ tag1:,\ tag2:\ some\ value\ ...-\f[]-.fi-.PP-Here,-.IP \[bu] 2-"\f[C]a\ comment\ containing\f[]" is just comment text, not a tag-.IP \[bu] 2-"\f[C]tag1\f[]" is a tag with no value-.IP \[bu] 2-"\f[C]tag2\f[]" is another tag, whose value is-"\f[C]some\ value\ ...\f[]"-.PP-Tags in a transaction comment affect the transaction and all of its-postings, while tags in a posting comment affect only that posting.-For example, the following transaction has three tags (\f[C]A\f[],-\f[C]TAG2\f[], \f[C]third\-tag\f[]) and the posting has four (those plus-\f[C]posting\-tag\f[]):-.IP-.nf-\f[C]-1/1\ a\ transaction\ \ ;\ A:,\ TAG2:-\ \ \ \ ;\ third\-tag:\ a\ third\ transaction\ tag,\ <\-\ with\ a\ value-\ \ \ \ (a)\ \ $1\ \ ;\ posting\-tag:-\f[]-.fi-.PP-Tags are like Ledger\[aq]s metadata feature, except hledger\[aq]s tag-values are simple strings.-.SS Directives-.PP-A directive is a line in the journal beginning with a special keyword,-that influences how the journal is processed.-hledger\[aq]s directives are based on a subset of Ledger\[aq]s, but-there are many differences (and also some differences between hledger-versions).-.PP-Directives\[aq] behaviour and interactions can get a little bit complex,-so here is a table summarising the directives and their effects, with-links to more detailed docs.-.PP-.TS-tab(@);-lw(7.8n) lw(8.6n) lw(7.0n) lw(27.8n) lw(18.8n).-T{-directive-T}@T{-end directive-T}@T{-subdirectives-T}@T{-purpose-T}@T{-can affect (as of 2018/06)-T}-_-T{-\f[C]account\f[]-T}@T{-T}@T{-any text-T}@T{-document account names, declare account types & display order-T}@T{-all entries in all files, before or after-T}-T{-\f[C]alias\f[]-T}@T{-\f[C]end\ aliases\f[]-T}@T{-T}@T{-rewrite account names-T}@T{-following inline/included entries until end of current file or end-directive-T}-T{-\f[C]apply\ account\f[]-T}@T{-\f[C]end\ apply\ account\f[]-T}@T{-T}@T{-prepend a common parent to account names-T}@T{-following inline/included entries until end of current file or end-directive-T}-T{-\f[C]comment\f[]-T}@T{-\f[C]end\ comment\f[]-T}@T{-T}@T{-ignore part of journal-T}@T{-following inline/included entries until end of current file or end-directive-T}-T{-\f[C]commodity\f[]-T}@T{-T}@T{-\f[C]format\f[]-T}@T{-declare a commodity and its number notation & display style-T}@T{-number notation: following entries in that commodity in all files;-display style: amounts of that commodity in reports-T}-T{-\f[C]D\f[]-T}@T{-T}@T{-T}@T{-declare a commodity, number notation & display style for commodityless-amounts-T}@T{-commodity: all commodityless entries in all files; number notation:-following commodityless entries and entries in that commodity in all-files; display style: amounts of that commodity in reports-T}-T{-\f[C]include\f[]-T}@T{-T}@T{-T}@T{-include entries/directives from another file-T}@T{-what the included directives affect-T}-T{-\f[C]P\f[]-T}@T{-T}@T{-T}@T{-declare a market price for a commodity-T}@T{-amounts of that commodity in reports, when \-V is used-T}-T{-\f[C]Y\f[]-T}@T{-T}@T{-T}@T{-declare a year for yearless dates-T}@T{-following inline/included entries until end of current file-T}-.TE-.PP-And some definitions:-.PP-.TS-tab(@);-lw(8.9n) lw(61.1n).-T{-subdirective-T}@T{-optional indented directive line immediately following a parent-directive-T}-T{-number notation-T}@T{-how to interpret numbers when parsing journal entries (the identity of-the decimal separator character).-(Currently each commodity can have its own notation, even in the same-file.)-T}-T{-display style-T}@T{-how to display amounts of a commodity in reports (symbol side and-spacing, digit groups, decimal separator, decimal places)-T}-T{-directive scope-T}@T{-which entries and (when there are multiple files) which files are-affected by a directive-T}-.TE-.PP-As you can see, directives vary in which journal entries and files they-affect, and whether they are focussed on input (parsing) or output-(reports).-Some directives have multiple effects.-.PP-If you have a journal made up of multiple files, or pass multiple \-f-options on the command line, note that directives which affect input-typically last only until the end of their defining file.-This provides more simplicity and predictability, eg reports are not-changed by writing file options in a different order.-It can be surprising at times though.-.SS Comment blocks-.PP-A line containing just \f[C]comment\f[] starts a commented region of the-file, and a line containing just \f[C]end\ comment\f[] (or the end of-the current file) ends it.-See also comments.-.SS Including other files-.PP-You can pull in the content of additional files by writing an include-directive, like this:-.IP-.nf-\f[C]-include\ path/to/file.journal-\f[]-.fi-.PP-If the path does not begin with a slash, it is relative to the current-file.-The include file path may contain common glob patterns (e.g.-\f[C]*\f[]).-.PP-The \f[C]include\f[] directive can only be used in journal files.-It can include journal, timeclock or timedot files, but not CSV files.-.SS Default year-.PP-You can set a default year to be used for subsequent dates which-don\[aq]t specify a year.-This is a line beginning with \f[C]Y\f[] followed by the year.-Eg:-.IP-.nf-\f[C]-Y2009\ \ \ \ \ \ ;\ set\ default\ year\ to\ 2009--12/15\ \ \ \ \ \ ;\ equivalent\ to\ 2009/12/15-\ \ expenses\ \ 1-\ \ assets--Y2010\ \ \ \ \ \ ;\ change\ default\ year\ to\ 2010--2009/1/30\ \ ;\ specifies\ the\ year,\ not\ affected-\ \ expenses\ \ 1-\ \ assets--1/31\ \ \ \ \ \ \ ;\ equivalent\ to\ 2010/1/31-\ \ expenses\ \ 1-\ \ assets-\f[]-.fi-.SS Declaring commodities-.PP-The \f[C]commodity\f[] directive declares commodities which may be used-in the journal (though currently we do not enforce this).-It may be written on a single line, like this:-.IP-.nf-\f[C]-;\ commodity\ EXAMPLEAMOUNT--;\ display\ AAAA\ amounts\ with\ the\ symbol\ on\ the\ right,\ space\-separated,-;\ using\ period\ as\ decimal\ point,\ with\ four\ decimal\ places,\ and-;\ separating\ thousands\ with\ comma.-commodity\ 1,000.0000\ AAAA-\f[]-.fi-.PP-or on multiple lines, using the "format" subdirective.-In this case the commodity symbol appears twice and should be the same-in both places:-.IP-.nf-\f[C]-;\ commodity\ SYMBOL-;\ \ \ format\ EXAMPLEAMOUNT--;\ display\ indian\ rupees\ with\ currency\ name\ on\ the\ left,-;\ thousands,\ lakhs\ and\ crores\ comma\-separated,-;\ period\ as\ decimal\ point,\ and\ two\ decimal\ places.-commodity\ INR-\ \ format\ INR\ 9,99,99,999.00-\f[]-.fi-.PP-Commodity directives have a second purpose: they define the standard-display format for amounts in the commodity.-Normally the display format is inferred from journal entries, but this-can be unpredictable; declaring it with a commodity directive overrides-this and removes ambiguity.-Towards this end, amounts in commodity directives must always be written-with a decimal point (a period or comma, followed by 0 or more decimal-digits).-.SS Default commodity-.PP-The \f[C]D\f[] directive sets a default commodity (and display format),-to be used for amounts without a commodity symbol (ie, plain numbers).-(Note this differs from Ledger\[aq]s default commodity directive.) The-commodity and display format will be applied to all subsequent-commodity\-less amounts, or until the next \f[C]D\f[] directive.-.IP-.nf-\f[C]-#\ commodity\-less\ amounts\ should\ be\ treated\ as\ dollars-#\ (and\ displayed\ with\ symbol\ on\ the\ left,\ thousands\ separators\ and\ two\ decimal\ places)-D\ $1,000.00--1/1-\ \ a\ \ \ \ \ 5\ \ \ \ ;\ <\-\ commodity\-less\ amount,\ becomes\ $1-\ \ b-\f[]-.fi-.PP-As with the \f[C]commodity\f[] directive, the amount must always be-written with a decimal point.-.SS Market prices-.PP-The \f[C]P\f[] directive declares a market price, which is an exchange-rate between two commodities on a certain date.-(In Ledger, they are called "historical prices".) These are often-obtained from a stock exchange, cryptocurrency exchange, or the foreign-exchange market.-.PP-Here is the format:-.IP-.nf-\f[C]-P\ DATE\ COMMODITYA\ COMMODITYBAMOUNT-\f[]-.fi-.IP \[bu] 2-DATE is a simple date-.IP \[bu] 2-COMMODITYA is the symbol of the commodity being priced-.IP \[bu] 2-COMMODITYBAMOUNT is an amount (symbol and quantity) in a second-commodity, giving the price in commodity B of one unit of commodity A.-.PP-These two market price directives say that one euro was worth 1.35 US-dollars during 2009, and $1.40 from 2010 onward:-.IP-.nf-\f[C]-P\ 2009/1/1\ €\ $1.35-P\ 2010/1/1\ €\ $1.40-\f[]-.fi-.PP-The \f[C]\-V/\-\-value\f[] flag can be used to convert reported amounts-to another commodity using these prices.-.SS Declaring accounts-.PP-\f[C]account\f[] directives can be used to pre\-declare accounts.-Though not required, they can provide several benefits:-.IP \[bu] 2-They can document your intended chart of accounts, providing a-reference.-.IP \[bu] 2-They can store extra information about accounts (account numbers, notes,-etc.)-.IP \[bu] 2-They can help hledger know your accounts\[aq] types (asset, liability,-equity, revenue, expense), useful for reports like balancesheet and-incomestatement.-.IP \[bu] 2-They control account display order in reports, allowing non\-alphabetic-sorting (eg Revenues to appear above Expenses).-.IP \[bu] 2-They help with account name completion in the add command,-hledger\-iadd, hledger\-web, ledger\-mode etc.-.PP-The simplest form is just the word \f[C]account\f[] followed by a-hledger\-style account name, eg:-.IP-.nf-\f[C]-account\ assets:bank:checking-\f[]-.fi-.SS Account comments-.PP-Comments, beginning with a semicolon, optionally including tags, can be-written after the account name, and/or on following lines.-Eg:-.IP-.nf-\f[C]-account\ assets:bank:checking\ \ ;\ a\ comment-\ \ ;\ another\ comment-\ \ ;\ acctno:12345,\ a\ tag-\f[]-.fi-.PP-Tip: comments on the same line require hledger 1.12+.-If you need your journal to be compatible with older hledger versions,-write comments on the next line instead.-.SS Account subdirectives-.PP-We also allow (and ignore) Ledger\-style indented subdirectives, just-for compatibility.:-.IP-.nf-\f[C]-account\ assets:bank:checking-\ \ format\ blah\ blah\ \ ;\ <\-\ subdirective,\ ignored-\f[]-.fi-.PP-Here is the full syntax of account directives:-.IP-.nf-\f[C]-account\ ACCTNAME\ \ [ACCTTYPE]\ [;COMMENT]-\ \ [;COMMENTS]-\ \ [LEDGER\-STYLE\ SUBDIRECTIVES,\ IGNORED]-\f[]-.fi-.SS Account types-.PP-hledger recognises five types (or classes) of account: Asset, Liability,-Equity, Revenue, Expense.-This is used by a few accounting\-aware reports such as balancesheet,-incomestatement and cashflow.-.SS Auto\-detected account types-.PP-If you name your top\-level accounts with some variation of-\f[C]assets\f[], \f[C]liabilities\f[]/\f[C]debts\f[], \f[C]equity\f[],-\f[C]revenues\f[]/\f[C]income\f[], or \f[C]expenses\f[], their types are-detected automatically.-.SS Account types declared with tags-.PP-More generally, you can declare an account\[aq]s type with an account-directive, by writing a \f[C]type:\f[] tag in a comment, followed by one-of the words \f[C]Asset\f[], \f[C]Liability\f[], \f[C]Equity\f[],-\f[C]Revenue\f[], \f[C]Expense\f[], or one of the letters \f[C]ALERX\f[]-(case insensitive):-.IP-.nf-\f[C]-account\ assets\ \ \ \ \ \ \ ;\ type:Asset-account\ liabilities\ \ ;\ type:Liability-account\ equity\ \ \ \ \ \ \ ;\ type:Equity-account\ revenues\ \ \ \ \ ;\ type:Revenue-account\ expenses\ \ \ \ \ ;\ type:Expenses-\f[]-.fi-.SS Account types declared with account type codes-.PP-Or, you can write one of those letters separated from the account name-by two or more spaces, but this should probably be considered deprecated-as of hledger 1.13:-.IP-.nf-\f[C]-account\ assets\ \ \ \ \ \ \ A-account\ liabilities\ \ L-account\ equity\ \ \ \ \ \ \ E-account\ revenues\ \ \ \ \ R-account\ expenses\ \ \ \ \ X-\f[]-.fi-.SS Overriding auto\-detected types-.PP-If you ever override the types of those auto\-detected english account-names mentioned above, you might need to help the reports a bit.-Eg:-.IP-.nf-\f[C]-;\ make\ "liabilities"\ not\ have\ the\ liability\ type\ \-\ who\ knows\ why-account\ liabilities\ \ \ ;\ type:E--;\ we\ need\ to\ ensure\ some\ other\ account\ has\ the\ liability\ type,\ -;\ otherwise\ balancesheet\ would\ still\ show\ "liabilities"\ under\ Liabilities\ -account\ \-\ \ \ \ \ \ \ \ \ \ \ \ \ ;\ type:L-\f[]-.fi-.SS Account display order-.PP-Account directives also set the order in which accounts are displayed,-eg in reports, the hledger\-ui accounts screen, and the hledger\-web-sidebar.-By default accounts are listed in alphabetical order.-But if you have these account directives in the journal:-.IP-.nf-\f[C]-account\ assets-account\ liabilities-account\ equity-account\ revenues-account\ expenses-\f[]-.fi-.PP-you\[aq]ll see those accounts displayed in declaration order, not-alphabetically:-.IP-.nf-\f[C]-$\ hledger\ accounts\ \-1-assets-liabilities-equity-revenues-expenses-\f[]-.fi-.PP-Undeclared accounts, if any, are displayed last, in alphabetical order.-.PP-Note that sorting is done at each level of the account tree (within each-group of sibling accounts under the same parent).-And currently, this directive:-.IP-.nf-\f[C]-account\ other:zoo-\f[]-.fi-.PP-would influence the position of \f[C]zoo\f[] among \f[C]other\f[]\[aq]s-subaccounts, but not the position of \f[C]other\f[] among the top\-level-accounts.-This means: \- you will sometimes declare parent accounts (eg-\f[C]account\ other\f[] above) that you don\[aq]t intend to post to,-just to customize their display order \- sibling accounts stay together-(you couldn\[aq]t display \f[C]x:y\f[] in between \f[C]a:b\f[] and-\f[C]a:c\f[]).-.SS Rewriting accounts-.PP-You can define account alias rules which rewrite your account names, or-parts of them, before generating reports.-This can be useful for:-.IP \[bu] 2-expanding shorthand account names to their full form, allowing easier-data entry and a less verbose journal-.IP \[bu] 2-adapting old journals to your current chart of accounts-.IP \[bu] 2-experimenting with new account organisations, like a new hierarchy or-combining two accounts into one-.IP \[bu] 2-customising reports-.PP-Account aliases also rewrite account names in account directives.-They do not affect account names being entered via hledger add or-hledger\-web.-.PP-See also Cookbook: Rewrite account names.-.SS Basic aliases-.PP-To set an account alias, use the \f[C]alias\f[] directive in your-journal file.-This affects all subsequent journal entries in the current file or its-included files.-The spaces around the = are optional:-.IP-.nf-\f[C]-alias\ OLD\ =\ NEW-\f[]-.fi-.PP-Or, you can use the \f[C]\-\-alias\ \[aq]OLD=NEW\[aq]\f[] option on the-command line.-This affects all entries.-It\[aq]s useful for trying out aliases interactively.-.PP-OLD and NEW are case sensitive full account names.-hledger will replace any occurrence of the old account name with the new-one.-Subaccounts are also affected.-Eg:-.IP-.nf-\f[C]-alias\ checking\ =\ assets:bank:wells\ fargo:checking-#\ rewrites\ "checking"\ to\ "assets:bank:wells\ fargo:checking",\ or\ "checking:a"\ to\ "assets:bank:wells\ fargo:checking:a"-\f[]-.fi-.SS Regex aliases-.PP-There is also a more powerful variant that uses a regular expression,-indicated by the forward slashes:-.IP-.nf-\f[C]-alias\ /REGEX/\ =\ REPLACEMENT-\f[]-.fi-.PP-or \f[C]\-\-alias\ \[aq]/REGEX/=REPLACEMENT\[aq]\f[].-.PP-REGEX is a case\-insensitive regular expression.-Anywhere it matches inside an account name, the matched part will be-replaced by REPLACEMENT.-If REGEX contains parenthesised match groups, these can be referenced by-the usual numeric backreferences in REPLACEMENT.-Eg:-.IP-.nf-\f[C]-alias\ /^(.+):bank:([^:]+)(.*)/\ =\ \\1:\\2\ \\3-#\ rewrites\ "assets:bank:wells\ fargo:checking"\ to\ \ "assets:wells\ fargo\ checking"-\f[]-.fi-.PP-Also note that REPLACEMENT continues to the end of line (or on command-line, to end of option argument), so it can contain trailing whitespace.-.SS Multiple aliases-.PP-You can define as many aliases as you like using directives or-command\-line options.-Aliases are recursive \- each alias sees the result of applying previous-ones.-(This is different from Ledger, where aliases are non\-recursive by-default).-Aliases are applied in the following order:-.IP "1." 3-alias directives, most recently seen first (recent directives take-precedence over earlier ones; directives not yet seen are ignored)-.IP "2." 3-alias options, in the order they appear on the command line-.SS \f[C]end\ aliases\f[]-.PP-You can clear (forget) all currently defined aliases with the-\f[C]end\ aliases\f[] directive:-.IP-.nf-\f[C]-end\ aliases-\f[]-.fi-.SS Default parent account-.PP-You can specify a parent account which will be prepended to all accounts-within a section of the journal.-Use the \f[C]apply\ account\f[] and \f[C]end\ apply\ account\f[]-directives like so:-.IP-.nf-\f[C]-apply\ account\ home--2010/1/1-\ \ \ \ food\ \ \ \ $10-\ \ \ \ cash--end\ apply\ account-\f[]-.fi-.PP-which is equivalent to:-.IP-.nf-\f[C]-2010/01/01-\ \ \ \ home:food\ \ \ \ \ \ \ \ \ \ \ $10-\ \ \ \ home:cash\ \ \ \ \ \ \ \ \ \ $\-10-\f[]-.fi-.PP-If \f[C]end\ apply\ account\f[] is omitted, the effect lasts to the end-of the file.-Included files are also affected, eg:-.IP-.nf-\f[C]-apply\ account\ business-include\ biz.journal-end\ apply\ account-apply\ account\ personal-include\ personal.journal-\f[]-.fi-.PP-Prior to hledger 1.0, legacy \f[C]account\f[] and \f[C]end\f[] spellings-were also supported.-.PP-A default parent account also affects account directives.-It does not affect account names being entered via hledger add or-hledger\-web.-If account aliases are present, they are applied after the default-parent account.-.SS Periodic transactions-.PP-Periodic transaction rules describe transactions that recur.-They allow you to generate future transactions for forecasting, without-having to write them out explicitly in the journal (with-\f[C]\-\-forecast\f[]).-Secondly, they also can be used to define budget goals (with-\f[C]\-\-budget\f[]).-.PP-A periodic transaction rule looks like a normal journal entry, with the-date replaced by a tilde (\f[C]~\f[]) followed by a period expression-(mnemonic: \f[C]~\f[] looks like a recurring sine wave.):-.IP-.nf-\f[C]-~\ monthly-\ \ \ \ expenses:rent\ \ \ \ \ \ \ \ \ \ $2000-\ \ \ \ assets:bank:checking-\f[]-.fi-.PP-There is an additional constraint on the period expression: the start-date must fall on a natural boundary of the interval.-Eg \f[C]monthly\ from\ 2018/1/1\f[] is valid, but-\f[C]monthly\ from\ 2018/1/15\f[] is not.-.PP-Partial or relative dates (M/D, D, tomorrow, last week) in the period-expression can work (useful or not).-They will be relative to today\[aq]s date, unless a Y default year-directive is in effect, in which case they will be relative to Y/1/1.-.SS Two spaces after the period expression-.PP-If the period expression is followed by a transaction description, these-must be separated by \f[B]two or more spaces\f[].-This helps hledger know where the period expression ends, so that-descriptions can not accidentally alter their meaning, as in this-example:-.IP-.nf-\f[C]-;\ 2\ or\ more\ spaces\ needed\ here,\ so\ the\ period\ is\ not\ understood\ as\ "every\ 2\ months\ in\ 2020"-;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||-;\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ vv-~\ every\ 2\ months\ \ in\ 2020,\ we\ will\ review-\ \ \ \ assets:bank:checking\ \ \ $1500-\ \ \ \ income:acme\ inc-\f[]-.fi-.SS Forecasting with periodic transactions-.PP-With the \f[C]\-\-forecast\f[] flag, each periodic transaction rule-generates future transactions recurring at the specified interval.-These are not saved in the journal, but appear in all reports.-They will look like normal transactions, but with an extra tag named-\f[C]recur\f[], whose value is the generating period expression.-.PP-Forecast transactions start on the first occurrence, and end on the last-occurrence, of their interval within the forecast period.-The forecast period:-.IP \[bu] 2-begins on the later of-.RS 2-.IP \[bu] 2-the report start date if specified with \-b/\-p/date:-.IP \[bu] 2-the day after the latest normal (non\-periodic) transaction in the-journal, or today if there are no normal transactions.-.RE-.IP \[bu] 2-ends on the report end date if specified with \-e/\-p/date:, or 180 days-from today.-.PP-where "today" means the current date at report time.-The "later of" rule ensures that forecast transactions do not overlap-normal transactions in time; they will begin only after normal-transactions end.-.PP-Forecasting can be useful for estimating balances into the future, and-experimenting with different scenarios.-Note the start date logic means that forecasted transactions are-automatically replaced by normal transactions as you add those.-.PP-Forecasting can also help with data entry: describe most of your-transactions with periodic rules, and every so often copy the output of-\f[C]print\ \-\-forecast\f[] to the journal.-.PP-You can generate one\-time transactions too: just write a period-expression specifying a date with no report interval.-(You could also write a normal transaction with a future date, but-remember this disables forecast transactions on previous dates.)-.SS Budgeting with periodic transactions-.PP-With the \f[C]\-\-budget\f[] flag, currently supported by the balance-command, each periodic transaction rule declares recurring budget goals-for the specified accounts.-Eg the first example above declares a goal of spending $2000 on rent-(and also, a goal of depositing $2000 into checking) every month.-Goals and actual performance can then be compared in budget reports.-.PP-For more details, see: balance: Budget report and Cookbook: Budgeting-and Forecasting.-.PP-.SS Transaction modifiers-.PP-Transaction modifier rules describe changes that should be applied-automatically to certain transactions.-They can be enabled by using the \f[C]\-\-auto\f[] flag.-Currently, just one kind of change is possible: adding extra postings.-These rule\-generated postings are known as "automated postings" or-"auto postings".-.PP-A transaction modifier rule looks quite like a normal transaction,-except the first line is an equals sign followed by a query that matches-certain postings (mnemonic: \f[C]=\f[] suggests matching).-And each "posting" is actually a posting\-generating rule:-.IP-.nf-\f[C]-=\ QUERY-\ \ \ \ ACCT\ \ AMT-\ \ \ \ ACCT\ \ [AMT]-\ \ \ \ ...-\f[]-.fi-.PP-These posting rules look like normal postings, except the amount can be:-.IP \[bu] 2-a normal amount with a commodity symbol, eg \f[C]$2\f[].-This will be used as\-is.-.IP \[bu] 2-a number, eg \f[C]2\f[].-The commodity symbol (if any) from the matched posting will be added to-this.-.IP \[bu] 2-a numeric multiplier, eg \f[C]*2\f[] (a star followed by a number N).-The matched posting\[aq]s amount (and total price, if any) will be-multiplied by N.-.IP \[bu] 2-a multiplier with a commodity symbol, eg \f[C]*$2\f[] (a star, number N,-and symbol S).-The matched posting\[aq]s amount will be multiplied by N, and its-commodity symbol will be replaced with S.-.PP-Some examples:-.IP-.nf-\f[C]-;\ every\ time\ I\ buy\ food,\ schedule\ a\ dollar\ donation-=\ expenses:food-\ \ \ \ (liabilities:charity)\ \ \ $\-1--;\ when\ I\ buy\ a\ gift,\ also\ deduct\ that\ amount\ from\ a\ budget\ envelope\ subaccount-=\ expenses:gifts-\ \ \ \ assets:checking:gifts\ \ *\-1-\ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ *1--2017/12/1-\ \ expenses:food\ \ \ \ $10-\ \ assets:checking--2017/12/14-\ \ expenses:gifts\ \ \ $20-\ \ assets:checking-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ print\ \-\-auto-2017/12/01-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ $10-\ \ \ \ assets:checking-\ \ \ \ (liabilities:charity)\ \ \ \ \ \ $\-1--2017/12/14-\ \ \ \ expenses:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ $20-\ \ \ \ assets:checking-\ \ \ \ assets:checking:gifts\ \ \ \ \ \-$20-\ \ \ \ assets:checking\ \ \ \ \ \ \ \ \ \ \ \ $20-\f[]-.fi-.SS Auto postings and transaction balancing / inferred amounts / balance-assertions-.PP-Currently, transaction modifiers are applied / auto postings are added:-.IP \[bu] 2-after missing amounts are inferred, and transactions are checked for-balancedness,-.IP \[bu] 2-but before balance assertions are checked.-.PP-Note this means that journal entries must be balanced both before and-after auto postings are added.-This changed in hledger 1.12+; see #893 for background.-.SH EDITOR SUPPORT-.PP-Helper modes exist for popular text editors, which make working with-journal files easier.-They add colour, formatting, tab completion, and helpful commands, and-are quite recommended if you edit your journal with a text editor.-They include ledger\-mode or hledger\-mode for Emacs, vim\-ledger for-Vim, hledger\-vscode for Visual Studio Code, and others.-See the [[Cookbook]] at hledger.org for the latest information.---.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)--.SH AUTHORS-Simon Michael <simon@joyful.com> and contributors--.SH COPYRIGHT--Copyright (C) 2007-2016 Simon Michael.-.br-Released under GNU GPL v3 or later.--.SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org
− embeddedfiles/hledger_journal.info
@@ -1,1693 +0,0 @@-This is hledger_journal.info, produced by makeinfo version 6.5 from-stdin.---File: hledger_journal.info, Node: Top, Next: FILE FORMAT, Up: (dir)--hledger_journal(5) hledger 1.14-*******************************--hledger's usual data source is a plain text file containing journal-entries in hledger journal format. This file represents a standard-accounting general journal. I use file names ending in '.journal', but-that's not required. The journal file contains a number of transaction-entries, each describing a transfer of money (or any commodity) between-two or more named accounts, in a simple format readable by both hledger-and humans.-- hledger's journal format is a compatible subset, mostly, of ledger's-journal format, so hledger can work with compatible ledger journal files-as well. It's safe, and encouraged, to run both hledger and ledger on-the same journal file, eg to validate the results you're getting.-- You can use hledger without learning any more about this file; just-use the add or web commands to create and update it. Many users,-though, also edit the journal file directly with a text editor, perhaps-assisted by the helper modes for emacs or vim.-- Here's an example:--; A sample journal file. This is a comment.--2008/01/01 income ; <- transaction's first line starts in column 0, contains date and description- assets:bank:checking $1 ; <- posting lines start with whitespace, each contains an account name- income:salary $-1 ; followed by at least two spaces and an amount--2008/06/01 gift- assets:bank:checking $1 ; <- at least two postings in a transaction- income:gifts $-1 ; <- their amounts must balance to 0--2008/06/02 save- assets:bank:saving $1- assets:bank:checking ; <- one amount may be omitted; here $-1 is inferred--2008/06/03 eat & shop ; <- description can be anything- expenses:food $1- expenses:supplies $1 ; <- this transaction debits two expense accounts- assets:cash ; <- $-2 inferred--2008/10/01 take a loan- assets:bank:checking $1- liabilities:debts $-1--2008/12/31 * pay off ; <- an optional * or ! after the date means "cleared" (or anything you want)- liabilities:debts $1- assets:bank:checking--* Menu:--* FILE FORMAT::-* EDITOR SUPPORT::---File: hledger_journal.info, Node: FILE FORMAT, Next: EDITOR SUPPORT, Prev: Top, Up: Top--1 FILE FORMAT-*************--* Menu:--* Transactions::-* Postings::-* Dates::-* Status::-* Description::-* Account names::-* Amounts::-* Virtual Postings::-* Balance Assertions::-* Balance Assignments::-* Transaction prices::-* Comments::-* Tags::-* Directives::-* Periodic transactions::-* Transaction modifiers::---File: hledger_journal.info, Node: Transactions, Next: Postings, Up: FILE FORMAT--1.1 Transactions-================--Transactions are movements of some quantity of commodities between named-accounts. Each transaction is represented by a journal entry beginning-with a simple date in column 0. This can be followed by any of the-following, separated by spaces:-- * (optional) a status character (empty, '!', or '*')- * (optional) a transaction code (any short number or text, enclosed- in parentheses)- * (optional) a transaction description (any remaining text until end- of line or a semicolon)- * (optional) a transaction comment (any remaining text following a- semicolon until end of line)-- Then comes zero or more (but usually at least 2) indented lines-representing...---File: hledger_journal.info, Node: Postings, Next: Dates, Prev: Transactions, Up: FILE FORMAT--1.2 Postings-============--A posting is an addition of some amount to, or removal of some amount-from, an account. Each posting line begins with at least one space or-tab (2 or 4 spaces is common), followed by:-- * (optional) a status character (empty, '!', or '*'), followed by a- space- * (required) an account name (any text, optionally containing *single- spaces*, until end of line or a double space)- * (optional) *two or more spaces* or tabs followed by an amount.-- Positive amounts are being added to the account, negative amounts are-being removed.-- The amounts within a transaction must always sum up to zero. As a-convenience, one amount may be left blank; it will be inferred so as to-balance the transaction.-- Be sure to note the unusual two-space delimiter between account name-and amount. This makes it easy to write account names containing-spaces. But if you accidentally leave only one space (or tab) before-the amount, the amount will be considered part of the account name.---File: hledger_journal.info, Node: Dates, Next: Status, Prev: Postings, Up: FILE FORMAT--1.3 Dates-=========--* Menu:--* Simple dates::-* Secondary dates::-* Posting dates::---File: hledger_journal.info, Node: Simple dates, Next: Secondary dates, Up: Dates--1.3.1 Simple dates---------------------Within a journal file, transaction dates use Y/M/D (or Y-M-D or Y.M.D)-Leading zeros are optional. The year may be omitted, in which case it-will be inferred from the context - the current transaction, the default-year set with a default year directive, or the current date when the-command is run. Some examples: '2010/01/31', '1/31', '2010-01-31',-'2010.1.31'.---File: hledger_journal.info, Node: Secondary dates, Next: Posting dates, Prev: Simple dates, Up: Dates--1.3.2 Secondary dates------------------------Real-life transactions sometimes involve more than one date - eg the-date you write a cheque, and the date it clears in your bank. When you-want to model this, eg for more accurate balances, you can specify-individual posting dates, which I recommend. Or, you can use the-secondary dates (aka auxiliary/effective dates) feature, supported for-compatibility with Ledger.-- A secondary date can be written after the primary date, separated by-an equals sign. The primary date, on the left, is used by default; the-secondary date, on the right, is used when the '--date2' flag is-specified ('--aux-date' or '--effective' also work).-- The meaning of secondary dates is up to you, but it's best to follow-a consistent rule. Eg write the bank's clearing date as primary, and-when needed, the date the transaction was initiated as secondary.-- Here's an example. Note that a secondary date will use the year of-the primary date if unspecified.--2010/2/23=2/19 movie ticket- expenses:cinema $10- assets:checking--$ hledger register checking-2010/02/23 movie ticket assets:checking $-10 $-10--$ hledger register checking --date2-2010/02/19 movie ticket assets:checking $-10 $-10-- Secondary dates require some effort; you must use them consistently-in your journal entries and remember whether to use or not use the-'--date2' flag for your reports. They are included in hledger for-Ledger compatibility, but posting dates are a more powerful and less-confusing alternative.---File: hledger_journal.info, Node: Posting dates, Prev: Secondary dates, Up: Dates--1.3.3 Posting dates----------------------You can give individual postings a different date from their parent-transaction, by adding a posting comment containing a tag (see below)-like 'date:DATE'. This is probably the best way to control posting-dates precisely. Eg in this example the expense should appear in May-reports, and the deduction from checking should be reported on 6/1 for-easy bank reconciliation:--2015/5/30- expenses:food $10 ; food purchased on saturday 5/30- assets:checking ; bank cleared it on monday, date:6/1--$ hledger -f t.j register food-2015/05/30 expenses:food $10 $10--$ hledger -f t.j register checking-2015/06/01 assets:checking $-10 $-10-- DATE should be a simple date; if the year is not specified it will-use the year of the transaction's date. You can set the secondary date-similarly, with 'date2:DATE2'. The 'date:' or 'date2:' tags must have a-valid simple date value if they are present, eg a 'date:' tag with no-value is not allowed.-- Ledger's earlier, more compact bracketed date syntax is also-supported: '[DATE]', '[DATE=DATE2]' or '[=DATE2]'. hledger will attempt-to parse any square-bracketed sequence of the '0123456789/-.='-characters in this way. With this syntax, DATE infers its year from the-transaction and DATE2 infers its year from DATE.---File: hledger_journal.info, Node: Status, Next: Description, Prev: Dates, Up: FILE FORMAT--1.4 Status-==========--Transactions, or individual postings within a transaction, can have a-status mark, which is a single character before the transaction-description or posting account name, separated from it by a space,-indicating one of three statuses:--mark status- ------------------- unmarked-'!' pending-'*' cleared-- When reporting, you can filter by status with the '-U/--unmarked',-'-P/--pending', and '-C/--cleared' flags; or the 'status:', 'status:!',-and 'status:*' queries; or the U, P, C keys in hledger-ui.-- Note, in Ledger and in older versions of hledger, the "unmarked"-state is called "uncleared". As of hledger 1.3 we have renamed it to-unmarked for clarity.-- To replicate Ledger and old hledger's behaviour of also matching-pending, combine -U and -P.-- Status marks are optional, but can be helpful eg for reconciling with-real-world accounts. Some editor modes provide highlighting and-shortcuts for working with status. Eg in Emacs ledger-mode, you can-toggle transaction status with C-c C-e, or posting status with C-c C-c.-- What "uncleared", "pending", and "cleared" actually mean is up to-you. Here's one suggestion:--status meaning----------------------------------------------------------------------------uncleared recorded but not yet reconciled; needs review-pending tentatively reconciled (if needed, eg during a big- reconciliation)-cleared complete, reconciled as far as possible, and considered- correct-- With this scheme, you would use '-PC' to see the current balance at-your bank, '-U' to see things which will probably hit your bank soon-(like uncashed checks), and no flags to see the most up-to-date state of-your finances.---File: hledger_journal.info, Node: Description, Next: Account names, Prev: Status, Up: FILE FORMAT--1.5 Description-===============--A transaction's description is the rest of the line following the date-and status mark (or until a comment begins). Sometimes called the-"narration" in traditional bookkeeping, it can be used for whatever you-wish, or left blank. Transaction descriptions can be queried, unlike-comments.-* Menu:--* Payee and note::---File: hledger_journal.info, Node: Payee and note, Up: Description--1.5.1 Payee and note-----------------------You can optionally include a '|' (pipe) character in a description to-subdivide it into a payee/payer name on the left and additional notes on-the right. This may be worthwhile if you need to do more precise-querying and pivoting by payee.---File: hledger_journal.info, Node: Account names, Next: Amounts, Prev: Description, Up: FILE FORMAT--1.6 Account names-=================--Account names typically have several parts separated by a full colon,-from which hledger derives a hierarchical chart of accounts. They can-be anything you like, but in finance there are traditionally five-top-level accounts: 'assets', 'liabilities', 'income', 'expenses', and-'equity'.-- Account names may contain single spaces, eg: 'assets:accounts-receivable'. Because of this, they must always be followed by *two or-more spaces* (or newline).-- Account names can be aliased.---File: hledger_journal.info, Node: Amounts, Next: Virtual Postings, Prev: Account names, Up: FILE FORMAT--1.7 Amounts-===========--After the account name, there is usually an amount. Important: between-account name and amount, there must be *two or more spaces*.-- Amounts consist of a number and (usually) a currency symbol or-commodity name. Some examples:-- '2.00001'-'$1'-'4000 AAPL'-'3 "green apples"'-'-$1,000,000.00'-'INR 9,99,99,999.00'-'EUR -2.000.000,00'-'1 999 999.9455'-'EUR 1E3'-'1000E-6s'-- As you can see, the amount format is somewhat flexible:-- * amounts are a number (the "quantity") and optionally a currency- symbol/commodity name (the "commodity").- * the commodity is a symbol, word, or phrase, on the left or right,- with or without a separating space. If the commodity contains- numbers, spaces or non-word punctuation it must be enclosed in- double quotes.- * negative amounts with a commodity on the left can have the minus- sign before or after it- * digit groups (thousands, or any other grouping) can be separated by- space or comma or period and should be used as separator between- all groups- * decimal part can be separated by comma or period and should be- different from digit groups separator- * scientific E-notation is allowed. Be careful not to use a digit- group separator character in scientific notation, as it's not- supported and it might get mistaken for a decimal point.- (Declaring the digit group separator character explicitly with a- commodity directive will prevent this.)-- You can use any of these variations when recording data. However,-there is some ambiguous way of representing numbers like '$1.000' and-'$1,000' both may mean either one thousand or one dollar. By default-hledger will assume that this is sole delimiter is used only for-decimals. On the other hand commodity format declared prior to that-line will help to resolve that ambiguity differently:--commodity $1,000.00--2017/12/25 New life of Scrooge- expenses:gifts $1,000- assets-- Though journal may contain mixed styles to represent amount, when-hledger displays amounts, it will choose a consistent format for each-commodity. (Except for price amounts, which are always formatted as-written). The display format is chosen as follows:-- * if there is a commodity directive specifying the format, that is- used- * otherwise the format is inferred from the first posting amount in- that commodity in the journal, and the precision (number of decimal- places) will be the maximum from all posting amounts in that- commmodity- * or if there are no such amounts in the journal, a default format is- used (like '$1000.00').-- Price amounts and amounts in 'D' directives usually don't affect-amount format inference, but in some situations they can do so-indirectly. (Eg when D's default commodity is applied to a-commodity-less amount, or when an amountless posting is balanced using a-price's commodity, or when -V is used.) If you find this causing-problems, set the desired format with a commodity directive.---File: hledger_journal.info, Node: Virtual Postings, Next: Balance Assertions, Prev: Amounts, Up: FILE FORMAT--1.8 Virtual Postings-====================--When you parenthesise the account name in a posting, we call that a-_virtual posting_, which means:-- * it is ignored when checking that the transaction is balanced- * it is excluded from reports when the '--real/-R' flag is used, or- the 'real:1' query.-- You could use this, eg, to set an account's opening balance without-needing to use the 'equity:opening balances' account:--1/1 special unbalanced posting to set initial balance- (assets:checking) $1000-- When the account name is bracketed, we call it a _balanced virtual-posting_. This is like an ordinary virtual posting except the balanced-virtual postings in a transaction must balance to 0, like the real-postings (but separately from them). Balanced virtual postings are also-excluded by '--real/-R' or 'real:1'.--1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere- expenses:food $10- assets:cash $-10- [assets:checking:available] $10- [assets:checking:budget:food] $-10-- Virtual postings have some legitimate uses, but those are few. You-can usually find an equivalent journal entry using real postings, which-is more correct and provides better error checking.---File: hledger_journal.info, Node: Balance Assertions, Next: Balance Assignments, Prev: Virtual Postings, Up: FILE FORMAT--1.9 Balance Assertions-======================--hledger supports Ledger-style balance assertions in journal files.-These look like, for example, '= EXPECTEDBALANCE' following a posting's-amount. Eg here we assert the expected dollar balance in accounts a and-b after each posting:--2013/1/1- a $1 =$1- b =$-1--2013/1/2- a $1 =$2- b $-1 =$-2-- After reading a journal file, hledger will check all balance-assertions and report an error if any of them fail. Balance assertions-can protect you from, eg, inadvertently disrupting reconciled balances-while cleaning up old entries. You can disable them temporarily with-the '-I/--ignore-assertions' flag, which can be useful for-troubleshooting or for reading Ledger files.-* Menu:--* Assertions and ordering::-* Assertions and included files::-* Assertions and multiple -f options::-* Assertions and commodities::-* Assertions and prices::-* Assertions and subaccounts::-* Assertions and virtual postings::-* Assertions and precision::---File: hledger_journal.info, Node: Assertions and ordering, Next: Assertions and included files, Up: Balance Assertions--1.9.1 Assertions and ordering--------------------------------hledger sorts an account's postings and assertions first by date and-then (for postings on the same day) by parse order. Note this is-different from Ledger, which sorts assertions only by parse order.-(Also, Ledger assertions do not see the accumulated effect of repeated-postings to the same account within a transaction.)-- So, hledger balance assertions keep working if you reorder-differently-dated transactions within the journal. But if you reorder-same-dated transactions or postings, assertions might break and require-updating. This order dependence does bring an advantage: precise-control over the order of postings and assertions within a day, so you-can assert intra-day balances.---File: hledger_journal.info, Node: Assertions and included files, Next: Assertions and multiple -f options, Prev: Assertions and ordering, Up: Balance Assertions--1.9.2 Assertions and included files--------------------------------------With included files, things are a little more complicated. Including-preserves the ordering of postings and assertions. If you have multiple-postings to an account on the same day, split across different files,-and you also want to assert the account's balance on the same day,-you'll have to put the assertion in the right file.---File: hledger_journal.info, Node: Assertions and multiple -f options, Next: Assertions and commodities, Prev: Assertions and included files, Up: Balance Assertions--1.9.3 Assertions and multiple -f options-------------------------------------------Balance assertions don't work well across files specified with multiple--f options. Use include or concatenate the files instead.---File: hledger_journal.info, Node: Assertions and commodities, Next: Assertions and prices, Prev: Assertions and multiple -f options, Up: Balance Assertions--1.9.4 Assertions and commodities-----------------------------------The asserted balance must be a simple single-commodity amount, and in-fact the assertion checks only this commodity's balance within the-(possibly multi-commodity) account balance.-This is how assertions work in Ledger also. We could call this a-"partial" balance assertion.-- To assert the balance of more than one commodity in an account, you-can write multiple postings, each asserting one commodity's balance.-- You can make a stronger "total" balance assertion by writing a double-equals sign ('== EXPECTEDBALANCE'). This asserts that there are no-other unasserted commodities in the account (or, that their balance is-0).--2013/1/1- a $1- a 1€- b $-1- c -1€--2013/1/2 ; These assertions succeed- a 0 = $1- a 0 = 1€- b 0 == $-1- c 0 == -1€--2013/1/3 ; This assertion fails as 'a' also contains 1€- a 0 == $1-- It's not yet possible to make a complete assertion about a balance-that has multiple commodities. One workaround is to isolate each-commodity into its own subaccount:--2013/1/1- a:usd $1- a:euro 1€- b--2013/1/2- a 0 == 0- a:usd 0 == $1- a:euro 0 == 1€---File: hledger_journal.info, Node: Assertions and prices, Next: Assertions and subaccounts, Prev: Assertions and commodities, Up: Balance Assertions--1.9.5 Assertions and prices------------------------------Balance assertions ignore transaction prices, and should normally be-written without one:--2019/1/1- (a) $1 @ €1 = $1-- We do allow prices to be written there, however, and print shows-them, even though they don't affect whether the assertion passes or-fails. This is for backward compatibility (hledger's close command used-to generate balance assertions with prices), and because balance-_assignments_ do use them (see below).---File: hledger_journal.info, Node: Assertions and subaccounts, Next: Assertions and virtual postings, Prev: Assertions and prices, Up: Balance Assertions--1.9.6 Assertions and subaccounts-----------------------------------The balance assertions above ('=' and '==') do not count the balance-from subaccounts; they check the account's exclusive balance only. You-can assert the balance including subaccounts by writing '=*' or '==*',-eg:--2019/1/1- equity:opening balances- checking:a 5- checking:b 5- checking 1 ==* 11---File: hledger_journal.info, Node: Assertions and virtual postings, Next: Assertions and precision, Prev: Assertions and subaccounts, Up: Balance Assertions--1.9.7 Assertions and virtual postings----------------------------------------Balance assertions are checked against all postings, both real and-virtual. They are not affected by the '--real/-R' flag or 'real:'-query.---File: hledger_journal.info, Node: Assertions and precision, Prev: Assertions and virtual postings, Up: Balance Assertions--1.9.8 Assertions and precision---------------------------------Balance assertions compare the exactly calculated amounts, which are not-always what is shown by reports. Eg a commodity directive may limit the-display precision, but this will not affect balance assertions. Balance-assertion failure messages show exact amounts.---File: hledger_journal.info, Node: Balance Assignments, Next: Transaction prices, Prev: Balance Assertions, Up: FILE FORMAT--1.10 Balance Assignments-========================--Ledger-style balance assignments are also supported. These are like-balance assertions, but with no posting amount on the left side of the-equals sign; instead it is calculated automatically so as to satisfy the-assertion. This can be a convenience during data entry, eg when setting-opening balances:--; starting a new journal, set asset account balances -2016/1/1 opening balances- assets:checking = $409.32- assets:savings = $735.24- assets:cash = $42- equity:opening balances-- or when adjusting a balance to reality:--; no cash left; update balance, record any untracked spending as a generic expense-2016/1/15- assets:cash = $0- expenses:misc-- The calculated amount depends on the account's balance in the-commodity at that point (which depends on the previously-dated postings-of the commodity to that account since the last balance assertion or-assignment). Note that using balance assignments makes your journal a-little less explicit; to know the exact amount posted, you have to run-hledger or do the calculations yourself, instead of just reading it.-* Menu:--* Balance assignments and prices::---File: hledger_journal.info, Node: Balance assignments and prices, Up: Balance Assignments--1.10.1 Balance assignments and prices----------------------------------------A transaction price in a balance assignment will cause the calculated-amount to have that price attached:--2019/1/1- (a) = $1 @ €2--$ hledger print --explicit-2019/01/01- (a) $1 @ €2 = $1 @ €2---File: hledger_journal.info, Node: Transaction prices, Next: Comments, Prev: Balance Assignments, Up: FILE FORMAT--1.11 Transaction prices-=======================--Within a transaction, you can note an amount's price in another-commodity. This can be used to document the cost (in a purchase) or-selling price (in a sale). For example, transaction prices are useful-to record purchases of a foreign currency. Note transaction prices are-fixed at the time of the transaction, and do not change over time. See-also market prices, which represent prevailing exchange rates on a-certain date.-- There are several ways to record a transaction price:-- 1. Write the price per unit, as '@ UNITPRICE' after the amount:-- 2009/1/1- assets:euros €100 @ $1.35 ; one hundred euros purchased at $1.35 each- assets:dollars ; balancing amount is -$135.00-- 2. Write the total price, as '@@ TOTALPRICE' after the amount:-- 2009/1/1- assets:euros €100 @@ $135 ; one hundred euros purchased at $135 for the lot- assets:dollars-- 3. Specify amounts for all postings, using exactly two commodities,- and let hledger infer the price that balances the transaction:-- 2009/1/1- assets:euros €100 ; one hundred euros purchased- assets:dollars $-135 ; for $135-- (Ledger users: Ledger uses a different syntax for fixed prices,-'{=UNITPRICE}', which hledger currently ignores).-- Use the '-B/--cost' flag to convert amounts to their transaction-price's commodity, if any. (mnemonic: "B" is from "cost Basis", as in-Ledger). Eg here is how -B affects the balance report for the example-above:--$ hledger bal -N --flat- $-135 assets:dollars- €100 assets:euros-$ hledger bal -N --flat -B- $-135 assets:dollars- $135 assets:euros # <- the euros' cost-- Note -B is sensitive to the order of postings when a transaction-price is inferred: the inferred price will be in the commodity of the-last amount. So if example 3's postings are reversed, while the-transaction is equivalent, -B shows something different:--2009/1/1- assets:dollars $-135 ; 135 dollars sold- assets:euros €100 ; for 100 euros--$ hledger bal -N --flat -B- €-100 assets:dollars # <- the dollars' selling price- €100 assets:euros---File: hledger_journal.info, Node: Comments, Next: Tags, Prev: Transaction prices, Up: FILE FORMAT--1.12 Comments-=============--Lines in the journal beginning with a semicolon (';') or hash ('#') or-star ('*') are comments, and will be ignored. (Star comments cause-org-mode nodes to be ignored, allowing emacs users to fold and navigate-their journals with org-mode or orgstruct-mode.)-- You can attach comments to a transaction by writing them after the-description and/or indented on the following lines (before the-postings). Similarly, you can attach comments to an individual posting-by writing them after the amount and/or indented on the following lines.-Transaction and posting comments must begin with a semicolon (';').-- Some examples:--# a file comment--; also a file comment--comment-This is a multiline file comment,-which continues until a line-where the "end comment" string-appears on its own (or end of file).-end comment--2012/5/14 something ; a transaction comment- ; the transaction comment, continued- posting1 1 ; a comment for posting 1- posting2- ; a comment for posting 2- ; another comment line for posting 2-; a file comment (because not indented)-- You can also comment larger regions of a file using 'comment' and-'end comment' directives.---File: hledger_journal.info, Node: Tags, Next: Directives, Prev: Comments, Up: FILE FORMAT--1.13 Tags-=========--Tags are a way to add extra labels or labelled data to postings and-transactions, which you can then search or pivot on.-- A simple tag is a word (which may contain hyphens) followed by a full-colon, written inside a transaction or posting comment line:--2017/1/16 bought groceries ; sometag:-- Tags can have a value, which is the text after the colon, up to the-next comma or end of line, with leading/trailing whitespace removed:-- expenses:food $10 ; a-posting-tag: the tag value-- Note this means hledger's tag values can not contain commas or-newlines. Ending at commas means you can write multiple short tags on-one line, comma separated:-- assets:checking ; a comment containing tag1:, tag2: some value ...-- Here,-- * "'a comment containing'" is just comment text, not a tag- * "'tag1'" is a tag with no value- * "'tag2'" is another tag, whose value is "'some value ...'"-- Tags in a transaction comment affect the transaction and all of its-postings, while tags in a posting comment affect only that posting. For-example, the following transaction has three tags ('A', 'TAG2',-'third-tag') and the posting has four (those plus 'posting-tag'):--1/1 a transaction ; A:, TAG2:- ; third-tag: a third transaction tag, <- with a value- (a) $1 ; posting-tag:-- Tags are like Ledger's metadata feature, except hledger's tag values-are simple strings.---File: hledger_journal.info, Node: Directives, Next: Periodic transactions, Prev: Tags, Up: FILE FORMAT--1.14 Directives-===============--A directive is a line in the journal beginning with a special keyword,-that influences how the journal is processed. hledger's directives are-based on a subset of Ledger's, but there are many differences (and also-some differences between hledger versions).-- Directives' behaviour and interactions can get a little bit complex,-so here is a table summarising the directives and their effects, with-links to more detailed docs.--directiveend subdirectivespurpose can affect (as of- directive 2018/06)-------------------------------------------------------------------------------'account' any document account names, all entries in- text declare account types & all files, before- display order or after-'alias' 'end rewrite account names following- aliases' inline/included- entries until end- of current file- or end directive-'apply 'end prepend a common parent to following-account' apply account names inline/included- account' entries until end- of current file- or end directive-'comment''end ignore part of journal following- comment' inline/included- entries until end- of current file- or end directive-'commodity' 'format'declare a commodity and its number notation:- number notation & display following entries- style in that commodity- in all files;- display style:- amounts of that- commodity in- reports-'D' declare a commodity, number commodity: all- notation & display style commodityless- for commodityless amounts entries in all- files; number- notation:- following- commodityless- entries and- entries in that- commodity in all- files; display- style: amounts of- that commodity in- reports-'include' include entries/directives what the included- from another file directives affect-'P' declare a market price for amounts of that- a commodity commodity in- reports, when -V- is used-'Y' declare a year for yearless following- dates inline/included- entries until end- of current file-- And some definitions:--subdirectiveoptional indented directive line immediately following a- parent directive-number how to interpret numbers when parsing journal entries (the-notation identity of the decimal separator character). (Currently- each commodity can have its own notation, even in the same- file.)-display how to display amounts of a commodity in reports (symbol side-style and spacing, digit groups, decimal separator, decimal places)-directive which entries and (when there are multiple files) which files-scope are affected by a directive-- As you can see, directives vary in which journal entries and files-they affect, and whether they are focussed on input (parsing) or output-(reports). Some directives have multiple effects.-- If you have a journal made up of multiple files, or pass multiple -f-options on the command line, note that directives which affect input-typically last only until the end of their defining file. This provides-more simplicity and predictability, eg reports are not changed by-writing file options in a different order. It can be surprising at-times though.-* Menu:--* Comment blocks::-* Including other files::-* Default year::-* Declaring commodities::-* Default commodity::-* Market prices::-* Declaring accounts::-* Rewriting accounts::-* Default parent account::---File: hledger_journal.info, Node: Comment blocks, Next: Including other files, Up: Directives--1.14.1 Comment blocks------------------------A line containing just 'comment' starts a commented region of the file,-and a line containing just 'end comment' (or the end of the current-file) ends it. See also comments.---File: hledger_journal.info, Node: Including other files, Next: Default year, Prev: Comment blocks, Up: Directives--1.14.2 Including other files-------------------------------You can pull in the content of additional files by writing an include-directive, like this:--include path/to/file.journal-- If the path does not begin with a slash, it is relative to the-current file. The include file path may contain common glob patterns-(e.g. '*').-- The 'include' directive can only be used in journal files. It can-include journal, timeclock or timedot files, but not CSV files.---File: hledger_journal.info, Node: Default year, Next: Declaring commodities, Prev: Including other files, Up: Directives--1.14.3 Default year----------------------You can set a default year to be used for subsequent dates which don't-specify a year. This is a line beginning with 'Y' followed by the year.-Eg:--Y2009 ; set default year to 2009--12/15 ; equivalent to 2009/12/15- expenses 1- assets--Y2010 ; change default year to 2010--2009/1/30 ; specifies the year, not affected- expenses 1- assets--1/31 ; equivalent to 2010/1/31- expenses 1- assets---File: hledger_journal.info, Node: Declaring commodities, Next: Default commodity, Prev: Default year, Up: Directives--1.14.4 Declaring commodities-------------------------------The 'commodity' directive declares commodities which may be used in the-journal (though currently we do not enforce this). It may be written on-a single line, like this:--; commodity EXAMPLEAMOUNT--; display AAAA amounts with the symbol on the right, space-separated,-; using period as decimal point, with four decimal places, and-; separating thousands with comma.-commodity 1,000.0000 AAAA-- or on multiple lines, using the "format" subdirective. In this case-the commodity symbol appears twice and should be the same in both-places:--; commodity SYMBOL-; format EXAMPLEAMOUNT--; display indian rupees with currency name on the left,-; thousands, lakhs and crores comma-separated,-; period as decimal point, and two decimal places.-commodity INR- format INR 9,99,99,999.00-- Commodity directives have a second purpose: they define the standard-display format for amounts in the commodity. Normally the display-format is inferred from journal entries, but this can be unpredictable;-declaring it with a commodity directive overrides this and removes-ambiguity. Towards this end, amounts in commodity directives must-always be written with a decimal point (a period or comma, followed by 0-or more decimal digits).---File: hledger_journal.info, Node: Default commodity, Next: Market prices, Prev: Declaring commodities, Up: Directives--1.14.5 Default commodity---------------------------The 'D' directive sets a default commodity (and display format), to be-used for amounts without a commodity symbol (ie, plain numbers). (Note-this differs from Ledger's default commodity directive.) The commodity-and display format will be applied to all subsequent commodity-less-amounts, or until the next 'D' directive.--# commodity-less amounts should be treated as dollars-# (and displayed with symbol on the left, thousands separators and two decimal places)-D $1,000.00--1/1- a 5 ; <- commodity-less amount, becomes $1- b-- As with the 'commodity' directive, the amount must always be written-with a decimal point.---File: hledger_journal.info, Node: Market prices, Next: Declaring accounts, Prev: Default commodity, Up: Directives--1.14.6 Market prices-----------------------The 'P' directive declares a market price, which is an exchange rate-between two commodities on a certain date. (In Ledger, they are called-"historical prices".) These are often obtained from a stock exchange,-cryptocurrency exchange, or the foreign exchange market.-- Here is the format:--P DATE COMMODITYA COMMODITYBAMOUNT-- * DATE is a simple date- * COMMODITYA is the symbol of the commodity being priced- * COMMODITYBAMOUNT is an amount (symbol and quantity) in a second- commodity, giving the price in commodity B of one unit of commodity- A.-- These two market price directives say that one euro was worth 1.35 US-dollars during 2009, and $1.40 from 2010 onward:--P 2009/1/1 € $1.35-P 2010/1/1 € $1.40-- The '-V/--value' flag can be used to convert reported amounts to-another commodity using these prices.---File: hledger_journal.info, Node: Declaring accounts, Next: Rewriting accounts, Prev: Market prices, Up: Directives--1.14.7 Declaring accounts----------------------------'account' directives can be used to pre-declare accounts. Though not-required, they can provide several benefits:-- * They can document your intended chart of accounts, providing a- reference.- * They can store extra information about accounts (account numbers,- notes, etc.)- * They can help hledger know your accounts' types (asset, liability,- equity, revenue, expense), useful for reports like balancesheet and- incomestatement.- * They control account display order in reports, allowing- non-alphabetic sorting (eg Revenues to appear above Expenses).- * They help with account name completion in the add command,- hledger-iadd, hledger-web, ledger-mode etc.-- The simplest form is just the word 'account' followed by a-hledger-style account name, eg:--account assets:bank:checking--* Menu:--* Account comments::-* Account subdirectives::-* Account types::-* Account display order::---File: hledger_journal.info, Node: Account comments, Next: Account subdirectives, Up: Declaring accounts--1.14.7.1 Account comments-.........................--Comments, beginning with a semicolon, optionally including tags, can be-written after the account name, and/or on following lines. Eg:--account assets:bank:checking ; a comment- ; another comment- ; acctno:12345, a tag-- Tip: comments on the same line require hledger 1.12+. If you need-your journal to be compatible with older hledger versions, write-comments on the next line instead.---File: hledger_journal.info, Node: Account subdirectives, Next: Account types, Prev: Account comments, Up: Declaring accounts--1.14.7.2 Account subdirectives-..............................--We also allow (and ignore) Ledger-style indented subdirectives, just for-compatibility.:--account assets:bank:checking- format blah blah ; <- subdirective, ignored-- Here is the full syntax of account directives:--account ACCTNAME [ACCTTYPE] [;COMMENT]- [;COMMENTS]- [LEDGER-STYLE SUBDIRECTIVES, IGNORED]---File: hledger_journal.info, Node: Account types, Next: Account display order, Prev: Account subdirectives, Up: Declaring accounts--1.14.7.3 Account types-......................--hledger recognises five types (or classes) of account: Asset, Liability,-Equity, Revenue, Expense. This is used by a few accounting-aware-reports such as balancesheet, incomestatement and cashflow.-Auto-detected account types If you name your top-level accounts with-some variation of 'assets', 'liabilities'/'debts', 'equity',-'revenues'/'income', or 'expenses', their types are detected-automatically. Account types declared with tags More generally, you can-declare an account's type with an account directive, by writing a-'type:' tag in a comment, followed by one of the words 'Asset',-'Liability', 'Equity', 'Revenue', 'Expense', or one of the letters-'ALERX' (case insensitive):--account assets ; type:Asset-account liabilities ; type:Liability-account equity ; type:Equity-account revenues ; type:Revenue-account expenses ; type:Expenses-- Account types declared with account type codes Or, you can write one-of those letters separated from the account name by two or more spaces,-but this should probably be considered deprecated as of hledger 1.13:--account assets A-account liabilities L-account equity E-account revenues R-account expenses X-- Overriding auto-detected types If you ever override the types of-those auto-detected english account names mentioned above, you might-need to help the reports a bit. Eg:--; make "liabilities" not have the liability type - who knows why-account liabilities ; type:E--; we need to ensure some other account has the liability type, -; otherwise balancesheet would still show "liabilities" under Liabilities -account - ; type:L---File: hledger_journal.info, Node: Account display order, Prev: Account types, Up: Declaring accounts--1.14.7.4 Account display order-..............................--Account directives also set the order in which accounts are displayed,-eg in reports, the hledger-ui accounts screen, and the hledger-web-sidebar. By default accounts are listed in alphabetical order. But if-you have these account directives in the journal:--account assets-account liabilities-account equity-account revenues-account expenses-- you'll see those accounts displayed in declaration order, not-alphabetically:--$ hledger accounts -1-assets-liabilities-equity-revenues-expenses-- Undeclared accounts, if any, are displayed last, in alphabetical-order.-- Note that sorting is done at each level of the account tree (within-each group of sibling accounts under the same parent). And currently,-this directive:--account other:zoo-- would influence the position of 'zoo' among 'other''s subaccounts,-but not the position of 'other' among the top-level accounts. This-means: - you will sometimes declare parent accounts (eg 'account other'-above) that you don't intend to post to, just to customize their display-order - sibling accounts stay together (you couldn't display 'x:y' in-between 'a:b' and 'a:c').---File: hledger_journal.info, Node: Rewriting accounts, Next: Default parent account, Prev: Declaring accounts, Up: Directives--1.14.8 Rewriting accounts----------------------------You can define account alias rules which rewrite your account names, or-parts of them, before generating reports. This can be useful for:-- * expanding shorthand account names to their full form, allowing- easier data entry and a less verbose journal- * adapting old journals to your current chart of accounts- * experimenting with new account organisations, like a new hierarchy- or combining two accounts into one- * customising reports-- Account aliases also rewrite account names in account directives.-They do not affect account names being entered via hledger add or-hledger-web.-- See also Cookbook: Rewrite account names.-* Menu:--* Basic aliases::-* Regex aliases::-* Multiple aliases::-* end aliases::---File: hledger_journal.info, Node: Basic aliases, Next: Regex aliases, Up: Rewriting accounts--1.14.8.1 Basic aliases-......................--To set an account alias, use the 'alias' directive in your journal file.-This affects all subsequent journal entries in the current file or its-included files. The spaces around the = are optional:--alias OLD = NEW-- Or, you can use the '--alias 'OLD=NEW'' option on the command line.-This affects all entries. It's useful for trying out aliases-interactively.-- OLD and NEW are case sensitive full account names. hledger will-replace any occurrence of the old account name with the new one.-Subaccounts are also affected. Eg:--alias checking = assets:bank:wells fargo:checking-# rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"---File: hledger_journal.info, Node: Regex aliases, Next: Multiple aliases, Prev: Basic aliases, Up: Rewriting accounts--1.14.8.2 Regex aliases-......................--There is also a more powerful variant that uses a regular expression,-indicated by the forward slashes:--alias /REGEX/ = REPLACEMENT-- or '--alias '/REGEX/=REPLACEMENT''.-- REGEX is a case-insensitive regular expression. Anywhere it matches-inside an account name, the matched part will be replaced by-REPLACEMENT. If REGEX contains parenthesised match groups, these can be-referenced by the usual numeric backreferences in REPLACEMENT. Eg:--alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3-# rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"-- Also note that REPLACEMENT continues to the end of line (or on-command line, to end of option argument), so it can contain trailing-whitespace.---File: hledger_journal.info, Node: Multiple aliases, Next: end aliases, Prev: Regex aliases, Up: Rewriting accounts--1.14.8.3 Multiple aliases-.........................--You can define as many aliases as you like using directives or-command-line options. Aliases are recursive - each alias sees the-result of applying previous ones. (This is different from Ledger, where-aliases are non-recursive by default). Aliases are applied in the-following order:-- 1. alias directives, most recently seen first (recent directives take- precedence over earlier ones; directives not yet seen are ignored)- 2. alias options, in the order they appear on the command line---File: hledger_journal.info, Node: end aliases, Prev: Multiple aliases, Up: Rewriting accounts--1.14.8.4 'end aliases'-......................--You can clear (forget) all currently defined aliases with the 'end-aliases' directive:--end aliases---File: hledger_journal.info, Node: Default parent account, Prev: Rewriting accounts, Up: Directives--1.14.9 Default parent account--------------------------------You can specify a parent account which will be prepended to all accounts-within a section of the journal. Use the 'apply account' and 'end apply-account' directives like so:--apply account home--2010/1/1- food $10- cash--end apply account-- which is equivalent to:--2010/01/01- home:food $10- home:cash $-10-- If 'end apply account' is omitted, the effect lasts to the end of the-file. Included files are also affected, eg:--apply account business-include biz.journal-end apply account-apply account personal-include personal.journal-- Prior to hledger 1.0, legacy 'account' and 'end' spellings were also-supported.-- A default parent account also affects account directives. It does-not affect account names being entered via hledger add or hledger-web.-If account aliases are present, they are applied after the default-parent account.---File: hledger_journal.info, Node: Periodic transactions, Next: Transaction modifiers, Prev: Directives, Up: FILE FORMAT--1.15 Periodic transactions-==========================--Periodic transaction rules describe transactions that recur. They allow-you to generate future transactions for forecasting, without having to-write them out explicitly in the journal (with '--forecast'). Secondly,-they also can be used to define budget goals (with '--budget').-- A periodic transaction rule looks like a normal journal entry, with-the date replaced by a tilde ('~') followed by a period expression-(mnemonic: '~' looks like a recurring sine wave.):--~ monthly- expenses:rent $2000- assets:bank:checking-- There is an additional constraint on the period expression: the start-date must fall on a natural boundary of the interval. Eg 'monthly from-2018/1/1' is valid, but 'monthly from 2018/1/15' is not.-- Partial or relative dates (M/D, D, tomorrow, last week) in the period-expression can work (useful or not). They will be relative to today's-date, unless a Y default year directive is in effect, in which case they-will be relative to Y/1/1.-* Menu:--* Two spaces after the period expression::-* Forecasting with periodic transactions::-* Budgeting with periodic transactions::---File: hledger_journal.info, Node: Two spaces after the period expression, Next: Forecasting with periodic transactions, Up: Periodic transactions--1.15.1 Two spaces after the period expression------------------------------------------------If the period expression is followed by a transaction description, these-must be separated by *two or more spaces*. This helps hledger know-where the period expression ends, so that descriptions can not-accidentally alter their meaning, as in this example:--; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2020"-; ||-; vv-~ every 2 months in 2020, we will review- assets:bank:checking $1500- income:acme inc---File: hledger_journal.info, Node: Forecasting with periodic transactions, Next: Budgeting with periodic transactions, Prev: Two spaces after the period expression, Up: Periodic transactions--1.15.2 Forecasting with periodic transactions------------------------------------------------With the '--forecast' flag, each periodic transaction rule generates-future transactions recurring at the specified interval. These are not-saved in the journal, but appear in all reports. They will look like-normal transactions, but with an extra tag named 'recur', whose value is-the generating period expression.-- Forecast transactions start on the first occurrence, and end on the-last occurrence, of their interval within the forecast period. The-forecast period:-- * begins on the later of- * the report start date if specified with -b/-p/date:- * the day after the latest normal (non-periodic) transaction in- the journal, or today if there are no normal transactions.-- * ends on the report end date if specified with -e/-p/date:, or 180- days from today.-- where "today" means the current date at report time. The "later of"-rule ensures that forecast transactions do not overlap normal-transactions in time; they will begin only after normal transactions-end.-- Forecasting can be useful for estimating balances into the future,-and experimenting with different scenarios. Note the start date logic-means that forecasted transactions are automatically replaced by normal-transactions as you add those.-- Forecasting can also help with data entry: describe most of your-transactions with periodic rules, and every so often copy the output of-'print --forecast' to the journal.-- You can generate one-time transactions too: just write a period-expression specifying a date with no report interval. (You could also-write a normal transaction with a future date, but remember this-disables forecast transactions on previous dates.)---File: hledger_journal.info, Node: Budgeting with periodic transactions, Prev: Forecasting with periodic transactions, Up: Periodic transactions--1.15.3 Budgeting with periodic transactions----------------------------------------------With the '--budget' flag, currently supported by the balance command,-each periodic transaction rule declares recurring budget goals for the-specified accounts. Eg the first example above declares a goal of-spending $2000 on rent (and also, a goal of depositing $2000 into-checking) every month. Goals and actual performance can then be-compared in budget reports.-- For more details, see: balance: Budget report and Cookbook: Budgeting-and Forecasting.---File: hledger_journal.info, Node: Transaction modifiers, Prev: Periodic transactions, Up: FILE FORMAT--1.16 Transaction modifiers-==========================--Transaction modifier rules describe changes that should be applied-automatically to certain transactions. They can be enabled by using the-'--auto' flag. Currently, just one kind of change is possible: adding-extra postings. These rule-generated postings are known as "automated-postings" or "auto postings".-- A transaction modifier rule looks quite like a normal transaction,-except the first line is an equals sign followed by a query that matches-certain postings (mnemonic: '=' suggests matching). And each "posting"-is actually a posting-generating rule:--= QUERY- ACCT AMT- ACCT [AMT]- ...-- These posting rules look like normal postings, except the amount can-be:-- * a normal amount with a commodity symbol, eg '$2'. This will be- used as-is.- * a number, eg '2'. The commodity symbol (if any) from the matched- posting will be added to this.- * a numeric multiplier, eg '*2' (a star followed by a number N). The- matched posting's amount (and total price, if any) will be- multiplied by N.- * a multiplier with a commodity symbol, eg '*$2' (a star, number N,- and symbol S). The matched posting's amount will be multiplied by- N, and its commodity symbol will be replaced with S.-- Some examples:--; every time I buy food, schedule a dollar donation-= expenses:food- (liabilities:charity) $-1--; when I buy a gift, also deduct that amount from a budget envelope subaccount-= expenses:gifts- assets:checking:gifts *-1- assets:checking *1--2017/12/1- expenses:food $10- assets:checking--2017/12/14- expenses:gifts $20- assets:checking--$ hledger print --auto-2017/12/01- expenses:food $10- assets:checking- (liabilities:charity) $-1--2017/12/14- expenses:gifts $20- assets:checking- assets:checking:gifts -$20- assets:checking $20--* Menu:--* Auto postings and transaction balancing / inferred amounts / balance assertions::---File: hledger_journal.info, Node: Auto postings and transaction balancing / inferred amounts / balance assertions, Up: Transaction modifiers--1.16.1 Auto postings and transaction balancing / inferred amounts /----------------------------------------------------------------------balance assertions Currently, transaction modifiers are applied / auto-postings are added:-- * after missing amounts are inferred, and transactions are checked- for balancedness,- * but before balance assertions are checked.-- Note this means that journal entries must be balanced both before and-after auto postings are added. This changed in hledger 1.12+; see #893-for background.---File: hledger_journal.info, Node: EDITOR SUPPORT, Prev: FILE FORMAT, Up: Top--2 EDITOR SUPPORT-****************--Helper modes exist for popular text editors, which make working with-journal files easier. They add colour, formatting, tab completion, and-helpful commands, and are quite recommended if you edit your journal-with a text editor. They include ledger-mode or hledger-mode for Emacs,-vim-ledger for Vim, hledger-vscode for Visual Studio Code, and others.-See the [[Cookbook]] at hledger.org for the latest information.---Tag Table:-Node: Top76-Node: FILE FORMAT2372-Ref: #file-format2496-Node: Transactions2783-Ref: #transactions2904-Node: Postings3588-Ref: #postings3715-Node: Dates4710-Ref: #dates4825-Node: Simple dates4890-Ref: #simple-dates5016-Node: Secondary dates5382-Ref: #secondary-dates5536-Node: Posting dates7099-Ref: #posting-dates7228-Node: Status8602-Ref: #status8722-Node: Description10430-Ref: #description10568-Node: Payee and note10887-Ref: #payee-and-note11001-Node: Account names11243-Ref: #account-names11386-Node: Amounts11873-Ref: #amounts12009-Node: Virtual Postings15026-Ref: #virtual-postings15185-Node: Balance Assertions16405-Ref: #balance-assertions16580-Node: Assertions and ordering17538-Ref: #assertions-and-ordering17724-Node: Assertions and included files18424-Ref: #assertions-and-included-files18665-Node: Assertions and multiple -f options18998-Ref: #assertions-and-multiple--f-options19252-Node: Assertions and commodities19384-Ref: #assertions-and-commodities19614-Node: Assertions and prices20770-Ref: #assertions-and-prices20982-Node: Assertions and subaccounts21422-Ref: #assertions-and-subaccounts21649-Node: Assertions and virtual postings21973-Ref: #assertions-and-virtual-postings22213-Node: Assertions and precision22355-Ref: #assertions-and-precision22546-Node: Balance Assignments22813-Ref: #balance-assignments22994-Node: Balance assignments and prices24158-Ref: #balance-assignments-and-prices24330-Node: Transaction prices24554-Ref: #transaction-prices24723-Node: Comments26991-Ref: #comments27125-Node: Tags28295-Ref: #tags28413-Node: Directives29815-Ref: #directives29958-Node: Comment blocks35565-Ref: #comment-blocks35710-Node: Including other files35886-Ref: #including-other-files36066-Node: Default year36474-Ref: #default-year36643-Node: Declaring commodities37066-Ref: #declaring-commodities37249-Node: Default commodity38476-Ref: #default-commodity38652-Node: Market prices39288-Ref: #market-prices39453-Node: Declaring accounts40294-Ref: #declaring-accounts40470-Node: Account comments41395-Ref: #account-comments41558-Node: Account subdirectives41953-Ref: #account-subdirectives42148-Node: Account types42461-Ref: #account-types42645-Node: Account display order44289-Ref: #account-display-order44459-Node: Rewriting accounts45588-Ref: #rewriting-accounts45773-Node: Basic aliases46507-Ref: #basic-aliases46653-Node: Regex aliases47357-Ref: #regex-aliases47528-Node: Multiple aliases48246-Ref: #multiple-aliases48421-Node: end aliases48919-Ref: #end-aliases49066-Node: Default parent account49167-Ref: #default-parent-account49333-Node: Periodic transactions50217-Ref: #periodic-transactions50399-Node: Two spaces after the period expression51524-Ref: #two-spaces-after-the-period-expression51769-Node: Forecasting with periodic transactions52254-Ref: #forecasting-with-periodic-transactions52544-Node: Budgeting with periodic transactions54231-Ref: #budgeting-with-periodic-transactions54470-Node: Transaction modifiers54929-Ref: #transaction-modifiers55092-Node: Auto postings and transaction balancing / inferred amounts / balance assertions57076-Ref: #auto-postings-and-transaction-balancing-inferred-amounts-balance-assertions57377-Node: EDITOR SUPPORT57755-Ref: #editor-support57873--End Tag Table
− embeddedfiles/hledger_journal.txt
@@ -1,1304 +0,0 @@--hledger_journal(5) hledger User Manuals hledger_journal(5)----NAME- Journal - hledger's default file format, representing a General Journal--DESCRIPTION- hledger's usual data source is a plain text file containing journal- entries in hledger journal format. This file represents a standard- accounting general journal. I use file names ending in .journal, but- that's not required. The journal file contains a number of transaction- entries, each describing a transfer of money (or any commodity) between- two or more named accounts, in a simple format readable by both hledger- and humans.-- hledger's journal format is a compatible subset, mostly, of ledger's- journal format, so hledger can work with compatible ledger journal- files as well. It's safe, and encouraged, to run both hledger and- ledger on the same journal file, eg to validate the results you're get-- ting.-- You can use hledger without learning any more about this file; just use- the add or web commands to create and update it. Many users, though,- also edit the journal file directly with a text editor, perhaps- assisted by the helper modes for emacs or vim.-- Here's an example:-- ; A sample journal file. This is a comment.-- 2008/01/01 income ; <- transaction's first line starts in column 0, contains date and description- assets:bank:checking $1 ; <- posting lines start with whitespace, each contains an account name- income:salary $-1 ; followed by at least two spaces and an amount-- 2008/06/01 gift- assets:bank:checking $1 ; <- at least two postings in a transaction- income:gifts $-1 ; <- their amounts must balance to 0-- 2008/06/02 save- assets:bank:saving $1- assets:bank:checking ; <- one amount may be omitted; here $-1 is inferred-- 2008/06/03 eat & shop ; <- description can be anything- expenses:food $1- expenses:supplies $1 ; <- this transaction debits two expense accounts- assets:cash ; <- $-2 inferred-- 2008/10/01 take a loan- assets:bank:checking $1- liabilities:debts $-1-- 2008/12/31 * pay off ; <- an optional * or ! after the date means "cleared" (or anything you want)- liabilities:debts $1- assets:bank:checking--FILE FORMAT- Transactions- Transactions are movements of some quantity of commodities between- named accounts. Each transaction is represented by a journal entry- beginning with a simple date in column 0. This can be followed by any- of the following, separated by spaces:-- o (optional) a status character (empty, !, or *)-- o (optional) a transaction code (any short number or text, enclosed in- parentheses)-- o (optional) a transaction description (any remaining text until end of- line or a semicolon)-- o (optional) a transaction comment (any remaining text following a- semicolon until end of line)-- Then comes zero or more (but usually at least 2) indented lines repre-- senting...-- Postings- A posting is an addition of some amount to, or removal of some amount- from, an account. Each posting line begins with at least one space or- tab (2 or 4 spaces is common), followed by:-- o (optional) a status character (empty, !, or *), followed by a space-- o (required) an account name (any text, optionally containing single- spaces, until end of line or a double space)-- o (optional) two or more spaces or tabs followed by an amount.-- Positive amounts are being added to the account, negative amounts are- being removed.-- The amounts within a transaction must always sum up to zero. As a con-- venience, one amount may be left blank; it will be inferred so as to- balance the transaction.-- Be sure to note the unusual two-space delimiter between account name- and amount. This makes it easy to write account names containing spa-- ces. But if you accidentally leave only one space (or tab) before the- amount, the amount will be considered part of the account name.-- Dates- Simple dates- Within a journal file, transaction dates use Y/M/D (or Y-M-D or Y.M.D)- Leading zeros are optional. The year may be omitted, in which case it- will be inferred from the context - the current transaction, the- default year set with a default year directive, or the current date- when the command is run. Some examples: 2010/01/31, 1/31, 2010-01-31,- 2010.1.31.-- Secondary dates- Real-life transactions sometimes involve more than one date - eg the- date you write a cheque, and the date it clears in your bank. When you- want to model this, eg for more accurate balances, you can specify- individual posting dates, which I recommend. Or, you can use the sec-- ondary dates (aka auxiliary/effective dates) feature, supported for- compatibility with Ledger.-- A secondary date can be written after the primary date, separated by an- equals sign. The primary date, on the left, is used by default; the- secondary date, on the right, is used when the --date2 flag is speci-- fied (--aux-date or --effective also work).-- The meaning of secondary dates is up to you, but it's best to follow a- consistent rule. Eg write the bank's clearing date as primary, and- when needed, the date the transaction was initiated as secondary.-- Here's an example. Note that a secondary date will use the year of the- primary date if unspecified.-- 2010/2/23=2/19 movie ticket- expenses:cinema $10- assets:checking-- $ hledger register checking- 2010/02/23 movie ticket assets:checking $-10 $-10-- $ hledger register checking --date2- 2010/02/19 movie ticket assets:checking $-10 $-10-- Secondary dates require some effort; you must use them consistently in- your journal entries and remember whether to use or not use the --date2- flag for your reports. They are included in hledger for Ledger compat-- ibility, but posting dates are a more powerful and less confusing- alternative.-- Posting dates- You can give individual postings a different date from their parent- transaction, by adding a posting comment containing a tag (see below)- like date:DATE. This is probably the best way to control posting dates- precisely. Eg in this example the expense should appear in May- reports, and the deduction from checking should be reported on 6/1 for- easy bank reconciliation:-- 2015/5/30- expenses:food $10 ; food purchased on saturday 5/30- assets:checking ; bank cleared it on monday, date:6/1-- $ hledger -f t.j register food- 2015/05/30 expenses:food $10 $10-- $ hledger -f t.j register checking- 2015/06/01 assets:checking $-10 $-10-- DATE should be a simple date; if the year is not specified it will use- the year of the transaction's date. You can set the secondary date- similarly, with date2:DATE2. The date: or date2: tags must have a- valid simple date value if they are present, eg a date: tag with no- value is not allowed.-- Ledger's earlier, more compact bracketed date syntax is also supported:- [DATE], [DATE=DATE2] or [=DATE2]. hledger will attempt to parse any- square-bracketed sequence of the 0123456789/-.= characters in this way.- With this syntax, DATE infers its year from the transaction and DATE2- infers its year from DATE.-- Status- Transactions, or individual postings within a transaction, can have a- status mark, which is a single character before the transaction- description or posting account name, separated from it by a space,- indicating one of three statuses:--- mark status- ------------------- unmarked- ! pending- * cleared-- When reporting, you can filter by status with the -U/--unmarked,- -P/--pending, and -C/--cleared flags; or the status:, status:!, and- status:* queries; or the U, P, C keys in hledger-ui.-- Note, in Ledger and in older versions of hledger, the "unmarked" state- is called "uncleared". As of hledger 1.3 we have renamed it to- unmarked for clarity.-- To replicate Ledger and old hledger's behaviour of also matching pend-- ing, combine -U and -P.-- Status marks are optional, but can be helpful eg for reconciling with- real-world accounts. Some editor modes provide highlighting and short-- cuts for working with status. Eg in Emacs ledger-mode, you can toggle- transaction status with C-c C-e, or posting status with C-c C-c.-- What "uncleared", "pending", and "cleared" actually mean is up to you.- Here's one suggestion:--- status meaning- --------------------------------------------------------------------------- uncleared recorded but not yet reconciled; needs review- pending tentatively reconciled (if needed, eg during a big reconcil-- iation)- cleared complete, reconciled as far as possible, and considered cor-- rect-- With this scheme, you would use -PC to see the current balance at your- bank, -U to see things which will probably hit your bank soon (like- uncashed checks), and no flags to see the most up-to-date state of your- finances.-- Description- A transaction's description is the rest of the line following the date- and status mark (or until a comment begins). Sometimes called the- "narration" in traditional bookkeeping, it can be used for whatever you- wish, or left blank. Transaction descriptions can be queried, unlike- comments.-- Payee and note- You can optionally include a | (pipe) character in a description to- subdivide it into a payee/payer name on the left and additional notes- on the right. This may be worthwhile if you need to do more precise- querying and pivoting by payee.-- Account names- Account names typically have several parts separated by a full colon,- from which hledger derives a hierarchical chart of accounts. They can- be anything you like, but in finance there are traditionally five- top-level accounts: assets, liabilities, income, expenses, and equity.-- Account names may contain single spaces, eg: assets:accounts receiv-- able. Because of this, they must always be followed by two or more- spaces (or newline).-- Account names can be aliased.-- Amounts- After the account name, there is usually an amount. Important: between- account name and amount, there must be two or more spaces.-- Amounts consist of a number and (usually) a currency symbol or commod-- ity name. Some examples:-- 2.00001- $1- 4000 AAPL- 3 "green apples"- -$1,000,000.00- INR 9,99,99,999.00- EUR -2.000.000,00- 1 999 999.9455- EUR 1E3- 1000E-6s-- As you can see, the amount format is somewhat flexible:-- o amounts are a number (the "quantity") and optionally a currency sym-- bol/commodity name (the "commodity").-- o the commodity is a symbol, word, or phrase, on the left or right,- with or without a separating space. If the commodity contains num-- bers, spaces or non-word punctuation it must be enclosed in double- quotes.-- o negative amounts with a commodity on the left can have the minus sign- before or after it-- o digit groups (thousands, or any other grouping) can be separated by- space or comma or period and should be used as separator between all- groups-- o decimal part can be separated by comma or period and should be dif-- ferent from digit groups separator-- o scientific E-notation is allowed. Be careful not to use a digit- group separator character in scientific notation, as it's not sup-- ported and it might get mistaken for a decimal point. (Declaring the- digit group separator character explicitly with a commodity directive- will prevent this.)-- You can use any of these variations when recording data. However,- there is some ambiguous way of representing numbers like $1.000 and- $1,000 both may mean either one thousand or one dollar. By default- hledger will assume that this is sole delimiter is used only for deci-- mals. On the other hand commodity format declared prior to that line- will help to resolve that ambiguity differently:-- commodity $1,000.00-- 2017/12/25 New life of Scrooge- expenses:gifts $1,000- assets-- Though journal may contain mixed styles to represent amount, when- hledger displays amounts, it will choose a consistent format for each- commodity. (Except for price amounts, which are always formatted as- written). The display format is chosen as follows:-- o if there is a commodity directive specifying the format, that is used-- o otherwise the format is inferred from the first posting amount in- that commodity in the journal, and the precision (number of decimal- places) will be the maximum from all posting amounts in that commmod-- ity-- o or if there are no such amounts in the journal, a default format is- used (like $1000.00).-- Price amounts and amounts in D directives usually don't affect amount- format inference, but in some situations they can do so indirectly.- (Eg when D's default commodity is applied to a commodity-less amount,- or when an amountless posting is balanced using a price's commodity, or- when -V is used.) If you find this causing problems, set the desired- format with a commodity directive.-- Virtual Postings- When you parenthesise the account name in a posting, we call that a- virtual posting, which means:-- o it is ignored when checking that the transaction is balanced-- o it is excluded from reports when the --real/-R flag is used, or the- real:1 query.-- You could use this, eg, to set an account's opening balance without- needing to use the equity:opening balances account:-- 1/1 special unbalanced posting to set initial balance- (assets:checking) $1000-- When the account name is bracketed, we call it a balanced virtual post-- ing. This is like an ordinary virtual posting except the balanced vir-- tual postings in a transaction must balance to 0, like the real post-- ings (but separately from them). Balanced virtual postings are also- excluded by --real/-R or real:1.-- 1/1 buy food with cash, and update some budget-tracking subaccounts elsewhere- expenses:food $10- assets:cash $-10- [assets:checking:available] $10- [assets:checking:budget:food] $-10-- Virtual postings have some legitimate uses, but those are few. You can- usually find an equivalent journal entry using real postings, which is- more correct and provides better error checking.-- Balance Assertions- hledger supports Ledger-style balance assertions in journal files.- These look like, for example, = EXPECTEDBALANCE following a posting's- amount. Eg here we assert the expected dollar balance in accounts a- and b after each posting:-- 2013/1/1- a $1 =$1- b =$-1-- 2013/1/2- a $1 =$2- b $-1 =$-2-- After reading a journal file, hledger will check all balance assertions- and report an error if any of them fail. Balance assertions can pro-- tect you from, eg, inadvertently disrupting reconciled balances while- cleaning up old entries. You can disable them temporarily with the- -I/--ignore-assertions flag, which can be useful for troubleshooting or- for reading Ledger files.-- Assertions and ordering- hledger sorts an account's postings and assertions first by date and- then (for postings on the same day) by parse order. Note this is dif-- ferent from Ledger, which sorts assertions only by parse order. (Also,- Ledger assertions do not see the accumulated effect of repeated post-- ings to the same account within a transaction.)-- So, hledger balance assertions keep working if you reorder differ-- ently-dated transactions within the journal. But if you reorder- same-dated transactions or postings, assertions might break and require- updating. This order dependence does bring an advantage: precise con-- trol over the order of postings and assertions within a day, so you can- assert intra-day balances.-- Assertions and included files- With included files, things are a little more complicated. Including- preserves the ordering of postings and assertions. If you have multi-- ple postings to an account on the same day, split across different- files, and you also want to assert the account's balance on the same- day, you'll have to put the assertion in the right file.-- Assertions and multiple -f options- Balance assertions don't work well across files specified with multiple- -f options. Use include or concatenate the files instead.-- Assertions and commodities- The asserted balance must be a simple single-commodity amount, and in- fact the assertion checks only this commodity's balance within the- (possibly multi-commodity) account balance.- This is how assertions work in Ledger also. We could call this a "par-- tial" balance assertion.-- To assert the balance of more than one commodity in an account, you can- write multiple postings, each asserting one commodity's balance.-- You can make a stronger "total" balance assertion by writing a double- equals sign (== EXPECTEDBALANCE). This asserts that there are no other- unasserted commodities in the account (or, that their balance is 0).-- 2013/1/1- a $1- a 1- b $-1- c -1-- 2013/1/2 ; These assertions succeed- a 0 = $1- a 0 = 1- b 0 == $-1- c 0 == -1-- 2013/1/3 ; This assertion fails as 'a' also contains 1- a 0 == $1-- It's not yet possible to make a complete assertion about a balance that- has multiple commodities. One workaround is to isolate each commodity- into its own subaccount:-- 2013/1/1- a:usd $1- a:euro 1- b-- 2013/1/2- a 0 == 0- a:usd 0 == $1- a:euro 0 == 1-- Assertions and prices- Balance assertions ignore transaction prices, and should normally be- written without one:-- 2019/1/1- (a) $1 @ 1 = $1-- We do allow prices to be written there, however, and print shows them,- even though they don't affect whether the assertion passes or fails.- This is for backward compatibility (hledger's close command used to- generate balance assertions with prices), and because balance assign-- ments do use them (see below).-- Assertions and subaccounts- The balance assertions above (= and ==) do not count the balance from- subaccounts; they check the account's exclusive balance only. You can- assert the balance including subaccounts by writing =* or ==*, eg:-- 2019/1/1- equity:opening balances- checking:a 5- checking:b 5- checking 1 ==* 11-- Assertions and virtual postings- Balance assertions are checked against all postings, both real and vir-- tual. They are not affected by the --real/-R flag or real: query.-- Assertions and precision- Balance assertions compare the exactly calculated amounts, which are- not always what is shown by reports. Eg a commodity directive may- limit the display precision, but this will not affect balance asser-- tions. Balance assertion failure messages show exact amounts.-- Balance Assignments- Ledger-style balance assignments are also supported. These are like- balance assertions, but with no posting amount on the left side of the- equals sign; instead it is calculated automatically so as to satisfy- the assertion. This can be a convenience during data entry, eg when- setting opening balances:-- ; starting a new journal, set asset account balances- 2016/1/1 opening balances- assets:checking = $409.32- assets:savings = $735.24- assets:cash = $42- equity:opening balances-- or when adjusting a balance to reality:-- ; no cash left; update balance, record any untracked spending as a generic expense- 2016/1/15- assets:cash = $0- expenses:misc-- The calculated amount depends on the account's balance in the commodity- at that point (which depends on the previously-dated postings of the- commodity to that account since the last balance assertion or assign-- ment). Note that using balance assignments makes your journal a little- less explicit; to know the exact amount posted, you have to run hledger- or do the calculations yourself, instead of just reading it.-- Balance assignments and prices- A transaction price in a balance assignment will cause the calculated- amount to have that price attached:-- 2019/1/1- (a) = $1 @ 2-- $ hledger print --explicit- 2019/01/01- (a) $1 @ 2 = $1 @ 2-- Transaction prices- Within a transaction, you can note an amount's price in another commod-- ity. This can be used to document the cost (in a purchase) or selling- price (in a sale). For example, transaction prices are useful to- record purchases of a foreign currency. Note transaction prices are- fixed at the time of the transaction, and do not change over time. See- also market prices, which represent prevailing exchange rates on a cer-- tain date.-- There are several ways to record a transaction price:-- 1. Write the price per unit, as @ UNITPRICE after the amount:-- 2009/1/1- assets:euros 100 @ $1.35 ; one hundred euros purchased at $1.35 each- assets:dollars ; balancing amount is -$135.00-- 2. Write the total price, as @@ TOTALPRICE after the amount:-- 2009/1/1- assets:euros 100 @@ $135 ; one hundred euros purchased at $135 for the lot- assets:dollars-- 3. Specify amounts for all postings, using exactly two commodities, and- let hledger infer the price that balances the transaction:-- 2009/1/1- assets:euros 100 ; one hundred euros purchased- assets:dollars $-135 ; for $135-- (Ledger users: Ledger uses a different syntax for fixed prices, {=UNIT-- PRICE}, which hledger currently ignores).-- Use the -B/--cost flag to convert amounts to their transaction price's- commodity, if any. (mnemonic: "B" is from "cost Basis", as in Ledger).- Eg here is how -B affects the balance report for the example above:-- $ hledger bal -N --flat- $-135 assets:dollars- 100 assets:euros- $ hledger bal -N --flat -B- $-135 assets:dollars- $135 assets:euros # <- the euros' cost-- Note -B is sensitive to the order of postings when a transaction price- is inferred: the inferred price will be in the commodity of the last- amount. So if example 3's postings are reversed, while the transaction- is equivalent, -B shows something different:-- 2009/1/1- assets:dollars $-135 ; 135 dollars sold- assets:euros 100 ; for 100 euros-- $ hledger bal -N --flat -B- -100 assets:dollars # <- the dollars' selling price- 100 assets:euros-- Comments- Lines in the journal beginning with a semicolon (;) or hash (#) or star- (*) are comments, and will be ignored. (Star comments cause org-mode- nodes to be ignored, allowing emacs users to fold and navigate their- journals with org-mode or orgstruct-mode.)-- You can attach comments to a transaction by writing them after the- description and/or indented on the following lines (before the post-- ings). Similarly, you can attach comments to an individual posting by- writing them after the amount and/or indented on the following lines.- Transaction and posting comments must begin with a semicolon (;).-- Some examples:-- # a file comment-- ; also a file comment-- comment- This is a multiline file comment,- which continues until a line- where the "end comment" string- appears on its own (or end of file).- end comment-- 2012/5/14 something ; a transaction comment- ; the transaction comment, continued- posting1 1 ; a comment for posting 1- posting2- ; a comment for posting 2- ; another comment line for posting 2- ; a file comment (because not indented)-- You can also comment larger regions of a file using comment and- end comment directives.-- Tags- Tags are a way to add extra labels or labelled data to postings and- transactions, which you can then search or pivot on.-- A simple tag is a word (which may contain hyphens) followed by a full- colon, written inside a transaction or posting comment line:-- 2017/1/16 bought groceries ; sometag:-- Tags can have a value, which is the text after the colon, up to the- next comma or end of line, with leading/trailing whitespace removed:-- expenses:food $10 ; a-posting-tag: the tag value-- Note this means hledger's tag values can not contain commas or new-- lines. Ending at commas means you can write multiple short tags on one- line, comma separated:-- assets:checking ; a comment containing tag1:, tag2: some value ...-- Here,-- o "a comment containing" is just comment text, not a tag-- o "tag1" is a tag with no value-- o "tag2" is another tag, whose value is "some value ..."-- Tags in a transaction comment affect the transaction and all of its- postings, while tags in a posting comment affect only that posting.- For example, the following transaction has three tags (A, TAG2,- third-tag) and the posting has four (those plus posting-tag):-- 1/1 a transaction ; A:, TAG2:- ; third-tag: a third transaction tag, <- with a value- (a) $1 ; posting-tag:-- Tags are like Ledger's metadata feature, except hledger's tag values- are simple strings.-- Directives- A directive is a line in the journal beginning with a special keyword,- that influences how the journal is processed. hledger's directives are- based on a subset of Ledger's, but there are many differences (and also- some differences between hledger versions).-- Directives' behaviour and interactions can get a little bit complex, so- here is a table summarising the directives and their effects, with- links to more detailed docs.--- direc- end subdi- purpose can affect (as of- tive directive rec- 2018/06)- tives- -------------------------------------------------------------------------------------------------- account any document account names, all entries in all- text declare account types & dis- files, before or- play order after----- alias end aliases rewrite account names following- inline/included- entries until end- of current file or- end directive- apply account end apply account prepend a common parent to following- account names inline/included- entries until end- of current file or- end directive- comment end comment ignore part of journal following- inline/included- entries until end- of current file or- end directive- commodity format declare a commodity and its number notation:- number notation & display following entries- style in that commodity- in all files; dis-- play style: amounts- of that commodity- in reports- D declare a commodity, number commodity: all com-- notation & display style for modityless entries- commodityless amounts in all files; num-- ber notation: fol-- lowing commodity-- less entries and- entries in that- commodity in all- files; display- style: amounts of- that commodity in- reports- include include entries/directives what the included- from another file directives affect- P declare a market price for a amounts of that- commodity commodity in- reports, when -V is- used- Y declare a year for yearless following- dates inline/included- entries until end- of current file-- And some definitions:--- subdirec- optional indented directive line immediately following a par-- tive ent directive- number how to interpret numbers when parsing journal entries (the- notation identity of the decimal separator character). (Currently- each commodity can have its own notation, even in the same- file.)- display how to display amounts of a commodity in reports (symbol side- style and spacing, digit groups, decimal separator, decimal places)- directive which entries and (when there are multiple files) which files- scope are affected by a directive-- As you can see, directives vary in which journal entries and files they- affect, and whether they are focussed on input (parsing) or output- (reports). Some directives have multiple effects.-- If you have a journal made up of multiple files, or pass multiple -f- options on the command line, note that directives which affect input- typically last only until the end of their defining file. This pro-- vides more simplicity and predictability, eg reports are not changed by- writing file options in a different order. It can be surprising at- times though.-- Comment blocks- A line containing just comment starts a commented region of the file,- and a line containing just end comment (or the end of the current file)- ends it. See also comments.-- Including other files- You can pull in the content of additional files by writing an include- directive, like this:-- include path/to/file.journal-- If the path does not begin with a slash, it is relative to the current- file. The include file path may contain common glob patterns (e.g.- *).-- The include directive can only be used in journal files. It can- include journal, timeclock or timedot files, but not CSV files.-- Default year- You can set a default year to be used for subsequent dates which don't- specify a year. This is a line beginning with Y followed by the year.- Eg:-- Y2009 ; set default year to 2009-- 12/15 ; equivalent to 2009/12/15- expenses 1- assets-- Y2010 ; change default year to 2010-- 2009/1/30 ; specifies the year, not affected- expenses 1- assets-- 1/31 ; equivalent to 2010/1/31- expenses 1- assets-- Declaring commodities- The commodity directive declares commodities which may be used in the- journal (though currently we do not enforce this). It may be written- on a single line, like this:-- ; commodity EXAMPLEAMOUNT-- ; display AAAA amounts with the symbol on the right, space-separated,- ; using period as decimal point, with four decimal places, and- ; separating thousands with comma.- commodity 1,000.0000 AAAA-- or on multiple lines, using the "format" subdirective. In this case- the commodity symbol appears twice and should be the same in both- places:-- ; commodity SYMBOL- ; format EXAMPLEAMOUNT-- ; display indian rupees with currency name on the left,- ; thousands, lakhs and crores comma-separated,- ; period as decimal point, and two decimal places.- commodity INR- format INR 9,99,99,999.00-- Commodity directives have a second purpose: they define the standard- display format for amounts in the commodity. Normally the display for-- mat is inferred from journal entries, but this can be unpredictable;- declaring it with a commodity directive overrides this and removes- ambiguity. Towards this end, amounts in commodity directives must- always be written with a decimal point (a period or comma, followed by- 0 or more decimal digits).-- Default commodity- The D directive sets a default commodity (and display format), to be- used for amounts without a commodity symbol (ie, plain numbers). (Note- this differs from Ledger's default commodity directive.) The commodity- and display format will be applied to all subsequent commodity-less- amounts, or until the next D directive.-- # commodity-less amounts should be treated as dollars- # (and displayed with symbol on the left, thousands separators and two decimal places)- D $1,000.00-- 1/1- a 5 ; <- commodity-less amount, becomes $1- b-- As with the commodity directive, the amount must always be written with- a decimal point.-- Market prices- The P directive declares a market price, which is an exchange rate- between two commodities on a certain date. (In Ledger, they are called- "historical prices".) These are often obtained from a stock exchange,- cryptocurrency exchange, or the foreign exchange market.-- Here is the format:-- P DATE COMMODITYA COMMODITYBAMOUNT-- o DATE is a simple date-- o COMMODITYA is the symbol of the commodity being priced-- o COMMODITYBAMOUNT is an amount (symbol and quantity) in a second com-- modity, giving the price in commodity B of one unit of commodity A.-- These two market price directives say that one euro was worth 1.35 US- dollars during 2009, and $1.40 from 2010 onward:-- P 2009/1/1 $1.35- P 2010/1/1 $1.40-- The -V/--value flag can be used to convert reported amounts to another- commodity using these prices.-- Declaring accounts- account directives can be used to pre-declare accounts. Though not- required, they can provide several benefits:-- o They can document your intended chart of accounts, providing a refer-- ence.-- o They can store extra information about accounts (account numbers,- notes, etc.)-- o They can help hledger know your accounts' types (asset, liability,- equity, revenue, expense), useful for reports like balancesheet and- incomestatement.-- o They control account display order in reports, allowing non-alpha-- betic sorting (eg Revenues to appear above Expenses).-- o They help with account name completion in the add command,- hledger-iadd, hledger-web, ledger-mode etc.-- The simplest form is just the word account followed by a hledger-style- account name, eg:-- account assets:bank:checking-- Account comments- Comments, beginning with a semicolon, optionally including tags, can be- written after the account name, and/or on following lines. Eg:-- account assets:bank:checking ; a comment- ; another comment- ; acctno:12345, a tag-- Tip: comments on the same line require hledger 1.12+. If you need your- journal to be compatible with older hledger versions, write comments on- the next line instead.-- Account subdirectives- We also allow (and ignore) Ledger-style indented subdirectives, just- for compatibility.:-- account assets:bank:checking- format blah blah ; <- subdirective, ignored-- Here is the full syntax of account directives:-- account ACCTNAME [ACCTTYPE] [;COMMENT]- [;COMMENTS]- [LEDGER-STYLE SUBDIRECTIVES, IGNORED]-- Account types- hledger recognises five types (or classes) of account: Asset, Liabil-- ity, Equity, Revenue, Expense. This is used by a few accounting-aware- reports such as balancesheet, incomestatement and cashflow.-- Auto-detected account types- If you name your top-level accounts with some variation of assets, lia-- bilities/debts, equity, revenues/income, or expenses, their types are- detected automatically.-- Account types declared with tags- More generally, you can declare an account's type with an account- directive, by writing a type: tag in a comment, followed by one of the- words Asset, Liability, Equity, Revenue, Expense, or one of the letters- ALERX (case insensitive):-- account assets ; type:Asset- account liabilities ; type:Liability- account equity ; type:Equity- account revenues ; type:Revenue- account expenses ; type:Expenses-- Account types declared with account type codes- Or, you can write one of those letters separated from the account name- by two or more spaces, but this should probably be considered depre-- cated as of hledger 1.13:-- account assets A- account liabilities L- account equity E- account revenues R- account expenses X-- Overriding auto-detected types- If you ever override the types of those auto-detected english account- names mentioned above, you might need to help the reports a bit. Eg:-- ; make "liabilities" not have the liability type - who knows why- account liabilities ; type:E-- ; we need to ensure some other account has the liability type,- ; otherwise balancesheet would still show "liabilities" under Liabilities- account - ; type:L-- Account display order- Account directives also set the order in which accounts are displayed,- eg in reports, the hledger-ui accounts screen, and the hledger-web- sidebar. By default accounts are listed in alphabetical order. But if- you have these account directives in the journal:-- account assets- account liabilities- account equity- account revenues- account expenses-- you'll see those accounts displayed in declaration order, not alphabet-- ically:-- $ hledger accounts -1- assets- liabilities- equity- revenues- expenses-- Undeclared accounts, if any, are displayed last, in alphabetical order.-- Note that sorting is done at each level of the account tree (within- each group of sibling accounts under the same parent). And currently,- this directive:-- account other:zoo-- would influence the position of zoo among other's subaccounts, but not- the position of other among the top-level accounts. This means: - you- will sometimes declare parent accounts (eg account other above) that- you don't intend to post to, just to customize their display order -- sibling accounts stay together (you couldn't display x:y in between a:b- and a:c).-- Rewriting accounts- You can define account alias rules which rewrite your account names, or- parts of them, before generating reports. This can be useful for:-- o expanding shorthand account names to their full form, allowing easier- data entry and a less verbose journal-- o adapting old journals to your current chart of accounts-- o experimenting with new account organisations, like a new hierarchy or- combining two accounts into one-- o customising reports-- Account aliases also rewrite account names in account directives. They- do not affect account names being entered via hledger add or- hledger-web.-- See also Cookbook: Rewrite account names.-- Basic aliases- To set an account alias, use the alias directive in your journal file.- This affects all subsequent journal entries in the current file or its- included files. The spaces around the = are optional:-- alias OLD = NEW-- Or, you can use the --alias 'OLD=NEW' option on the command line. This- affects all entries. It's useful for trying out aliases interactively.-- OLD and NEW are case sensitive full account names. hledger will- replace any occurrence of the old account name with the new one. Sub-- accounts are also affected. Eg:-- alias checking = assets:bank:wells fargo:checking- # rewrites "checking" to "assets:bank:wells fargo:checking", or "checking:a" to "assets:bank:wells fargo:checking:a"-- Regex aliases- There is also a more powerful variant that uses a regular expression,- indicated by the forward slashes:-- alias /REGEX/ = REPLACEMENT-- or --alias '/REGEX/=REPLACEMENT'.-- REGEX is a case-insensitive regular expression. Anywhere it matches- inside an account name, the matched part will be replaced by REPLACE-- MENT. If REGEX contains parenthesised match groups, these can be ref-- erenced by the usual numeric backreferences in REPLACEMENT. Eg:-- alias /^(.+):bank:([^:]+)(.*)/ = \1:\2 \3- # rewrites "assets:bank:wells fargo:checking" to "assets:wells fargo checking"-- Also note that REPLACEMENT continues to the end of line (or on command- line, to end of option argument), so it can contain trailing white-- space.-- Multiple aliases- You can define as many aliases as you like using directives or com-- mand-line options. Aliases are recursive - each alias sees the result- of applying previous ones. (This is different from Ledger, where- aliases are non-recursive by default). Aliases are applied in the fol-- lowing order:-- 1. alias directives, most recently seen first (recent directives take- precedence over earlier ones; directives not yet seen are ignored)-- 2. alias options, in the order they appear on the command line-- end aliases- You can clear (forget) all currently defined aliases with the- end aliases directive:-- end aliases-- Default parent account- You can specify a parent account which will be prepended to all- accounts within a section of the journal. Use the apply account and- end apply account directives like so:-- apply account home-- 2010/1/1- food $10- cash-- end apply account-- which is equivalent to:-- 2010/01/01- home:food $10- home:cash $-10-- If end apply account is omitted, the effect lasts to the end of the- file. Included files are also affected, eg:-- apply account business- include biz.journal- end apply account- apply account personal- include personal.journal-- Prior to hledger 1.0, legacy account and end spellings were also sup-- ported.-- A default parent account also affects account directives. It does not- affect account names being entered via hledger add or hledger-web. If- account aliases are present, they are applied after the default parent- account.-- Periodic transactions- Periodic transaction rules describe transactions that recur. They- allow you to generate future transactions for forecasting, without hav-- ing to write them out explicitly in the journal (with --forecast).- Secondly, they also can be used to define budget goals (with --budget).-- A periodic transaction rule looks like a normal journal entry, with the- date replaced by a tilde (~) followed by a period expression (mnemonic:- ~ looks like a recurring sine wave.):-- ~ monthly- expenses:rent $2000- assets:bank:checking-- There is an additional constraint on the period expression: the start- date must fall on a natural boundary of the interval. Eg- monthly from 2018/1/1 is valid, but monthly from 2018/1/15 is not.-- Partial or relative dates (M/D, D, tomorrow, last week) in the period- expression can work (useful or not). They will be relative to today's- date, unless a Y default year directive is in effect, in which case- they will be relative to Y/1/1.-- Two spaces after the period expression- If the period expression is followed by a transaction description,- these must be separated by two or more spaces. This helps hledger know- where the period expression ends, so that descriptions can not acciden-- tally alter their meaning, as in this example:-- ; 2 or more spaces needed here, so the period is not understood as "every 2 months in 2020"- ; ||- ; vv- ~ every 2 months in 2020, we will review- assets:bank:checking $1500- income:acme inc-- Forecasting with periodic transactions- With the --forecast flag, each periodic transaction rule generates- future transactions recurring at the specified interval. These are not- saved in the journal, but appear in all reports. They will look like- normal transactions, but with an extra tag named recur, whose value is- the generating period expression.-- Forecast transactions start on the first occurrence, and end on the- last occurrence, of their interval within the forecast period. The- forecast period:-- o begins on the later of-- o the report start date if specified with -b/-p/date:-- o the day after the latest normal (non-periodic) transaction in the- journal, or today if there are no normal transactions.-- o ends on the report end date if specified with -e/-p/date:, or 180- days from today.-- where "today" means the current date at report time. The "later of"- rule ensures that forecast transactions do not overlap normal transac-- tions in time; they will begin only after normal transactions end.-- Forecasting can be useful for estimating balances into the future, and- experimenting with different scenarios. Note the start date logic- means that forecasted transactions are automatically replaced by normal- transactions as you add those.-- Forecasting can also help with data entry: describe most of your trans-- actions with periodic rules, and every so often copy the output of- print --forecast to the journal.-- You can generate one-time transactions too: just write a period expres-- sion specifying a date with no report interval. (You could also write- a normal transaction with a future date, but remember this disables- forecast transactions on previous dates.)-- Budgeting with periodic transactions- With the --budget flag, currently supported by the balance command,- each periodic transaction rule declares recurring budget goals for the- specified accounts. Eg the first example above declares a goal of- spending $2000 on rent (and also, a goal of depositing $2000 into- checking) every month. Goals and actual performance can then be com-- pared in budget reports.-- For more details, see: balance: Budget report and Cookbook: Budgeting- and Forecasting.--- Transaction modifiers- Transaction modifier rules describe changes that should be applied- automatically to certain transactions. They can be enabled by using- the --auto flag. Currently, just one kind of change is possible:- adding extra postings. These rule-generated postings are known as- "automated postings" or "auto postings".-- A transaction modifier rule looks quite like a normal transaction,- except the first line is an equals sign followed by a query that- matches certain postings (mnemonic: = suggests matching). And each- "posting" is actually a posting-generating rule:-- = QUERY- ACCT AMT- ACCT [AMT]- ...-- These posting rules look like normal postings, except the amount can- be:-- o a normal amount with a commodity symbol, eg $2. This will be used- as-is.-- o a number, eg 2. The commodity symbol (if any) from the matched post-- ing will be added to this.-- o a numeric multiplier, eg *2 (a star followed by a number N). The- matched posting's amount (and total price, if any) will be multiplied- by N.-- o a multiplier with a commodity symbol, eg *$2 (a star, number N, and- symbol S). The matched posting's amount will be multiplied by N, and- its commodity symbol will be replaced with S.-- Some examples:-- ; every time I buy food, schedule a dollar donation- = expenses:food- (liabilities:charity) $-1-- ; when I buy a gift, also deduct that amount from a budget envelope subaccount- = expenses:gifts- assets:checking:gifts *-1- assets:checking *1-- 2017/12/1- expenses:food $10- assets:checking-- 2017/12/14- expenses:gifts $20- assets:checking-- $ hledger print --auto- 2017/12/01- expenses:food $10- assets:checking- (liabilities:charity) $-1-- 2017/12/14- expenses:gifts $20- assets:checking- assets:checking:gifts -$20- assets:checking $20-- Auto postings and transaction balancing / inferred amounts / balance- assertions-- Currently, transaction modifiers are applied / auto postings are added:-- o after missing amounts are inferred, and transactions are checked for- balancedness,-- o but before balance assertions are checked.-- Note this means that journal entries must be balanced both before and- after auto postings are added. This changed in hledger 1.12+; see #893- for background.--EDITOR SUPPORT- Helper modes exist for popular text editors, which make working with- journal files easier. They add colour, formatting, tab completion, and- helpful commands, and are quite recommended if you edit your journal- with a text editor. They include ledger-mode or hledger-mode for- Emacs, vim-ledger for Vim, hledger-vscode for Visual Studio Code, and- others. See the [[Cookbook]] at hledger.org for the latest informa-- tion.----REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)---AUTHORS- Simon Michael <simon@joyful.com> and contributors---COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.---SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org----hledger 1.14 March 2019 hledger_journal(5)
− embeddedfiles/hledger_timeclock.5
@@ -1,92 +0,0 @@--.TH "hledger_timeclock" "5" "March 2019" "hledger 1.14" "hledger User Manuals"----.SH NAME-.PP-Timeclock \- the time logging format of timeclock.el, as read by hledger-.SH DESCRIPTION-.PP-hledger can read timeclock files.-As with Ledger, these are (a subset of) timeclock.el\[aq]s format,-containing clock\-in and clock\-out entries as in the example below.-The date is a simple date.-The time format is HH:MM[:SS][+\-ZZZZ].-Seconds and timezone are optional.-The timezone, if present, must be four digits and is ignored (currently-the time is always interpreted as a local time).-.IP-.nf-\f[C]-i\ 2015/03/30\ 09:00:00\ some:account\ name\ \ optional\ description\ after\ two\ spaces-o\ 2015/03/30\ 09:20:00-i\ 2015/03/31\ 22:21:45\ another\ account-o\ 2015/04/01\ 02:00:34-\f[]-.fi-.PP-hledger treats each clock\-in/clock\-out pair as a transaction posting-some number of hours to an account.-Or if the session spans more than one day, it is split into several-transactions, one for each day.-For the above time log, \f[C]hledger\ print\f[] generates these journal-entries:-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.timeclock\ print-2015/03/30\ *\ optional\ description\ after\ two\ spaces-\ \ \ \ (some:account\ name)\ \ \ \ \ \ \ \ \ 0.33h--2015/03/31\ *\ 22:21\-23:59-\ \ \ \ (another\ account)\ \ \ \ \ \ \ \ \ 1.64h--2015/04/01\ *\ 00:00\-02:00-\ \ \ \ (another\ account)\ \ \ \ \ \ \ \ \ 2.01h-\f[]-.fi-.PP-Here is a sample.timeclock to download and some queries to try:-.IP-.nf-\f[C]-$\ 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-\f[]-.fi-.PP-To generate time logs, ie to clock in and clock out, you could:-.IP \[bu] 2-use emacs and the built\-in timeclock.el, or the extended-timeclock\-x.el and perhaps the extras in ledgerutils.el-.IP \[bu] 2-at the command line, use these bash aliases:-\f[C]shell\ \ \ alias\ ti="echo\ i\ `date\ \[aq]+%Y\-%m\-%d\ %H:%M:%S\[aq]`\ \\$*\ >>$TIMELOG"\ \ \ alias\ to="echo\ o\ `date\ \[aq]+%Y\-%m\-%d\ %H:%M:%S\[aq]`\ >>$TIMELOG"\f[]-.IP \[bu] 2-or use the old \f[C]ti\f[] and \f[C]to\f[] scripts in the ledger 2.x-repository.-These rely on a "timeclock" executable which I think is just the ledger-2 executable renamed.---.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)--.SH AUTHORS-Simon Michael <simon@joyful.com> and contributors--.SH COPYRIGHT--Copyright (C) 2007-2016 Simon Michael.-.br-Released under GNU GPL v3 or later.--.SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org
− embeddedfiles/hledger_timeclock.info
@@ -1,60 +0,0 @@-This is hledger_timeclock.info, produced by makeinfo version 6.5 from-stdin.---File: hledger_timeclock.info, Node: Top, Up: (dir)--hledger_timeclock(5) hledger 1.14-*********************************--hledger can read timeclock files. As with Ledger, these are (a subset-of) timeclock.el's format, containing clock-in and clock-out entries as-in the example below. The date is a simple date. The time format is-HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. The timezone, if-present, must be four digits and is ignored (currently the time is-always interpreted as a local time).--i 2015/03/30 09:00:00 some:account name optional description after two spaces-o 2015/03/30 09:20:00-i 2015/03/31 22:21:45 another account-o 2015/04/01 02:00:34-- hledger treats each clock-in/clock-out pair as a transaction posting-some number of hours to an account. Or if the session spans more than-one day, it is split into several transactions, one for each day. For-the above time log, 'hledger print' generates these journal entries:--$ hledger -f t.timeclock print-2015/03/30 * optional description after two spaces- (some:account name) 0.33h--2015/03/31 * 22:21-23:59- (another account) 1.64h--2015/04/01 * 00:00-02:00- (another account) 2.01h-- Here is a sample.timeclock to download and some queries to try:--$ 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-- To generate time logs, ie to clock in and clock out, you could:-- * use emacs and the built-in timeclock.el, or the extended- timeclock-x.el and perhaps the extras in ledgerutils.el-- * at the command line, use these bash aliases: 'shell alias ti="echo- i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG" alias to="echo o- `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG"'- * or use the old 'ti' and 'to' scripts in the ledger 2.x repository.- These rely on a "timeclock" executable which I think is just the- ledger 2 executable renamed.----Tag Table:-Node: Top78--End Tag Table
− embeddedfiles/hledger_timeclock.txt
@@ -1,80 +0,0 @@--hledger_timeclock(5) hledger User Manuals hledger_timeclock(5)----NAME- Timeclock - the time logging format of timeclock.el, as read by hledger--DESCRIPTION- hledger can read timeclock files. As with Ledger, these are (a subset- of) timeclock.el's format, containing clock-in and clock-out entries as- in the example below. The date is a simple date. The time format is- HH:MM[:SS][+-ZZZZ]. Seconds and timezone are optional. The timezone,- if present, must be four digits and is ignored (currently the time is- always interpreted as a local time).-- i 2015/03/30 09:00:00 some:account name optional description after two spaces- o 2015/03/30 09:20:00- i 2015/03/31 22:21:45 another account- o 2015/04/01 02:00:34-- hledger treats each clock-in/clock-out pair as a transaction posting- some number of hours to an account. Or if the session spans more than- one day, it is split into several transactions, one for each day. For- the above time log, hledger print generates these journal entries:-- $ hledger -f t.timeclock print- 2015/03/30 * optional description after two spaces- (some:account name) 0.33h-- 2015/03/31 * 22:21-23:59- (another account) 1.64h-- 2015/04/01 * 00:00-02:00- (another account) 2.01h-- Here is a sample.timeclock to download and some queries to try:-- $ 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-- To generate time logs, ie to clock in and clock out, you could:-- o use emacs and the built-in timeclock.el, or the extended time-- clock-x.el and perhaps the extras in ledgerutils.el-- o at the command line, use these bash aliases:- shell alias ti="echo i `date '+%Y-%m-%d %H:%M:%S'` \$* >>$TIMELOG" alias to="echo o `date '+%Y-%m-%d %H:%M:%S'` >>$TIMELOG"-- o or use the old ti and to scripts in the ledger 2.x repository. These- rely on a "timeclock" executable which I think is just the ledger 2- executable renamed.----REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)---AUTHORS- Simon Michael <simon@joyful.com> and contributors---COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.---SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org----hledger 1.14 March 2019 hledger_timeclock(5)
− embeddedfiles/hledger_timedot.5
@@ -1,154 +0,0 @@--.TH "hledger_timedot" "5" "March 2019" "hledger 1.14" "hledger User Manuals"----.SH NAME-.PP-Timedot \- hledger\[aq]s human\-friendly time logging format-.SH DESCRIPTION-.PP-Timedot is a plain text format for logging dated, categorised quantities-(of time, usually), supported by hledger.-It is convenient for approximate and retroactive time logging, eg when-the real\-time clock\-in/out required with a timeclock file is too-precise or too interruptive.-It can be formatted like a bar chart, making clear at a glance where-time was spent.-.PP-Though called "timedot", this format is read by hledger as commodityless-quantities, so it could be used to represent dated quantities other than-time.-In the docs below we\[aq]ll assume it\[aq]s time.-.SH FILE FORMAT-.PP-A timedot file contains a series of day entries.-A day entry begins with a date, and is followed by category/quantity-pairs, one per line.-Dates are hledger\-style simple dates (see hledger_journal(5)).-Categories are hledger\-style account names, optionally indented.-As in a hledger journal, there must be at least two spaces between the-category (account name) and the quantity.-.PP-Quantities can be written as:-.IP \[bu] 2-a sequence of dots (.) representing quarter hours.-Spaces may optionally be used for grouping and readability.-Eg: ....-\&..-.IP \[bu] 2-an integral or decimal number, representing hours.-Eg: 1.5-.IP \[bu] 2-an integral or decimal number immediately followed by a unit symbol-\f[C]s\f[], \f[C]m\f[], \f[C]h\f[], \f[C]d\f[], \f[C]w\f[], \f[C]mo\f[],-or \f[C]y\f[], representing seconds, minutes, hours, days weeks, months-or years respectively.-Eg: 90m.-The following equivalencies are assumed, currently: 1m = 60s, 1h = 60m,-1d = 24h, 1w = 7d, 1mo = 30d, 1y=365d.-.PP-Blank lines and lines beginning with #, ; or * are ignored.-An example:-.IP-.nf-\f[C]-#\ on\ this\ day,\ 6h\ was\ spent\ on\ client\ work,\ 1.5h\ on\ haskell\ FOSS\ work,\ etc.-2016/2/1-inc:client1\ \ \ ....\ ....\ ....\ ....\ ....\ ....-fos:haskell\ \ \ ....\ ..\ -biz:research\ \ .--2016/2/2-inc:client1\ \ \ ....\ ....-biz:research\ \ .-\f[]-.fi-.PP-Or with numbers:-.IP-.nf-\f[C]-2016/2/3-inc:client1\ \ \ 4-fos:hledger\ \ \ 3-biz:research\ \ 1-\f[]-.fi-.PP-Reporting:-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.timedot\ print\ date:2016/2/2-2016/02/02\ *-\ \ \ \ (inc:client1)\ \ \ \ \ \ \ \ \ \ 2.00--2016/02/02\ *-\ \ \ \ (biz:research)\ \ \ \ \ \ \ \ \ \ 0.25-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.timedot\ bal\ \-\-daily\ \-\-tree-Balance\ changes\ in\ 2016/02/01\-2016/02/03:--\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2016/02/01d\ \ 2016/02/02d\ \ 2016/02/03d\ -============++========================================-\ biz\ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 1.00\ -\ \ \ research\ ||\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 0.25\ \ \ \ \ \ \ \ \ 1.00\ -\ fos\ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 1.50\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ 3.00\ -\ \ \ haskell\ \ ||\ \ \ \ \ \ \ \ \ 1.50\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ 0\ -\ \ \ hledger\ \ ||\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ 3.00\ -\ inc\ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 6.00\ \ \ \ \ \ \ \ \ 2.00\ \ \ \ \ \ \ \ \ 4.00\ -\ \ \ client1\ \ ||\ \ \ \ \ \ \ \ \ 6.00\ \ \ \ \ \ \ \ \ 2.00\ \ \ \ \ \ \ \ \ 4.00\ -\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ 7.75\ \ \ \ \ \ \ \ \ 2.25\ \ \ \ \ \ \ \ \ 8.00\ -\f[]-.fi-.PP-I prefer to use period for separating account components.-We can make this work with an account alias:-.IP-.nf-\f[C]-2016/2/4-fos.hledger.timedot\ \ 4-fos.ledger\ \ \ \ \ \ \ \ \ \ \ ..-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.timedot\ \-\-alias\ /\\\\./=:\ bal\ date:2016/2/4-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4.50\ \ fos-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4.00\ \ \ \ hledger:timedot-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0.50\ \ \ \ ledger-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 4.50-\f[]-.fi-.PP-Here is a sample.timedot.---.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)--.SH AUTHORS-Simon Michael <simon@joyful.com> and contributors--.SH COPYRIGHT--Copyright (C) 2007-2016 Simon Michael.-.br-Released under GNU GPL v3 or later.--.SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org
− embeddedfiles/hledger_timedot.info
@@ -1,116 +0,0 @@-This is hledger_timedot.info, produced by makeinfo version 6.5 from-stdin.---File: hledger_timedot.info, Node: Top, Next: FILE FORMAT, Up: (dir)--hledger_timedot(5) hledger 1.14-*******************************--Timedot is a plain text format for logging dated, categorised quantities-(of time, usually), supported by hledger. It is convenient for-approximate and retroactive time logging, eg when the real-time-clock-in/out required with a timeclock file is too precise or too-interruptive. It can be formatted like a bar chart, making clear at a-glance where time was spent.-- Though called "timedot", this format is read by hledger as-commodityless quantities, so it could be used to represent dated-quantities other than time. In the docs below we'll assume it's time.-* Menu:--* FILE FORMAT::---File: hledger_timedot.info, Node: FILE FORMAT, Prev: Top, Up: Top--1 FILE FORMAT-*************--A timedot file contains a series of day entries. A day entry begins-with a date, and is followed by category/quantity pairs, one per line.-Dates are hledger-style simple dates (see hledger_journal(5)).-Categories are hledger-style account names, optionally indented. As in-a hledger journal, there must be at least two spaces between the-category (account name) and the quantity.-- Quantities can be written as:-- * a sequence of dots (.) representing quarter hours. Spaces may- optionally be used for grouping and readability. Eg: .... ..-- * an integral or decimal number, representing hours. Eg: 1.5-- * an integral or decimal number immediately followed by a unit symbol- 's', 'm', 'h', 'd', 'w', 'mo', or 'y', representing seconds,- minutes, hours, days weeks, months or years respectively. Eg: 90m.- The following equivalencies are assumed, currently: 1m = 60s, 1h =- 60m, 1d = 24h, 1w = 7d, 1mo = 30d, 1y=365d.-- Blank lines and lines beginning with #, ; or * are ignored. An-example:--# on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.-2016/2/1-inc:client1 .... .... .... .... .... ....-fos:haskell .... .. -biz:research .--2016/2/2-inc:client1 .... ....-biz:research .-- Or with numbers:--2016/2/3-inc:client1 4-fos:hledger 3-biz:research 1-- Reporting:--$ hledger -f t.timedot print date:2016/2/2-2016/02/02 *- (inc:client1) 2.00--2016/02/02 *- (biz:research) 0.25--$ hledger -f t.timedot bal --daily --tree-Balance changes in 2016/02/01-2016/02/03:-- || 2016/02/01d 2016/02/02d 2016/02/03d -============++========================================- biz || 0.25 0.25 1.00 - research || 0.25 0.25 1.00 - fos || 1.50 0 3.00 - haskell || 1.50 0 0 - hledger || 0 0 3.00 - inc || 6.00 2.00 4.00 - client1 || 6.00 2.00 4.00 -------------++----------------------------------------- || 7.75 2.25 8.00 -- I prefer to use period for separating account components. We can-make this work with an account alias:--2016/2/4-fos.hledger.timedot 4-fos.ledger ..--$ hledger -f t.timedot --alias /\\./=: bal date:2016/2/4- 4.50 fos- 4.00 hledger:timedot- 0.50 ledger---------------------- 4.50-- Here is a sample.timedot.---Tag Table:-Node: Top76-Node: FILE FORMAT807-Ref: #file-format908--End Tag Table
− embeddedfiles/hledger_timedot.txt
@@ -1,127 +0,0 @@--hledger_timedot(5) hledger User Manuals hledger_timedot(5)----NAME- Timedot - hledger's human-friendly time logging format--DESCRIPTION- Timedot is a plain text format for logging dated, categorised quanti-- ties (of time, usually), supported by hledger. It is convenient for- approximate and retroactive time logging, eg when the real-time- clock-in/out required with a timeclock file is too precise or too- interruptive. It can be formatted like a bar chart, making clear at a- glance where time was spent.-- Though called "timedot", this format is read by hledger as commodity-- less quantities, so it could be used to represent dated quantities- other than time. In the docs below we'll assume it's time.--FILE FORMAT- A timedot file contains a series of day entries. A day entry begins- with a date, and is followed by category/quantity pairs, one per line.- Dates are hledger-style simple dates (see hledger_journal(5)). Cate-- gories are hledger-style account names, optionally indented. As in a- hledger journal, there must be at least two spaces between the category- (account name) and the quantity.-- Quantities can be written as:-- o a sequence of dots (.) representing quarter hours. Spaces may- optionally be used for grouping and readability. Eg: .... ..-- o an integral or decimal number, representing hours. Eg: 1.5-- o an integral or decimal number immediately followed by a unit symbol- s, m, h, d, w, mo, or y, representing seconds, minutes, hours, days- weeks, months or years respectively. Eg: 90m. The following equiva-- lencies are assumed, currently: 1m = 60s, 1h = 60m, 1d = 24h, 1w =- 7d, 1mo = 30d, 1y=365d.-- Blank lines and lines beginning with #, ; or * are ignored. An exam-- ple:-- # on this day, 6h was spent on client work, 1.5h on haskell FOSS work, etc.- 2016/2/1- inc:client1 .... .... .... .... .... ....- fos:haskell .... ..- biz:research .-- 2016/2/2- inc:client1 .... ....- biz:research .-- Or with numbers:-- 2016/2/3- inc:client1 4- fos:hledger 3- biz:research 1-- Reporting:-- $ hledger -f t.timedot print date:2016/2/2- 2016/02/02 *- (inc:client1) 2.00-- 2016/02/02 *- (biz:research) 0.25-- $ hledger -f t.timedot bal --daily --tree- Balance changes in 2016/02/01-2016/02/03:-- || 2016/02/01d 2016/02/02d 2016/02/03d- ============++========================================- biz || 0.25 0.25 1.00- research || 0.25 0.25 1.00- fos || 1.50 0 3.00- haskell || 1.50 0 0- hledger || 0 0 3.00- inc || 6.00 2.00 4.00- client1 || 6.00 2.00 4.00- ------------++----------------------------------------- || 7.75 2.25 8.00-- I prefer to use period for separating account components. We can make- this work with an account alias:-- 2016/2/4- fos.hledger.timedot 4- fos.ledger ..-- $ hledger -f t.timedot --alias /\\./=: bal date:2016/2/4- 4.50 fos- 4.00 hledger:timedot- 0.50 ledger- --------------------- 4.50-- Here is a sample.timedot.----REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)---AUTHORS- Simon Michael <simon@joyful.com> and contributors---COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.---SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org----hledger 1.14 March 2019 hledger_timedot(5)
+ embeddedfiles/install.cast view
@@ -0,0 +1,1578 @@+{"version": 2, "width": 80, "height": 25, "timestamp": 1679022326, "env": {"SHELL": "/opt/homebrew/bin/bash", "TERM": "xterm-256color"}, "title": "Upgrading hledger tools to latest source release with hledger-install"}+[0.176734, "o", "\u001b[?2004h$ "]+[1.370668, "o", "#"]+[1.638932, "o", " "]+[1.902566, "o", "G"]+[2.050607, "o", "o"]+[2.196438, "o", "a"]+[2.321222, "o", "l"]+[2.594621, "o", ":"]+[2.654595, "o", " "]+[3.032902, "o", "u"]+[3.119646, "o", "s"]+[3.202388, "o", "e"]+[3.358939, "o", " "]+[3.520646, "o", "t"]+[3.602487, "o", "h"]+[3.724757, "o", "e"]+[3.781112, "o", " "]+[3.963303, "o", "h"]+[4.038573, "o", "l"]+[4.074891, "o", "e"]+[4.24445, "o", "d"]+[4.381226, "o", "g"]+[4.52317, "o", "e"]+[4.59591, "o", "r"]+[4.673338, "o", "-"]+[4.881321, "o", "i"]+[4.93948, "o", "n"]+[5.025133, "o", "s"]+[5.064065, "o", "t"]+[5.196402, "o", "a"]+[5.336885, "o", "l"]+[5.486745, "o", "l"]+[5.550249, "o", " "]+[5.731842, "o", "b"]+[5.847355, "o", "a"]+[5.925392, "o", "s"]+[6.043606, "o", "h"]+[6.116812, "o", " "]+[6.252079, "o", "s"]+[6.353887, "o", "c"]+[6.564841, "o", "r"]+[6.656664, "o", "i"]+[6.71234, "o", "p"]+[6.852646, "o", "t"]+[6.950147, "o", " "]+[7.11887, "o", "t"]+[7.278621, "o", "o"]+[7.371103, "o", " "]+[7.7892, "o", "u"]+[7.859178, "o", "p"]+[7.950347, "o", "g"]+[8.005077, "o", "r"]+[8.148006, "o", "a"]+[8.249959, "o", "d"]+[8.452416, "o", "e"]+[8.641369, "o", " "]+[9.607081, "o", "h"]+[9.651407, "o", "l"]+[9.715114, "o", "e"]+[9.894138, "o", "d"]+[10.026633, "o", "g"]+[10.18316, "o", "e"]+[10.243145, "o", "r"]+[10.375556, "o", " "]+[10.701801, "o", "a"]+[10.805391, "o", "n"]+[10.889889, "o", "d"]+[11.028208, "o", " "]+[11.460136, "o", "r"]+[11.494157, "o", "e"]+[11.585034, "o", "l"]+[11.769757, "o", "a"]+[11.930786, "o", "t"]+[11.998833, "o", "e"]+[12.191688, "o", "d"]+[12.331504, "o", " "]+[12.472755, "o", "t"]+[12.5659, "o", "o"]+[12.699219, "o", "o \r"]+[12.911827, "o", "l"]+[13.008721, "o", "s"]+[14.076361, "o", "\r\n"]+[14.076596, "o", "\u001b[?2004l\r"]+[14.076772, "o", "\u001b[?2004h$ "]+[17.898143, "o", "\u001b[7mcurl -O https://raw.githubusercontent.com/simonmichael/hledger/master/hledger-\u001b[27m\u001b[7mi\u001b[27m\u001b[7mnstall/hledger-install.sh \u001b[27m"]+[20.279622, "o", "\u001b[A\r\u001b[C\u001b[Ccurl -O https://raw.githubusercontent.com/simonmichael/hledger/master/hledger-install/hledger-install.sh "]+[21.332271, "o", " "]+[21.474465, "o", " "]+[21.676089, "o", "#"]+[21.838239, "o", " "]+[22.010876, "o", "g"]+[22.145012, "o", "e"]+[22.253908, "o", "t"]+[22.348254, "o", " "]+[22.441593, "o", "t"]+[22.556485, "o", "h"]+[22.621661, "o", "e"]+[22.736076, "o", " "]+[22.866482, "o", "l"]+[22.939641, "o", "a"]+[23.059433, "o", "t"]+[23.143479, "o", "e"]+[23.231822, "o", "s"]+[23.311578, "o", "t"]+[24.015276, "o", "\r\n"]+[24.015439, "o", "\u001b[?2004l\r"]+[24.032231, "o", " % Total % Received % Xferd Average Speed Time "]+[24.032263, "o", " Time Time Current\r\n Dload Upload Total Spent Left "]+[24.032409, "o", " Speed\r\n\r 0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0"]+[24.780302, "o", "\r100 31183 100 31183 0 0 41224 "]+[24.780456, "o", " 0 --:--:-- --:--:-- --:--:-- 41688\r\n"]+[24.783804, "o", "\u001b[?2004h$ "]+[26.961496, "o", "l"]+[27.064797, "o", "e"]+[27.139896, "o", "s"]+[27.333159, "o", "s"]+[27.505476, "o", " "]+[28.858202, "o", "h"]+[28.915346, "o", "l"]+[28.972458, "o", "e"]+[29.153008, "o", "d"]+[29.252495, "o", "g"]+[29.384733, "o", "e"]+[29.461821, "o", "r"]+[29.537611, "o", "-"]+[29.728954, "o", "i"]+[29.795565, "o", "n"]+[29.82052, "o", "s"]+[29.899985, "o", "t"]+[30.010507, "o", "s"]+[30.016084, "o", "a"]+[30.122473, "o", "l"]+[30.251287, "o", "l"]+[30.453547, "o", "."]+[30.603412, "o", "s"]+[30.667159, "o", "h"]+[31.210044, "o", "\b\u001b[K"]+[31.461264, "o", "\b\u001b[K"]+[31.49236, "o", "\b\u001b[K"]+[31.52637, "o", "\b\u001b[K"]+[31.560295, "o", "\b\u001b[K"]+[31.593332, "o", "\b\u001b[K"]+[31.625685, "o", "\b\u001b[K"]+[32.187842, "o", "a"]+[32.279734, "o", "l"]+[32.417519, "o", "l"]+[32.60417, "o", "."]+[32.744899, "o", "s"]+[32.849145, "o", "h"]+[33.067965, "o", " "]+[33.200691, "o", " "]+[33.41353, "o", "#"]+[33.913465, "o", " "]+[34.134768, "o", "s"]+[34.258318, "o", "a"]+[34.421427, "o", "n"]+[34.516776, "o", "i"]+[34.643727, "o", "t"]+[34.786966, "o", "y"]+[34.843291, "o", " "]+[34.975237, "o", "c"]+[35.066835, "o", "h"]+[35.163416, "o", "e"]+[35.231586, "o", "c"]+[35.326834, "o", "k"]+[35.401151, "o", " "]+[35.553708, "o", "i"]+[35.624617, "o", "t"]+[35.727053, "o", " "]+[35.979997, "o", "f"]+[36.066291, "o", "o"]+[36.158722, "o", "r"]+[36.279483, "o", " "]+[36.705012, "o", "s"]+[36.782066, "o", "e"]+[36.972752, "o", "c"]+[37.132775, "o", "u"]+[37.231615, "o", "r"]+[37.347584, "o", "i"]+[37.467899, "o", "t"]+[37.590745, "o", "y"]+[40.616408, "o", "\b\b\b\b\b\b\b\b\u001b[K"]+[40.811557, "o", "\b\b\b\b\u001b[K"]+[40.996774, "o", "\b\b\b\u001b[K"]+[41.171117, "o", "\b\b\b\b\b\b\u001b[K"]+[41.346749, "o", "\b\b\b\b\b\b\b\u001b[K"]+[41.525057, "o", "\b\b\b\b\b\b\u001b[K"]+[41.702317, "o", "\b\b\b\b\b\b\b\b\u001b[K"]+[41.882476, "o", "\b\b\b\b\b\b\b\b\u001b[K"]+[42.060761, "o", "\r\u001b[C\u001b[C\u001b[K"]+[43.733882, "o", "b"]+[43.874113, "o", "a"]+[43.918772, "o", "s"]+[44.015582, "o", "h"]+[44.088499, "o", " "]+[44.268316, "o", "h"]+[44.332259, "o", "l"]+[44.376558, "o", "e"]+[44.524447, "o", "d"]+[44.639242, "o", "g"]+[44.772352, "o", "e"]+[44.841668, "o", "r"]+[44.926803, "o", "-"]+[45.157838, "o", "i"]+[45.202148, "o", "n"]+[45.283461, "o", "s"]+[45.343617, "o", "t"]+[45.465177, "o", "a"]+[45.60539, "o", "l"]+[45.746209, "o", "l"]+[45.9551, "o", "."]+[46.130441, "o", "s"]+[46.240858, "o", "h"]+[47.051474, "o", " "]+[47.198596, "o", " "]+[47.339509, "o", "#"]+[47.636693, "o", " "]+[47.742026, "o", "a"]+[47.852332, "o", "n"]+[47.951976, "o", "d"]+[48.039539, "o", " "]+[48.201027, "o", "r"]+[48.3132, "o", "u"]+[48.51545, "o", "n"]+[49.048946, "o", "\r\n"]+[49.049102, "o", "\u001b[?2004l\r"]+[49.062342, "o", "Thu Mar 16 17:06:15 HST 2023\r\n"]+[49.062586, "o", "Running hledger-install.sh version 20230316 to install hledger 1.29.1 and related tools\r\n"]+[49.065782, "o", "on "]+[49.067688, "o", "Darwin 21.6.0 Darwin Kernel Version 21.6.0: Sun Nov 6 23:29:57 PST 2022; root:xnu-8020.240.14~1/RELEASE_ARM64_T8101\r\n"]+[49.069173, "o", "\r\nCurrent install status:\r\n"]+[49.118169, "o", "hledger 1.29 is installed at /Users/simon/.local/bin/hledger\r\n"]+[49.163219, "o", "hledger-ui 1.29 is installed at /Users/simon/.local/bin/hledger-ui\r\n"]+[49.218934, "o", "hledger-web 1.29 is installed at /Users/simon/.local/bin/hledger-web\r\n"]+[49.274654, "o", "hledger-stockquotes 0.1.2.1 is installed at /Users/simon/.local/bin/hledger-stockquotes\r\n"]+[50.619726, "o", "hledger-edit 1.13.2 is installed at /opt/homebrew/bin/hledger-edit\r\n"]+[51.32363, "o", "hledger-plot 1.13.2 is installed at /opt/homebrew/bin/hledger-plot\r\n"]+[51.360783, "o", "hledger-interest 1.6.5 is installed at /Users/simon/.local/bin/hledger-interest\r\n"]+[51.409888, "o", "hledger-iadd 1.3.17 is installed at /Users/simon/.cabal/bin/hledger-iadd\r\n"]+[51.409911, "o", "\r\nEnsuring a Haskell build tool:\r\n"]+[51.464642, "o", "stack 2.9.3 is installed, using stack to install hledger in /Users/simon/.local/bin\r\n"]+[51.536206, "o", "Using stack Version 2.9.3, Git revision d0e984f00034552aac7c67675d49ef0807c10c7b (dirty) (112 commits) aarch64\r\nWarning: this is an unsupported build that may use different versions of\r\ndependencies and GHC than the officially released binaries, and therefore may\r\nnot behave identically. If you encounter problems, please try the latest\r\nofficial build by running 'stack upgrade --force-download'.\r\n"]+[51.536229, "o", "Updating stack's package db to see latest packages\r\nTrying stack update --verbosity=error\r\n"]+[63.303664, "o", "\r\nEnsuring the Python pip install tool:\r\n"]+[63.520606, "o", "pip 23.0 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9) is installed\r\n\r\nInstalling hledger tools:\r\n"]+[63.583691, "o", "Installing hledger\r\n"]+[63.583791, "o", "Trying stack install --install-ghc --resolver=lts-20.14 hledger-1.29.1 hledger-lib-1.29.1 brick-1.6 fsnotify-0.4.1.0 --verbosity=error\r\n"]+[66.628657, "o", "Progress 0/135"]+[66.734469, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[66.734496, "o", "Progress 1/135: Diff, OneTuple, Only, StateVar, base-compat, base-orphans, bimap, blaze-builder"]+[66.801372, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[66.801559, "o", "Progress 2/135: OneTuple, Only, StateVar, base-compat, base-orphans, bimap, blaze-builder, cabal-doctest"]+[66.870952, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[66.871065, "o", "Progress 3/135: Only, StateVar, base-compat, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack"]+[66.938928, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[66.93905, "o", "Progress 4/135: StateVar, base-compat, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack, cereal"]+[67.004839, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.004873, "o", "Progress 5/135: base-compat, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack, cereal, clock"]+[67.087887, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.088013, "o", "Progress 6/135: base-compat-batteries, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack, cereal, clock"]+[67.157264, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.157291, "o", "Progress 7/135: base-compat-batteries, bimap, blaze-builder, cabal-doctest, call-stack, cereal, clock, cmdargs"]+[67.226998, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.227106, "o", "Progress 8/135: base-compat-batteries, blaze-builder, cabal-doctest, call-stack, cereal, clock, cmdargs, colour"]+[67.294664, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.294683, "o", "Progress 9/135: base-compat-batteries, blaze-markup, cabal-doctest, call-stack, cereal, clock, cmdargs, colour"]+[67.364781, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.364901, "o", "Progress 10/135: base-compat-batteries, blaze-markup, call-stack, cereal, clock, cmdargs, colour, contravariant"]+[67.434849, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.434945, "o", "Progress 11/135: base-compat-batteries, blaze-markup, cereal, clock, cmdargs, colour, contravariant, control-monad-free"]+[67.502403, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.502499, "o", "Progress 12/135: base-compat-batteries, blaze-markup, clock, cmdargs, colour, contravariant, control-monad-free, csv"]+[67.571581, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.571664, "o", "Progress 13/135: base-compat-batteries, blaze-markup, cmdargs, colour, contravariant, control-monad-free, csv, data-array-byte"]+[67.648921, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.649013, "o", "Progress 14/135: blaze-markup, cmdargs, colour, contravariant, control-monad-free, csv, data-array-byte, data-clist"]+[67.716431, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.716457, "o", "Progress 15/135: blaze-markup, colour, contravariant, control-monad-free, csv, data-array-byte, data-clist, data-default-class"]+[67.782473, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.782593, "o", "Progress 16/135: ansi-terminal, blaze-markup, contravariant, control-monad-free, csv, data-array-byte, data-clist, data-default-class"]+[67.84998, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.850164, "o", "Progress 17/135: ansi-terminal, blaze-html, contravariant, control-monad-free, csv, data-array-byte, data-clist, data-default-class"]+[67.917932, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.918099, "o", "Progress 18/135: ansi-terminal, blaze-html, control-monad-free, csv, data-array-byte, data-clist, data-default-class, dlist"]+[67.985774, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[67.985872, "o", "Progress 19/135: ansi-terminal, blaze-html, csv, data-array-byte, data-clist, data-default-class, dlist, emojis"]+[68.053443, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.053581, "o", "Progress 20/135: ansi-terminal, blaze-html, data-array-byte, data-clist, data-default-class, dlist, emojis, extra"]+[68.118894, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.118922, "o", "Progress 21/135: ansi-terminal, blaze-html, data-clist, data-default-class, dlist, emojis, extra, file-embed"]+[68.188577, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.188654, "o", "Progress 22/135: ansi-terminal, blaze-html, data-default-class, dlist, emojis, extra, file-embed, hashable"]+[68.255757, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.255899, "o", "Progress 23/135: ansi-terminal, blaze-html, data-default-instances-containers, dlist, emojis, extra, file-embed, hashable"]+[68.323647, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.323841, "o", "Progress 24/135: ansi-wl-pprint, blaze-html, data-default-instances-containers, dlist, emojis, extra, file-embed, hashable"]+[68.393516, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.39354, "o", "Progress 25/135: ansi-wl-pprint, data-default-instances-containers, dlist, emojis, extra, file-embed, hashable, haskeline"]+[68.457735, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.457821, "o", "Progress 26/135: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, emojis, extra, file-embed, hashable, haskeline"]+[68.523531, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.523556, "o", "Progress 27/135: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, extra, file-embed, hashable, haskeline, hfsevents"]+[68.58999, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.59017, "o", "Progress 28/135: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, file-embed, hashable, haskeline, hfsevents, html"]+[68.657569, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.657672, "o", "Progress 29/135: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, hashable, haskeline, hfsevents, html, indexed-traversable"]+[68.723733, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.723758, "o", "Progress 30/135: ansi-wl-pprint, async, data-default-instances-containers, data-default-instances-dlist, haskeline, hfsevents, html, indexed-traversable"]+[68.790493, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.790587, "o", "Progress 31/135: ansi-wl-pprint, async, case-insensitive, data-default-instances-dlist, haskeline, hfsevents, html, indexed-traversable"]+[68.854509, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.854652, "o", "Progress 32/135: async, case-insensitive, data-default-instances-dlist, data-fix, haskeline, hfsevents, html, indexed-traversable"]+[68.924087, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.924291, "o", "Progress 33/135: async, case-insensitive, data-default-instances-dlist, data-fix, hfsevents, html, indexed-traversable, integer-logarithms"]+[68.992299, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[68.992428, "o", "Progress 34/135: async, case-insensitive, data-fix, hfsevents, html, indexed-traversable, integer-logarithms, microlens"]+[69.060303, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.060327, "o", "Progress 35/135: async, case-insensitive, data-fix, html, indexed-traversable, integer-logarithms, microlens, network"]+[69.135362, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.13558, "o", "Progress 36/135: async, case-insensitive, data-fix, indexed-traversable, integer-logarithms, microlens, network, old-locale"]+[69.198866, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.198995, "o", "Progress 37/135: async, case-insensitive, data-fix, integer-logarithms, microlens, network, old-locale, parallel"]+[69.266419, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.266578, "o", "Progress 38/135: case-insensitive, data-fix, integer-logarithms, microlens, network, old-locale, parallel, parser-combinators"]+[69.331747, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.331772, "o", "Progress 39/135: data-fix, integer-logarithms, microlens, network, old-locale, parallel, parser-combinators, prettyprinter"]+[69.398399, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.398528, "o", "Progress 40/135: integer-logarithms, microlens, network, old-locale, parallel, parser-combinators, prettyprinter, primitive"]+[69.463617, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.463642, "o", "Progress 41/135: microlens, network, old-locale, parallel, parser-combinators, prettyprinter, primitive, regex-base"]+[69.531593, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.531619, "o", "Progress 42/135: network, old-locale, parallel, parser-combinators, prettyprinter, primitive, regex-base, safe"]+[69.59901, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.599133, "o", "Progress 43/135: data-default-instances-old-locale, network, parallel, parser-combinators, prettyprinter, primitive, regex-base, safe"]+[69.666844, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.666868, "o", "Progress 44/135: data-default-instances-old-locale, network, parser-combinators, prettyprinter, primitive, regex-base, safe, safe-exceptions"]+[69.734599, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.734705, "o", "Progress 45/135: data-default-instances-old-locale, network, prettyprinter, primitive, regex-base, safe, safe-exceptions, split"]+[69.803643, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.803804, "o", "Progress 46/135: data-default-instances-old-locale, network, prettyprinter-ansi-terminal, primitive, regex-base, safe, safe-exceptions, split"]+[69.876169, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.876423, "o", "Progress 47/135: data-default-instances-old-locale, network, prettyprinter-ansi-terminal, regex-base, safe, safe-exceptions, scientific, split"]+[69.96197, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[69.962098, "o", "Progress 48/135: data-default-instances-old-locale, network, prettyprinter-ansi-terminal, regex-tdfa, safe, safe-exceptions, scientific, split"]+[70.031083, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.031217, "o", "Progress 49/135: data-default-instances-old-locale, doclayout, network, prettyprinter-ansi-terminal, regex-tdfa, safe-exceptions, scientific, split"]+[70.102656, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.102785, "o", "Progress 50/135: data-default, doclayout, network, prettyprinter-ansi-terminal, regex-tdfa, safe-exceptions, scientific, split"]+[70.184031, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.184197, "o", "Progress 51/135: data-default, doclayout, network, prettyprinter-ansi-terminal, regex-tdfa, scientific, split, splitmix"]+[70.265704, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.265892, "o", "Progress 52/135: data-default, doclayout, network, prettyprinter-ansi-terminal, regex-tdfa, scientific, splitmix, tabular"]+[70.333181, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.333205, "o", "Progress 53/135: data-default, doclayout, network, regex-tdfa, scientific, splitmix, tabular, tagged"]+[70.414374, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.414449, "o", "Progress 54/135: attoparsec, data-default, doclayout, network, regex-tdfa, splitmix, tabular, tagged"]+[70.496118, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.496311, "o", "Progress 55/135: attoparsec, data-default, doclayout, megaparsec, network, splitmix, tabular, tagged"]+[70.598438, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.598826, "o", "Progress 56/135: attoparsec, data-default, megaparsec, network, splitmix, tabular, tagged, text-short"]+[70.693058, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.693163, "o", "Progress 57/135: attoparsec, megaparsec, network, splitmix, tabular, tagged, text-short"]+[70.761599, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.761687, "o", "Progress 58/135: attoparsec, megaparsec, network, random, tabular, tagged, text-short, th-abstraction"]+[70.83064, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.830749, "o", "Progress 59/135: attoparsec, megaparsec, network, random, tagged, text-short, th-abstraction, th-compat"]+[70.8998, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[70.899943, "o", "Progress 60/135: attoparsec, distributive, megaparsec, network, random, text-short, th-abstraction, th-compat"]+[71.052999, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.053099, "o", "Progress 61/135: distributive, megaparsec, network, random, text-short, th-abstraction, th-compat, time-compat"]+[71.131267, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.131455, "o", "Progress 62/135: distributive, network, random, text-short, th-abstraction, th-compat, time-compat"]+[71.20473, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.204874, "o", "Progress 63/135: distributive, network, random, th-abstraction, th-compat, time-compat, timeit"]+[71.277562, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.277739, "o", "Progress 64/135: distributive, microlens-th, network, random, th-compat, time-compat, timeit, transformers-compat"]+[71.362161, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.362585, "o", "Progress 65/135: QuickCheck, distributive, microlens-th, network, th-compat, time-compat, timeit, transformers-compat"]+[71.444863, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.445058, "o", "Progress 66/135: QuickCheck, distributive, githash, microlens-th, network, time-compat, timeit, transformers-compat"]+[71.513027, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.513054, "o", "Progress 67/135: QuickCheck, githash, microlens-th, network, temporary, time-compat, timeit, transformers-compat"]+[71.579238, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.579368, "o", "Progress 68/135: QuickCheck, githash, microlens-th, network, temporary, th-lift, timeit, transformers-compat"]+[71.650516, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.650729, "o", "Progress 69/135: QuickCheck, githash, microlens-th, network, temporary, th-lift, transformers-compat, uglymemo"]+[71.716619, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.716868, "o", "Progress 70/135: QuickCheck, githash, microlens-th, network, temporary, th-lift, uglymemo"]+[71.798709, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.79885, "o", "Progress 71/135: Glob, QuickCheck, comonad, githash, network, temporary, th-lift, uglymemo"]+[71.877181, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.877386, "o", "Progress 72/135: Glob, comonad, githash, microlens-mtl, network, temporary, th-lift, uglymemo"]+[71.956409, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[71.956632, "o", "Progress 73/135: Glob, comonad, microlens-mtl, mmorph, network, temporary, th-lift, uglymemo"]+[72.036224, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.036407, "o", "Progress 74/135: Glob, comonad, microlens-mtl, mmorph, network, optparse-applicative, th-lift, uglymemo"]+[72.11443, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.114529, "o", "Progress 75/135: Glob, comonad, microlens-mtl, mmorph, network, optparse-applicative, transformers-base, uglymemo"]+[72.195284, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.195398, "o", "Progress 76/135: Glob, comonad, microlens-mtl, mmorph, network, optparse-applicative, transformers-base, unix-compat"]+[72.276523, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.276693, "o", "Progress 77/135: comonad, microlens-mtl, mmorph, network, optparse-applicative, transformers-base, unix-compat, unliftio-core"]+[72.357975, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.358124, "o", "Progress 78/135: bifunctors, microlens-mtl, mmorph, network, optparse-applicative, transformers-base, unix-compat, unliftio-core"]+[72.435967, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.436122, "o", "Progress 79/135: bifunctors, mmorph, network, optparse-applicative, transformers-base, unix-compat, unliftio-core, unordered-containers"]+[72.518475, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.518643, "o", "Progress 80/135: bifunctors, lucid, network, optparse-applicative, transformers-base, unix-compat, unliftio-core, unordered-containers"]+[72.598651, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.598771, "o", "Progress 81/135: bifunctors, lucid, network, pretty-simple, transformers-base, unix-compat, unliftio-core, unordered-containers"]+[72.681608, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.681657, "o", "Progress 82/135: bifunctors, lucid, network, pretty-simple, tasty, transformers-base, unliftio-core, unordered-containers"]+[72.764176, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.764276, "o", "Progress 83/135: bifunctors, lucid, network, pretty-simple, resourcet, tasty, transformers-base, unordered-containers"]+[72.845507, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.845599, "o", "Progress 84/135: assoc, lucid, network, pretty-simple, resourcet, tasty, transformers-base, unordered-containers"]+[72.926562, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[72.926584, "o", "Progress 85/135: assoc, config-ini, lucid, network, pretty-simple, resourcet, tasty, transformers-base"]+[73.008067, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.008212, "o", "Progress 86/135: assoc, config-ini, network, pretty-simple, profunctors, resourcet, tasty, transformers-base"]+[73.091174, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.091318, "o", "Progress 87/135: assoc, config-ini, network, profunctors, resourcet, semigroupoids, tasty, transformers-base"]+[73.171688, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.171711, "o", "Progress 88/135: assoc, config-ini, network, profunctors, resourcet, semigroupoids, tasty-hunit, transformers-base"]+[73.251539, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.251706, "o", "Progress 89/135: assoc, config-ini, network, profunctors, semigroupoids, tasty-hunit, transformers-base, typed-process"]+[73.331631, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.331658, "o", "Progress 90/135: config-ini, network, profunctors, semigroupoids, tasty-hunit, these, transformers-base, typed-process"]+[73.410026, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.410057, "o", "Progress 91/135: network, profunctors, semigroupoids, tasty-hunit, these, transformers-base, typed-process, utf8-string"]+[73.487501, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.487713, "o", "Progress 92/135: network, profunctors, tasty-hunit, these, transformers-base, typed-process, utf8-string, utility-ht"]+[73.568477, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.568585, "o", "Progress 93/135: network, profunctors, these, transformers-base, typed-process, utf8-string, utility-ht, uuid-types"]+[73.649047, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.649073, "o", "Progress 94/135: network, profunctors, these, transformers-base, utf8-string, utility-ht, uuid-types, vector"]+[73.731333, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.731511, "o", "Progress 95/135: network, profunctors, strict, transformers-base, utf8-string, utility-ht, uuid-types, vector"]+[73.81237, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.812504, "o", "Progress 96/135: network, profunctors, strict, transformers-base, utility-ht, uuid-types, vector, wizards"]+[73.893704, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.893735, "o", "Progress 97/135: network, profunctors, strict, transformers-base, uuid-types, vector, wizards, word-wrap"]+[73.973933, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[73.974107, "o", "Progress 98/135: network, profunctors, strict, transformers-base, vector, wizards, word-wrap, zlib"]+[74.055498, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.055671, "o", "Progress 99/135: cassava, network, profunctors, strict, transformers-base, wizards, word-wrap, zlib"]+[74.137336, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.13748, "o", "Progress 100/135: cassava, hashtables, network, profunctors, transformers-base, wizards, word-wrap, zlib"]+[74.218419, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.218649, "o", "Progress 101/135: cassava, hashtables, indexed-traversable-instances, network, profunctors, transformers-base, word-wrap, zlib"]+[74.298043, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.298211, "o", "Progress 102/135: cassava, hashtables, indexed-traversable-instances, isomorphism-class, network, profunctors, transformers-base, zlib"]+[74.377516, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.377666, "o", "Progress 103/135: cassava, hashtables, indexed-traversable-instances, isomorphism-class, math-functions, network, profunctors, transformers-base"]+[74.494776, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.494803, "o", "Progress 104/135: cassava-megaparsec, hashtables, indexed-traversable-instances, isomorphism-class, math-functions, network, profunctors, transformers-base"]+[74.575948, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.575983, "o", "Progress 105/135: cassava-megaparsec, indexed-traversable-instances, isomorphism-class, math-functions, network, profunctors, text-zipper, transformers-base"]+[74.657861, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.658072, "o", "Progress 106/135: cassava-megaparsec, isomorphism-class, math-functions, network, profunctors, semialign, text-zipper, transformers-base"]+[74.739153, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.739407, "o", "Progress 107/135: cassava-megaparsec, math-functions, network, profunctors, semialign, text-zipper, transformers-base, vector-algorithms"]+[74.81977, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.819796, "o", "Progress 108/135: cassava-megaparsec, network, profunctors, semialign, text-zipper, transformers-base, vector-algorithms, vty"]+[74.90125, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.901382, "o", "Progress 109/135: network, profunctors, semialign, text-zipper, transformers-base, vector-algorithms, vty, witherable"]+[74.98241, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[74.982453, "o", "Progress 110/135: network, profunctors, semialign, transformers-base, vector-algorithms, vty, witherable"]+[75.064802, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[75.064937, "o", "Progress 111/135: network, profunctors, transformers-base, vector-algorithms, vty, witherable"]+[75.145547, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[75.145657, "o", "Progress 112/135: mono-traversable, network, profunctors, transformers-base, vty, witherable"]+[75.227361, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[75.227466, "o", "Progress 113/135: brick, mono-traversable, network, profunctors, transformers-base, witherable"]+[75.307274, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[75.307411, "o", "Progress 114/135: aeson, brick, mono-traversable, network, profunctors, transformers-base"]+[75.387084, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[75.387243, "o", "Progress 115/135: aeson, brick, conduit, network, profunctors, transformers-base"]+[75.465978, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 116/135: aeson, conduit, network, profunctors, transformers-base"]+[75.546452, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 117/135: aeson-pretty, conduit, network, profunctors, shakespeare, transformers-base"]+[75.621012, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[75.621051, "o", "Progress 118/135: aeson-pretty, network, profunctors, shakespeare, transformers-base"]+[75.699655, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 119/135: network, profunctors, shakespeare, transformers-base"]+[75.777227, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 120/135: network, profunctors, transformers-base"]+[77.054756, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[77.05478, "o", "Progress 121/135: monad-control, network, profunctors"]+[78.886525, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[78.886608, "o", "Progress 122/135: fsnotify, network, profunctors"]+[82.257503, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 123/135: network, profunctors"]+[82.728565, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[82.728678, "o", "Progress 124/135: foldl, network"]+[87.694345, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 125/135: foldl, streaming-commons"]+[88.48506, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 126/135: deferred-folds, streaming-commons"]+[91.786806, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[91.786915, "o", "Progress 127/135: streaming-commons, text-builder-dev"]+[93.637853, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[93.637965, "o", "Progress 128/135: conduit-extra, text-builder-dev"]+[95.3383, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[95.338329, "o", "Progress 129/135: conduit-extra, text-builder"]+[97.425921, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[97.426085, "o", "Progress 130/135: conduit-extra, text-ansi"]+[98.793653, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[98.79376, "o", "Progress 131/135: pager, text-ansi"]+[101.681294, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 132/135: text-ansi"]+[105.094767, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[105.094795, "o", "Progress 133/135: hledger-lib"]+[124.900153, "o", " "]+[125.10379, "o", " "]+[125.291966, "o", " "]+[125.52379, "o", "#"]+[125.811915, "o", " "]+[126.086154, "o", "w"]+[126.232879, "o", "h"]+[126.296292, "o", "i"]+[126.356857, "o", "l"]+[126.469053, "o", "e"]+[126.600857, "o", " "]+[126.7246, "o", "w"]+[126.821066, "o", "e"]+[126.92071, "o", " "]+[127.100508, "o", "w"]+[127.202095, "o", "a"]+[127.36135, "o", "i"]+[127.514402, "o", "t"]+[127.848334, "o", "."]+[128.025137, "o", "."]+[128.176967, "o", "."]+[128.301749, "o", " "]+[128.962672, "o", "t"]+[129.065807, "o", "h"]+[129.127209, "o", "i"]+[129.242853, "o", "s"]+[129.354678, "o", " "]+[129.485986, "o", "i"]+[129.682919, "o", "s"]+[129.719141, "o", " "]+[132.25637, "o", "t"]+[132.447468, "o", "y"]+[132.519602, "o", "p"]+[132.754644, "o", "i"]+[132.909922, "o", "c"]+[133.022794, "o", "a"]+[133.172551, "o", "l"]+[133.239931, "o", " "]+[133.47921, "o", "o"]+[133.635156, "o", "f"]+[133.859473, "o", " "]+[134.554253, "o", "a"]+[134.675146, "o", "n"]+[134.727527, "o", " "]+[135.019586, "o", "u"]+[135.039525, "o", "p"]+[135.183684, "o", "g"]+[135.231371, "o", "r"]+[135.367296, "o", "a"]+[135.475442, "o", "d"]+[135.683532, "o", "e"]+[138.746489, "o", "^[\b \b\b \b"]+[138.934445, "o", "^[\b \b\b \b"]+[139.094216, "o", "^[\b \b\b \b"]+[139.246407, "o", "^[\b \b\b \b"]+[139.760467, "o", "\b \b"]+[140.011539, "o", "\b \b"]+[140.045528, "o", "\b \b"]+[140.079623, "o", "\b \b"]+[140.113546, "o", "\b \b"]+[140.14639, "o", "\b \b"]+[140.180617, "o", "\b \b"]+[140.213819, "o", "\b \b"]+[140.246522, "o", "\b \b"]+[140.280527, "o", "\b \b"]+[140.313978, "o", "\b \b"]+[140.347237, "o", "\b \b"]+[140.380655, "o", "\b \b"]+[140.413996, "o", "\b \b"]+[140.447289, "o", "\b \b"]+[140.480658, "o", "\b \b"]+[140.514108, "o", "\b \b"]+[140.547243, "o", "\b \b"]+[140.580524, "o", "\b \b"]+[140.613946, "o", "\b \b"]+[140.647146, "o", "\b \b"]+[140.680572, "o", "\b \b"]+[140.713902, "o", "\b \b"]+[140.747334, "o", "\b \b"]+[140.779893, "o", "\b \b"]+[140.814134, "o", "\b \b"]+[140.847331, "o", "\b \b"]+[140.881532, "o", "\b \b"]+[140.913396, "o", "\b \b"]+[140.947008, "o", "\b \b"]+[140.980381, "o", "\b \b"]+[141.013783, "o", "\b \b"]+[141.047946, "o", "\b \b"]+[141.081042, "o", "\b \b"]+[141.116427, "o", "\b \b"]+[141.14786, "o", "\b \b"]+[141.181264, "o", "\b \b"]+[141.21468, "o", "\b \b"]+[141.248057, "o", "\b \b"]+[141.281415, "o", "\b \b"]+[141.314729, "o", "\b \b"]+[141.563137, "o", "\b \b"]+[141.745654, "o", "\b \b"]+[141.921348, "o", "\b \b"]+[142.11468, "o", "\b \b"]+[145.659727, "o", "m"]+[145.856586, "o", "a"]+[145.912839, "o", "n"]+[146.205114, "o", "y"]+[146.266482, "o", " "]+[146.557181, "o", "p"]+[146.665137, "o", "a"]+[146.728362, "o", "c"]+[146.82955, "o", "k"]+[146.933884, "o", "a"]+[147.085768, "o", "g"]+[147.150165, "o", "e"]+[147.214058, "o", "s"]+[150.416886, "o", " "]+[150.721088, "o", "w"]+[150.840988, "o", "e"]+[150.984826, "o", "r"]+[151.15052, "o", "e"]+[151.591895, "o", " "]+[151.741116, "o", "r"]+[151.777834, "o", "e"]+[152.299721, "o", "u"]+[152.359707, "o", "s"]+[152.447583, "o", "e"]+[152.631718, "o", "d"]+[152.945893, "o", ","]+[153.026015, "o", " "]+[153.264877, "o", "b"]+[153.388912, "o", "u"]+[153.488425, "o", "t"]+[153.576752, "o", " "]+[153.739446, "o", "s"]+[153.83178, "o", "o"]+[153.875742, "o", "m"]+[153.999549, "o", "e"]+[154.150705, "o", " "]+[154.393811, "o", "m"]+[154.620866, "o", "u"]+[154.701323, "o", "s"]+[154.802695, "o", "t"]+[157.481655, "o", " "]+[157.674667, "o", "b"]+[157.782107, "o", "e"]+[157.870761, "o", " "]+[158.167673, "o", "r"]+[158.210803, "o", "e"]+[158.525522, "o", "b"]+[158.639369, "o", "u"]+[158.695678, "o", "i"]+[158.767703, "o", "l"]+[158.859281, "o", "t"]+[159.730592, "o", ","]+[159.798749, "o", " "]+[159.993608, "o", "w"]+[160.109374, "o", "h"]+[160.162186, "o", "i"]+[160.28634, "o", "c"]+[160.447356, "o", "h"]+[160.515476, "o", " "]+[160.67146, "o", "i"]+[160.771515, "o", "s"]+[160.883243, "o", " "]+[161.075469, "o", "s"]+[161.229463, "o", "l"]+[161.416524, "o", "o"]+[161.524486, "o", "w"]+[167.293214, "o", "^[\b \b\b \b"]+[167.543741, "o", "^[\b \b\b \b"]+[167.578005, "o", "^[\b \b\b \b"]+[167.614352, "o", "^[\b \b\b \b"]+[167.64986, "o", "^[\b \b\b \b"]+[167.678083, "o", "^[\b \b\b \b"]+[167.711754, "o", "^[\b \b\b \b"]+[167.745027, "o", "^[\b \b\b \b"]+[167.778339, "o", "^[\b \b\b \b"]+[167.810864, "o", "^[\b \b\b \b"]+[167.844517, "o", "^[\b \b\b \b"]+[168.012097, "o", "\b \b"]+[168.262716, "o", "\b \b"]+[168.296208, "o", "\b \b"]+[168.330071, "o", "\b \b"]+[168.364279, "o", "\b \b"]+[168.398918, "o", "\b \b"]+[168.432997, "o", "\b \b"]+[168.46694, "o", "\b \b"]+[168.500469, "o", "\b \b"]+[168.535262, "o", "\b \b"]+[168.569243, "o", "\b \b"]+[168.602376, "o", "\b \b"]+[168.63558, "o", "\b \b"]+[168.668045, "o", "\b \b"]+[168.701816, "o", "\b \b"]+[168.735791, "o", "\b \b"]+[168.768926, "o", "\b \b"]+[168.802002, "o", "\b \b"]+[168.835698, "o", "\b \b"]+[168.869717, "o", "\b \b"]+[168.903577, "o", "\b \b"]+[168.936855, "o", "\b \b"]+[168.970255, "o", "\b \b"]+[169.003473, "o", "\b \b"]+[169.037001, "o", "\b \b"]+[169.070459, "o", "\b \b"]+[169.106225, "o", "\b \b"]+[169.137083, "o", "\b \b"]+[169.170444, "o", "\b \b"]+[169.203853, "o", "\b \b"]+[169.237119, "o", "\b \b"]+[169.270454, "o", "\b \b"]+[169.303775, "o", "\b \b"]+[169.337283, "o", "\b \b"]+[169.370569, "o", "\b \b"]+[169.403888, "o", "\b \b"]+[169.437329, "o", "\b \b"]+[169.470419, "o", "\b \b"]+[169.503484, "o", "\b \b"]+[169.537466, "o", "\b \b"]+[169.570939, "o", "\b \b"]+[169.603778, "o", "\b \b"]+[169.637584, "o", "\b \b"]+[169.671365, "o", "\b \b"]+[169.704103, "o", "\b \b"]+[169.737744, "o", "\b \b"]+[169.770865, "o", "\b \b"]+[169.804304, "o", "\b \b"]+[169.837629, "o", "\b \b"]+[169.871041, "o", "\b \b"]+[169.904426, "o", "\b \b"]+[169.937688, "o", "\b \b"]+[169.970437, "o", "\b \b"]+[170.004348, "o", "\b \b"]+[170.037725, "o", "\b \b"]+[170.071155, "o", "\b \b"]+[170.103802, "o", "\b \b"]+[170.13777, "o", "\b \b"]+[170.170803, "o", "\b \b"]+[170.203971, "o", "\b \b"]+[170.238057, "o", "\b \b"]+[170.270643, "o", "\b \b"]+[170.303989, "o", "\b \b"]+[170.337429, "o", "\b \b"]+[170.37077, "o", "\b \b"]+[170.404069, "o", "\b \b"]+[170.437928, "o", "\b \b"]+[170.470974, "o", "\b \b"]+[170.504817, "o", "\b \b"]+[170.537558, "o", "\b \b"]+[170.5716, "o", "\b \b"]+[170.604249, "o", "\b \b"]+[187.022409, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 134/135: hledger"]+[208.519027, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[208.610929, "o", "\r\n"]+[208.650759, "o", "Installing hledger-ui\r\n"]+[208.650852, "o", "Trying stack install --install-ghc --resolver=lts-20.14 hledger-ui-1.29.1 hledger-1.29.1 hledger-lib-1.29.1 brick-1.6 fsnotify-0.4.1.0 --verbosity=error\r\n"]+[210.456915, "o", "Progress 0/138"]+[210.56121, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 1/138: Diff, OneTuple, Only, StateVar, base-compat, base-orphans, bimap, blaze-builder"]+[210.631118, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[210.631278, "o", "Progress 2/138: OneTuple, Only, StateVar, base-compat, base-orphans, bimap, blaze-builder, cabal-doctest"]+[210.699119, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[210.699142, "o", "Progress 3/138: Only, StateVar, base-compat, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack"]+[210.768085, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[210.768204, "o", "Progress 4/138: StateVar, base-compat, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack, cereal"]+[210.836597, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[210.836621, "o", "Progress 5/138: base-compat, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack, cereal, clock"]+[210.904689, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[210.904712, "o", "Progress 6/138: base-compat-batteries, base-orphans, bimap, blaze-builder, cabal-doctest, call-stack, cereal, clock"]+[210.97276, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[210.97295, "o", "Progress 7/138: base-compat-batteries, bimap, blaze-builder, cabal-doctest, call-stack, cereal, clock, cmdargs"]+[211.041426, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.04157, "o", "Progress 8/138: base-compat-batteries, blaze-builder, cabal-doctest, call-stack, cereal, clock, cmdargs, colour"]+[211.10961, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.109752, "o", "Progress 9/138: base-compat-batteries, blaze-markup, cabal-doctest, call-stack, cereal, clock, cmdargs, colour"]+[211.176626, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.176715, "o", "Progress 10/138: base-compat-batteries, blaze-markup, call-stack, cereal, clock, cmdargs, colour, contravariant"]+[211.246487, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.246639, "o", "Progress 11/138: base-compat-batteries, blaze-markup, cereal, clock, cmdargs, colour, contravariant, control-monad-free"]+[211.312718, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.31277, "o", "Progress 12/138: base-compat-batteries, blaze-markup, clock, cmdargs, colour, contravariant, control-monad-free, csv"]+[211.378998, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.37914, "o", "Progress 13/138: base-compat-batteries, blaze-markup, cmdargs, colour, contravariant, control-monad-free, csv, data-array-byte"]+[211.447096, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.447219, "o", "Progress 14/138: blaze-markup, cmdargs, colour, contravariant, control-monad-free, csv, data-array-byte, data-clist"]+[211.513292, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.513417, "o", "Progress 15/138: blaze-markup, colour, contravariant, control-monad-free, csv, data-array-byte, data-clist, data-default-class"]+[211.579345, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.579372, "o", "Progress 16/138: ansi-terminal, blaze-markup, contravariant, control-monad-free, csv, data-array-byte, data-clist, data-default-class"]+[211.646576, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.646702, "o", "Progress 17/138: ansi-terminal, blaze-html, contravariant, control-monad-free, csv, data-array-byte, data-clist, data-default-class"]+[211.712898, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.712975, "o", "Progress 18/138: ansi-terminal, blaze-html, control-monad-free, csv, data-array-byte, data-clist, data-default-class, dlist"]+[211.780733, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.780869, "o", "Progress 19/138: ansi-terminal, blaze-html, csv, data-array-byte, data-clist, data-default-class, dlist, emojis"]+[211.84951, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.84961, "o", "Progress 20/138: ansi-terminal, blaze-html, data-array-byte, data-clist, data-default-class, dlist, emojis, extra"]+[211.917178, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.917253, "o", "Progress 21/138: ansi-terminal, blaze-html, data-clist, data-default-class, dlist, emojis, extra, file-embed"]+[211.98254, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[211.982703, "o", "Progress 22/138: ansi-terminal, blaze-html, data-default-class, dlist, emojis, extra, file-embed, hashable"]+[212.051007, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.05111, "o", "Progress 23/138: ansi-terminal, blaze-html, data-default-instances-containers, dlist, emojis, extra, file-embed, hashable"]+[212.120578, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.120658, "o", "Progress 24/138: ansi-wl-pprint, blaze-html, data-default-instances-containers, dlist, emojis, extra, file-embed, hashable"]+[212.19121, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.191316, "o", "Progress 25/138: ansi-wl-pprint, data-default-instances-containers, dlist, emojis, extra, file-embed, hashable, haskeline"]+[212.25921, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.259234, "o", "Progress 26/138: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, emojis, extra, file-embed, hashable, haskeline"]+[212.326794, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.326904, "o", "Progress 27/138: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, extra, file-embed, hashable, haskeline, hfsevents"]+[212.394437, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.394569, "o", "Progress 28/138: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, file-embed, hashable, haskeline, hfsevents, html"]+[212.461719, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.461844, "o", "Progress 29/138: ansi-wl-pprint, data-default-instances-containers, data-default-instances-dlist, hashable, haskeline, hfsevents, html, indexed-traversable"]+[212.529895, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.529984, "o", "Progress 30/138: ansi-wl-pprint, async, data-default-instances-containers, data-default-instances-dlist, haskeline, hfsevents, html, indexed-traversable"]+[212.596302, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.596332, "o", "Progress 31/138: ansi-wl-pprint, async, case-insensitive, data-default-instances-dlist, haskeline, hfsevents, html, indexed-traversable"]+[212.663522, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.663711, "o", "Progress 32/138: async, case-insensitive, data-default-instances-dlist, data-fix, haskeline, hfsevents, html, indexed-traversable"]+[212.732066, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.732176, "o", "Progress 33/138: async, case-insensitive, data-default-instances-dlist, data-fix, hfsevents, html, indexed-traversable, integer-logarithms"]+[212.803699, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.803856, "o", "Progress 34/138: async, case-insensitive, data-fix, hfsevents, html, indexed-traversable, integer-logarithms"]+[212.872589, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.872695, "o", "Progress 35/138: async, case-insensitive, data-fix, html, indexed-traversable, integer-logarithms, microlens, network"]+[212.939065, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[212.939209, "o", "Progress 36/138: async, case-insensitive, data-fix, indexed-traversable, integer-logarithms, microlens, network, old-locale"]+[213.007071, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.007208, "o", "Progress 37/138: async, case-insensitive, data-fix, integer-logarithms, microlens, network, old-locale, parallel"]+[213.073058, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.073179, "o", "Progress 38/138: case-insensitive, data-fix, integer-logarithms, microlens, network, old-locale, parallel, parser-combinators"]+[213.142147, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.142288, "o", "Progress 39/138: data-fix, integer-logarithms, microlens, network, old-locale, parallel, parser-combinators, prettyprinter"]+[213.208196, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.208305, "o", "Progress 40/138: integer-logarithms, microlens, network, old-locale, parallel, parser-combinators, prettyprinter, primitive"]+[213.276614, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.276737, "o", "Progress 41/138: microlens, network, old-locale, parallel, parser-combinators, prettyprinter, primitive, regex-base"]+[213.344722, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.344855, "o", "Progress 42/138: microlens-ghc, network, old-locale, parallel, parser-combinators, prettyprinter, primitive, regex-base"]+[213.412659, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.412773, "o", "Progress 43/138: microlens-ghc, old-locale, parallel, parser-combinators, prettyprinter, primitive, regex-base, safe"]+[213.480496, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.48052, "o", "Progress 44/138: data-default-instances-old-locale, microlens-ghc, parallel, parser-combinators, prettyprinter, primitive, regex-base, safe"]+[213.545224, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.545249, "o", "Progress 45/138: data-default-instances-old-locale, microlens-ghc, parser-combinators, prettyprinter, primitive, regex-base, safe, safe-exceptions"]+[213.614912, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.615069, "o", "Progress 46/138: data-default-instances-old-locale, microlens-ghc, prettyprinter, primitive, regex-base, safe, safe-exceptions, split"]+[213.683548, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.683573, "o", "Progress 47/138: data-default-instances-old-locale, microlens-ghc, prettyprinter-ansi-terminal, primitive, regex-base, safe, safe-exceptions, split"]+[213.751275, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.751376, "o", "Progress 48/138: data-default-instances-old-locale, microlens-ghc, prettyprinter-ansi-terminal, regex-base, safe, safe-exceptions, scientific, split"]+[213.818592, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.818617, "o", "Progress 49/138: data-default-instances-old-locale, microlens-ghc, prettyprinter-ansi-terminal, regex-tdfa, safe, safe-exceptions, scientific, split"]+[213.882797, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.882936, "o", "Progress 50/138: data-default-instances-old-locale, prettyprinter-ansi-terminal, regex-tdfa, safe, safe-exceptions, scientific, split, splitmix"]+[213.952527, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[213.952602, "o", "Progress 51/138: data-default-instances-old-locale, doclayout, prettyprinter-ansi-terminal, regex-tdfa, safe-exceptions, scientific, split, splitmix"]+[214.018675, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.018755, "o", "Progress 52/138: data-default, doclayout, prettyprinter-ansi-terminal, regex-tdfa, safe-exceptions, scientific, split, splitmix"]+[214.086057, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.086167, "o", "Progress 53/138: data-default, doclayout, prettyprinter-ansi-terminal, regex-tdfa, scientific, split, splitmix, tabular"]+[214.153305, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.153449, "o", "Progress 54/138: data-default, doclayout, prettyprinter-ansi-terminal, regex-tdfa, scientific, splitmix, tabular, tagged"]+[214.22075, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.22084, "o", "Progress 55/138: data-default, doclayout, regex-tdfa, scientific, splitmix, tabular, tagged, text-short"]+[214.288325, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.288404, "o", "Progress 56/138: attoparsec, data-default, doclayout, regex-tdfa, splitmix, tabular, tagged, text-short"]+[214.355698, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.355797, "o", "Progress 57/138: attoparsec, data-default, doclayout, megaparsec, splitmix, tabular, tagged, text-short"]+[214.422581, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.422622, "o", "Progress 58/138: attoparsec, data-default, doclayout, megaparsec, random, tabular, tagged, text-short"]+[214.489728, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.489909, "o", "Progress 59/138: attoparsec, data-default, megaparsec, random, tabular, tagged, text-short, th-abstraction"]+[214.554716, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.554741, "o", "Progress 60/138: attoparsec, megaparsec, random, tabular, tagged, text-short, th-abstraction, th-compat"]+[214.622802, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.62291, "o", "Progress 61/138: attoparsec, megaparsec, random, tagged, text-short, th-abstraction, th-compat, time-compat"]+[214.688549, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.688705, "o", "Progress 62/138: attoparsec, distributive, megaparsec, random, text-short, th-abstraction, th-compat, time-compat"]+[214.756987, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.757195, "o", "Progress 63/138: attoparsec, distributive, megaparsec, random, th-abstraction, th-compat, time-compat, timeit"]+[214.893361, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.893384, "o", "Progress 64/138: distributive, megaparsec, random, th-abstraction, th-compat, time-compat, timeit, transformers-compat"]+[214.96038, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[214.960487, "o", "Progress 65/138: distributive, random, th-abstraction, th-compat, time-compat, timeit, transformers-compat, uglymemo"]+[215.02733, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.027448, "o", "Progress 66/138: QuickCheck, distributive, th-abstraction, th-compat, time-compat, timeit, transformers-compat, uglymemo"]+[215.094405, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.094507, "o", "Progress 67/138: QuickCheck, distributive, microlens-th, th-compat, time-compat, timeit, transformers-compat, uglymemo"]+[215.162117, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.162271, "o", "Progress 68/138: QuickCheck, distributive, githash, microlens-th, time-compat, timeit, transformers-compat, uglymemo"]+[215.229493, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.22957, "o", "Progress 69/138: QuickCheck, distributive, githash, microlens-th, temporary, timeit, transformers-compat, uglymemo"]+[215.296058, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.29621, "o", "Progress 70/138: QuickCheck, githash, microlens-th, temporary, th-lift, timeit, transformers-compat, uglymemo"]+[215.362368, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.362527, "o", "Progress 71/138: QuickCheck, githash, microlens-th, temporary, th-lift, transformers-compat, uglymemo, unix-compat"]+[215.429254, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.429299, "o", "Progress 72/138: Glob, QuickCheck, githash, microlens-th, temporary, th-lift, uglymemo, unix-compat"]+[215.496377, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.496458, "o", "Progress 73/138: Glob, QuickCheck, comonad, githash, microlens-th, temporary, th-lift, unix-compat"]+[215.563186, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.563233, "o", "Progress 74/138: Glob, comonad, githash, microlens-mtl, microlens-th, temporary, th-lift, unix-compat"]+[215.641494, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.64159, "o", "Progress 75/138: Glob, comonad, githash, microlens-mtl, mmorph, temporary, th-lift, unix-compat"]+[215.708527, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.708648, "o", "Progress 76/138: Glob, comonad, microlens-mtl, mmorph, optparse-applicative, temporary, th-lift, unix-compat"]+[215.787125, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.787199, "o", "Progress 77/138: Glob, comonad, microlens-mtl, mmorph, optparse-applicative, th-lift, transformers-base, unix-compat"]+[215.854041, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.854134, "o", "Progress 78/138: Glob, comonad, microlens-mtl, mmorph, optparse-applicative, transformers-base, unix-compat, unliftio-core"]+[215.921431, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.921616, "o", "Progress 79/138: Glob, comonad, microlens-mtl, mmorph, optparse-applicative, transformers-base, unliftio-core, unordered-containers"]+[215.985977, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[215.986076, "o", "Progress 80/138: comonad, microlens-mtl, mmorph, optparse-applicative, transformers-base, unliftio-core, unordered-containers, utf8-string"]+[216.055557, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.055629, "o", "Progress 81/138: bifunctors, microlens-mtl, mmorph, optparse-applicative, transformers-base, unliftio-core, unordered-containers, utf8-string"]+[216.133974, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.134141, "o", "Progress 82/138: bifunctors, mmorph, optparse-applicative, transformers-base, unliftio-core, unordered-containers, utf8-string, utility-ht"]+[216.201068, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.2012, "o", "Progress 83/138: bifunctors, lucid, optparse-applicative, transformers-base, unliftio-core, unordered-containers, utf8-string, utility-ht"]+[216.28135, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.281444, "o", "Progress 84/138: bifunctors, lucid, pretty-simple, transformers-base, unliftio-core, unordered-containers, utf8-string, utility-ht"]+[216.362203, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.36229, "o", "Progress 85/138: bifunctors, lucid, monad-control, pretty-simple, unliftio-core, unordered-containers, utf8-string, utility-ht"]+[216.441873, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.441907, "o", "Progress 86/138: bifunctors, lucid, monad-control, pretty-simple, resourcet, unordered-containers, utf8-string, utility-ht"]+[216.520616, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.520642, "o", "Progress 87/138: bifunctors, config-ini, lucid, monad-control, pretty-simple, resourcet, utf8-string, utility-ht"]+[216.60074, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.600778, "o", "Progress 88/138: bifunctors, config-ini, lucid, monad-control, pretty-simple, resourcet, tasty, utility-ht"]+[216.680877, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.681021, "o", "Progress 89/138: assoc, config-ini, lucid, monad-control, pretty-simple, resourcet, tasty, utility-ht"]+[216.758515, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.758539, "o", "Progress 90/138: assoc, config-ini, lucid, monad-control, pretty-simple, profunctors, resourcet, tasty"]+[216.837693, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.837797, "o", "Progress 91/138: assoc, config-ini, monad-control, pretty-simple, profunctors, resourcet, semigroupoids, tasty"]+[216.916621, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.916699, "o", "Progress 92/138: assoc, config-ini, monad-control, profunctors, resourcet, semigroupoids, tasty, typed-process"]+[216.996599, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[216.996719, "o", "Progress 93/138: assoc, config-ini, fsnotify, profunctors, resourcet, semigroupoids, tasty, typed-process"]+[217.075629, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.075651, "o", "Progress 94/138: assoc, config-ini, fsnotify, profunctors, semigroupoids, tasty, typed-process, uuid-types"]+[217.156508, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.156588, "o", "Progress 95/138: assoc, fsnotify, profunctors, semigroupoids, tasty, typed-process, uuid-types, vector"]+[217.235367, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.235479, "o", "Progress 96/138: assoc, fsnotify, profunctors, semigroupoids, tasty-hunit, typed-process, uuid-types, vector"]+[217.315474, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.31554, "o", "Progress 97/138: fsnotify, profunctors, semigroupoids, tasty-hunit, these, typed-process, uuid-types, vector"]+[217.395626, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.395707, "o", "Progress 98/138: fsnotify, semigroupoids, tasty-hunit, these, typed-process, uuid-types, vector, wizards"]+[217.475638, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.475722, "o", "Progress 99/138: fsnotify, tasty-hunit, these, typed-process, uuid-types, vector, wizards, word-wrap"]+[217.555656, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.555779, "o", "Progress 100/138: fsnotify, tasty-hunit, these, uuid-types, vector, wizards, word-wrap, zlib"]+[217.635321, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.635451, "o", "Progress 101/138: tasty-hunit, these, uuid-types, vector, wizards, word-wrap, zlib"]+[217.716021, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 102/138: tasty-hunit, these, vector, wizards, word-wrap, zlib"]+[217.7976, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 103/138: cassava, foldl, hashtables, tasty-hunit, these, wizards, word-wrap, zlib"]+[217.876281, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.876418, "o", "Progress 104/138: cassava, foldl, hashtables, indexed-traversable-instances, these, wizards, word-wrap, zlib"]+[217.956031, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[217.956055, "o", "Progress 105/138: cassava, foldl, hashtables, indexed-traversable-instances, isomorphism-class, wizards, word-wrap, zlib"]+[218.034092, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.034175, "o", "Progress 106/138: cassava, foldl, hashtables, indexed-traversable-instances, isomorphism-class, math-functions, word-wrap, zlib"]+[218.112437, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.112463, "o", "Progress 107/138: cassava, foldl, hashtables, indexed-traversable-instances, isomorphism-class, math-functions, microlens-platform, zlib"]+[218.191435, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.191458, "o", "Progress 108/138: cassava, foldl, hashtables, indexed-traversable-instances, isomorphism-class, math-functions, microlens-platform, streaming-commons"]+[218.266259, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.26633, "o", "Progress 109/138: cassava-megaparsec, foldl, hashtables, indexed-traversable-instances, isomorphism-class, math-functions, microlens-platform, streaming-commons"]+[218.34796, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.348118, "o", "Progress 110/138: cassava-megaparsec, deferred-folds, hashtables, indexed-traversable-instances, isomorphism-class, math-functions, microlens-platform, streaming-commons"]+[218.427342, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.427456, "o", "Progress 111/138: cassava-megaparsec, deferred-folds, indexed-traversable-instances, isomorphism-class, math-functions, microlens-platform, streaming-commons, strict"]+[218.506997, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.507155, "o", "Progress 112/138: cassava-megaparsec, deferred-folds, isomorphism-class, math-functions, microlens-platform, semialign, streaming-commons, strict"]+[218.586308, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.586619, "o", "Progress 113/138: cassava-megaparsec, deferred-folds, math-functions, microlens-platform, semialign, streaming-commons, strict, text-zipper"]+[218.662588, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.662741, "o", "Progress 114/138: cassava-megaparsec, deferred-folds, microlens-platform, semialign, streaming-commons, strict, text-zipper, vector-algorithms"]+[218.743669, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.743693, "o", "Progress 115/138: cassava-megaparsec, deferred-folds, semialign, streaming-commons, strict, text-zipper, vector-algorithms, vty"]+[218.822309, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.82248, "o", "Progress 116/138: cassava-megaparsec, deferred-folds, semialign, strict, text-zipper, vector-algorithms, vty, witherable"]+[218.902336, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.902361, "o", "Progress 117/138: deferred-folds, semialign, strict, text-zipper, vector-algorithms, vty, witherable"]+[218.981971, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[218.981993, "o", "Progress 118/138: semialign, strict, text-builder-dev, text-zipper, vector-algorithms, vty, witherable"]+[219.060363, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[219.06051, "o", "Progress 119/138: semialign, text-builder-dev, text-zipper, vector-algorithms, vty, witherable"]+[219.140577, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[219.140636, "o", "Progress 120/138: text-builder-dev, text-zipper, vector-algorithms, vty, witherable"]+[219.220406, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 121/138: text-builder-dev, vector-algorithms, vty, witherable"]+[219.299006, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 122/138: mono-traversable, text-builder-dev, vty, witherable"]+[219.379084, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 123/138: brick, mono-traversable, text-builder-dev, witherable"]+[219.457279, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[219.457305, "o", "Progress 124/138: aeson, brick, mono-traversable, text-builder-dev"]+[219.536674, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 125/138: aeson, brick, mono-traversable, text-builder"]+[219.616935, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 126/138: aeson, brick, conduit, text-builder"]+[219.697345, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 127/138: aeson, conduit, text-builder"]+[219.777222, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[219.777248, "o", "Progress 128/138: aeson-pretty, conduit, shakespeare, text-builder"]+[219.856635, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 129/138: aeson-pretty, conduit, shakespeare, text-ansi"]+[219.9347, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 130/138: aeson-pretty, conduit-extra, shakespeare, text-ansi"]+[220.014352, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 131/138: conduit-extra, shakespeare, text-ansi"]+[220.092454, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 132/138: conduit-extra, text-ansi"]+[220.170423, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 133/138: conduit-extra"]+[220.246387, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 134/138: pager"]+[220.358327, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 135/138: hledger-lib"]+[220.469458, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[220.469535, "o", "Progress 136/138: hledger"]+[220.592862, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 137/138: hledger-ui"]+[235.666409, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[235.851339, "o", "\r\n"]+[235.908524, "o", "Installing hledger-web\r\n"]+[235.908629, "o", "Trying stack install --install-ghc --resolver=lts-20.14 hledger-web-1.29.1 hledger-1.29.1 hledger-lib-1.29.1 brick-1.6 fsnotify-0.4.1.0 --verbosity=error\r\n"]+[238.095245, "o", "Progress 0/240"]+[238.100345, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.100369, "o", "Progress 1/240: Decimal, Diff, OneTuple, Only, StateVar, appar, auto-update, base-compat"]+[238.198618, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.198732, "o", "Progress 2/240: Diff, OneTuple, Only, StateVar, appar, auto-update, base-compat, base-orphans"]+[238.266537, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.266646, "o", "Progress 3/240: OneTuple, Only, StateVar, appar, auto-update, base-compat, base-orphans, base-unicode-symbols"]+[238.334861, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.334886, "o", "Progress 4/240: Only, StateVar, appar, auto-update, base-compat, base-orphans, base-unicode-symbols, base64-bytestring"]+[238.401702, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.401726, "o", "Progress 5/240: StateVar, appar, auto-update, base-compat, base-orphans, base-unicode-symbols, base64-bytestring, basement"]+[238.468475, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.468578, "o", "Progress 6/240: appar, auto-update, base-compat, base-orphans, base-unicode-symbols, base64-bytestring, basement, bimap"]+[238.536249, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.536415, "o", "Progress 7/240: auto-update, base-compat, base-orphans, base-unicode-symbols, base64-bytestring, basement, bimap, blaze-builder"]+[238.605109, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.605134, "o", "Progress 8/240: base-compat, base-orphans, base-unicode-symbols, base64-bytestring, basement, bimap, blaze-builder, bsb-http-chunked"]+[238.67192, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.672046, "o", "Progress 9/240: base-compat-batteries, base-orphans, base-unicode-symbols, base64-bytestring, basement, bimap, blaze-builder, bsb-http-chunked"]+[238.740034, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.740202, "o", "Progress 10/240: base-compat-batteries, base-unicode-symbols, base64-bytestring, basement, bimap, blaze-builder, bsb-http-chunked"]+[238.807621, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.807646, "o", "Progress 11/240: base-compat-batteries, base64-bytestring, basement, bimap, blaze-builder, bsb-http-chunked, byteable, byteorder"]+[238.876259, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.876408, "o", "Progress 12/240: base-compat-batteries, basement, bimap, blaze-builder, bsb-http-chunked, byteable, byteorder, cabal-doctest"]+[238.944602, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[238.944736, "o", "Progress 13/240: base-compat-batteries, bimap, blaze-builder, bsb-http-chunked, byteable, byteorder, cabal-doctest, call-stack"]+[239.012796, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.012821, "o", "Progress 14/240: base-compat-batteries, blaze-builder, bsb-http-chunked, byteable, byteorder, cabal-doctest, call-stack, cereal"]+[239.080197, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.080277, "o", "Progress 15/240: base-compat-batteries, blaze-markup, bsb-http-chunked, byteable, byteorder, cabal-doctest, call-stack, cereal"]+[239.144855, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.145011, "o", "Progress 16/240: base-compat-batteries, blaze-markup, byteable, byteorder, cabal-doctest, call-stack, cereal, clock"]+[239.213337, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.213484, "o", "Progress 17/240: blaze-markup, byteable, byteorder, cabal-doctest, call-stack, cereal, clock, cmdargs"]+[239.278939, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.279044, "o", "Progress 18/240: blaze-markup, byteorder, cabal-doctest, call-stack, cereal, clock, cmdargs, colour"]+[239.346776, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.346903, "o", "Progress 19/240: blaze-markup, cabal-doctest, call-stack, cereal, clock, cmdargs, colour, contravariant"]+[239.416367, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.416435, "o", "Progress 20/240: blaze-markup, call-stack, cereal, clock, cmdargs, colour, contravariant, control-monad-free"]+[239.484391, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.484492, "o", "Progress 21/240: HUnit, blaze-markup, cereal, clock, cmdargs, colour, contravariant, control-monad-free"]+[239.552599, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.552726, "o", "Progress 22/240: HUnit, blaze-markup, clock, cmdargs, colour, contravariant, control-monad-free, csv"]+[239.62177, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.62184, "o", "Progress 23/240: HUnit, blaze-html, clock, cmdargs, colour, contravariant, control-monad-free, csv"]+[239.689679, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.689704, "o", "Progress 24/240: HUnit, blaze-html, cmdargs, colour, contravariant, control-monad-free, csv, data-array-byte"]+[239.758598, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.758743, "o", "Progress 25/240: HUnit, blaze-html, colour, contravariant, control-monad-free, csv, data-array-byte, data-clist"]+[239.827022, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.827157, "o", "Progress 26/240: HUnit, ansi-terminal, blaze-html, contravariant, control-monad-free, csv, data-array-byte, data-clist"]+[239.895255, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.895404, "o", "Progress 27/240: HUnit, ansi-terminal, blaze-html, control-monad-free, csv, data-array-byte, data-clist, data-default-class"]+[239.962592, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[239.962774, "o", "Progress 28/240: HUnit, ansi-terminal, blaze-html, csv, data-array-byte, data-clist, data-default-class, dlist"]+[240.031428, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.031548, "o", "Progress 29/240: ansi-terminal, blaze-html, csv, data-array-byte, data-clist, data-default-class, dlist, easy-file"]+[240.098215, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.098239, "o", "Progress 30/240: ansi-terminal, blaze-html, data-array-byte, data-clist, data-default-class, dlist, easy-file, emojis"]+[240.16545, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.165545, "o", "Progress 31/240: ansi-terminal, data-array-byte, data-clist, data-default-class, dlist, easy-file, emojis, entropy"]+[240.233014, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.233145, "o", "Progress 32/240: ansi-terminal, data-clist, data-default-class, dlist, easy-file, emojis, entropy, extra"]+[240.30154, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.301638, "o", "Progress 33/240: ansi-terminal, data-default-class, dlist, easy-file, emojis, entropy, extra, file-embed"]+[240.369081, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.369109, "o", "Progress 34/240: ansi-wl-pprint, data-default-class, dlist, easy-file, emojis, entropy, extra, file-embed"]+[240.436726, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.436875, "o", "Progress 35/240: ansi-wl-pprint, cookie, dlist, easy-file, emojis, entropy, extra, file-embed"]+[240.504352, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.50451, "o", "Progress 36/240: ansi-wl-pprint, cookie, data-default-instances-containers, easy-file, emojis, entropy, extra, file-embed"]+[240.570262, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.570349, "o", "Progress 37/240: ansi-wl-pprint, cookie, data-default-instances-containers, data-default-instances-dlist, emojis, entropy, extra, file-embed"]+[240.637479, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.637582, "o", "Progress 38/240: ansi-wl-pprint, cookie, data-default-instances-containers, data-default-instances-dlist, entropy, extra, file-embed, happy"]+[240.639353, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.639367, "o", "Progress 39/240: ansi-wl-pprint, cookie, data-default-instances-containers, data-default-instances-dlist, entropy, extra, file-embed, hashable"]+[240.705681, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.705758, "o", "Progress 40/240: ansi-wl-pprint, cookie, data-default-instances-containers, data-default-instances-dlist, extra, file-embed, hashable, haskeline"]+[240.773428, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.773526, "o", "Progress 41/240: ansi-wl-pprint, cookie, data-default-instances-containers, data-default-instances-dlist, file-embed, hashable, haskeline, haskell-lexer"]+[240.84194, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.842058, "o", "Progress 42/240: ansi-wl-pprint, cookie, data-default-instances-containers, data-default-instances-dlist, hashable, haskeline, haskell-lexer, hfsevents"]+[240.909961, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.910124, "o", "Progress 43/240: cookie, data-default-instances-containers, data-default-instances-dlist, hashable, haskeline, haskell-lexer, hfsevents, hourglass"]+[240.976583, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[240.976607, "o", "Progress 44/240: data-default-instances-containers, data-default-instances-dlist, hashable, haskeline, haskell-lexer, hfsevents, hourglass, hspec-discover"]+[241.044678, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.044838, "o", "Progress 45/240: data-default-instances-dlist, hashable, haskeline, haskell-lexer, hfsevents, hourglass, hspec-discover, hspec-expectations"]+[241.111665, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.111749, "o", "Progress 46/240: hashable, haskeline, haskell-lexer, hfsevents, hourglass, hspec-discover, hspec-expectations, html"]+[241.178696, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.178773, "o", "Progress 47/240: async, haskeline, haskell-lexer, hfsevents, hourglass, hspec-discover, hspec-expectations, html"]+[241.245744, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.245774, "o", "Progress 48/240: async, case-insensitive, haskell-lexer, hfsevents, hourglass, hspec-discover, hspec-expectations, html"]+[241.31167, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.311774, "o", "Progress 49/240: async, case-insensitive, data-fix, hfsevents, hourglass, hspec-discover, hspec-expectations, html"]+[241.379326, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.379432, "o", "Progress 50/240: async, case-insensitive, data-fix, hourglass, hspec-discover, hspec-expectations, html, indexed-traversable"]+[241.447871, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.447898, "o", "Progress 51/240: async, case-insensitive, data-fix, hspec-discover, hspec-expectations, html, indexed-traversable, integer-logarithms"]+[241.515852, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.516057, "o", "Progress 52/240: async, case-insensitive, data-fix, hspec-expectations, html, indexed-traversable, integer-logarithms, lift-type"]+[241.585652, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.585675, "o", "Progress 53/240: async, case-insensitive, data-fix, html, indexed-traversable, integer-logarithms, lift-type, memory"]+[241.650729, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.650856, "o", "Progress 54/240: async, case-insensitive, data-fix, indexed-traversable, integer-logarithms, lift-type, memory, microlens"]+[241.71898, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.719148, "o", "Progress 55/240: case-insensitive, data-fix, indexed-traversable, integer-logarithms, lift-type, memory, microlens, mime-types"]+[241.786658, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.786736, "o", "Progress 56/240: data-fix, http-types, indexed-traversable, integer-logarithms, lift-type, memory, microlens, mime-types"]+[241.855007, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.855141, "o", "Progress 57/240: http-types, indexed-traversable, integer-logarithms, lift-type, memory, microlens, mime-types, monad-loops"]+[241.92257, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.922683, "o", "Progress 58/240: http-types, integer-logarithms, lift-type, memory, microlens, mime-types, monad-loops, network"]+[241.98999, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[241.990128, "o", "Progress 59/240: http-types, lift-type, memory, microlens, mime-types, monad-loops, network, network-byte-order"]+[242.057033, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.057125, "o", "Progress 60/240: http-types, memory, microlens, mime-types, monad-loops, network, network-byte-order, old-locale"]+[242.12536, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.125496, "o", "Progress 61/240: asn1-types, http-types, microlens, mime-types, monad-loops, network, network-byte-order, old-locale"]+[242.192838, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.192912, "o", "Progress 62/240: asn1-types, cryptonite, http-types, mime-types, monad-loops, network, network-byte-order, old-locale"]+[242.26057, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.260593, "o", "Progress 63/240: asn1-types, cryptonite, http-types, monad-loops, network, network-byte-order, old-locale, parallel"]+[242.327874, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.327995, "o", "Progress 64/240: asn1-types, cryptonite, monad-loops, network, network-byte-order, old-locale, parallel, parser-combinators"]+[242.395234, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.395379, "o", "Progress 65/240: asn1-types, cryptonite, network, network-byte-order, old-locale, parallel, parser-combinators, path-pieces"]+[242.462965, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.463035, "o", "Progress 66/240: asn1-types, cryptonite, iproute, network-byte-order, old-locale, parallel, parser-combinators, path-pieces"]+[242.532258, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.532282, "o", "Progress 67/240: asn1-types, cryptonite, iproute, old-locale, parallel, parser-combinators, path-pieces, pem"]+[242.599596, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.599678, "o", "Progress 68/240: asn1-types, cryptonite, data-default-instances-old-locale, iproute, parallel, parser-combinators, path-pieces, pem"]+[242.667841, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.667975, "o", "Progress 69/240: asn1-encoding, cryptonite, data-default-instances-old-locale, iproute, parallel, parser-combinators, path-pieces, pem"]+[242.746703, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.746854, "o", "Progress 70/240: asn1-encoding, data-default-instances-old-locale, iproute, old-time, parallel, parser-combinators, path-pieces, pem"]+[242.814269, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.814293, "o", "Progress 71/240: asn1-encoding, data-default-instances-old-locale, iproute, old-time, parser-combinators, path-pieces, pem, persistent-template"]+[242.882447, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.882788, "o", "Progress 72/240: asn1-encoding, data-default-instances-old-locale, iproute, old-time, path-pieces, pem, persistent-template, pretty-show"]+[242.951192, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[242.951446, "o", "Progress 73/240: asn1-encoding, data-default-instances-old-locale, iproute, old-time, pem, persistent-template, pretty-show, prettyprinter"]+[243.020075, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.020366, "o", "Progress 74/240: asn1-encoding, data-default-instances-old-locale, iproute, old-time, persistent-template, pretty-show, prettyprinter, primitive"]+[243.088836, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.089097, "o", "Progress 75/240: asn1-encoding, data-default, iproute, old-time, persistent-template, pretty-show, prettyprinter, primitive"]+[243.166933, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.167115, "o", "Progress 76/240: asn1-parse, data-default, iproute, old-time, persistent-template, pretty-show, prettyprinter, primitive"]+[243.235546, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.23557, "o", "Progress 77/240: asn1-parse, data-default, iproute, persistent-template, pretty-show, prettyprinter, primitive, psqueues"]+[243.303784, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.303851, "o", "Progress 78/240: asn1-parse, data-default, iproute, pretty-show, prettyprinter, primitive, psqueues, recv"]+[243.383822, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.383848, "o", "Progress 79/240: asn1-parse, data-default, iproute, prettyprinter, primitive, psqueues, recv, regex-base"]+[243.454878, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.454906, "o", "Progress 80/240: asn1-parse, data-default, iproute, primitive, psqueues, recv, regex-base"]+[243.537616, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.537642, "o", "Progress 81/240: asn1-parse, data-default, iproute, prettyprinter-ansi-terminal, psqueues, recv, regex-base, safe"]+[243.606503, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.606638, "o", "Progress 82/240: asn1-parse, iproute, prettyprinter-ansi-terminal, psqueues, recv, regex-base, safe, safe-exceptions"]+[243.686671, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.687397, "o", "Progress 83/240: iproute, prettyprinter-ansi-terminal, psqueues, recv, regex-base, safe, safe-exceptions, scientific"]+[243.767077, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.767289, "o", "Progress 84/240: iproute, prettyprinter-ansi-terminal, recv, regex-base, safe, safe-exceptions, scientific, securemem"]+[243.847742, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.847951, "o", "Progress 85/240: iproute, prettyprinter-ansi-terminal, recv, regex-tdfa, safe, safe-exceptions, scientific, securemem"]+[243.927944, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[243.927991, "o", "Progress 86/240: iproute, recv, regex-tdfa, safe, safe-exceptions, scientific, securemem, setenv"]+[244.008974, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.009153, "o", "Progress 87/240: doclayout, iproute, recv, regex-tdfa, safe-exceptions, scientific, securemem, setenv"]+[244.091861, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.09209, "o", "Progress 88/240: doclayout, iproute, recv, regex-tdfa, scientific, securemem, setenv, silently"]+[244.173747, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.173937, "o", "Progress 89/240: attoparsec, doclayout, iproute, recv, regex-tdfa, securemem, setenv, silently"]+[244.256473, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.25674, "o", "Progress 90/240: attoparsec, crypto-cipher-types, doclayout, iproute, recv, regex-tdfa, setenv, silently"]+[244.337873, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.338151, "o", "Progress 91/240: attoparsec, crypto-cipher-types, doclayout, iproute, megaparsec, recv, setenv, silently"]+[244.418513, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.418647, "o", "Progress 92/240: attoparsec, crypto-cipher-types, doclayout, iproute, megaparsec, recv, silently"]+[244.503369, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.503569, "o", "Progress 93/240: attoparsec, crypto-cipher-types, iproute, megaparsec, recv, silently, simple-sendfile, socks"]+[244.585946, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.586075, "o", "Progress 94/240: attoparsec, crypto-cipher-types, iproute, megaparsec, recv, simple-sendfile, socks, split"]+[244.749778, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.749957, "o", "Progress 95/240: crypto-cipher-types, css-text, iproute, megaparsec, recv, simple-sendfile, socks, split"]+[244.833452, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.83358, "o", "Progress 96/240: cipher-aes, css-text, iproute, megaparsec, recv, simple-sendfile, socks, split"]+[244.920648, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[244.920859, "o", "Progress 97/240: cipher-aes, css-text, email-validate, iproute, recv, simple-sendfile, socks, split"]+[245.004308, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.004504, "o", "Progress 98/240: cipher-aes, css-text, email-validate, http-date, iproute, recv, simple-sendfile, socks"]+[245.093061, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.093304, "o", "Progress 99/240: cipher-aes, email-validate, http-date, iproute, recv, simple-sendfile, socks, splitmix"]+[245.177353, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.177536, "o", "Progress 100/240: email-validate, http-date, iproute, recv, simple-sendfile, socks, splitmix, stm-chans"]+[245.25868, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.258885, "o", "Progress 101/240: http-date, iproute, recv, simple-sendfile, socks, splitmix, stm-chans, tabular"]+[245.353467, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.353765, "o", "Progress 102/240: iproute, recv, simple-sendfile, socks, splitmix, stm-chans, tabular, tagged"]+[245.441895, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.44205, "o", "Progress 103/240: iproute, random, recv, simple-sendfile, socks, stm-chans, tabular, tagged"]+[245.53227, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.532579, "o", "Progress 104/240: iproute, random, recv, simple-sendfile, socks, tabular, tagged, tagsoup"]+[245.611307, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.611444, "o", "Progress 105/240: iproute, random, recv, simple-sendfile, socks, tagged, tagsoup, text-short"]+[245.702141, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.702337, "o", "Progress 106/240: crypto-api, iproute, random, recv, simple-sendfile, socks, tagsoup, text-short"]+[245.783398, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.783504, "o", "Progress 107/240: QuickCheck, crypto-api, iproute, recv, simple-sendfile, socks, tagsoup, text-short"]+[245.87547, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.875678, "o", "Progress 108/240: QuickCheck, crypto-api, distributive, iproute, recv, simple-sendfile, socks, text-short"]+[245.956065, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[245.956259, "o", "Progress 109/240: QuickCheck, base64, crypto-api, distributive, iproute, recv, simple-sendfile, socks"]+[246.037896, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.038091, "o", "Progress 110/240: QuickCheck, base64, distributive, iproute, recv, simple-sendfile, skein, socks"]+[246.204538, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.204902, "o", "Progress 111/240: QuickCheck, base64, distributive, iproute, simple-sendfile, skein, socks, temporary"]+[246.296273, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.29647, "o", "Progress 112/240: base64, distributive, iproute, quickcheck-io, simple-sendfile, skein, socks, temporary"]+[246.366385, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.366599, "o", "Progress 113/240: base64, iproute, quickcheck-io, simple-sendfile, skein, socks, temporary, tf-random"]+[246.476738, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.478505, "o", "Progress 114/240: iproute, quickcheck-io, simple-sendfile, skein, socks, temporary, tf-random, th-abstraction"]+[246.587328, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.587504, "o", "Progress 115/240: iproute, quickcheck-io, simple-sendfile, socks, temporary, tf-random, th-abstraction, th-compat"]+[246.669863, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.670044, "o", "Progress 116/240: iproute, quickcheck-io, simple-sendfile, socks, tf-random, th-abstraction, th-compat, time-compat"]+[246.752851, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.753063, "o", "Progress 117/240: iproute, simple-sendfile, socks, tf-random, th-abstraction, th-compat, time-compat"]+[246.838369, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.83856, "o", "Progress 118/240: hspec-core, iproute, simple-sendfile, socks, th-abstraction, th-compat, time-compat, time-manager"]+[246.934921, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[246.935075, "o", "Progress 119/240: hspec-core, iproute, microlens-th, simple-sendfile, socks, th-compat, time-compat, time-manager"]+[247.027299, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.027785, "o", "Progress 120/240: githash, hspec-core, iproute, microlens-th, simple-sendfile, socks, time-compat, time-manager"]+[247.108651, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.108834, "o", "Progress 121/240: attoparsec-iso8601, githash, hspec-core, iproute, microlens-th, simple-sendfile, socks, time-manager"]+[247.237758, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.238008, "o", "Progress 122/240: attoparsec-iso8601, githash, hspec-core, iproute, microlens-th, network-uri, simple-sendfile, socks"]+[247.357862, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.358059, "o", "Progress 123/240: attoparsec-iso8601, githash, hspec, iproute, microlens-th, network-uri, simple-sendfile, socks"]+[247.484202, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.484801, "o", "Progress 124/240: attoparsec-iso8601, githash, hspec, iproute, network-uri, simple-sendfile, socks, th-lift"]+[247.580471, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.580607, "o", "Progress 125/240: attoparsec-iso8601, hspec, iproute, network-uri, simple-sendfile, socks, th-lift, timeit"]+[247.691474, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.69175, "o", "Progress 126/240: attoparsec-iso8601, hspec, iproute, simple-sendfile, socks, th-lift, timeit, transformers-compat"]+[247.776362, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.776586, "o", "Progress 127/240: attoparsec-iso8601, iproute, simple-sendfile, socks, th-lift, timeit, transformers-compat, uglymemo"]+[247.873733, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.873881, "o", "Progress 128/240: attoparsec-iso8601, iproute, simple-sendfile, socks, timeit, transformers-compat, uglymemo, unix-compat"]+[247.958887, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[247.959107, "o", "Progress 129/240: attoparsec-iso8601, iproute, simple-sendfile, socks, transformers-compat, uglymemo, unix-compat, unix-time"]+[248.156759, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.157042, "o", "Progress 130/240: attoparsec-iso8601, iproute, socks, transformers-compat, uglymemo, unix-compat, unix-time, unliftio-core"]+[248.244179, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.244417, "o", "Progress 131/240: Glob, attoparsec-iso8601, iproute, socks, uglymemo, unix-compat, unix-time, unliftio-core"]+[248.322616, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.322645, "o", "Progress 132/240: Glob, attoparsec-iso8601, comonad, iproute, socks, unix-compat, unix-time, unliftio-core"]+[248.400002, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.40003, "o", "Progress 133/240: Glob, attoparsec-iso8601, comonad, iproute, microlens-mtl, socks, unix-time, unliftio-core"]+[248.501553, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.501819, "o", "Progress 134/240: Glob, attoparsec-iso8601, comonad, fast-logger, iproute, microlens-mtl, socks, unliftio-core"]+[248.574641, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.574901, "o", "Progress 135/240: Glob, attoparsec-iso8601, comonad, fast-logger, http2, iproute, microlens-mtl, socks"]+[248.685984, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.686427, "o", "Progress 136/240: attoparsec-iso8601, comonad, fast-logger, http2, iproute, microlens-mtl, mmorph, socks"]+[248.796137, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.796355, "o", "Progress 137/240: attoparsec-iso8601, bifunctors, fast-logger, http2, iproute, microlens-mtl, mmorph, socks"]+[248.986488, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[248.986635, "o", "Progress 138/240: attoparsec-iso8601, bifunctors, fast-logger, http2, microlens-mtl, mmorph, optparse-applicative, socks"]+[249.077079, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.077229, "o", "Progress 139/240: attoparsec-iso8601, bifunctors, fast-logger, http2, mmorph, optparse-applicative, resourcet, socks"]+[249.150474, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.150703, "o", "Progress 140/240: attoparsec-iso8601, bifunctors, http2, mmorph, optparse-applicative, resourcet, socks, transformers-base"]+[249.256882, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.256996, "o", "Progress 141/240: attoparsec-iso8601, bifunctors, http2, lucid, optparse-applicative, resourcet, socks, transformers-base"]+[249.379145, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.379457, "o", "Progress 142/240: assoc, attoparsec-iso8601, http2, lucid, optparse-applicative, resourcet, socks, transformers-base"]+[249.477034, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.477127, "o", "Progress 143/240: assoc, attoparsec-iso8601, http2, lucid, pretty-simple, resourcet, socks, transformers-base"]+[249.584993, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.585152, "o", "Progress 144/240: assoc, attoparsec-iso8601, http2, lucid, pretty-simple, profunctors, socks, transformers-base"]+[249.675321, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.675557, "o", "Progress 145/240: assoc, attoparsec-iso8601, http2, lucid, monad-control, pretty-simple, profunctors, socks"]+[249.772514, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.772875, "o", "Progress 146/240: assoc, attoparsec-iso8601, http2, monad-control, pretty-simple, profunctors, socks"]+[249.867925, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.868052, "o", "Progress 147/240: attoparsec-iso8601, http2, monad-control, pretty-simple, profunctors, socks, tasty, these"]+[249.957089, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[249.957225, "o", "Progress 148/240: attoparsec-iso8601, http2, monad-control, profunctors, socks, tasty, these, typed-process"]+[250.060103, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.060263, "o", "Progress 149/240: attoparsec-iso8601, http2, monad-control, socks, tasty, these, typed-process, unliftio"]+[250.152312, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.152514, "o", "Progress 150/240: attoparsec-iso8601, http2, socks, tasty, these, typed-process, unliftio"]+[250.246532, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.246706, "o", "Progress 151/240: attoparsec-iso8601, fsnotify, http2, lifted-base, socks, these, typed-process, unliftio"]+[250.352705, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.352989, "o", "Progress 152/240: attoparsec-iso8601, fsnotify, http2, lifted-base, socks, strict, typed-process, unliftio"]+[250.43503, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.435311, "o", "Progress 153/240: attoparsec-iso8601, fsnotify, http2, lifted-base, socks, strict, tasty-hunit, unliftio"]+[250.551862, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.551988, "o", "Progress 154/240: attoparsec-iso8601, fsnotify, http2, lifted-base, socks, strict, tasty-hunit, unordered-containers"]+[250.645382, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.645618, "o", "Progress 155/240: attoparsec-iso8601, http2, lifted-base, socks, strict, tasty-hunit, unordered-containers, utf8-string"]+[250.831046, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.831324, "o", "Progress 156/240: http2, lifted-base, socks, strict, tasty-hunit, unordered-containers, utf8-string, utility-ht"]+[250.93094, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[250.931092, "o", "Progress 157/240: http2, lifted-base, socks, tasty-hunit, unordered-containers, utf8-string, utility-ht, uuid-types"]+[251.023427, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.023594, "o", "Progress 158/240: http2, lifted-base, socks, unordered-containers, utf8-string, utility-ht, uuid-types, vector"]+[251.130261, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.130426, "o", "Progress 159/240: config-ini, http2, lifted-base, socks, utf8-string, utility-ht, uuid-types, vector"]+[251.225951, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.226094, "o", "Progress 160/240: config-ini, http2, language-javascript, lifted-base, socks, utility-ht, uuid-types, vector"]+[251.417803, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.417946, "o", "Progress 161/240: config-ini, http2, language-javascript, lifted-base, semigroupoids, utility-ht, uuid-types, vector"]+[251.519219, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.519464, "o", "Progress 162/240: config-ini, http2, language-javascript, lifted-base, semigroupoids, uuid-types, vault, vector"]+[251.614907, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.615039, "o", "Progress 163/240: config-ini, http-api-data, http2, language-javascript, lifted-base, semigroupoids, vault, vector"]+[251.72488, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.725085, "o", "Progress 164/240: cassava, config-ini, http-api-data, http2, language-javascript, lifted-base, semigroupoids, vault"]+[251.831596, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.831804, "o", "Progress 165/240: cassava, crypto-random, http-api-data, http2, language-javascript, lifted-base, semigroupoids, vault"]+[251.936229, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[251.936429, "o", "Progress 166/240: cassava, crypto-random, hashtables, http-api-data, http2, lifted-base, semigroupoids, vault"]+[252.030468, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.030664, "o", "Progress 167/240: cassava, crypto-random, foldl, hashtables, http-api-data, http2, lifted-base, vault"]+[252.158254, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.158429, "o", "Progress 168/240: cassava, crypto-random, foldl, hashtables, hjsmin, http-api-data, http2, lifted-base"]+[252.272517, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.272567, "o", "Progress 169/240: cassava-megaparsec, crypto-random, foldl, hashtables, hjsmin, http-api-data, http2, lifted-base"]+[252.365372, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.365772, "o", "Progress 170/240: cassava-megaparsec, foldl, hashtables, hjsmin, http-api-data, http2, lifted-base"]+[252.472896, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.473089, "o", "Progress 171/240: cassava-megaparsec, cprng-aes, foldl, hjsmin, http-api-data, http2, indexed-traversable-instances, lifted-base"]+[252.579823, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.579989, "o", "Progress 172/240: cassava-megaparsec, cprng-aes, deferred-folds, hjsmin, http-api-data, http2, indexed-traversable-instances, lifted-base"]+[252.687062, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.687136, "o", "Progress 173/240: cassava-megaparsec, cprng-aes, deferred-folds, http-api-data, http2, indexed-traversable-instances, isomorphism-class, lifted-base"]+[252.789364, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.789569, "o", "Progress 174/240: cprng-aes, deferred-folds, http-api-data, http2, indexed-traversable-instances, isomorphism-class, lifted-base, math-functions"]+[252.908822, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[252.909011, "o", "Progress 175/240: clientsession, deferred-folds, http-api-data, http2, indexed-traversable-instances, isomorphism-class, lifted-base, math-functions"]+[253.0197, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.019918, "o", "Progress 176/240: clientsession, deferred-folds, http-api-data, http2, isomorphism-class, lifted-base, math-functions, resource-pool"]+[253.124912, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.125296, "o", "Progress 177/240: clientsession, http-api-data, http2, isomorphism-class, lifted-base, math-functions, resource-pool, semialign"]+[253.240306, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.240424, "o", "Progress 178/240: clientsession, http-api-data, http2, lifted-base, math-functions, resource-pool, semialign, text-builder-dev"]+[253.361235, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.361386, "o", "Progress 179/240: clientsession, http-api-data, http2, lifted-base, resource-pool, semialign, text-builder-dev, text-zipper"]+[253.461299, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.46143, "o", "Progress 180/240: http-api-data, http2, lifted-base, resource-pool, semialign, text-builder-dev, text-zipper, th-lift-instances"]+[253.675232, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.675462, "o", "Progress 181/240: http-api-data, http2, resource-pool, semialign, text-builder-dev, text-zipper, th-lift-instances, vector-algorithms"]+[253.775199, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.775485, "o", "Progress 182/240: http-api-data, http2, resource-pool, text-builder-dev, text-zipper, th-lift-instances, vector-algorithms, vty"]+[253.887785, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[253.887912, "o", "Progress 183/240: http-api-data, http2, resource-pool, text-builder, text-zipper, th-lift-instances, vector-algorithms, vty"]+[254.005293, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.005539, "o", "Progress 184/240: http-api-data, http2, resource-pool, text-builder, th-lift-instances, vector-algorithms, vty, wai"]+[254.110908, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.110945, "o", "Progress 185/240: http-api-data, http2, resource-pool, text-builder, vector-algorithms, vty, wai, witherable"]+[254.264047, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.264096, "o", "Progress 186/240: http-api-data, http2, mono-traversable, resource-pool, text-builder, vty, wai, witherable"]+[254.391877, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.392095, "o", "Progress 187/240: http-api-data, http2, mono-traversable, resource-pool, text-builder, wai, witherable, wizards"]+[254.516051, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.516235, "o", "Progress 188/240: http-api-data, http2, mono-traversable, resource-pool, text-ansi, wai, witherable, wizards"]+[254.625001, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.625071, "o", "Progress 189/240: aeson, http-api-data, http2, mono-traversable, resource-pool, text-ansi, wai, wizards"]+[254.740618, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.740783, "o", "Progress 190/240: aeson, conduit, http-api-data, http2, resource-pool, text-ansi, wai, wizards"]+[254.867277, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.867462, "o", "Progress 191/240: aeson, conduit, http-api-data, http2, resource-pool, text-ansi, wai, word-wrap"]+[254.979744, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[254.979889, "o", "Progress 192/240: aeson, conduit, http-api-data, http2, resource-pool, wai, word-wrap, word8"]+[255.096189, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[255.096481, "o", "Progress 193/240: aeson-pretty, conduit, http-api-data, http2, resource-pool, wai, word-wrap, word8"]+[255.229598, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[255.229941, "o", "Progress 194/240: aeson-pretty, http-api-data, http2, libyaml, resource-pool, wai, word-wrap, word8"]+[255.365664, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[255.365848, "o", "Progress 195/240: aeson-pretty, brick, http-api-data, http2, libyaml, resource-pool, wai, word8"]+[255.486174, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[255.486274, "o", "Progress 196/240: aeson-pretty, brick, http-api-data, http2, libyaml, resource-pool, shakespeare, wai"]+[255.602276, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[255.602404, "o", "Progress 197/240: brick, http-api-data, http2, libyaml, resource-pool, shakespeare, wai"]+[255.727853, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[255.728002, "o", "Progress 198/240: brick, http-api-data, http2, resource-pool, shakespeare, wai, x509, xml-types"]+[255.845601, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[255.845746, "o", "Progress 199/240: http-api-data, http2, resource-pool, shakespeare, wai, x509, xml-types, xss-sanitize"]+[256.038051, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[256.038204, "o", "Progress 200/240: http-api-data, http2, shakespeare, wai, x509, xml-types, xss-sanitize, yaml"]+[256.17251, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[256.17324, "o", "Progress 201/240: http-api-data, http2, wai, x509, xml-types, xss-sanitize, yaml, zlib"]+[256.279842, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[256.280022, "o", "Progress 202/240: http-api-data, http2, wai, x509-store, xml-types, xss-sanitize, yaml, zlib"]+[256.403791, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[256.4039, "o", "Progress 203/240: http-api-data, http2, wai, x509-store, xss-sanitize, yaml, zlib"]+[256.500573, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 204/240: http-api-data, http2, wai, x509-store, yaml, zlib"]+[256.614574, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[256.614694, "o", "Progress 205/240: http-api-data, http2, streaming-commons, wai, x509-store, yaml"]+[256.807331, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 206/240: http-api-data, http2, streaming-commons, wai-cors, wai-logger, x509-store, yaml"]+[256.947798, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[256.947953, "o", "Progress 207/240: http-api-data, http2, streaming-commons, wai-cors, wai-logger, x509-system, x509-validation, yaml"]+[257.129081, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[257.129581, "o", "Progress 208/240: conduit-extra, http-api-data, http2, wai-cors, wai-logger, x509-system, x509-validation, yaml"]+[257.267193, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[257.267332, "o", "Progress 209/240: conduit-extra, http-api-data, http-client, http2, wai-cors, wai-logger, x509-validation, yaml"]+[257.407419, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[257.407603, "o", "Progress 210/240: conduit-extra, http-api-data, http-client, http2, tls, wai-cors, wai-logger, yaml"]+[257.551015, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[257.55119, "o", "Progress 211/240: cryptonite-conduit, http-api-data, http-client, http2, tls, wai-cors, wai-logger, yaml"]+[260.521759, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[260.521827, "o", "Progress 212/240: cryptonite-conduit, http-api-data, http-client, http2, monad-logger, tls, wai-logger, yaml"]+[262.390527, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[262.390612, "o", "Progress 213/240: cryptonite-conduit, http-client, http2, monad-logger, pager, tls, wai-logger, yaml"]+[262.58713, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[262.58741, "o", "Progress 214/240: cryptonite-conduit, hledger-lib, http-client, http2, monad-logger, tls, wai-logger, yaml"]+[262.772832, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[262.772883, "o", "Progress 215/240: cryptonite-conduit, hledger, http-client, http2, monad-logger, tls, wai-logger, yaml"]+[262.95233, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[262.953018, "o", "Progress 216/240: cryptonite-conduit, http-client, http2, monad-logger, tls, wai-logger, xml-conduit, yaml"]+[263.490861, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[263.490991, "o", "Progress 217/240: cryptonite-conduit, http-client, http2, monad-logger, tls, xml-conduit, yaml"]+[263.731057, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[263.731216, "o", "Progress 218/240: cryptonite-conduit, http-client, http2, monad-logger, tls, xml-conduit"]+[265.252348, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[265.252497, "o", "Progress 219/240: cryptonite-conduit, http-client, monad-logger, tls, warp, xml-conduit"]+[266.270033, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[266.270186, "o", "Progress 220/240: http-client, monad-logger, tls, warp, xml-conduit"]+[269.223805, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 221/240: http-client, persistent, tls, warp, xml-conduit"]+[271.75887, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 222/240: persistent, tls, warp, xml-conduit"]+[277.797344, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 223/240: persistent, tls, wai-extra, wai-handler-launch, xml-conduit"]+[279.813295, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[279.813445, "o", "Progress 224/240: html-conduit, persistent, tls, wai-extra, wai-handler-launch"]+[281.589886, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 225/240: html-conduit, persistent, tls, wai-extra"]+[286.120649, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 226/240: persistent, tls, wai-extra"]+[289.139744, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 227/240: persistent, tls, wai-app-static, yesod-core"]+[290.334113, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[290.334344, "o", "Progress 228/240: connection, persistent, wai-app-static, yesod-core"]+[294.24231, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 229/240: http-client-tls, persistent, wai-app-static, yesod-core"]+[297.378746, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[297.378938, "o", "Progress 230/240: http-conduit, persistent, wai-app-static, yesod-core"]+[298.032819, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 231/240: http-conduit, persistent, yesod-core"]+[300.492745, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 232/240: persistent, yesod-core"]+[308.438763, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 233/240: persistent, yesod-static, yesod-test"]+[313.355814, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[313.355942, "o", "Progress 234/240: yesod-persistent, yesod-static, yesod-test"]+[314.365925, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 235/240: yesod-persistent, yesod-test"]+[315.656714, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 236/240: yesod-form, yesod-test"]+[316.173906, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 237/240: yesod-form"]+[332.717061, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\bProgress 238/240: yesod"]+[336.713324, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[336.7134, "o", "Progress 239/240: hledger-web"]+[354.974123, "o", "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b \b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b"]+[355.23619, "o", "\r\n"]+[356.997391, "o", "\r\nNew install status:\r\n"]+[357.509073, "o", "hledger 1.29.1 is installed at /Users/simon/.local/bin/hledger\r\n"]+[358.045447, "o", "hledger-ui 1.29.1 is installed at /Users/simon/.local/bin/hledger-ui\r\n"]+[358.903871, "o", "hledger-web 1.29.1 is installed at /Users/simon/.local/bin/hledger-web\r\n"]+[358.932765, "o", "hledger-stockquotes 0.1.2.1 is installed at /Users/simon/.local/bin/hledger-stockquotes\r\n"]+[359.662483, "o", "hledger-edit 1.13.2 is installed at /opt/homebrew/bin/hledger-edit\r\n"]+[360.354996, "o", "hledger-plot 1.13.2 is installed at /opt/homebrew/bin/hledger-plot\r\n"]+[360.375546, "o", "hledger-interest 1.6.5 is installed at /Users/simon/.local/bin/hledger-interest\r\n"]+[360.413586, "o", "hledger-iadd 1.3.17 is installed at /Users/simon/.cabal/bin/hledger-iadd\r\n"]+[360.416339, "o", "\u001b[?2004h"]+[360.416385, "o", "$ "]+[365.313147, "o", "#"]+[366.306759, "o", " "]+[366.624867, "o", "d"]+[366.768587, "o", "o"]+[366.822121, "o", "e"]+[366.825189, "o", "n"]+[367.50777, "o", "\b\u001b[K"]+[367.680683, "o", "\b\u001b[K"]+[367.916256, "o", "n"]+[368.044179, "o", "e"]+[368.287415, "o", "."]+[368.363115, "o", " "]+[368.961613, "o", "S"]+[369.187915, "o", "o"]+[369.246177, "o", "m"]+[369.34153, "o", "e"]+[369.445492, "o", " "]+[369.5779, "o", "a"]+[369.818719, "o", "d"]+[369.98427, "o", "d"]+[370.187788, "o", "o"]+[370.259924, "o", "n"]+[370.397534, "o", "s"]+[370.525574, "o", " "]+[370.864266, "o", "w"]+[370.958329, "o", "e"]+[371.111432, "o", "r"]+[371.182965, "o", "e"]+[371.560046, "o", " "]+[371.756584, "o", "n"]+[371.80506, "o", "o"]+[371.89748, "o", "t"]+[372.040847, "o", " "]+[372.650083, "o", "u"]+[372.72412, "o", "p"]+[372.826074, "o", "g"]+[372.851334, "o", "r"]+[373.011351, "o", "a"]+[373.130255, "o", "d"]+[373.328552, "o", "e"]+[373.488942, "o", "d"]+[373.646344, "o", " "]+[373.854596, "o", "a"]+[373.96003, "o", "s"]+[374.103067, "o", " "]+[374.30972, "o", "t"]+[374.423943, "o", "h"]+[374.546169, "o", "e"]+[374.65783, "o", "y"]+[374.751791, "o", " "]+[374.920814, "o", "d"]+[375.025355, "o", "o"]+[375.070231, "o", "n"]+[375.194212, "o", "'"]+[376.96099, "o", "t"]+[377.219954, "o", " "]+[377.543877, "o", "y"]+[377.669859, "o", "e"]+[377.793524, "o", "t"]+[377.91397, "o", " "]+[378.295377, "o", "h"]+[378.371338, "o", "a"]+[378.45759, "o", "v"]+[378.54082, "o", "e"]+[378.601699, "o", " "]+[378.788839, "o", "n"]+[378.862145, "o", "e"]+[378.990827, "o", "w"]+[379.399231, "o", " "]+[379.601514, "o", "v"]+[379.787963, "o", "e"]+[379.830847, "o", "r"]+[379.959845, "o", "s"]+[380.114249, "o", "i"]+[380.154449, "o", "o"]+[380.227695, "o", "n"]+[380.301919, "o", "s"]+[382.740552, "o", "\r\u001b[C\u001b[C\u001b[K"]+[383.332762, "o", "\u001b[?2004l\r\r\n"]
+ embeddedfiles/print.cast view
@@ -0,0 +1,43 @@+{"version": 2, "width": 80, "height": 25, "timestamp": 1678904454, "idle_time_limit": 0.5, "env": {"SHELL": "/opt/homebrew/bin/bash", "TERM": "xterm-256color"}, "title": "Show full transactions (print)"}+[97.851861, "o", "\u001b[?2004h~$ "]+[99.846929, "o", "h"]+[99.937799, "o", "l"]+[100.053606, "o", "e"]+[100.200706, "o", "d"]+[100.294199, "o", "g"]+[100.442973, "o", "e"]+[100.539811, "o", "r"]+[100.67039, "o", " "]+[100.863265, "o", "p"]+[101.011799, "o", "r"]+[101.106802, "o", "i"]+[101.159327, "o", "n"]+[101.248174, "o", "t"]+[101.70797, "o", " "]+[101.896357, "o", " "]+[102.07318, "o", " "]+[102.261496, "o", "#"]+[102.529299, "o", " "]+[102.975838, "o", "s"]+[103.097044, "o", "h"]+[103.157234, "o", "o"]+[103.241647, "o", "w"]+[103.371897, "o", " "]+[104.520774, "o", "t"]+[104.586339, "o", "r"]+[104.675919, "o", "a"]+[104.793261, "o", "n"]+[104.894559, "o", "s"]+[104.97797, "o", "a"]+[105.074301, "o", "c"]+[105.278951, "o", "t"]+[105.371914, "o", "i"]+[105.402599, "o", "o"]+[105.467888, "o", "n"]+[105.52808, "o", "s"]+[106.697984, "o", "\r\n"]+[106.698066, "o", "\u001b[?2004l\r"]+[106.877241, "o", "2023-03-15 opening balances\r\n cash $50.25\r\n equity $-50.25\r\n\r\n"]+[107, "o", "\u001b[?2004h"]+[107, "o", "~$ "]+[108, "o", "\u001b[?2004l\r\r\n"]
− hledger.1
@@ -1,3275 +0,0 @@-.\"t--.TH "hledger" "1" "March 2019" "hledger 1.14" "hledger User Manuals"----.SH NAME-.PP-hledger \- a command\-line accounting tool-.SH SYNOPSIS-.PP-\f[C]hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [ARGS]\f[]-.PD 0-.P-.PD-\f[C]hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [ARGS]\f[]-.PD 0-.P-.PD-\f[C]hledger\f[]-.SH DESCRIPTION-.PP-hledger is a cross\-platform program for tracking money, time, or any-other commodity, using double\-entry accounting and a simple, editable-file format.-hledger is inspired by and largely compatible with ledger(1).-.PD 0-.P-.PD-Tested on unix, mac, windows, hledger aims to be a reliable, practical-tool for daily use.-.PP-This is hledger's command\-line interface (there are also curses and web-interfaces).-Its basic function is to read a plain text file describing financial-transactions (in accounting terms, a general journal) and print useful-reports on standard output, or export them as CSV.-hledger can also read some other file formats such as CSV files,-translating them to journal format.-Additionally, hledger lists other hledger\-* executables found in the-user's $PATH and can invoke them as subcommands.-.PP-hledger reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-If using \f[C]$LEDGER_FILE\f[], note this must be a real environment-variable, not a shell variable.-You can specify standard input with \f[C]\-f\-\f[].-.PP-Transactions are dated movements of money between two (or more) named-accounts, and are recorded with journal entries like this:-.IP-.nf-\f[C]-2015/10/16\ bought\ food-\ expenses:food\ \ \ \ \ \ \ \ \ \ $10-\ assets:cash-\f[]-.fi-.PP-For more about this format, see hledger_journal(5).-.PP-Most users use a text editor to edit the journal, usually with an editor-mode such as ledger\-mode for added convenience.-hledger's interactive add command is another way to record new-transactions.-hledger never changes existing transactions.-.PP-To get started, you can either save some entries like the above in-\f[C]~/.hledger.journal\f[], or run \f[C]hledger\ add\f[] and follow the-prompts.-Then try some commands like \f[C]hledger\ print\f[] or-\f[C]hledger\ balance\f[].-Run \f[C]hledger\f[] with no arguments for a list of commands.-.SH EXAMPLES-.PP-Two simple transactions in hledger journal format:-.IP-.nf-\f[C]-2015/9/30\ gift\ received-\ \ assets:cash\ \ \ $20-\ \ income:gifts--2015/10/16\ farmers\ market-\ \ expenses:food\ \ \ \ $10-\ \ assets:cash-\f[]-.fi-.PP-Some basic reports:-.IP-.nf-\f[C]-$\ hledger\ print-2015/09/30\ gift\ received-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ $20-\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ $\-20--2015/10/16\ farmers\ market-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ $10-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ $\-10-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ accounts\ \-\-tree-assets-\ \ cash-expenses-\ \ food-income-\ \ gifts-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ balance-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ assets:cash-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $10\ \ expenses:food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-20\ \ income:gifts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ register\ cash-2015/09/30\ gift\ received\ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ $20-2015/10/16\ farmers\ market\ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-10\ \ \ \ \ \ \ \ \ \ \ $10-\f[]-.fi-.PP-More commands:-.IP-.nf-\f[C]-$\ hledger\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ available\ commands-$\ hledger\ add\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ add\ more\ transactions\ to\ the\ journal\ file-$\ hledger\ balance\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ all\ accounts\ with\ aggregated\ balances-$\ hledger\ balance\ \-\-help\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ detailed\ help\ for\ balance\ command-$\ hledger\ balance\ \-\-depth\ 1\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ only\ top\-level\ accounts-$\ hledger\ register\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ account\ postings,\ with\ running\ total-$\ hledger\ reg\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ postings\ to/from\ income\ accounts-$\ hledger\ reg\ \[aq]assets:some\ bank:checking\[aq]\ #\ show\ postings\ to/from\ this\ checking\ account-$\ hledger\ print\ desc:shop\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ transactions\ with\ shop\ in\ the\ description-$\ hledger\ activity\ \-W\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ show\ transaction\ counts\ per\ week\ as\ a\ bar\ chart-\f[]-.fi-.SH OPTIONS-.SS General options-.PP-To see general usage help, including general options which are supported-by most hledger commands, run \f[C]hledger\ \-h\f[].-.PP-General help options:-.TP-.B \f[C]\-h\ \-\-help\f[]-show general usage (or after COMMAND, command usage)-.RS-.RE-.TP-.B \f[C]\-\-version\f[]-show version-.RS-.RE-.TP-.B \f[C]\-\-debug[=N]\f[]-show debug output (levels 1\-9, default: 1)-.RS-.RE-.PP-General input options:-.TP-.B \f[C]\-f\ FILE\ \-\-file=FILE\f[]-use a different input file.-For stdin, use \- (default: \f[C]$LEDGER_FILE\f[] or-\f[C]$HOME/.hledger.journal\f[])-.RS-.RE-.TP-.B \f[C]\-\-rules\-file=RULESFILE\f[]-Conversion rules file to use when reading CSV (default: FILE.rules)-.RS-.RE-.TP-.B \f[C]\-\-separator=CHAR\f[]-Field separator to expect when reading CSV (default: \[aq],\[aq])-.RS-.RE-.TP-.B \f[C]\-\-alias=OLD=NEW\f[]-rename accounts named OLD to NEW-.RS-.RE-.TP-.B \f[C]\-\-anon\f[]-anonymize accounts and payees-.RS-.RE-.TP-.B \f[C]\-\-pivot\ FIELDNAME\f[]-use some other field or tag for the account name-.RS-.RE-.TP-.B \f[C]\-I\ \-\-ignore\-assertions\f[]-ignore any failing balance assertions-.RS-.RE-.PP-General reporting options:-.TP-.B \f[C]\-b\ \-\-begin=DATE\f[]-include postings/txns on or after this date-.RS-.RE-.TP-.B \f[C]\-e\ \-\-end=DATE\f[]-include postings/txns before this date-.RS-.RE-.TP-.B \f[C]\-D\ \-\-daily\f[]-multiperiod/multicolumn report by day-.RS-.RE-.TP-.B \f[C]\-W\ \-\-weekly\f[]-multiperiod/multicolumn report by week-.RS-.RE-.TP-.B \f[C]\-M\ \-\-monthly\f[]-multiperiod/multicolumn report by month-.RS-.RE-.TP-.B \f[C]\-Q\ \-\-quarterly\f[]-multiperiod/multicolumn report by quarter-.RS-.RE-.TP-.B \f[C]\-Y\ \-\-yearly\f[]-multiperiod/multicolumn report by year-.RS-.RE-.TP-.B \f[C]\-p\ \-\-period=PERIODEXP\f[]-set start date, end date, and/or reporting interval all at once using-period expressions syntax (overrides the flags above)-.RS-.RE-.TP-.B \f[C]\-\-date2\f[]-match the secondary date instead (see command help for other effects)-.RS-.RE-.TP-.B \f[C]\-U\ \-\-unmarked\f[]-include only unmarked postings/txns (can combine with \-P or \-C)-.RS-.RE-.TP-.B \f[C]\-P\ \-\-pending\f[]-include only pending postings/txns-.RS-.RE-.TP-.B \f[C]\-C\ \-\-cleared\f[]-include only cleared postings/txns-.RS-.RE-.TP-.B \f[C]\-R\ \-\-real\f[]-include only non\-virtual postings-.RS-.RE-.TP-.B \f[C]\-NUM\ \-\-depth=NUM\f[]-hide/aggregate accounts or postings more than NUM levels deep-.RS-.RE-.TP-.B \f[C]\-E\ \-\-empty\f[]-show items with zero amount, normally hidden (and vice\-versa in-hledger\-ui/hledger\-web)-.RS-.RE-.TP-.B \f[C]\-B\ \-\-cost\f[]-convert amounts to their cost at transaction time (using the transaction-price, if any)-.RS-.RE-.TP-.B \f[C]\-V\ \-\-value\f[]-convert amounts to their market value on the report end date (using the-most recent applicable market price, if any)-.RS-.RE-.TP-.B \f[C]\-\-auto\f[]-apply automated posting rules to modify transactions.-.RS-.RE-.TP-.B \f[C]\-\-forecast\f[]-apply periodic transaction rules to generate future transactions, to 6-months from now or report end date.-.RS-.RE-.PP-When a reporting option appears more than once in the command line, the-last one takes precedence.-.PP-Some reporting options can also be written as query arguments.-.SS Command options-.PP-To see options for a particular command, including command\-specific-options, run: \f[C]hledger\ COMMAND\ \-h\f[].-.PP-Command\-specific options must be written after the command name, eg:-\f[C]hledger\ print\ \-x\f[].-.PP-Additionally, if the command is an addon, you may need to put its-options after a double\-hyphen, eg:-\f[C]hledger\ ui\ \-\-\ \-\-watch\f[].-Or, you can run the addon executable directly:-\f[C]hledger\-ui\ \-\-watch\f[].-.SS Command arguments-.PP-Most hledger commands accept arguments after the command name, which are-often a query, filtering the data in some way.-.SS Argument files-.PP-You can save a set of command line options/arguments in a file, one per-line, and then reuse them by writing \f[C]\@FILENAME\f[] in a command-line.-To prevent this expansion of \f[C]\@\f[]\-arguments, precede them with a-\f[C]\-\-\f[] argument.-For more, see Save frequently used options.-.SS Special characters in arguments and queries-.PP-In shell command lines, option and argument values which contain-"problematic" characters, ie spaces, and also characters significant to-your shell such as \f[C]<\f[], \f[C]>\f[], \f[C](\f[], \f[C])\f[],-\f[C]|\f[] and \f[C]$\f[], should be escaped by enclosing them in quotes-or by writing backslashes before the characters.-Eg:-.PP-\f[C]hledger\ register\ \-p\ \[aq]last\ year\[aq]\ "accounts\ receivable\ (receivable|payable)"\ amt:\\>100\f[].-.SS More escaping-.PP-Characters significant both to the shell and in regular expressions may-need one extra level of escaping.-These include parentheses, the pipe symbol and the dollar sign.-Eg, to match the dollar symbol, bash users should do:-.PP-\f[C]hledger\ balance\ cur:\[aq]\\$\[aq]\f[]-.PP-or:-.PP-\f[C]hledger\ balance\ cur:\\\\$\f[]-.SS Even more escaping-.PP-When hledger runs an addon executable (eg you type \f[C]hledger\ ui\f[],-hledger runs \f[C]hledger\-ui\f[]), it de\-escapes command\-line options-and arguments once, so you might need to \f[I]triple\f[]\-escape.-Eg in bash, running the ui command and matching the dollar sign,-it\[aq]s:-.PP-\f[C]hledger\ ui\ cur:\[aq]\\\\$\[aq]\f[]-.PP-or:-.PP-\f[C]hledger\ ui\ cur:\\\\\\\\$\f[]-.PP-If you asked why \f[I]four\f[] slashes above, this may help:-.PP-.TS-tab(@);-l l.-T{-unescaped:-T}@T{-\f[C]$\f[]-T}-T{-escaped:-T}@T{-\f[C]\\$\f[]-T}-T{-double\-escaped:-T}@T{-\f[C]\\\\$\f[]-T}-T{-triple\-escaped:-T}@T{-\f[C]\\\\\\\\$\f[]-T}-.TE-.PP-(The number of backslashes in fish shell is left as an exercise for the-reader.)-.PP-You can always avoid the extra escaping for addons by running the addon-directly:-.PP-\f[C]hledger\-ui\ cur:\\\\$\f[]-.SS Less escaping-.PP-Inside an argument file, or in the search field of hledger\-ui or-hledger\-web, or at a GHCI prompt, you need one less level of escaping-than at the command line.-And backslashes may work better than quotes.-Eg:-.PP-\f[C]ghci>\ :main\ balance\ cur:\\$\f[]-.SS Command line tips-.PP-If in doubt, keep things simple:-.IP \[bu] 2-write options after the command (\f[C]hledger\ CMD\ \-OPTIONS\ ARGS\f[])-.IP \[bu] 2-run add\-on executables directly (\f[C]hledger\-ui\ \-OPTIONS\ ARGS\f[])-.IP \[bu] 2-enclose problematic args in single quotes-.IP \[bu] 2-if needed, also add a backslash to escape regexp metacharacters-.PP-To find out exactly how a command line is being parsed, add-\f[C]\-\-debug=2\f[] to troubleshoot.-.SS Unicode characters-.PP-hledger is expected to handle unicode (non\-ascii) characters, but this-requires a well\-configured environment.-.PP-To handle unicode characters in the command line or input data, a system-locale that can decode them must be configured (POSIX\[aq]s default-\f[C]C\f[] locale will not work).-Eg in bash, you could do:-.IP-.nf-\f[C]-export\ LANG=en_US.UTF\-8-\f[]-.fi-.PP-See Troubleshooting for more about this.-.PP-Unicode characters should appear correctly in hledger\[aq]s output.-For the hledger and hledger\-ui tools, this requires that-.IP \[bu] 2-your terminal supports unicode-.IP \[bu] 2-the terminal\[aq]s font includes the required unicode glyphs-.IP \[bu] 2-the terminal is configured to display "wide" characters as double width-(otherwise report alignment will be off)-.SS Input files-.PP-hledger reads transactions from a data file (and the add command writes-to it).-By default this file is \f[C]$HOME/.hledger.journal\f[] (or on Windows,-something like \f[C]C:/Users/USER/.hledger.journal\f[]).-You can override this with the \f[C]$LEDGER_FILE\f[] environment-variable:-.IP-.nf-\f[C]-$\ setenv\ LEDGER_FILE\ ~/finance/2016.journal-$\ hledger\ stats-\f[]-.fi-.PP-or with the \f[C]\-f/\-\-file\f[] option:-.IP-.nf-\f[C]-$\ hledger\ \-f\ /some/file\ stats-\f[]-.fi-.PP-The file name \f[C]\-\f[] (hyphen) means standard input:-.IP-.nf-\f[C]-$\ cat\ some.journal\ |\ hledger\ \-f\--\f[]-.fi-.PP-Usually the data file is in hledger\[aq]s journal format, but it can-also be one of several other formats, listed below.-hledger detects the format automatically based on the file extension, or-if that is not recognised, by trying each built\-in "reader" in turn:-.PP-.TS-tab(@);-lw(10.3n) lw(33.5n) lw(26.2n).-T{-Reader:-T}@T{-Reads:-T}@T{-Used for file extensions:-T}-_-T{-\f[C]journal\f[]-T}@T{-hledger\[aq]s journal format, also some Ledger journals-T}@T{-\f[C]\&.journal\f[] \f[C]\&.j\f[] \f[C]\&.hledger\f[] \f[C]\&.ledger\f[]-T}-T{-\f[C]timeclock\f[]-T}@T{-timeclock files (precise time logging)-T}@T{-\f[C]\&.timeclock\f[]-T}-T{-\f[C]timedot\f[]-T}@T{-timedot files (approximate time logging)-T}@T{-\f[C]\&.timedot\f[]-T}-T{-\f[C]csv\f[]-T}@T{-comma\-separated values (data interchange)-T}@T{-\f[C]\&.csv\f[]-T}-.TE-.PP-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:-.IP-.nf-\f[C]-$\ hledger\ \-f\ csv:/some/csv\-file.dat\ stats-$\ echo\ \[aq]i\ 2009/13/1\ 08:00:00\[aq]\ |\ hledger\ print\ \-ftimeclock:\--\f[]-.fi-.PP-You can also specify multiple \f[C]\-f\f[] options, to read multiple-files as one big journal.-There are some limitations with this:-.IP \[bu] 2-directives in one file will not affect the other files-.IP \[bu] 2-balance assertions will not see any account balances from previous files-.PP-If you need those, either use the include directive, or concatenate the-files, eg: \f[C]cat\ a.journal\ b.journal\ |\ hledger\ \-f\-\ CMD\f[].-.SS Smart dates-.PP-hledger\[aq]s user interfaces accept a flexible "smart date" syntax-(unlike dates in the journal file).-Smart dates allow some english words, can be relative to today\[aq]s-date, and can have less\-significant date parts omitted (defaulting to-1).-.PP-Examples:-.PP-.TS-tab(@);-l l.-T{-\f[C]2004/10/1\f[], \f[C]2004\-01\-01\f[], \f[C]2004.9.1\f[]-T}@T{-exact date, several separators allowed.-Year is 4+ digits, month is 1\-12, day is 1\-31-T}-T{-\f[C]2004\f[]-T}@T{-start of year-T}-T{-\f[C]2004/10\f[]-T}@T{-start of month-T}-T{-\f[C]10/1\f[]-T}@T{-month and day in current year-T}-T{-\f[C]21\f[]-T}@T{-day in current month-T}-T{-\f[C]october,\ oct\f[]-T}@T{-start of month in current year-T}-T{-\f[C]yesterday,\ today,\ tomorrow\f[]-T}@T{-\-1, 0, 1 days from today-T}-T{-\f[C]last/this/next\ day/week/month/quarter/year\f[]-T}@T{-\-1, 0, 1 periods from the current period-T}-T{-\f[C]20181201\f[]-T}@T{-8 digit YYYYMMDD with valid year month and day-T}-T{-\f[C]201812\f[]-T}@T{-6 digit YYYYMM with valid year and month-T}-.TE-.PP-Counterexamples \- malformed digit sequences might give surprising-results:-.PP-.TS-tab(@);-l l.-T{-\f[C]201813\f[]-T}@T{-6 digits with an invalid month is parsed as start of 6\-digit year-T}-T{-\f[C]20181301\f[]-T}@T{-8 digits with an invalid month is parsed as start of 8\-digit year-T}-T{-\f[C]20181232\f[]-T}@T{-8 digits with an invalid day gives an error-T}-T{-\f[C]201801012\f[]-T}@T{-9+ digits beginning with a valid YYYYMMDD gives an error-T}-.TE-.SS Report start & end date-.PP-Most hledger reports show the full span of time represented by the-journal data, by default.-So, the effective report start and end dates will be the earliest and-latest transaction or posting dates found in the journal.-.PP-Often you will want to see a shorter time span, such as the current-month.-You can specify a start and/or end date using \f[C]\-b/\-\-begin\f[],-\f[C]\-e/\-\-end\f[], \f[C]\-p/\-\-period\f[] or a \f[C]date:\f[] query-(described below).-All of these accept the smart date syntax.-One important thing to be aware of when specifying end dates: as in-Ledger, end dates are exclusive, so you need to write the date-\f[I]after\f[] the last day you want to include.-.PP-Examples:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-b\ 2016/3/17\f[]-T}@T{-begin on St.-Patrick\[aq]s day 2016-T}-T{-\f[C]\-e\ 12/1\f[]-T}@T{-end at the start of december 1st of the current year (11/30 will be the-last date included)-T}-T{-\f[C]\-b\ thismonth\f[]-T}@T{-all transactions on or after the 1st of the current month-T}-T{-\f[C]\-p\ thismonth\f[]-T}@T{-all transactions in the current month-T}-T{-\f[C]date:2016/3/17\-\f[]-T}@T{-the above written as queries instead-T}-T{-\f[C]date:\-12/1\f[]-T}@T{-T}-T{-\f[C]date:thismonth\-\f[]-T}@T{-T}-T{-\f[C]date:thismonth\f[]-T}@T{-T}-.TE-.SS Report intervals-.PP-A report interval can be specified so that commands like register,-balance and activity will divide their reports into multiple subperiods.-The basic intervals can be selected with one of \f[C]\-D/\-\-daily\f[],-\f[C]\-W/\-\-weekly\f[], \f[C]\-M/\-\-monthly\f[],-\f[C]\-Q/\-\-quarterly\f[], or \f[C]\-Y/\-\-yearly\f[].-More complex intervals may be specified with a period expression.-Report intervals can not be specified with a query, currently.-.SS Period expressions-.PP-The \f[C]\-p/\-\-period\f[] option accepts period expressions, a-shorthand way of expressing a start date, end date, and/or report-interval all at once.-.PP-Here\[aq]s a basic period expression specifying the first quarter of-2009.-Note, hledger always treats start dates as inclusive and end dates as-exclusive:-.PP-\f[C]\-p\ "from\ 2009/1/1\ to\ 2009/4/1"\f[]-.PP-Keywords like "from" and "to" are optional, and so are the spaces, as-long as you don\[aq]t run two dates together.-"to" can also be written as "\-".-These are equivalent to the above:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "2009/1/1\ 2009/4/1"\f[]-T}-T{-\f[C]\-p2009/1/1to2009/4/1\f[]-T}-T{-\f[C]\-p2009/1/1\-2009/4/1\f[]-T}-.TE-.PP-Dates are smart dates, so if the current year is 2009, the above can-also be written as:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "1/1\ 4/1"\f[]-T}-T{-\f[C]\-p\ "january\-apr"\f[]-T}-T{-\f[C]\-p\ "this\ year\ to\ 4/1"\f[]-T}-.TE-.PP-If you specify only one date, the missing start or end date will be the-earliest or latest transaction in your journal:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-p\ "from\ 2009/1/1"\f[]-T}@T{-everything after january 1, 2009-T}-T{-\f[C]\-p\ "from\ 2009/1"\f[]-T}@T{-the same-T}-T{-\f[C]\-p\ "from\ 2009"\f[]-T}@T{-the same-T}-T{-\f[C]\-p\ "to\ 2009"\f[]-T}@T{-everything before january 1, 2009-T}-.TE-.PP-A single date with no "from" or "to" defines both the start and end date-like so:-.PP-.TS-tab(@);-l l.-T{-\f[C]\-p\ "2009"\f[]-T}@T{-the year 2009; equivalent to "2009/1/1 to 2010/1/1"-T}-T{-\f[C]\-p\ "2009/1"\f[]-T}@T{-the month of jan; equivalent to "2009/1/1 to 2009/2/1"-T}-T{-\f[C]\-p\ "2009/1/1"\f[]-T}@T{-just that day; equivalent to "2009/1/1 to 2009/1/2"-T}-.TE-.PP-The argument of \f[C]\-p\f[] can also begin with, or be, a report-interval expression.-The basic report intervals are \f[C]daily\f[], \f[C]weekly\f[],-\f[C]monthly\f[], \f[C]quarterly\f[], or \f[C]yearly\f[], which have the-same effect as the \f[C]\-D\f[],\f[C]\-W\f[],\f[C]\-M\f[],\f[C]\-Q\f[],-or \f[C]\-Y\f[] flags.-Between report interval and start/end dates (if any), the word-\f[C]in\f[] is optional.-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[]-T}-T{-\f[C]\-p\ "monthly\ in\ 2008"\f[]-T}-T{-\f[C]\-p\ "quarterly"\f[]-T}-.TE-.PP-Note that \f[C]weekly\f[], \f[C]monthly\f[], \f[C]quarterly\f[] and-\f[C]yearly\f[] intervals will always start on the first day on week,-month, quarter or year accordingly, and will end on the last day of same-period, even if associated period expression specifies different-explicit start and end date.-.PP-For example:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "weekly\ from\ 2009/1/1\ to\ 2009/4/1"\f[] \-\- starts on-2008/12/29, closest preceeding Monday-T}-T{-\f[C]\-p\ "monthly\ in\ 2008/11/25"\f[] \-\- starts on 2018/11/01-T}-T{-\f[C]\-p\ "quarterly\ from\ 2009\-05\-05\ to\ 2009\-06\-01"\f[] \--starts on 2009/04/01, ends on 2009/06/30, which are first and last days-of Q2 2009-T}-T{-\f[C]\-p\ "yearly\ from\ 2009\-12\-29"\f[] \- starts on 2009/01/01,-first day of 2009-T}-.TE-.PP-The following more complex report intervals are also supported:-\f[C]biweekly\f[], \f[C]bimonthly\f[],-\f[C]every\ day|week|month|quarter|year\f[],-\f[C]every\ N\ days|weeks|months|quarters|years\f[].-.PP-All of these will start on the first day of the requested period and end-on the last one, as described above.-.PP-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "bimonthly\ from\ 2008"\f[] \-\- periods will have boundaries-on 2008/01/01, 2008/03/01, ...-T}-T{-\f[C]\-p\ "every\ 2\ weeks"\f[] \-\- starts on closest preceeding Monday-T}-T{-\f[C]\-p\ "every\ 5\ month\ from\ 2009/03"\f[] \-\- periods will have-boundaries on 2009/03/01, 2009/08/01, ...-T}-.TE-.PP-If you want intervals that start on arbitrary day of your choosing and-span a week, month or year, you need to use any of the following:-.PP-\f[C]every\ Nth\ day\ of\ week\f[], \f[C]every\ <weekday>\f[],-\f[C]every\ Nth\ day\ [of\ month]\f[],-\f[C]every\ Nth\ weekday\ [of\ month]\f[],-\f[C]every\ MM/DD\ [of\ year]\f[], \f[C]every\ Nth\ MMM\ [of\ year]\f[],-\f[C]every\ MMM\ Nth\ [of\ year]\f[].-.PP-Examples:-.PP-.TS-tab(@);-l.-T{-\f[C]\-p\ "every\ 2nd\ day\ of\ week"\f[] \-\- periods will go from Tue-to Tue-T}-T{-\f[C]\-p\ "every\ Tue"\f[] \-\- same-T}-T{-\f[C]\-p\ "every\ 15th\ day"\f[] \-\- period boundaries will be on 15th-of each month-T}-T{-\f[C]\-p\ "every\ 2nd\ Monday"\f[] \-\- period boundaries will be on-second Monday of each month-T}-T{-\f[C]\-p\ "every\ 11/05"\f[] \-\- yearly periods with boundaries on 5th-of Nov-T}-T{-\f[C]\-p\ "every\ 5th\ Nov"\f[] \-\- same-T}-T{-\f[C]\-p\ "every\ Nov\ 5th"\f[] \-\- same-T}-.TE-.PP-Show historical balances at end of 15th each month (N is exclusive end-date):-.PP-\f[C]hledger\ balance\ \-H\ \-p\ "every\ 16th\ day"\f[]-.PP-Group postings from start of wednesday to end of next tuesday (N is-start date and exclusive end date):-.PP-\f[C]hledger\ register\ checking\ \-p\ "every\ 3rd\ day\ of\ week"\f[]-.SS Depth limiting-.PP-With the \f[C]\-\-depth\ N\f[] option (short form: \f[C]\-N\f[]),-commands like account, balance and register will show only the uppermost-accounts in the account tree, down to level N.-Use this when you want a summary with less detail.-This flag has the same effect as a \f[C]depth:\f[] query argument (so-\f[C]\-2\f[], \f[C]\-\-depth=2\f[] or \f[C]depth:2\f[] are basically-equivalent).-.SS Pivoting-.PP-Normally hledger sums amounts, and organizes them in a hierarchy, based-on account name.-The \f[C]\-\-pivot\ FIELD\f[] option causes it to sum and organize-hierarchy based on the value of some other field instead.-FIELD can be: \f[C]code\f[], \f[C]description\f[], \f[C]payee\f[],-\f[C]note\f[], or the full name (case insensitive) of any tag.-As with account names, values containing \f[C]colon:separated:parts\f[]-will be displayed hierarchically in reports.-.PP-\f[C]\-\-pivot\f[] is a general option affecting all reports; you can-think of hledger transforming the journal before any other processing,-replacing every posting\[aq]s account name with the value of the-specified field on that posting, inheriting it from the transaction or-using a blank value if it\[aq]s not present.-.PP-An example:-.IP-.nf-\f[C]-2016/02/16\ Member\ Fee\ Payment-\ \ \ \ assets:bank\ account\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR-\ \ \ \ income:member\ fees\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ ;\ member:\ John\ Doe-\f[]-.fi-.PP-Normal balance report showing account names:-.IP-.nf-\f[C]-$\ hledger\ balance-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR\ \ assets:bank\ account-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ income:member\ fees-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-Pivoted balance report, using member: tag values instead:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-pivot\ member-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 2\ EUR-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-One way to show only amounts with a member: value (using a query,-described below):-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-pivot\ member\ tag:member=.-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR-\f[]-.fi-.PP-Another way (the acct: query matches against the pivoted "account-name"):-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-pivot\ member\ acct:.-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR\ \ John\ Doe-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \-2\ EUR-\f[]-.fi-.SS Cost-.PP-The \f[C]\-B/\-\-cost\f[] flag converts amounts to their cost at-transaction time, if they have a transaction price specified.-.SS Market value-.PP-The \f[C]\-V/\-\-value\f[] flag converts reported amounts to their-current market value.-.PD 0-.P-.PD-Specifically, when there is a market price (P directive) for the-amount\[aq]s commodity, dated on or before today\[aq]s date (or the-report end date if specified), the amount will be converted to the-price\[aq]s commodity.-.PP-When there are multiple applicable P directives, \-V chooses the most-recent one, or in case of equal dates, the last\-parsed one.-.PP-For example:-.IP-.nf-\f[C]-#\ one\ euro\ is\ worth\ this\ many\ dollars\ from\ nov\ 1-P\ 2016/11/01\ €\ $1.10--#\ purchase\ some\ euros\ on\ nov\ 3-2016/11/3-\ \ \ \ assets:euros\ \ \ \ \ \ \ \ €100-\ \ \ \ assets:checking--#\ the\ euro\ is\ worth\ fewer\ dollars\ by\ dec\ 21-P\ 2016/12/21\ €\ $1.03-\f[]-.fi-.PP-How many euros do I have ?-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ \-N\ euros-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ €100\ \ assets:euros-\f[]-.fi-.PP-What are they worth at end of nov 3 ?-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ \-N\ euros\ \-V\ \-e\ 2016/11/4-\ \ \ \ \ \ \ \ \ \ \ \ \ $110.00\ \ assets:euros-\f[]-.fi-.PP-What are they worth after 2016/12/21 ?-(no report end date specified, defaults to today)-.IP-.nf-\f[C]-$\ hledger\ \-f\ t.j\ bal\ \-N\ euros\ \-V-\ \ \ \ \ \ \ \ \ \ \ \ \ $103.00\ \ assets:euros-\f[]-.fi-.PP-Currently, hledger\[aq]s \-V only uses market prices recorded with P-directives, not transaction prices (unlike Ledger).-.PP-Currently, \-V has a limitation in multicolumn balance reports: it uses-the market prices on the report end date for all columns.-(Instead of the prices on each column\[aq]s end date.)-.SS Combining \-B and \-V-.PP-Using \-B/\-\-cost and \-V/\-\-value together is currently allowed, but-the results are probably not meaningful.-Let us know if you find a use for this.-.SS Output destination-.PP-Some commands (print, register, stats, the balance commands) can write-their output to a destination other than the console.-This is controlled by the \f[C]\-o/\-\-output\-file\f[] option.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-o\ \-\ \ \ \ \ #\ write\ to\ stdout\ (the\ default)-$\ hledger\ balance\ \-o\ FILE\ \ #\ write\ to\ FILE-\f[]-.fi-.SS Output format-.PP-Some commands can write their output in other formats.-Eg print and register can output CSV, and the balance commands can-output CSV or HTML.-This is controlled by the \f[C]\-O/\-\-output\-format\f[] option, or by-specifying a \f[C]\&.csv\f[] or \f[C]\&.html\f[] file extension with-\f[C]\-o/\-\-output\-file\f[].-.IP-.nf-\f[C]-$\ hledger\ balance\ \-O\ csv\ \ \ \ \ \ \ #\ write\ CSV\ to\ stdout-$\ hledger\ balance\ \-o\ FILE.csv\ \ #\ write\ CSV\ to\ FILE.csv-\f[]-.fi-.SS Regular expressions-.PP-hledger uses regular expressions in a number of places:-.IP \[bu] 2-query terms, on the command line and in the hledger\-web search form:-\f[C]REGEX\f[], \f[C]desc:REGEX\f[], \f[C]cur:REGEX\f[],-\f[C]tag:...=REGEX\f[]-.IP \[bu] 2-CSV rules conditional blocks: \f[C]if\ REGEX\ ...\f[]-.IP \[bu] 2-account alias directives and options:-\f[C]alias\ /REGEX/\ =\ REPLACEMENT\f[],-\f[C]\-\-alias\ /REGEX/=REPLACEMENT\f[]-.PP-hledger\[aq]s regular expressions come from the regex\-tdfa library.-In general they:-.IP \[bu] 2-are case insensitive-.IP \[bu] 2-are infix matching (do not need to match the entire thing being matched)-.IP \[bu] 2-are POSIX extended regular expressions-.IP \[bu] 2-also support GNU word boundaries (\\<, \\>, \\b, \\B)-.IP \[bu] 2-and parenthesised capturing groups and numeric backreferences in-replacement strings-.IP \[bu] 2-do not support mode modifiers like (?s)-.PP-Some things to note:-.IP \[bu] 2-In the \f[C]alias\f[] directive and \f[C]\-\-alias\f[] option, regular-expressions must be enclosed in forward slashes (\f[C]/REGEX/\f[]).-Elsewhere in hledger, these are not required.-.IP \[bu] 2-In queries, to match a regular expression metacharacter like \f[C]$\f[]-as a literal character, prepend a backslash.-Eg to search for amounts with the dollar sign in hledger\-web, write-\f[C]cur:\\$\f[].-.IP \[bu] 2-On the command line, some metacharacters like \f[C]$\f[] have a special-meaning to the shell and so must be escaped at least once more.-See Special characters.-.SH QUERIES-.PP-One of hledger\[aq]s strengths is being able to quickly report on-precise subsets of your data.-Most commands accept an optional query expression, written as arguments-after the command name, to filter the data by date, account name or-other criteria.-The syntax is similar to a web search: one or more space\-separated-search terms, quotes to enclose whitespace, prefixes to match specific-fields, a not: prefix to negate the match.-.PP-We do not yet support arbitrary boolean combinations of search terms;-instead most commands show transactions/postings/accounts which match-(or negatively match):-.IP \[bu] 2-any of the description terms AND-.IP \[bu] 2-any of the account terms AND-.IP \[bu] 2-any of the status terms AND-.IP \[bu] 2-all the other terms.-.PP-The print command instead shows transactions which:-.IP \[bu] 2-match any of the description terms AND-.IP \[bu] 2-have any postings matching any of the positive account terms AND-.IP \[bu] 2-have no postings matching any of the negative account terms AND-.IP \[bu] 2-match all the other terms.-.PP-The following kinds of search terms can be used.-Remember these can also be prefixed with \f[B]\f[BC]not:\f[B]\f[], eg to-exclude a particular subaccount.-.TP-.B \f[B]\f[BC]REGEX\f[B], \f[BC]acct:REGEX\f[B]\f[]-match account names by this regular expression.-(With no prefix, \f[C]acct:\f[] is assumed.)-.RS-.RE-same as above-.RS-.RE-.TP-.B \f[B]\f[BC]amt:N,\ amt:<N,\ amt:<=N,\ amt:>N,\ amt:>=N\f[B]\f[]-match postings with a single\-commodity amount that is equal to, less-than, or greater than N.-(Multi\-commodity amounts are not tested, and will always match.) The-comparison has two modes: if N is preceded by a + or \- sign (or is 0),-the two signed numbers are compared.-Otherwise, the absolute magnitudes are compared, ignoring sign.-.RS-.RE-.TP-.B \f[B]\f[BC]code:REGEX\f[B]\f[]-match by transaction code (eg check number)-.RS-.RE-.TP-.B \f[B]\f[BC]cur:REGEX\f[B]\f[]-match postings or transactions including any amounts whose-currency/commodity symbol is fully matched by REGEX.-(For a partial match, use \f[C]\&.*REGEX.*\f[]).-Note, to match characters which are regex\-significant, like the dollar-sign (\f[C]$\f[]), you need to prepend \f[C]\\\f[].-And when using the command line you need to add one more level of-quoting to hide it from the shell, so eg do:-\f[C]hledger\ print\ cur:\[aq]\\$\[aq]\f[] or-\f[C]hledger\ print\ cur:\\\\$\f[].-.RS-.RE-.TP-.B \f[B]\f[BC]desc:REGEX\f[B]\f[]-match transaction descriptions.-.RS-.RE-.TP-.B \f[B]\f[BC]date:PERIODEXPR\f[B]\f[]-match dates within the specified period.-PERIODEXPR is a period expression (with no report interval).-Examples: \f[C]date:2016\f[], \f[C]date:thismonth\f[],-\f[C]date:2000/2/1\-2/15\f[], \f[C]date:lastweek\-\f[].-If the \f[C]\-\-date2\f[] command line flag is present, this matches-secondary dates instead.-.RS-.RE-.TP-.B \f[B]\f[BC]date2:PERIODEXPR\f[B]\f[]-match secondary dates within the specified period.-.RS-.RE-.TP-.B \f[B]\f[BC]depth:N\f[B]\f[]-match (or display, depending on command) accounts at or above this depth-.RS-.RE-.TP-.B \f[B]\f[BC]note:REGEX\f[B]\f[]-match transaction notes (part of description right of \f[C]|\f[], or-whole description when there\[aq]s no \f[C]|\f[])-.RS-.RE-.TP-.B \f[B]\f[BC]payee:REGEX\f[B]\f[]-match transaction payee/payer names (part of description left of-\f[C]|\f[], or whole description when there\[aq]s no \f[C]|\f[])-.RS-.RE-.TP-.B \f[B]\f[BC]real:,\ real:0\f[B]\f[]-match real or virtual postings respectively-.RS-.RE-.TP-.B \f[B]\f[BC]status:,\ status:!,\ status:*\f[B]\f[]-match unmarked, pending, or cleared transactions respectively-.RS-.RE-.TP-.B \f[B]\f[BC]tag:REGEX[=REGEX]\f[B]\f[]-match by tag name, and optionally also by tag value.-Note a tag: query is considered to match a transaction if it matches any-of the postings.-Also remember that postings inherit the tags of their parent-transaction.-.RS-.RE-.PP-The following special search term is used automatically in hledger\-web,-only:-.TP-.B \f[B]\f[BC]inacct:ACCTNAME\f[B]\f[]-tells hledger\-web to show the transaction register for this account.-Can be filtered further with \f[C]acct\f[] etc.-.RS-.RE-.PP-Some of these can also be expressed as command\-line options (eg-\f[C]depth:2\f[] is equivalent to \f[C]\-\-depth\ 2\f[]).-Generally you can mix options and query arguments, and the resulting-query will be their intersection (perhaps excluding the-\f[C]\-p/\-\-period\f[] option).-.SH COMMANDS-.PP-hledger provides a number of subcommands; \f[C]hledger\f[] with no-arguments shows a list.-.PP-If you install additional \f[C]hledger\-*\f[] packages, or if you put-programs or scripts named \f[C]hledger\-NAME\f[] in your PATH, these-will also be listed as subcommands.-.PP-Run a subcommand by writing its name as first argument (eg-\f[C]hledger\ incomestatement\f[]).-You can also write one of the standard short aliases displayed in-parentheses in the command list (\f[C]hledger\ b\f[]), or any any-unambiguous prefix of a command name (\f[C]hledger\ inc\f[]).-.PP-Here are all the builtin commands in alphabetical order.-See also \f[C]hledger\f[] for a more organised command list, and-\f[C]hledger\ CMD\ \-h\f[] for detailed command help.-.SS accounts-.PP-accounts, a-.PD 0-.P-.PD-Show account names.-.PP-This command lists account names, either declared with account-directives (\-\-declared), posted to (\-\-used), or both (the default).-With query arguments, only matched account names and account names-referenced by matched postings are shown.-It shows a flat list by default.-With \f[C]\-\-tree\f[], it uses indentation to show the account-hierarchy.-In flat mode you can add \f[C]\-\-drop\ N\f[] to omit the first few-account name components.-Account names can be depth\-clipped with \f[C]depth:N\f[] or-\f[C]\-\-depth\ N\f[] or \f[C]\-N\f[].-.PP-Examples:-.IP-.nf-\f[C]-$\ hledger\ accounts-assets:bank:checking-assets:bank:saving-assets:cash-expenses:food-expenses:supplies-income:gifts-income:salary-liabilities:debts-\f[]-.fi-.SS activity-.PP-activity-.PD 0-.P-.PD-Show an ascii barchart of posting counts per interval.-.PP-The activity command displays an ascii histogram showing transaction-counts by day, week, month or other reporting interval (by day is the-default).-With query arguments, it counts only matched transactions.-.PP-Examples:-.IP-.nf-\f[C]-$\ hledger\ activity\ \-\-quarterly-2008\-01\-01\ **-2008\-04\-01\ *******-2008\-07\-01\ -2008\-10\-01\ **-\f[]-.fi-.SS add-.PP-add-.PD 0-.P-.PD-Prompt for transactions and add them to the journal.-.PP-Many hledger users edit their journals directly with a text editor, or-generate them from CSV.-For more interactive data entry, there is the \f[C]add\f[] command,-which prompts interactively on the console for new transactions, and-appends them to the journal file (if there are multiple-\f[C]\-f\ FILE\f[] options, the first file is used.) Existing-transactions are not changed.-This is the only hledger command that writes to the journal file.-.PP-To use it, just run \f[C]hledger\ add\f[] and follow the prompts.-You can add as many transactions as you like; when you are finished,-enter \f[C]\&.\f[] or press control\-d or control\-c to exit.-.PP-Features:-.IP \[bu] 2-add tries to provide useful defaults, using the most similar (by-description) recent transaction (filtered by the query, if any) as a-template.-.IP \[bu] 2-You can also set the initial defaults with command line arguments.-.IP \[bu] 2-Readline\-style edit keys can be used during data entry.-.IP \[bu] 2-The tab key will auto\-complete whenever possible \- accounts,-descriptions, dates (\f[C]yesterday\f[], \f[C]today\f[],-\f[C]tomorrow\f[]).-If the input area is empty, it will insert the default value.-.IP \[bu] 2-If the journal defines a default commodity, it will be added to any bare-numbers entered.-.IP \[bu] 2-A parenthesised transaction code may be entered following a date.-.IP \[bu] 2-Comments and tags may be entered following a description or amount.-.IP \[bu] 2-If you make a mistake, enter \f[C]<\f[] at any prompt to restart the-transaction.-.IP \[bu] 2-Input prompts are displayed in a different colour when the terminal-supports it.-.PP-Example (see the tutorial for a detailed explanation):-.IP-.nf-\f[C]-$\ hledger\ add-Adding\ transactions\ to\ journal\ file\ /src/hledger/examples/sample.journal-Any\ command\ line\ arguments\ will\ be\ used\ as\ defaults.-Use\ tab\ key\ to\ complete,\ readline\ keys\ to\ edit,\ enter\ to\ accept\ defaults.-An\ optional\ (CODE)\ may\ follow\ transaction\ dates.-An\ optional\ ;\ COMMENT\ may\ follow\ descriptions\ or\ amounts.-If\ you\ make\ a\ mistake,\ enter\ <\ at\ any\ prompt\ to\ restart\ the\ transaction.-To\ end\ a\ transaction,\ enter\ .\ when\ prompted.-To\ quit,\ enter\ .\ at\ a\ date\ prompt\ or\ press\ control\-d\ or\ control\-c.-Date\ [2015/05/22]:\ -Description:\ supermarket-Account\ 1:\ expenses:food-Amount\ \ 1:\ $10-Account\ 2:\ assets:checking-Amount\ \ 2\ [$\-10.0]:\ -Account\ 3\ (or\ .\ or\ enter\ to\ finish\ this\ transaction):\ .-2015/05/22\ supermarket-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ $10-\ \ \ \ assets:checking\ \ \ \ \ \ \ \ $\-10.0--Save\ this\ transaction\ to\ the\ journal\ ?\ [y]:\ -Saved.-Starting\ the\ next\ transaction\ (.\ or\ ctrl\-D/ctrl\-C\ to\ quit)-Date\ [2015/05/22]:\ <CTRL\-D>\ $-\f[]-.fi-.SS balance-.PP-balance, bal, b-.PD 0-.P-.PD-Show accounts and their balances.-.PP-The balance command is hledger\[aq]s most versatile command.-Note, despite the name, it is not always used for showing real\-world-account balances; the more accounting\-aware balancesheet and-incomestatement may be more convenient for that.-.PP-By default, it displays all accounts, and each account\[aq]s change in-balance during the entire period of the journal.-Balance changes are calculated by adding up the postings in each-account.-You can limit the postings matched, by a query, to see fewer accounts,-changes over a different time period, changes from only cleared-transactions, etc.-.PP-If you include an account\[aq]s complete history of postings in the-report, the balance change is equivalent to the account\[aq]s current-ending balance.-For a real\-world account, typically you won\[aq]t have all transactions-in the journal; instead you\[aq]ll have all transactions after a certain-date, and an "opening balances" transaction setting the correct starting-balance on that date.-Then the balance command will show real\-world account balances.-In some cases the \-H/\-\-historical flag is used to ensure this (more-below).-.PP-The balance command can produce several styles of report:-.SS Classic balance report-.PP-This is the original balance report, as found in Ledger.-It usually looks like this:-.IP-.nf-\f[C]-$\ hledger\ balance-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ gifts-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ salary-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-By default, accounts are displayed hierarchically, with subaccounts-indented below their parent.-At each level of the tree, accounts are sorted by account code if any,-then by account name.-Or with \f[C]\-S/\-\-sort\-amount\f[], by their balance amount.-.PP-"Boring" accounts, which contain a single interesting subaccount and no-balance of their own, are elided into the following line for more-compact output.-(Eg above, the "liabilities" account.) Use \f[C]\-\-no\-elide\f[] to-prevent this.-.PP-Account balances are "inclusive" \- they include the balances of any-subaccounts.-.PP-Accounts which have zero balance (and no non\-zero subaccounts) are-omitted.-Use \f[C]\-E/\-\-empty\f[] to show them.-.PP-A final total is displayed by default; use \f[C]\-N/\-\-no\-total\f[] to-suppress it, eg:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-\-no\-total-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies-\f[]-.fi-.SS Customising the classic balance report-.PP-You can customise the layout of classic balance reports with-\f[C]\-\-format\ FMT\f[]:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-format\ "%20(account)\ %12(total)"-\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ \ \ \ \ \ \ bank:saving\ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ cash\ \ \ \ \ \ \ \ \ \ $\-2-\ \ \ \ \ \ \ \ \ \ \ \ expenses\ \ \ \ \ \ \ \ \ \ \ $2-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ food\ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ \ \ \ \ \ \ \ supplies\ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ income\ \ \ \ \ \ \ \ \ \ $\-2-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ gifts\ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ salary\ \ \ \ \ \ \ \ \ \ $\-1-\ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ $1-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-The FMT format string (plus a newline) specifies the formatting applied-to each account/balance pair.-It may contain any suitable text, with data fields interpolated like so:-.PP-\f[C]%[MIN][.MAX](FIELDNAME)\f[]-.IP \[bu] 2-MIN pads with spaces to at least this width (optional)-.IP \[bu] 2-MAX truncates at this width (optional)-.IP \[bu] 2-FIELDNAME must be enclosed in parentheses, and can be one of:-.RS 2-.IP \[bu] 2-\f[C]depth_spacer\f[] \- a number of spaces equal to the account\[aq]s-depth, or if MIN is specified, MIN * depth spaces.-.IP \[bu] 2-\f[C]account\f[] \- the account\[aq]s name-.IP \[bu] 2-\f[C]total\f[] \- the account\[aq]s balance/posted total, right-justified-.RE-.PP-Also, FMT can begin with an optional prefix to control how-multi\-commodity amounts are rendered:-.IP \[bu] 2-\f[C]%_\f[] \- render on multiple lines, bottom\-aligned (the default)-.IP \[bu] 2-\f[C]%^\f[] \- render on multiple lines, top\-aligned-.IP \[bu] 2-\f[C]%,\f[] \- render on one line, comma\-separated-.PP-There are some quirks.-Eg in one\-line mode, \f[C]%(depth_spacer)\f[] has no effect, instead-\f[C]%(account)\f[] has indentation built in.- Experimentation may be needed to get pleasing results.-.PP-Some example formats:-.IP \[bu] 2-\f[C]%(total)\f[] \- the account\[aq]s total-.IP \[bu] 2-\f[C]%\-20.20(account)\f[] \- the account\[aq]s name, left justified,-padded to 20 characters and clipped at 20 characters-.IP \[bu] 2-\f[C]%,%\-50(account)\ \ %25(total)\f[] \- account name padded to 50-characters, total padded to 20 characters, with multiple commodities-rendered on one line-.IP \[bu] 2-\f[C]%20(total)\ \ %2(depth_spacer)%\-(account)\f[] \- the default-format for the single\-column balance report-.SS Colour support-.PP-The balance command shows negative amounts in red, if:-.IP \[bu] 2-the \f[C]TERM\f[] environment variable is not set to \f[C]dumb\f[]-.IP \[bu] 2-the output is not being redirected or piped anywhere-.SS Flat mode-.PP-To see a flat list instead of the default hierarchical display, use-\f[C]\-\-flat\f[].-In this mode, accounts (unless depth\-clipped) show their full names and-"exclusive" balance, excluding any subaccount balances.-In this mode, you can also use \f[C]\-\-drop\ N\f[] to omit the first-few account name components.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-p\ 2008/6\ expenses\ \-N\ \-\-flat\ \-\-drop\ 1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ supplies-\f[]-.fi-.SS Depth limited balance reports-.PP-With \f[C]\-\-depth\ N\f[] or \f[C]depth:N\f[] or just \f[C]\-N\f[],-balance reports show accounts only to the specified numeric depth.-This is very useful to summarise a complex set of accounts and get an-overview.-.IP-.nf-\f[C]-$\ hledger\ balance\ \-N\ \-1-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities-\f[]-.fi-.PP-Flat\-mode balance reports, which normally show exclusive balances, show-inclusive balances at the depth limit.-.SS Multicolumn balance report-.PP-Multicolumn or tabular balance reports are a very useful hledger-feature, and usually the preferred style.-They share many of the above features, but they show the report as a-table, with columns representing time periods.-This mode is activated by providing a reporting interval.-.PP-There are three types of multicolumn balance report, showing different-information:-.IP "1." 3-By default: each column shows the sum of postings in that period, ie the-account\[aq]s change of balance in that period.-This is useful eg for a monthly income statement:-.RS 4-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-quarterly\ income\ expenses\ \-E-Balance\ changes\ in\ 2008:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008q1\ \ 2008q2\ \ 2008q3\ \ 2008q4\ -===================++=================================-\ expenses:food\ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ expenses:supplies\ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ income:gifts\ \ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\ income:salary\ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ -\f[]-.fi-.RE-.IP "2." 3-With \f[C]\-\-cumulative\f[]: each column shows the ending balance for-that period, accumulating the changes across periods, starting from 0 at-the report start date:-.RS 4-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-quarterly\ income\ expenses\ \-E\ \-\-cumulative-Ending\ balances\ (cumulative)\ in\ 2008:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008/03/31\ \ 2008/06/30\ \ 2008/09/30\ \ 2008/12/31\ -===================++=================================================-\ expenses:food\ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ expenses:supplies\ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ income:gifts\ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ -\ income:salary\ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ $\-1\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ -\f[]-.fi-.RE-.IP "3." 3-With \f[C]\-\-historical/\-H\f[]: each column shows the actual-historical ending balance for that period, accumulating the changes-across periods, starting from the actual balance at the report start-date.-This is useful eg for a multi\-period balance sheet, and when you are-showing only the data after a certain start date:-.RS 4-.IP-.nf-\f[C]-$\ hledger\ balance\ ^assets\ ^liabilities\ \-\-quarterly\ \-\-historical\ \-\-begin\ 2008/4/1-Ending\ balances\ (historical)\ in\ 2008/04/01\-2008/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008/06/30\ \ 2008/09/30\ \ 2008/12/31\ -======================++=====================================-\ assets:bank:checking\ ||\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ 0\ -\ assets:bank:saving\ \ \ ||\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ $1\ -\ assets:cash\ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ $\-2\ \ \ \ \ \ \ \ \ $\-2\ \ \ \ \ \ \ \ \ $\-2\ -\ liabilities:debts\ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $1\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ 0\ -\f[]-.fi-.RE-.PP-Multicolumn balance reports display accounts in flat mode by default; to-see the hierarchy, use \f[C]\-\-tree\f[].-.PP-With a reporting interval (like \f[C]\-\-quarterly\f[] above), the-report start/end dates will be adjusted if necessary so that they-encompass the displayed report periods.-This is so that the first and last periods will be "full" and comparable-to the others.-.PP-The \f[C]\-E/\-\-empty\f[] flag does two things in multicolumn balance-reports: first, the report will show all columns within the specified-report period (without \-E, leading and trailing columns with all zeroes-are not shown).-Second, all accounts which existed at the report start date will be-considered, not just the ones with activity during the report period-(use \-E to include low\-activity accounts which would otherwise would-be omitted).-.PP-The \f[C]\-T/\-\-row\-total\f[] flag adds an additional column showing-the total for each row.-.PP-The \f[C]\-A/\-\-average\f[] flag adds a column showing the average-value in each row.-.PP-Here\[aq]s an example of all three:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-Q\ income\ expenses\ \-\-tree\ \-ETA-Balance\ changes\ in\ 2008:--\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ 2008q1\ \ 2008q2\ \ 2008q3\ \ 2008q4\ \ \ \ Total\ \ Average\ -============++===================================================-\ expenses\ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $2\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $2\ \ \ \ \ \ \ $1\ -\ \ \ food\ \ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ 0\ -\ \ \ supplies\ ||\ \ \ \ \ \ \ 0\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ 0\ -\ income\ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-2\ \ \ \ \ \ $\-1\ -\ \ \ gifts\ \ \ \ ||\ \ \ \ \ \ \ 0\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ 0\ -\ \ \ salary\ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ 0\ -\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ $\-1\ \ \ \ \ \ $1\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ 0\ --#\ Average\ is\ rounded\ to\ the\ dollar\ here\ since\ all\ journal\ amounts\ are-\f[]-.fi-.PP-Limitations:-.PP-In multicolumn reports the \f[C]\-V/\-\-value\f[] flag uses the market-price on the report end date, for all columns (not the price on each-column\[aq]s end date).-.PP-Eliding of boring parent accounts in tree mode, as in the classic-balance report, is not yet supported in multicolumn reports.-.SS Budget report-.PP-With \f[C]\-\-budget\f[], extra columns are displayed showing budget-goals for each account and period, if any.-Budget goals are defined by periodic transactions.-This is very useful for comparing planned and actual income, expenses,-time usage, etc.-\-\-budget is most often combined with a report interval.-.PP-For example, you can take average monthly expenses in the common expense-categories to construct a minimal monthly budget:-.IP-.nf-\f[C]-;;\ Budget-~\ monthly-\ \ income\ \ $2000-\ \ expenses:food\ \ \ \ $400-\ \ expenses:bus\ \ \ \ \ $50-\ \ expenses:movies\ \ $30-\ \ assets:bank:checking--;;\ Two\ months\ worth\ of\ expenses-2017\-11\-01-\ \ income\ \ $1950-\ \ expenses:food\ \ \ \ $396-\ \ expenses:bus\ \ \ \ \ $49-\ \ expenses:movies\ \ $30-\ \ expenses:supplies\ \ $20-\ \ assets:bank:checking--2017\-12\-01-\ \ income\ \ $2100-\ \ expenses:food\ \ \ \ $412-\ \ expenses:bus\ \ \ \ \ $53-\ \ expenses:gifts\ \ \ $100-\ \ assets:bank:checking-\f[]-.fi-.PP-You can now see a monthly budget report:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-M\ \-\-budget-Budget\ performance\ in\ 2017/11/01\-2017/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ -======================++====================================================-\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ \ $565\ [\ 118%\ of\ \ \ $480]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ \ $53\ [\ 106%\ of\ \ \ \ $50]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $412\ [\ 103%\ of\ \ \ $400]\ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ \ \ 0\ [\ \ \ 0%\ of\ \ \ \ $30]\ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $2100\ [\ 105%\ of\ \ $2000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-Note this is different from a normal balance report in several ways:-.IP \[bu] 2-Only accounts with budget goals during the report period are shown, by-default.-.IP \[bu] 2-In each column, in square brackets after the actual amount, budgeted-amounts are shown, along with the percentage of budget used.-.IP \[bu] 2-All parent accounts are always shown, even in flat mode.-Eg assets, assets:bank, and expenses above.-.IP \[bu] 2-Amounts always include all subaccounts, budgeted or unbudgeted, even in-flat mode.-.PP-This means that the numbers displayed will not always add up! Eg above,-the \f[C]expenses\f[] actual amount includes the gifts and supplies-transactions, but the \f[C]expenses:gifts\f[] and-\f[C]expenses:supplies\f[] accounts are not shown, as they have no-budget amounts declared.-.PP-This can be confusing.-When you need to make things clearer, use the \f[C]\-E/\-\-empty\f[]-flag, which will reveal all accounts including unbudgeted ones, giving-the full picture.-Eg:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-M\ \-\-budget\ \-\-empty-Budget\ performance\ in\ 2017/11/01\-2017/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ -======================++====================================================-\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-2665\ [\ 107%\ of\ $\-2480]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ \ $565\ [\ 118%\ of\ \ \ $480]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ \ $53\ [\ 106%\ of\ \ \ \ $50]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $412\ [\ 103%\ of\ \ \ $400]\ -\ expenses:gifts\ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $100\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ \ \ 0\ [\ \ \ 0%\ of\ \ \ \ $30]\ -\ expenses:supplies\ \ \ \ ||\ \ \ \ $20\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $2100\ [\ 105%\ of\ \ $2000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-You can roll over unspent budgets to next period with-\f[C]\-\-cumulative\f[]:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-M\ \-\-budget\ \-\-cumulative-Budget\ performance\ in\ 2017/11/01\-2017/12/31:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Nov\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Dec\ -======================++====================================================-\ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ assets:bank\ \ \ \ \ \ \ \ \ \ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ assets:bank:checking\ ||\ $\-2445\ [\ \ 99%\ of\ $\-2480]\ \ $\-5110\ [\ 103%\ of\ $\-4960]\ -\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ $495\ [\ 103%\ of\ \ \ $480]\ \ \ $1060\ [\ 110%\ of\ \ \ $960]\ -\ expenses:bus\ \ \ \ \ \ \ \ \ ||\ \ \ \ $49\ [\ \ 98%\ of\ \ \ \ $50]\ \ \ \ $102\ [\ 102%\ of\ \ \ $100]\ -\ expenses:food\ \ \ \ \ \ \ \ ||\ \ \ $396\ [\ \ 99%\ of\ \ \ $400]\ \ \ \ $808\ [\ 101%\ of\ \ \ $800]\ -\ expenses:movies\ \ \ \ \ \ ||\ \ \ \ $30\ [\ 100%\ of\ \ \ \ $30]\ \ \ \ \ $30\ [\ \ 50%\ of\ \ \ \ $60]\ -\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $1950\ [\ \ 98%\ of\ \ $2000]\ \ \ $4050\ [\ 101%\ of\ \ $4000]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-For more examples, see Budgeting and Forecasting.-.SS Nested budgets-.PP-You can add budgets to any account in your account hierarchy.-If you have budgets on both parent account and some of its children,-then budget(s) of the child account(s) would be added to the budget of-their parent, much like account balances behave.-.PP-In the most simple case this means that once you add a budget to any-account, all its parents would have budget as well.-.PP-To illustrate this, consider the following budget:-.IP-.nf-\f[C]-~\ monthly\ from\ 2019/01-\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ $1,000.00-\ \ \ \ expenses:personal:electronics\ \ \ \ $100.00-\ \ \ \ liabilities-\f[]-.fi-.PP-With this, monthly budget for electronics is defined to be $100 and-budget for personal expenses is an additional $1000, which implicity-means that budget for both \f[C]expenses:personal\f[] and-\f[C]expenses\f[] is $1100.-.PP-Transactions in \f[C]expenses:personal:electronics\f[] will be counted-both towards its $100 budget and $1100 of \f[C]expenses:personal\f[] ,-and transactions in any other subaccount of \f[C]expenses:personal\f[]-would be counted towards only towards the budget of-\f[C]expenses:personal\f[].-.PP-For example, let\[aq]s consider these transactions:-.IP-.nf-\f[C]-~\ monthly\ from\ 2019/01-\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ $1,000.00-\ \ \ \ expenses:personal:electronics\ \ \ \ $100.00-\ \ \ \ liabilities--2019/01/01\ Google\ home\ hub-\ \ \ \ expenses:personal:electronics\ \ \ \ \ \ \ \ \ \ $90.00-\ \ \ \ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-90.00--2019/01/02\ Phone\ screen\ protector-\ \ \ \ expenses:personal:electronics:upgrades\ \ \ \ \ \ \ \ \ \ $10.00-\ \ \ \ liabilities--2019/01/02\ Weekly\ train\ ticket-\ \ \ \ expenses:personal:train\ tickets\ \ \ \ \ \ \ $153.00-\ \ \ \ liabilities--2019/01/03\ Flowers-\ \ \ \ expenses:personal\ \ \ \ \ \ \ \ \ \ $30.00-\ \ \ \ liabilities-\f[]-.fi-.PP-As you can see, we have transactions in-\f[C]expenses:personal:electronics:upgrades\f[] and-\f[C]expenses:personal:train\ tickets\f[], and since both of these-accounts are without explicitly defined budget, these transactions would-be counted towards budgets of \f[C]expenses:personal:electronics\f[] and-\f[C]expenses:personal\f[] accordingly:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-budget\ \-M-Budget\ performance\ in\ 2019/01:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Jan\ -===============================++===============================-\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal:electronics\ ||\ \ $100.00\ [\ 100%\ of\ \ \ $100.00]\ -\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-283.00\ [\ \ 26%\ of\ $\-1100.00]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.PP-And with \f[C]\-\-empty\f[], we can get a better picture of budget-allocation and consumption:-.IP-.nf-\f[C]-$\ hledger\ balance\ \-\-budget\ \-M\ \-\-empty-Budget\ performance\ in\ 2019/01:--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ Jan\ -========================================++===============================-\ expenses\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ $283.00\ [\ \ 26%\ of\ \ $1100.00]\ -\ expenses:personal:electronics\ \ \ \ \ \ \ \ \ \ ||\ \ $100.00\ [\ 100%\ of\ \ \ $100.00]\ -\ expenses:personal:electronics:upgrades\ ||\ \ \ $10.00\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ expenses:personal:train\ tickets\ \ \ \ \ \ \ \ ||\ \ $153.00\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ -\ liabilities\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ $\-283.00\ [\ \ 26%\ of\ $\-1100.00]\ -\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-++\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ||\ \ \ \ \ \ \ \ 0\ [\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0]\ -\f[]-.fi-.SS Output format-.PP-The balance command supports output destination and output format-selection.-.SS balancesheet-.PP-balancesheet, bs-.PD 0-.P-.PD-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date).-It assumes that these accounts are under a top\-level \f[C]asset\f[] or-\f[C]liability\f[] account (case insensitive, plural forms also-allowed).-.PP-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ balancesheet-Balance\ Sheet--Assets:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--Liabilities:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-With a reporting interval, multiple columns will be shown, one for each-report period.-As with multicolumn balance reports, you can alter the report mode with-\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].-Normally balancesheet shows historical ending balances, which is what-you need for a balance sheet; note this means it ignores report begin-dates.-.PP-This command also supports output destination and output format-selection.-.SS balancesheetequity-.PP-balancesheetequity, bse-.PD 0-.P-.PD-Just like balancesheet, but also reports Equity (which it assumes is-under a top\-level \f[C]equity\f[] account).-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ balancesheetequity-Balance\ Sheet\ With\ Equity--Assets:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-3\ \ \ \ cash-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2--Liabilities:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ liabilities:debts-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1--Equity:-\ \ \ \ \ \ \ \ \ \ $1\ \ equity:owner-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ $1--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.SS cashflow-.PP-cashflow, cf-.PD 0-.P-.PD-This command displays a simple cashflow statement, showing changes in-"cash" accounts.-It assumes that these accounts are under a top\-level \f[C]asset\f[]-account (case insensitive, plural forms also allowed) and do not contain-\f[C]receivable\f[] or \f[C]A/R\f[] in their name.-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ cashflow-Cashflow\ Statement--Cash\ flows:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ assets-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ bank:saving-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ \ \ cash-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1-\f[]-.fi-.PP-With a reporting interval, multiple columns will be shown, one for each-report period.-Normally cashflow shows changes in assets per period, though as with-multicolumn balance reports you can alter the report mode with-\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].-.PP-This command also supports output destination and output format-selection.-.SS check\-dates-.PP-check\-dates-.PD 0-.P-.PD-Check that transactions are sorted by increasing date.-With \-\-date2, checks secondary dates instead.-With \-\-strict, dates must also be unique.-With a query, only matched transactions\[aq] dates are checked.-Reads the default journal file, or another specified with \-f.-.SS check\-dupes-.PP-check\-dupes-.PD 0-.P-.PD-Reports account names having the same leaf but different prefixes.-In other words, two or more leaves that are categorized differently.-Reads the default journal file, or another specified as an argument.-.PP-An example: http://stefanorodighiero.net/software/hledger\-dupes.html-.SS close-.PP-close, equity-.PD 0-.P-.PD-Prints a "closing balances" transaction and an "opening balances"-transaction that bring account balances to and from zero, respectively.-Useful for bringing asset/liability balances forward into a new journal-file, or for closing out revenues/expenses to retained earnings at the-end of a period.-.PP-The closing transaction transfers balances to "equity:closing balances".-The opening transaction transfers balances from "equity:opening-balances".-You can chose to print just one of the transactions by using the-\f[C]\-\-opening\f[] or \f[C]\-\-closing\f[] flag.-.PP-If you split your journal files by time (eg yearly), you will typically-run this command at the end of the year, and save the closing-transaction as last entry of the old file, and the opening transaction-as the first entry of the new file.-This makes the files self contained, so that correct balances are-reported no matter which of them are loaded.-Ie, if you load just one file, the balances are initialised correctly;-or if you load several files, the redundant closing/opening transactions-cancel each other out.-(They will show up in print or register reports; you can exclude them-with a query like-\f[C]not:desc:\[aq](opening|closing)\ balances\[aq]\f[].)-.PP-If you\[aq]re running a business, you might also use this command to-"close the books" at the end of an accounting period, transferring-income statement account balances to retained earnings.-(You may want to change the equity account name to something like-"equity:retained earnings".)-.PP-By default, the closing transaction is dated yesterday, the balances are-calculated as of end of yesterday, and the opening transaction is dated-today.-To close on some other date, use:-\f[C]hledger\ close\ \-e\ OPENINGDATE\f[].-Eg, to close/open on the 2018/2019 boundary, use \f[C]\-e\ 2019\f[].-You can also use \-p or \f[C]date:PERIOD\f[] (any starting date is-ignored).-.PP-Both transactions will include balance assertions for the-closed/reopened accounts.-You probably shouldn\[aq]t use status or realness filters (like \-C or-\-R or \f[C]status:\f[]) with this command, or the generated balance-assertions will depend on these flags.-Likewise, if you run this command with \-\-auto, the balance assertions-will probably always require \-\-auto.-.PP-Examples:-.PP-Carrying asset/liability balances into a new file for 2019, all from-command line:-.PP-\f[I]Warning: we use \f[CI]>>\f[I] here to append; be careful not to-type a single \f[CI]>\f[I] which would wipe your journal!\f[]-.IP-.nf-\f[C]-$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-opening\ >>2019.journal-$\ hledger\ close\ \-f\ 2018.journal\ \-e\ 2019\ assets\ liabilities\ \-\-closing\ >>2018.journal-\f[]-.fi-.PP-Now:-.IP-.nf-\f[C]-$\ 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-\f[]-.fi-.PP-Transactions spanning the closing date can complicate matters, breaking-balance assertions:-.IP-.nf-\f[C]-2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5-\ \ \ \ assets:bank:checking\ \ \-5\ \ ;\ [2019/1/2]-\f[]-.fi-.PP-Here\[aq]s one way to resolve that:-.IP-.nf-\f[C]-;\ in\ 2018.journal:-2018/12/30\ a\ purchase\ made\ in\ 2018,\ clearing\ the\ following\ year-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ 5-\ \ \ \ liabilities:pending--;\ in\ 2019.journal:-2019/1/2\ clearance\ of\ last\ year\[aq]s\ pending\ transactions-\ \ \ \ liabilities:pending\ \ \ \ 5\ =\ 0-\ \ \ \ assets:checking-\f[]-.fi-.SS files-.PP-files-.PD 0-.P-.PD-List all files included in the journal.-With a REGEX argument, only file names matching the regular expression-(case sensitive) are shown.-.SS help-.PP-help-.PD 0-.P-.PD-Show any of the hledger manuals.-.PP-The \f[C]help\f[] command displays any of the main hledger manuals, in-one of several ways.-Run it with no argument to list the manuals, or provide a full or-partial manual name to select one.-.PP-hledger manuals are available in several formats.-hledger help will use the first of these display methods that it finds:-info, man, $PAGER, less, stdout (or when non\-interactive, just stdout).-You can force a particular viewer with the \f[C]\-\-info\f[],-\f[C]\-\-man\f[], \f[C]\-\-pager\f[], \f[C]\-\-cat\f[] flags.-.PP-Examples:-.IP-.nf-\f[C]-$\ hledger\ help-Please\ choose\ a\ manual\ by\ typing\ "hledger\ help\ MANUAL"\ (a\ substring\ is\ ok).-Manuals:\ hledger\ hledger\-ui\ hledger\-web\ hledger\-api\ journal\ csv\ timeclock\ timedot-\f[]-.fi-.IP-.nf-\f[C]-$\ hledger\ help\ h\ \-\-man--hledger(1)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger\ User\ Manuals\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ hledger(1)--NAME-\ \ \ \ \ \ \ hledger\ \-\ a\ command\-line\ accounting\ tool--SYNOPSIS-\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ COMMAND\ [OPTIONS]\ [ARGS]-\ \ \ \ \ \ \ hledger\ [\-f\ FILE]\ ADDONCMD\ \-\-\ [OPTIONS]\ [ARGS]-\ \ \ \ \ \ \ hledger--DESCRIPTION-\ \ \ \ \ \ \ hledger\ \ is\ \ a\ \ cross\-platform\ \ program\ \ for\ tracking\ money,\ time,\ or\ any-\&...-\f[]-.fi-.SS import-.PP-import-.PD 0-.P-.PD-Read new transactions added to each FILE since last run, and add them to-the main journal file.-Or with \-\-dry\-run, just print the transactions that would be added.-.PP-The input files are specified as arguments \- no need to write \-f-before each one.-So eg to add new transactions from all CSV files to the main journal,-it\[aq]s just: \f[C]hledger\ import\ *.csv\f[]-.PP-New transactions are detected in the same way as print \-\-new: by-assuming transactions are always added to the input files in increasing-date order, and by saving \f[C]\&.latest.FILE\f[] state files.-.PP-The \-\-dry\-run output is in journal format, so you can filter it, eg-to see only uncategorised transactions:-.IP-.nf-\f[C]-$\ hledger\ import\ \-\-dry\ ...\ |\ hledger\ \-f\-\ print\ unknown\ \-\-ignore\-assertions-\f[]-.fi-.SS incomestatement-.PP-incomestatement, is-.PD 0-.P-.PD-This command displays a simple income statement, showing revenues and-expenses during a period.-It assumes that these accounts are under a top\-level \f[C]revenue\f[]-or \f[C]income\f[] or \f[C]expense\f[] account (case insensitive, plural-forms also allowed).-Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-.PP-This command displays a simple income statement.-It currently assumes that you have top\-level accounts named-\f[C]income\f[] (or \f[C]revenue\f[]) and \f[C]expense\f[] (plural forms-also allowed.)-.IP-.nf-\f[C]-$\ hledger\ incomestatement-Income\ Statement--Revenues:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2\ \ income-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ gifts-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ salary-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2--Expenses:-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2\ \ expenses-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ food-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ supplies-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $2--Total:-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\--\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-With a reporting interval, multiple columns will be shown, one for each-report period.-Normally incomestatement shows revenues/expenses per period, though as-with multicolumn balance reports you can alter the report mode with-\f[C]\-\-change\f[]/\f[C]\-\-cumulative\f[]/\f[C]\-\-historical\f[].-.PP-This command also supports output destination and output format-selection.-.SS prices-.PP-prices-.PD 0-.P-.PD-Print market price directives from the journal.-With \-\-costs, also print synthetic market prices based on transaction-prices.-With \-\-inverted\-costs, also print inverse prices based on transaction-prices.-Prices (and postings providing prices) can be filtered by a query.-.SS print-.PP-print, txns, p-.PD 0-.P-.PD-Show transaction journal entries, sorted by date.-.PP-The print command displays full journal entries (transactions) from the-journal file in date order, tidily formatted.-With \-\-date2, transactions are sorted by secondary date instead.-.PP-print\[aq]s output is always a valid hledger journal.-.PD 0-.P-.PD-It preserves all transaction information, but it does not preserve-directives or inter\-transaction comments-.IP-.nf-\f[C]-$\ hledger\ print-2008/01/01\ income-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--2008/06/01\ gift-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1--2008/06/02\ save-\ \ \ \ assets:bank:saving\ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1--2008/06/03\ *\ eat\ &\ shop-\ \ \ \ expenses:food\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ expenses:supplies\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ assets:cash\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-2--2008/12/31\ *\ pay\ off-\ \ \ \ liabilities:debts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1-\f[]-.fi-.PP-Normally, the journal entry\[aq]s explicit or implicit amount style is-preserved.-Ie when an amount is omitted in the journal, it will be omitted in the-output.-You can use the \f[C]\-x\f[]/\f[C]\-\-explicit\f[] flag to make all-amounts explicit, which can be useful for troubleshooting or for making-your journal more readable and robust against data entry errors.-Note, \f[C]\-x\f[] will cause postings with a multi\-commodity amount-(these can arise when a multi\-commodity transaction has an implicit-amount) will be split into multiple single\-commodity postings, for-valid journal output.-.PP-With \f[C]\-B\f[]/\f[C]\-\-cost\f[], amounts with transaction prices are-converted to cost using that price.-This can be used for troubleshooting.-.PP-With \f[C]\-m\f[]/\f[C]\-\-match\f[] and a STR argument, print will show-at most one transaction: the one one whose description is most similar-to STR, and is most recent.-STR should contain at least two characters.-If there is no similar\-enough match, no transaction will be shown.-.PP-With \f[C]\-\-new\f[], for each FILE being read, hledger reads (and-writes) a special state file (\f[C]\&.latest.FILE\f[] in the same-directory), containing the latest transaction date(s) that were seen-last time FILE was read.-When this file is found, only transactions 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:-.IP-.nf-\f[C]-$\ hledger\ \-f\ bank1.csv\ print\ \-\-new-#\ shows\ transactions\ added\ since\ last\ print\ \-\-new\ on\ this\ file-\f[]-.fi-.PP-This assumes that transactions added to FILE always have same or-increasing dates, and that transactions on the same day do not get-reordered.-See also the import command.-.PP-This command also supports output destination and output format-selection.-Here\[aq]s an example of print\[aq]s CSV output:-.IP-.nf-\f[C]-$\ hledger\ print\ \-Ocsv-"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting\-status","posting\-comment"-"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""-"1","2008/01/01","","","","income","","income:salary","\-1","$","1","","",""-"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""-"2","2008/06/01","","","","gift","","income:gifts","\-1","$","1","","",""-"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""-"3","2008/06/02","","","","save","","assets:bank:checking","\-1","$","1","","",""-"4","2008/06/03","","*","","eat\ &\ shop","","expenses:food","1","$","","1","",""-"4","2008/06/03","","*","","eat\ &\ shop","","expenses:supplies","1","$","","1","",""-"4","2008/06/03","","*","","eat\ &\ shop","","assets:cash","\-2","$","2","","",""-"5","2008/12/31","","*","","pay\ off","","liabilities:debts","1","$","","1","",""-"5","2008/12/31","","*","","pay\ off","","assets:bank:checking","\-1","$","1","","",""-\f[]-.fi-.IP \[bu] 2-There is one CSV record per posting, with the parent transaction\[aq]s-fields repeated.-.IP \[bu] 2-The "txnidx" (transaction index) field shows which postings belong to-the same transaction.-(This number might change if transactions are reordered within the file,-files are parsed/included in a different order, etc.)-.IP \[bu] 2-The amount is separated into "commodity" (the symbol) and "amount"-(numeric quantity) fields.-.IP \[bu] 2-The numeric amount is repeated in either the "credit" or "debit" column,-for convenience.-(Those names are not accurate in the accounting sense; it just puts-negative amounts under credit and zero or greater amounts under debit.)-.SS print\-unique-.PP-print\-unique-.PD 0-.P-.PD-Print transactions which do not reuse an already\-seen description.-.PP-Example:-.IP-.nf-\f[C]-$\ cat\ unique.journal-1/1\ test-\ (acct:one)\ \ 1-2/2\ test-\ (acct:two)\ \ 2-$\ LEDGER_FILE=unique.journal\ hledger\ print\-unique-(\-f\ option\ not\ supported)-2015/01/01\ test-\ \ \ \ (acct:one)\ \ \ \ \ \ \ \ \ \ \ \ \ 1-\f[]-.fi-.SS register-.PP-register, reg, r-.PD 0-.P-.PD-Show postings and their running total.-.PP-The register command displays postings in date order, one per line, and-their running total.-This is typically used with a query selecting a particular account, to-see that account\[aq]s activity:-.IP-.nf-\f[C]-$\ hledger\ register\ checking-2008/01/01\ income\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $1-2008/06/01\ gift\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $2-2008/06/02\ save\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ $1-2008/12/31\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-With \-\-date2, it shows and sorts by secondary date instead.-.PP-The \f[C]\-\-historical\f[]/\f[C]\-H\f[] flag adds the balance from any-undisplayed prior postings to the running total.-This is useful when you want to see only recent activity, with a-historically accurate running balance:-.IP-.nf-\f[C]-$\ hledger\ register\ checking\ \-b\ 2008/6\ \-\-historical-2008/06/01\ gift\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $2-2008/06/02\ save\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ $1-2008/12/31\ pay\ off\ \ \ \ \ \ \ \ \ \ \ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-The \f[C]\-\-depth\f[] option limits the amount of sub\-account detail-displayed.-.PP-The \f[C]\-\-average\f[]/\f[C]\-A\f[] flag shows the running average-posting amount instead of the running total (so, the final number-displayed is the average for the whole report period).-This flag implies \f[C]\-\-empty\f[] (see below).-It is affected by \f[C]\-\-historical\f[].-It works best when showing just one account and one commodity.-.PP-The \f[C]\-\-related\f[]/\f[C]\-r\f[] flag shows the \f[I]other\f[]-postings in the transactions of the postings which would normally be-shown.-.PP-The \f[C]\-\-invert\f[] flag negates all amounts.-For example, it can be used on an income account where amounts are-normally displayed as negative numbers.-It\[aq]s also useful to show postings on the checking account together-with the related account:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-related\ \-\-invert\ assets:checking-\f[]-.fi-.PP-With a reporting interval, register shows summary postings, one per-interval, aggregating the postings to each account:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-monthly\ income-2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1-2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-2-\f[]-.fi-.PP-Periods with no activity, and summary postings with a zero amount, are-not shown by default; use the \f[C]\-\-empty\f[]/\f[C]\-E\f[] flag to-see them:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-monthly\ income\ \-E-2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:salary\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1-2008/02\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/03\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/04\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/05\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-1-2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ income:gifts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-2-2008/07\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/08\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/09\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/10\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/11\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-2008/12\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0\ \ \ \ \ \ \ \ \ \ $\-2-\f[]-.fi-.PP-Often, you\[aq]ll want to see just one line per interval.-The \f[C]\-\-depth\f[] option helps with this, causing subaccounts to be-aggregated:-.IP-.nf-\f[C]-$\ hledger\ register\ \-\-monthly\ assets\ \-\-depth\ 1h-2008/01\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $1\ \ \ \ \ \ \ \ \ \ \ $1-2008/06\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ \ \ 0-2008/12\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ assets\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ $\-1\ \ \ \ \ \ \ \ \ \ $\-1-\f[]-.fi-.PP-Note when using report intervals, if you specify start/end dates these-will be adjusted outward if necessary to contain a whole number of-intervals.-This ensures that the first and last intervals are full length and-comparable to the others in the report.-.SS Custom register output-.PP-register uses the full terminal width by default, except on windows.-You can override this by setting the \f[C]COLUMNS\f[] environment-variable (not a bash shell variable) or by using the-\f[C]\-\-width\f[]/\f[C]\-w\f[] option.-.PP-The description and account columns normally share the space equally-(about half of (width \- 40) each).-You can adjust this by adding a description width as part of-\-\-width\[aq]s argument, comma\-separated: \f[C]\-\-width\ W,D\f[] .-Here\[aq]s a diagram (won\[aq]t display correctly in \-\-help):-.IP-.nf-\f[C]-<\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\ width\ (W)\ \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\->-date\ (10)\ \ description\ (D)\ \ \ \ \ \ \ account\ (W\-41\-D)\ \ \ \ \ amount\ (12)\ \ \ balance\ (12)-DDDDDDDDDD\ dddddddddddddddddddd\ \ aaaaaaaaaaaaaaaaaaa\ \ AAAAAAAAAAAA\ \ AAAAAAAAAAAA-\f[]-.fi-.PP-and some examples:-.IP-.nf-\f[C]-$\ hledger\ reg\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ use\ terminal\ width\ (or\ 80\ on\ windows)-$\ hledger\ reg\ \-w\ 100\ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ use\ width\ 100-$\ COLUMNS=100\ hledger\ reg\ \ \ \ \ \ \ \ \ #\ set\ with\ one\-time\ environment\ variable-$\ export\ COLUMNS=100;\ hledger\ reg\ #\ set\ till\ session\ end\ (or\ window\ resize)-$\ hledger\ reg\ \-w\ 100,40\ \ \ \ \ \ \ \ \ \ \ #\ set\ overall\ width\ 100,\ description\ width\ 40-$\ hledger\ reg\ \-w\ $COLUMNS,40\ \ \ \ \ \ #\ use\ terminal\ width,\ &\ description\ width\ 40-\f[]-.fi-.PP-This command also supports output destination and output format-selection.-.SS register\-match-.PP-register\-match-.PD 0-.P-.PD-Print the one posting whose transaction description is closest to DESC,-in the style of the register command.-If there are multiple equally good matches, it shows the most recent.-Query options (options, not arguments) can be used to restrict the-search space.-Helps ledger\-autosync detect already\-seen transactions when importing.-.SS rewrite-.PP-rewrite-.PD 0-.P-.PD-Print all transactions, rewriting the postings of matched transactions.-For now the only rewrite available is adding new postings, like print-\-\-auto.-.PP-This is a start at a generic rewriter of transaction entries.-It reads the default journal and prints the transactions, like print,-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\[aq]s first posting amount.-.PP-Examples:-.IP-.nf-\f[C]-hledger\-rewrite.hs\ ^income\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\ \ ;\ income\ tax\[aq]\ \-\-add\-posting\ \[aq](reserve:gifts)\ \ $100\[aq]-hledger\-rewrite.hs\ expenses:gifts\ \-\-add\-posting\ \[aq](reserve:gifts)\ \ *\-1"\[aq]-hledger\-rewrite.hs\ \-f\ rewrites.hledger-\f[]-.fi-.PP-rewrites.hledger may consist of entries like:-.IP-.nf-\f[C]-=\ ^income\ amt:<0\ date:2017-\ \ (liabilities:tax)\ \ *0.33\ \ ;\ tax\ on\ income-\ \ (reserve:grocery)\ \ *0.25\ \ ;\ reserve\ 25%\ for\ grocery-\ \ (reserve:)\ \ *0.25\ \ ;\ reserve\ 25%\ for\ grocery-\f[]-.fi-.PP-Note the single quotes to protect the dollar sign from bash, and the two-spaces between account and amount.-.PP-More:-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ [QUERY]\ \ \ \ \ \ \ \ \-\-add\-posting\ "ACCT\ \ AMTEXPR"\ ...-$\ hledger\ rewrite\ \-\-\ ^income\ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]-$\ hledger\ rewrite\ \-\-\ expenses:gifts\ \-\-add\-posting\ \[aq](budget:gifts)\ \ *\-1"\[aq]-$\ hledger\ rewrite\ \-\-\ ^income\ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq](budget:foreign\ currency)\ \ *0.25\ JPY;\ diversify\[aq]-\f[]-.fi-.PP-Argument for \f[C]\-\-add\-posting\f[] option is a usual posting of-transaction with an exception for amount specification.-More precisely, you can use \f[C]\[aq]*\[aq]\f[] (star symbol) before-the amount to indicate that that this is a factor for an amount of-original matched posting.-If the amount includes a commodity name, the new posting amount will be-in the new commodity; otherwise, it will be in the matched posting-amount\[aq]s commodity.-.SS Re\-write rules in a file-.PP-During the run this tool will execute so called "Automated Transactions"-found in any journal it process.-I.e instead of specifying this operations in command line you can put-them in a journal file.-.IP-.nf-\f[C]-$\ rewrite\-rules.journal-\f[]-.fi-.PP-Make contents look like this:-.IP-.nf-\f[C]-=\ ^income-\ \ \ \ (liabilities:tax)\ \ *.33--=\ expenses:gifts-\ \ \ \ budget:gifts\ \ *\-1-\ \ \ \ assets:budget\ \ *1-\f[]-.fi-.PP-Note that \f[C]\[aq]=\[aq]\f[] (equality symbol) that is used instead of-date in transactions you usually write.-It indicates the query by which you want to match the posting to add new-ones.-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ \-f\ input.journal\ \-f\ rewrite\-rules.journal\ >\ rewritten\-tidy\-output.journal-\f[]-.fi-.PP-This is something similar to the commands pipeline:-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ \-f\ input.journal\ \[aq]^income\[aq]\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]\ \\-\ \ |\ hledger\ rewrite\ \-\-\ \-f\ \-\ expenses:gifts\ \ \ \ \ \ \-\-add\-posting\ \[aq]budget:gifts\ \ *\-1\[aq]\ \ \ \ \ \ \ \\-\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \-\-add\-posting\ \[aq]assets:budget\ \ *1\[aq]\ \ \ \ \ \ \ \\-\ \ >\ rewritten\-tidy\-output.journal-\f[]-.fi-.PP-It is important to understand that relative order of such entries in-journal is important.-You can re\-use result of previously added postings.-.SS Diff output format-.PP-To use this tool for batch modification of your journal files you may-find useful output in form of unified diff.-.IP-.nf-\f[C]-$\ hledger\ rewrite\ \-\-\ \-\-diff\ \-f\ examples/sample.journal\ \[aq]^income\[aq]\ \-\-add\-posting\ \[aq](liabilities:tax)\ \ *.33\[aq]-\f[]-.fi-.PP-Output might look like:-.IP-.nf-\f[C]-\-\-\-\ /tmp/examples/sample.journal-+++\ /tmp/examples/sample.journal-\@\@\ \-18,3\ +18,4\ \@\@-\ 2008/01/01\ income-\-\ \ \ \ assets:bank:checking\ \ $1-+\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ income:salary-+\ \ \ \ (liabilities:tax)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\@\@\ \-22,3\ +23,4\ \@\@-\ 2008/06/01\ gift-\-\ \ \ \ assets:bank:checking\ \ $1-+\ \ \ \ assets:bank:checking\ \ \ \ \ \ \ \ \ \ \ \ $1-\ \ \ \ \ income:gifts-+\ \ \ \ (liabilities:tax)\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ 0-\f[]-.fi-.PP-If you\[aq]ll pass this through \f[C]patch\f[] tool you\[aq]ll get-transactions containing the posting that matches your query be updated.-Note that multiple files might be update according to list of input-files specified via \f[C]\-\-file\f[] options and \f[C]include\f[]-directives inside of these files.-.PP-Be careful.-Whole transaction being re\-formatted in a style of output from-\f[C]hledger\ print\f[].-.PP-See also:-.PP-https://github.com/simonmichael/hledger/issues/99-.SS rewrite vs. print \-\-auto-.PP-This command predates print \-\-auto, and currently does much the same-thing, but with these differences:-.IP \[bu] 2-with multiple files, rewrite lets rules in any file affect all other-files.-print \-\-auto uses standard directive scoping; rules affect only child-files.-.IP \[bu] 2-rewrite\[aq]s query limits which transactions can be rewritten; all are-printed.-print \-\-auto\[aq]s query limits which transactions are printed.-.IP \[bu] 2-rewrite applies rules specified on command line or in the journal.-print \-\-auto applies rules specified in the journal.-.SS roi-.PP-roi-.PD 0-.P-.PD-Shows the time\-weighted (TWR) and money\-weighted (IRR) rate of return-on your investments.-.PP-This command assumes that you have account(s) that hold nothing but your-investments and whenever you record current appraisal/valuation of these-investments you offset unrealized profit and loss into account(s) that,-again, hold nothing but unrealized profit and loss.-.PP-Any transactions affecting balance of investment account(s) and not-originating from unrealized profit and loss account(s) are assumed to be-your investments or withdrawals.-.PP-At a minimum, you need to supply a query (which could be just an account-name) to select your investments with \f[C]\-\-inv\f[], and another-query to identify your profit and loss transactions with-\f[C]\-\-pnl\f[].-.PP-It will compute and display the internalized rate of return (IRR) and-time\-weighted rate of return (TWR) for your investments for the time-period requested.-Both rates of return are annualized before display, regardless of the-length of reporting interval.-.SS stats-.PP-stats-.PD 0-.P-.PD-Show some journal statistics.-.PP-The stats command displays summary information for the whole journal, or-a matched part of it.-With a reporting interval, it shows a report for each report period.-.PP-Example:-.IP-.nf-\f[C]-$\ hledger\ stats-Main\ journal\ file\ \ \ \ \ \ \ \ :\ /src/hledger/examples/sample.journal-Included\ journal\ files\ \ \ :\ -Transactions\ span\ \ \ \ \ \ \ \ :\ 2008\-01\-01\ to\ 2009\-01\-01\ (366\ days)-Last\ transaction\ \ \ \ \ \ \ \ \ :\ 2008\-12\-31\ (2333\ days\ ago)-Transactions\ \ \ \ \ \ \ \ \ \ \ \ \ :\ 5\ (0.0\ per\ day)-Transactions\ last\ 30\ days:\ 0\ (0.0\ per\ day)-Transactions\ last\ 7\ days\ :\ 0\ (0.0\ per\ day)-Payees/descriptions\ \ \ \ \ \ :\ 5-Accounts\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ 8\ (depth\ 3)-Commodities\ \ \ \ \ \ \ \ \ \ \ \ \ \ :\ 1\ ($)-\f[]-.fi-.PP-This command also supports output destination and output format-selection.-.SS tags-.PP-tags-.PD 0-.P-.PD-List all the tag names used in the journal.-With a TAGREGEX argument, only tag names matching the regular expression-(case insensitive) are shown.-With QUERY arguments, only transactions matching the query are-considered.-.SS test-.PP-test-.PD 0-.P-.PD-Run built\-in unit tests.-.PP-This command runs the unit tests built in to hledger\-lib and hledger,-printing test names and results on stdout.-If any test fails, the exit code will be non\-zero.-.PP-Test names include a group prefix.-If a (exact, case sensitive) group prefix, or a full test name is-provided as the first argument, only that group or test is run.-.PP-If a numeric second argument is provided, it will set the randomness-seed, for repeatable results from tests using randomness (currently none-of them).-.PP-This is mainly used by developers, but it\[aq]s nice to be able to-sanity\-check your installed hledger executable at any time.-All tests are expected to pass \- if you ever see otherwise, something-has gone wrong, please report a bug!-.SH ADD\-ON COMMANDS-.PP-hledger also searches for external add\-on commands, and will include-these in the commands list.-These are programs or scripts in your PATH whose name starts with-\f[C]hledger\-\f[] and ends with a recognised file extension (currently:-no extension, \f[C]bat\f[],\f[C]com\f[],\f[C]exe\f[],-\f[C]hs\f[],\f[C]lhs\f[],\f[C]pl\f[],\f[C]py\f[],\f[C]rb\f[],\f[C]rkt\f[],\f[C]sh\f[]).-.PP-Add\-ons can be invoked like any hledger command, but there are a few-things to be aware of.-Eg if the \f[C]hledger\-web\f[] add\-on is installed,-.IP \[bu] 2-\f[C]hledger\ \-h\ web\f[] shows hledger\[aq]s help, while-\f[C]hledger\ web\ \-h\f[] shows hledger\-web\[aq]s help.-.IP \[bu] 2-Flags specific to the add\-on must have a preceding \f[C]\-\-\f[] to-hide them from hledger.-So \f[C]hledger\ web\ \-\-serve\ \-\-port\ 9000\f[] will be rejected;-you must use \f[C]hledger\ web\ \-\-\ \-\-serve\ \-\-port\ 9000\f[].-.IP \[bu] 2-You can always run add\-ons directly if preferred:-\f[C]hledger\-web\ \-\-serve\ \-\-port\ 9000\f[].-.PP-Add\-ons are a relatively easy way to add local features or experiment-with new ideas.-They can be written in any language, but haskell scripts have a big-advantage: they can use the same hledger (and haskell) library functions-that built\-in commands do, for command\-line options, journal parsing,-reporting, etc.-.PP-Here are some hledger add\-ons available:-.SS Official add\-ons-.PP-These are maintained and released along with hledger.-.SS api-.PP-hledger\-api serves hledger data as a JSON web API.-.SS ui-.PP-hledger\-ui provides an efficient curses\-style interface.-.SS web-.PP-hledger\-web provides a simple web interface.-.SS Third party add\-ons-.PP-These are maintained separately, and usually updated shortly after a-hledger release.-.SS diff-.PP-hledger\-diff shows differences in an account\[aq]s transactions between-one journal file and another.-.SS iadd-.PP-hledger\-iadd is a curses\-style, more interactive replacement for the-add command.-.SS interest-.PP-hledger\-interest generates interest transactions for an account-according to various schemes.-.SS irr-.PP-hledger\-irr calculates the internal rate of return of an investment-account, but it\[aq]s superseded now by the built\-in roi command.-.SS Experimental add\-ons-.PP-These are available in source form in the hledger repo\[aq]s bin/-directory; installing them is pretty easy.-They may be less mature and documented than built\-in commands.-Reading and tweaking these is a good way to start making your own!-.SS autosync-.PP-hledger\-autosync is a symbolic link for easily running-ledger\-autosync, if installed.-ledger\-autosync does deduplicating conversion of OFX data and some CSV-formats, and can also download the data if your bank offers OFX Direct-Connect.-.SS chart-.PP-hledger\-chart.hs is an old pie chart generator, in need of some love.-.SS check-.PP-hledger\-check.hs checks more powerful account balance assertions.-.SH ENVIRONMENT-.PP-\f[B]COLUMNS\f[] The screen width used by the register command.-Default: the full terminal width.-.PP-\f[B]LEDGER_FILE\f[] The journal file path when not specified with-\f[C]\-f\f[].-Default: \f[C]~/.hledger.journal\f[] (on windows, perhaps-\f[C]C:/Users/USER/.hledger.journal\f[]).-.SH FILES-.PP-Reads data from one or more files in hledger journal, timeclock,-timedot, or CSV format specified with \f[C]\-f\f[], or-\f[C]$LEDGER_FILE\f[], or \f[C]$HOME/.hledger.journal\f[] (on windows,-perhaps \f[C]C:/Users/USER/.hledger.journal\f[]).-.SH BUGS-.PP-The need to precede addon command options with \f[C]\-\-\f[] when-invoked from hledger is awkward.-.PP-When input data contains non\-ascii characters, a suitable system locale-must be configured (or there will be an unhelpful error).-Eg on POSIX, set LANG to something other than C.-.PP-In a Microsoft Windows CMD window, non\-ascii characters and colours are-not supported.-.PP-In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger-add.-.PP-Not all of Ledger\[aq]s journal file syntax is supported.-See file format differences.-.PP-On large data files, hledger is slower and uses more memory than Ledger.-.SH TROUBLESHOOTING-.PP-Here are some issues you might encounter when you run hledger (and-remember you can also seek help from the IRC channel, mail list or bug-tracker):-.PP-\f[B]Successfully installed, but "No command \[aq]hledger\[aq]-found"\f[]-.PD 0-.P-.PD-stack and cabal install binaries into a special directory, which should-be added to your PATH environment variable.-Eg on unix\-like systems, that is ~/.local/bin and ~/.cabal/bin-respectively.-.PP-\f[B]I set a custom LEDGER_FILE, but hledger is still using the default-file\f[]-.PD 0-.P-.PD-\f[C]LEDGER_FILE\f[] should be a real environment variable, not just a-shell variable.-The command \f[C]env\ |\ grep\ LEDGER_FILE\f[] should show it.-You may need to use \f[C]export\f[].-Here\[aq]s an explanation.-.PP-\f[B]"Illegal byte sequence" or "Invalid or incomplete multibyte or wide-character" errors\f[]-.PD 0-.P-.PD-In order to handle non\-ascii letters and symbols (like £), hledger-needs an appropriate locale.-This is usually configured system\-wide; you can also configure it-temporarily.-The locale may need to be one that supports UTF\-8, if you built hledger-with GHC < 7.2 (or possibly always, I\[aq]m not sure yet).-.PP-Here\[aq]s an example of setting the locale temporarily, on ubuntu-gnu/linux:-.IP-.nf-\f[C]-$\ file\ my.journal-my.journal:\ UTF\-8\ Unicode\ text\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ <\-\ the\ file\ is\ UTF8\-encoded-$\ locale\ \-a-C-en_US.utf8\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ #\ <\-\ a\ UTF8\-aware\ locale\ is\ available-POSIX-$\ LANG=en_US.utf8\ hledger\ \-f\ my.journal\ print\ \ \ #\ <\-\ use\ it\ for\ this\ command-\f[]-.fi-.PP-Here\[aq]s one way to set it permanently, there are probably better-ways:-.IP-.nf-\f[C]-$\ echo\ "export\ LANG=en_US.UTF\-8"\ >>~/.bash_profile-$\ bash\ \-\-login-\f[]-.fi-.PP-If we preferred to use eg \f[C]fr_FR.utf8\f[], we might have to install-that first:-.IP-.nf-\f[C]-$\ apt\-get\ install\ language\-pack\-fr-$\ locale\ \-a-C-en_US.utf8-fr_BE.utf8-fr_CA.utf8-fr_CH.utf8-fr_FR.utf8-fr_LU.utf8-POSIX-$\ LANG=fr_FR.utf8\ hledger\ \-f\ my.journal\ print-\f[]-.fi-.PP-Note some platforms allow variant locale spellings, but not all (ubuntu-accepts \f[C]fr_FR.UTF8\f[], mac osx requires exactly-\f[C]fr_FR.UTF\-8\f[]).---.SH "REPORTING BUGS"-Report bugs at http://bugs.hledger.org-(or on the #hledger IRC channel or hledger mail list)--.SH AUTHORS-Simon Michael <simon@joyful.com> and contributors--.SH COPYRIGHT--Copyright (C) 2007-2016 Simon Michael.-.br-Released under GNU GPL v3 or later.--.SH SEE ALSO-hledger(1), hledger\-ui(1), hledger\-web(1), hledger\-api(1),-hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_timedot(5),-ledger(1)--http://hledger.org
hledger.cabal view
@@ -1,88 +1,93 @@-cabal-version: 1.12+cabal-version: 2.2 --- This file has been generated from package.yaml by hpack version 0.31.1.+-- This file has been generated from package.yaml by hpack version 0.39.1. -- -- see: https://github.com/sol/hpack------ hash: 8134c3c5306064822b7909327946d48b3bcd3fec6dc432a27afb7665840d6201 name: hledger-version: 1.14.2-synopsis: Command-line interface for the hledger accounting tool-description: This is hledger's command-line interface.+version: 1.52.1+synopsis: Command-line interface for the hledger accounting system+description: The command-line interface for the hledger accounting system. Its basic function is to read a plain text file describing financial transactions and produce useful reports. .- hledger is a cross-platform program for tracking money, time, or- any other commodity, using double-entry accounting and a simple,- editable file format. It is inspired by and largely compatible- with ledger(1). hledger provides command-line, curses and web- interfaces, and aims to be a reliable, practical tool for daily- use.+ hledger is a robust, cross-platform set of tools for tracking money,+ time, or any other commodity, using double-entry accounting and a+ simple, editable file format, with command-line, terminal and web+ interfaces. It is a Haskell rewrite of Ledger, and one of the leading+ implementations of Plain Text Accounting. Read more at:+ <https://hledger.org> category: Finance, Console stability: stable homepage: http://hledger.org bug-reports: http://bugs.hledger.org author: Simon Michael <simon@joyful.com> maintainer: Simon Michael <simon@joyful.com>-license: GPL-3+license: GPL-3.0-or-later license-file: LICENSE-tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.3 build-type: Simple+tested-with:+ ghc==9.6.7, ghc==9.8.4, ghc==9.10.2, ghc==9.12.2 extra-source-files: CHANGES.md README.md- test/test.hs bench/10000x1000x10.journal- hledger.1- hledger.txt- hledger.info+ shell-completion/hledger-completion.bash+ test/unittest.hs+ embeddedfiles/add.cast+ embeddedfiles/balance.cast+ embeddedfiles/install.cast+ embeddedfiles/print.cast+ embeddedfiles/hledger-accounts.md+ embeddedfiles/hledger-add.md+ embeddedfiles/hledger-aregister.md+ embeddedfiles/hledger-balance.md+ embeddedfiles/hledger-balancesheet.md+ embeddedfiles/hledger-import.md+ embeddedfiles/hledger-incomestatement.md+ embeddedfiles/hledger-print.md+ embeddedfiles/hledger-ui.md+ embeddedfiles/hledger-web.md+ embeddedfiles/hledger.md embeddedfiles/hledger.1 embeddedfiles/hledger.txt embeddedfiles/hledger.info- embeddedfiles/hledger-api.1- embeddedfiles/hledger-api.txt- embeddedfiles/hledger-api.info embeddedfiles/hledger-ui.1 embeddedfiles/hledger-ui.txt embeddedfiles/hledger-ui.info embeddedfiles/hledger-web.1 embeddedfiles/hledger-web.txt embeddedfiles/hledger-web.info- embeddedfiles/hledger_journal.5- embeddedfiles/hledger_journal.txt- embeddedfiles/hledger_journal.info- embeddedfiles/hledger_csv.5- embeddedfiles/hledger_csv.txt- embeddedfiles/hledger_csv.info- embeddedfiles/hledger_timeclock.5- embeddedfiles/hledger_timeclock.txt- embeddedfiles/hledger_timeclock.info- embeddedfiles/hledger_timedot.5- embeddedfiles/hledger_timedot.txt- embeddedfiles/hledger_timedot.info Hledger/Cli/Commands/Accounts.txt Hledger/Cli/Commands/Activity.txt Hledger/Cli/Commands/Add.txt+ Hledger/Cli/Commands/Aregister.txt Hledger/Cli/Commands/Balance.txt Hledger/Cli/Commands/Balancesheet.txt Hledger/Cli/Commands/Balancesheetequity.txt Hledger/Cli/Commands/Cashflow.txt- Hledger/Cli/Commands/Checkdates.txt- Hledger/Cli/Commands/Checkdupes.txt+ Hledger/Cli/Commands/Check.txt Hledger/Cli/Commands/Close.txt+ Hledger/Cli/Commands/Codes.txt+ Hledger/Cli/Commands/Commands.txt Hledger/Cli/Commands/Commodities.txt+ Hledger/Cli/Commands/Demo.txt+ Hledger/Cli/Commands/Descriptions.txt+ Hledger/Cli/Commands/Diff.txt Hledger/Cli/Commands/Files.txt Hledger/Cli/Commands/Help.txt Hledger/Cli/Commands/Import.txt Hledger/Cli/Commands/Incomestatement.txt+ Hledger/Cli/Commands/Notes.txt+ Hledger/Cli/Commands/Payees.txt Hledger/Cli/Commands/Prices.txt Hledger/Cli/Commands/Print.txt- Hledger/Cli/Commands/Printunique.txt Hledger/Cli/Commands/Register.txt- Hledger/Cli/Commands/Registermatch.txt Hledger/Cli/Commands/Rewrite.txt+ Hledger/Cli/Commands/Repl.txt Hledger/Cli/Commands/Roi.txt+ Hledger/Cli/Commands/Run.txt+ Hledger/Cli/Commands/Setup.txt Hledger/Cli/Commands/Stats.txt Hledger/Cli/Commands/Tags.txt Hledger/Cli/Commands/Test.txt@@ -91,240 +96,256 @@ type: git location: https://github.com/simonmichael/hledger -flag terminfo- description: On POSIX systems, build with the terminfo lib for detecting terminal width.- manual: False- default: True--flag threaded- description: Build with support for multithreaded execution- manual: False- default: True+flag debug+ description: Build with GHC 9.10+ stack traces enabled+ manual: True+ default: False library exposed-modules: Hledger.Cli- Hledger.Cli.Main+ Hledger.Cli.Anchor+ Hledger.Cli.Anon Hledger.Cli.CliOptions- Hledger.Cli.DocFiles- Hledger.Cli.Utils- Hledger.Cli.Version Hledger.Cli.Commands Hledger.Cli.Commands.Accounts Hledger.Cli.Commands.Activity Hledger.Cli.Commands.Add+ Hledger.Cli.Commands.Aregister Hledger.Cli.Commands.Balance Hledger.Cli.Commands.Balancesheet Hledger.Cli.Commands.Balancesheetequity Hledger.Cli.Commands.Cashflow- Hledger.Cli.Commands.Checkdates- Hledger.Cli.Commands.Checkdupes+ Hledger.Cli.Commands.Check Hledger.Cli.Commands.Close+ Hledger.Cli.Commands.Codes Hledger.Cli.Commands.Commodities- Hledger.Cli.Commands.Help+ Hledger.Cli.Commands.Demo+ Hledger.Cli.Commands.Descriptions+ Hledger.Cli.Commands.Diff Hledger.Cli.Commands.Files+ Hledger.Cli.Commands.Help Hledger.Cli.Commands.Import Hledger.Cli.Commands.Incomestatement+ Hledger.Cli.Commands.Notes+ Hledger.Cli.Commands.Payees Hledger.Cli.Commands.Prices Hledger.Cli.Commands.Print- Hledger.Cli.Commands.Printunique Hledger.Cli.Commands.Register- Hledger.Cli.Commands.Registermatch Hledger.Cli.Commands.Rewrite Hledger.Cli.Commands.Roi+ Hledger.Cli.Commands.Run+ Hledger.Cli.Commands.Setup Hledger.Cli.Commands.Stats Hledger.Cli.Commands.Tags Hledger.Cli.CompoundBalanceCommand+ Hledger.Cli.Conf+ Hledger.Cli.DocFiles+ Hledger.Cli.Script+ Hledger.Cli.Utils+ Hledger.Cli.Version other-modules: Paths_hledger- ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path- cpp-options: -DVERSION="1.14.2"+ autogen-modules:+ Paths_hledger+ hs-source-dirs:+ ./+ ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind -optP-Wno-nonportable-include-path+ cpp-options: -DVERSION="1.52.1" build-depends:- Decimal- , Diff- , ansi-terminal >=0.6.2.3- , base >=4.8 && <4.13- , base-compat-batteries >=0.10.1 && <0.11+ Decimal >=0.5.1+ , Diff >=0.2+ , aeson >=1 && <2.3+ , ansi-terminal >=0.9+ , base >=4.18 && <4.23 , bytestring , cmdargs >=0.10- , containers+ , containers >=0.5.9 , data-default >=0.5 , directory- , easytest >=0.2.1 && <0.3+ , extra >=1.7.11 , filepath+ , githash >=0.1.6.2 , hashable >=1.2.4 , haskeline >=0.6- , hledger-lib >=1.14.1 && <1.15+ , hledger-lib >=1.52.1 && <1.53+ , http-client+ , http-types , lucid- , math-functions >=0.2.0.0- , megaparsec >=7.0.0 && <8- , mtl- , mtl-compat- , old-time- , parsec >=3- , pretty-show >=1.6.4+ , math-functions >=0.3.3.0+ , megaparsec >=7.0.0 && <9.8+ , microlens >=0.4+ , modern-uri >=0.3+ , mtl >=2.2.1 , process , regex-tdfa- , safe >=0.2+ , req+ , safe >=0.3.20 , shakespeare >=2.0.2.2 , split >=0.1 , tabular >=0.2+ , tasty >=1.2.3 , temporary- , text >=0.11+ , text >=1.2.4.1+ , text-ansi >=0.2.1 , time >=1.5+ , timeit , transformers , unordered-containers , utf8-string >=0.3.5 , utility-ht >=0.0.13 , wizards >=1.0- if (!(os(windows))) && (flag(terminfo))- build-depends:- terminfo- default-language: Haskell2010+ default-language: GHC2021+ if (flag(debug))+ cpp-options: -DDEBUG executable hledger main-is: hledger-cli.hs other-modules: Paths_hledger+ autogen-modules:+ Paths_hledger hs-source-dirs: app- ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path- cpp-options: -DVERSION="1.14.2"+ ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind -optP-Wno-nonportable-include-path -threaded -with-rtsopts=-T+ cpp-options: -DVERSION="1.52.1" build-depends:- Decimal- , ansi-terminal >=0.6.2.3- , base >=4.8 && <4.13- , base-compat-batteries >=0.10.1 && <0.11+ Decimal >=0.5.1+ , aeson >=1 && <2.3+ , ansi-terminal >=0.9+ , base >=4.18 && <4.23 , bytestring , cmdargs >=0.10- , containers+ , containers >=0.5.9 , data-default >=0.5 , directory- , easytest >=0.2.1 && <0.3+ , extra >=1.7.11 , filepath+ , githash >=0.1.6.2 , haskeline >=0.6 , hledger- , hledger-lib >=1.14.1 && <1.15- , math-functions >=0.2.0.0- , megaparsec >=7.0.0 && <8- , mtl- , mtl-compat- , old-time- , parsec >=3- , pretty-show >=1.6.4+ , hledger-lib >=1.52.1 && <1.53+ , http-client+ , http-types+ , math-functions >=0.3.3.0+ , megaparsec >=7.0.0 && <9.8+ , microlens >=0.4+ , mtl >=2.2.1 , process , regex-tdfa- , safe >=0.2+ , req+ , safe >=0.3.20 , shakespeare >=2.0.2.2 , split >=0.1 , tabular >=0.2+ , tasty >=1.2.3 , temporary- , text >=0.11+ , text >=1.2.4.1+ , text-ansi >=0.2.1 , time >=1.5+ , timeit , transformers , unordered-containers , utf8-string >=0.3.5 , utility-ht >=0.0.13 , wizards >=1.0- if (!(os(windows))) && (flag(terminfo))- build-depends:- terminfo- if flag(threaded)- ghc-options: -threaded- default-language: Haskell2010+ default-language: GHC2021+ if (flag(debug))+ cpp-options: -DDEBUG -test-suite test+test-suite unittest type: exitcode-stdio-1.0- main-is: test.hs- other-modules:- Paths_hledger+ main-is: unittest.hs hs-source-dirs: test- ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path- cpp-options: -DVERSION="1.14.2"+ ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind -optP-Wno-nonportable-include-path+ cpp-options: -DVERSION="1.52.1" build-depends:- Decimal- , ansi-terminal >=0.6.2.3- , base >=4.8 && <4.13- , base-compat-batteries >=0.10.1 && <0.11+ Decimal >=0.5.1+ , aeson >=1 && <2.3+ , ansi-terminal >=0.9+ , base >=4.18 && <4.23 , bytestring , cmdargs >=0.10- , containers+ , containers >=0.5.9 , data-default >=0.5 , directory- , easytest >=0.2.1 && <0.3+ , extra >=1.7.11 , filepath+ , githash >=0.1.6.2 , haskeline >=0.6 , hledger- , hledger-lib >=1.14.1 && <1.15- , math-functions >=0.2.0.0- , megaparsec >=7.0.0 && <8- , mtl- , mtl-compat- , old-time- , parsec >=3- , pretty-show >=1.6.4+ , hledger-lib >=1.52.1 && <1.53+ , http-client+ , http-types+ , math-functions >=0.3.3.0+ , megaparsec >=7.0.0 && <9.8+ , microlens >=0.4+ , mtl >=2.2.1 , process , regex-tdfa- , safe >=0.2+ , req+ , safe >=0.3.20 , shakespeare >=2.0.2.2 , split >=0.1 , tabular >=0.2+ , tasty >=1.2.3 , temporary- , test-framework- , test-framework-hunit- , text >=0.11+ , text >=1.2.4.1+ , text-ansi >=0.2.1 , time >=1.5+ , timeit , transformers , unordered-containers , utf8-string >=0.3.5 , utility-ht >=0.0.13 , wizards >=1.0- if (!(os(windows))) && (flag(terminfo))- build-depends:- terminfo- default-language: Haskell2010+ default-language: GHC2021+ if (flag(debug))+ cpp-options: -DDEBUG benchmark bench type: exitcode-stdio-1.0 main-is: bench.hs- other-modules:- Paths_hledger hs-source-dirs: bench- ghc-options: -Wall -fno-warn-unused-do-bind -fno-warn-name-shadowing -fno-warn-missing-signatures -fno-warn-type-defaults -fno-warn-orphans -optP-Wno-nonportable-include-path+ ghc-options: -Wall -Wno-incomplete-uni-patterns -Wno-missing-signatures -Wno-orphans -Wno-type-defaults -Wno-unused-do-bind -optP-Wno-nonportable-include-path+ cpp-options: -DVERSION="1.52.1" build-depends:- Decimal- , ansi-terminal >=0.6.2.3- , base >=4.8 && <4.13- , base-compat-batteries >=0.10.1 && <0.11+ Decimal >=0.5.1+ , aeson >=1 && <2.3+ , ansi-terminal >=0.9+ , base >=4.18 && <4.23 , bytestring , cmdargs >=0.10- , containers+ , containers >=0.5.9 , criterion , data-default >=0.5 , directory- , easytest >=0.2.1 && <0.3+ , extra >=1.7.11 , filepath+ , githash >=0.1.6.2 , haskeline >=0.6 , hledger- , hledger-lib >=1.14.1 && <1.15+ , hledger-lib >=1.52.1 && <1.53 , html- , math-functions >=0.2.0.0- , megaparsec >=7.0.0 && <8- , mtl- , mtl-compat- , old-time- , parsec >=3- , pretty-show >=1.6.4+ , http-client+ , http-types+ , math-functions >=0.3.3.0+ , megaparsec >=7.0.0 && <9.8+ , microlens >=0.4+ , mtl >=2.2.1 , process , regex-tdfa- , safe >=0.2+ , req+ , safe >=0.3.20 , shakespeare >=2.0.2.2 , split >=0.1 , tabular >=0.2+ , tasty >=1.2.3 , temporary- , text >=0.11+ , text >=1.2.4.1+ , text-ansi >=0.2.1 , time >=1.5 , timeit , transformers@@ -332,7 +353,7 @@ , utf8-string >=0.3.5 , utility-ht >=0.0.13 , wizards >=1.0- if (!(os(windows))) && (flag(terminfo))- build-depends:- terminfo- default-language: Haskell2010+ buildable: False+ default-language: GHC2021+ if (flag(debug))+ cpp-options: -DDEBUG
− hledger.info
@@ -1,2856 +0,0 @@-This is hledger.info, produced by makeinfo version 6.5 from stdin.---File: hledger.info, Node: Top, Next: EXAMPLES, Up: (dir)--hledger(1) hledger 1.14-***********************--This is hledger's command-line interface (there are also curses and web-interfaces). Its basic function is to read a plain text file describing-financial transactions (in accounting terms, a general journal) and-print useful reports on standard output, or export them as CSV. hledger-can also read some other file formats such as CSV files, translating-them to journal format. Additionally, hledger lists other hledger-*-executables found in the user's $PATH and can invoke them as-subcommands.-- hledger reads data from one or more files in hledger journal,-timeclock, timedot, or CSV format specified with '-f', or-'$LEDGER_FILE', or '$HOME/.hledger.journal' (on windows, perhaps-'C:/Users/USER/.hledger.journal'). If using '$LEDGER_FILE', note this-must be a real environment variable, not a shell variable. You can-specify standard input with '-f-'.-- Transactions are dated movements of money between two (or more) named-accounts, and are recorded with journal entries like this:--2015/10/16 bought food- expenses:food $10- assets:cash-- For more about this format, see hledger_journal(5).-- Most users use a text editor to edit the journal, usually with an-editor mode such as ledger-mode for added convenience. hledger's-interactive add command is another way to record new transactions.-hledger never changes existing transactions.-- To get started, you can either save some entries like the above in-'~/.hledger.journal', or run 'hledger add' and follow the prompts. Then-try some commands like 'hledger print' or 'hledger balance'. Run-'hledger' with no arguments for a list of commands.-* Menu:--* EXAMPLES::-* OPTIONS::-* QUERIES::-* COMMANDS::-* ADD-ON COMMANDS::---File: hledger.info, Node: EXAMPLES, Next: OPTIONS, Prev: Top, Up: Top--1 EXAMPLES-**********--Two simple transactions in hledger journal format:--2015/9/30 gift received- assets:cash $20- income:gifts--2015/10/16 farmers market- expenses:food $10- assets:cash-- Some basic reports:--$ hledger print-2015/09/30 gift received- assets:cash $20- income:gifts $-20--2015/10/16 farmers market- expenses:food $10- assets:cash $-10--$ hledger accounts --tree-assets- cash-expenses- food-income- gifts--$ hledger balance- $10 assets:cash- $10 expenses:food- $-20 income:gifts---------------------- 0--$ hledger register cash-2015/09/30 gift received assets:cash $20 $20-2015/10/16 farmers market assets:cash $-10 $10-- More commands:--$ hledger # show available commands-$ hledger add # add more transactions to the journal file-$ hledger balance # all accounts with aggregated balances-$ hledger balance --help # show detailed help for balance command-$ hledger balance --depth 1 # only top-level accounts-$ hledger register # show account postings, with running total-$ hledger reg income # show postings to/from income accounts-$ hledger reg 'assets:some bank:checking' # show postings to/from this checking account-$ hledger print desc:shop # show transactions with shop in the description-$ hledger activity -W # show transaction counts per week as a bar chart---File: hledger.info, Node: OPTIONS, Next: QUERIES, Prev: EXAMPLES, Up: Top--2 OPTIONS-*********--* Menu:--* General options::-* Command options::-* Command arguments::-* Argument files::-* Special characters in arguments and queries::-* Command line tips::-* Unicode characters::-* Input files::-* Smart dates::-* Report start & end date::-* Report intervals::-* Period expressions::-* Depth limiting::-* Pivoting::-* Cost::-* Market value::-* Combining -B and -V::-* Output destination::-* Output format::-* Regular expressions::---File: hledger.info, Node: General options, Next: Command options, Up: OPTIONS--2.1 General options-===================--To see general usage help, including general options which are supported-by most hledger commands, run 'hledger -h'.-- General help options:--'-h --help'-- show general usage (or after COMMAND, command usage)-'--version'-- show version-'--debug[=N]'-- show debug output (levels 1-9, default: 1)-- General input options:--'-f FILE --file=FILE'-- use a different input file. For stdin, use - (default:- '$LEDGER_FILE' or '$HOME/.hledger.journal')-'--rules-file=RULESFILE'-- Conversion rules file to use when reading CSV (default: FILE.rules)-'--separator=CHAR'-- Field separator to expect when reading CSV (default: ',')-'--alias=OLD=NEW'-- rename accounts named OLD to NEW-'--anon'-- anonymize accounts and payees-'--pivot FIELDNAME'-- use some other field or tag for the account name-'-I --ignore-assertions'-- ignore any failing balance assertions-- General reporting options:--'-b --begin=DATE'-- include postings/txns on or after this date-'-e --end=DATE'-- include postings/txns before this date-'-D --daily'-- multiperiod/multicolumn report by day-'-W --weekly'-- multiperiod/multicolumn report by week-'-M --monthly'-- multiperiod/multicolumn report by month-'-Q --quarterly'-- multiperiod/multicolumn report by quarter-'-Y --yearly'-- multiperiod/multicolumn report by year-'-p --period=PERIODEXP'-- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)-'--date2'-- match the secondary date instead (see command help for other- effects)-'-U --unmarked'-- include only unmarked postings/txns (can combine with -P or -C)-'-P --pending'-- include only pending postings/txns-'-C --cleared'-- include only cleared postings/txns-'-R --real'-- include only non-virtual postings-'-NUM --depth=NUM'-- hide/aggregate accounts or postings more than NUM levels deep-'-E --empty'-- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)-'-B --cost'-- convert amounts to their cost at transaction time (using the- transaction price, if any)-'-V --value'-- convert amounts to their market value on the report end date (using- the most recent applicable market price, if any)-'--auto'-- apply automated posting rules to modify transactions.-'--forecast'-- apply periodic transaction rules to generate future transactions,- to 6 months from now or report end date.-- When a reporting option appears more than once in the command line,-the last one takes precedence.-- Some reporting options can also be written as query arguments.---File: hledger.info, Node: Command options, Next: Command arguments, Prev: General options, Up: OPTIONS--2.2 Command options-===================--To see options for a particular command, including command-specific-options, run: 'hledger COMMAND -h'.-- Command-specific options must be written after the command name, eg:-'hledger print -x'.-- Additionally, if the command is an addon, you may need to put its-options after a double-hyphen, eg: 'hledger ui -- --watch'. Or, you can-run the addon executable directly: 'hledger-ui --watch'.---File: hledger.info, Node: Command arguments, Next: Argument files, Prev: Command options, Up: OPTIONS--2.3 Command arguments-=====================--Most hledger commands accept arguments after the command name, which are-often a query, filtering the data in some way.---File: hledger.info, Node: Argument files, Next: Special characters in arguments and queries, Prev: Command arguments, Up: OPTIONS--2.4 Argument files-==================--You can save a set of command line options/arguments in a file, one per-line, and then reuse them by writing '@FILENAME' in a command line. To-prevent this expansion of '@'-arguments, precede them with a '--'-argument. For more, see Save frequently used options.---File: hledger.info, Node: Special characters in arguments and queries, Next: Command line tips, Prev: Argument files, Up: OPTIONS--2.5 Special characters in arguments and queries-===============================================--In shell command lines, option and argument values which contain-"problematic" characters, ie spaces, and also characters significant to-your shell such as '<', '>', '(', ')', '|' and '$', should be escaped by-enclosing them in quotes or by writing backslashes before the-characters. Eg:-- 'hledger register -p 'last year' "accounts receivable-(receivable|payable)" amt:\>100'.-* Menu:--* More escaping::-* Even more escaping::-* Less escaping::---File: hledger.info, Node: More escaping, Next: Even more escaping, Up: Special characters in arguments and queries--2.5.1 More escaping----------------------Characters significant both to the shell and in regular expressions may-need one extra level of escaping. These include parentheses, the pipe-symbol and the dollar sign. Eg, to match the dollar symbol, bash users-should do:-- 'hledger balance cur:'\$''-- or:-- 'hledger balance cur:\\$'---File: hledger.info, Node: Even more escaping, Next: Less escaping, Prev: More escaping, Up: Special characters in arguments and queries--2.5.2 Even more escaping---------------------------When hledger runs an addon executable (eg you type 'hledger ui', hledger-runs 'hledger-ui'), it de-escapes command-line options and arguments-once, so you might need to _triple_-escape. Eg in bash, running the ui-command and matching the dollar sign, it's:-- 'hledger ui cur:'\\$''-- or:-- 'hledger ui cur:\\\\$'-- If you asked why _four_ slashes above, this may help:--unescaped: '$'-escaped: '\$'-double-escaped: '\\$'-triple-escaped: '\\\\$'-- (The number of backslashes in fish shell is left as an exercise for-the reader.)-- You can always avoid the extra escaping for addons by running the-addon directly:-- 'hledger-ui cur:\\$'---File: hledger.info, Node: Less escaping, Prev: Even more escaping, Up: Special characters in arguments and queries--2.5.3 Less escaping----------------------Inside an argument file, or in the search field of hledger-ui or-hledger-web, or at a GHCI prompt, you need one less level of escaping-than at the command line. And backslashes may work better than quotes.-Eg:-- 'ghci> :main balance cur:\$'---File: hledger.info, Node: Command line tips, Next: Unicode characters, Prev: Special characters in arguments and queries, Up: OPTIONS--2.6 Command line tips-=====================--If in doubt, keep things simple:-- * write options after the command ('hledger CMD -OPTIONS ARGS')- * run add-on executables directly ('hledger-ui -OPTIONS ARGS')- * enclose problematic args in single quotes- * if needed, also add a backslash to escape regexp metacharacters-- To find out exactly how a command line is being parsed, add-'--debug=2' to troubleshoot.---File: hledger.info, Node: Unicode characters, Next: Input files, Prev: Command line tips, Up: OPTIONS--2.7 Unicode characters-======================--hledger is expected to handle unicode (non-ascii) characters, but this-requires a well-configured environment.-- To handle unicode characters in the command line or input data, a-system locale that can decode them must be configured (POSIX's default-'C' locale will not work). Eg in bash, you could do:--export LANG=en_US.UTF-8-- See Troubleshooting for more about this.-- Unicode characters should appear correctly in hledger's output. For-the hledger and hledger-ui tools, this requires that-- * your terminal supports unicode- * the terminal's font includes the required unicode glyphs- * the terminal is configured to display "wide" characters as double- width (otherwise report alignment will be off)---File: hledger.info, Node: Input files, Next: Smart dates, Prev: Unicode characters, Up: OPTIONS--2.8 Input files-===============--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:--$ setenv LEDGER_FILE ~/finance/2016.journal-$ hledger stats-- or with the '-f/--file' option:--$ hledger -f /some/file stats-- The file name '-' (hyphen) means standard input:--$ cat some.journal | hledger -f--- Usually the data file is in hledger's journal format, but it can also-be one of several other formats, listed below. hledger detects the-format automatically based on the file extension, or if that is not-recognised, by trying each built-in "reader" in turn:--Reader: Reads: Used for file extensions:------------------------------------------------------------------------------'journal' hledger's journal format, also '.journal' '.j'- some Ledger journals '.hledger' '.ledger'-'timeclock' timeclock files (precise time '.timeclock'- logging)-'timedot' timedot files (approximate time '.timedot'- logging)-'csv' comma-separated values (data '.csv'- interchange)-- 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:--$ hledger -f csv:/some/csv-file.dat stats-$ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:--- You can also specify multiple '-f' options, to read multiple files as-one big journal. There are some limitations with this:-- * directives in one file will not affect the other files- * balance assertions will not see any account balances from previous- files-- If you need those, either use the include directive, or concatenate-the files, eg: 'cat a.journal b.journal | hledger -f- CMD'.---File: hledger.info, Node: Smart dates, Next: Report start & end date, Prev: Input files, Up: OPTIONS--2.9 Smart dates-===============--hledger's user interfaces accept a flexible "smart date" syntax (unlike-dates in the journal file). Smart dates allow some english words, can-be relative to today's date, and can have less-significant date parts-omitted (defaulting to 1).-- Examples:--'2004/10/1', '2004-01-01', '2004.9.1' exact date, several separators allowed. Year is 4+ digits, month is 1-12, day is 1-31-'2004' start of year-'2004/10' start of month-'10/1' month and day in current year-'21' day in current month-'october, oct' start of month in current year-'yesterday, today, tomorrow' -1, 0, 1 days from today-'last/this/next -1, 0, 1 periods from the current period-day/week/month/quarter/year'-'20181201' 8 digit YYYYMMDD with valid year month and day-'201812' 6 digit YYYYMM with valid year and month-- Counterexamples - malformed digit sequences might give surprising-results:--'201813' 6 digits with an invalid month is parsed as start of 6-digit year-'20181301' 8 digits with an invalid month is parsed as start of 8-digit year-'20181232' 8 digits with an invalid day gives an error-'201801012' 9+ digits beginning with a valid YYYYMMDD gives an error---File: hledger.info, Node: Report start & end date, Next: Report intervals, Prev: Smart dates, Up: OPTIONS--2.10 Report start & end date-============================--Most hledger reports show the full span of time represented by the-journal data, by default. So, the effective report start and end dates-will be the earliest and latest transaction or posting dates found in-the journal.-- Often you will want to see a shorter time span, such as the current-month. You can specify a start and/or end date using '-b/--begin',-'-e/--end', '-p/--period' or a 'date:' query (described below). All of-these accept the smart date syntax. One important thing to be aware of-when specifying end dates: as in Ledger, end dates are exclusive, so you-need to write the date _after_ the last day you want to include.-- Examples:--'-b 2016/3/17' begin on St. Patrick's day 2016-'-e 12/1' end at the start of december 1st of the current year (11/30 will be the last date included)-'-b thismonth' all transactions on or after the 1st of the current month-'-p thismonth' all transactions in the current month-'date:2016/3/17-' the above written as queries instead-'date:-12/1'-'date:thismonth-'-'date:thismonth'---File: hledger.info, Node: Report intervals, Next: Period expressions, Prev: Report start & end date, Up: OPTIONS--2.11 Report intervals-=====================--A report interval can be specified so that commands like register,-balance and activity will divide their reports into multiple subperiods.-The basic intervals can be selected with one of '-D/--daily',-'-W/--weekly', '-M/--monthly', '-Q/--quarterly', or '-Y/--yearly'. More-complex intervals may be specified with a period expression. Report-intervals can not be specified with a query, currently.---File: hledger.info, Node: Period expressions, Next: Depth limiting, Prev: Report intervals, Up: OPTIONS--2.12 Period expressions-=======================--The '-p/--period' option accepts period expressions, a shorthand way of-expressing a start date, end date, and/or report interval all at once.-- Here's a basic period expression specifying the first quarter of-2009. Note, hledger always treats start dates as inclusive and end-dates as exclusive:-- '-p "from 2009/1/1 to 2009/4/1"'-- Keywords like "from" and "to" are optional, and so are the spaces, as-long as you don't run two dates together. "to" can also be written as-"-". These are equivalent to the above:--'-p "2009/1/1 2009/4/1"'-'-p2009/1/1to2009/4/1'-'-p2009/1/1-2009/4/1'-- Dates are smart dates, so if the current year is 2009, the above can-also be written as:--'-p "1/1 4/1"'-'-p "january-apr"'-'-p "this year to 4/1"'-- If you specify only one date, the missing start or end date will be-the earliest or latest transaction in your journal:--'-p "from 2009/1/1"' everything after january 1, 2009-'-p "from 2009/1"' the same-'-p "from 2009"' the same-'-p "to 2009"' everything before january 1, 2009-- A single date with no "from" or "to" defines both the start and end-date like so:--'-p "2009"' the year 2009; equivalent to "2009/1/1 to 2010/1/1"-'-p "2009/1"' the month of jan; equivalent to "2009/1/1 to 2009/2/1"-'-p "2009/1/1"' just that day; equivalent to "2009/1/1 to 2009/1/2"-- The argument of '-p' can also begin with, or be, a report interval-expression. The basic report intervals are 'daily', 'weekly',-'monthly', 'quarterly', or 'yearly', which have the same effect as the-'-D','-W','-M','-Q', or '-Y' flags. Between report interval and-start/end dates (if any), the word 'in' is optional. Examples:--'-p "weekly from 2009/1/1 to 2009/4/1"'-'-p "monthly in 2008"'-'-p "quarterly"'-- Note that 'weekly', 'monthly', 'quarterly' and 'yearly' intervals-will always start on the first day on week, month, quarter or year-accordingly, and will end on the last day of same period, even if-associated period expression specifies different explicit start and end-date.-- For example:--'-p "weekly from 2009/1/1 to 2009/4/1"' - starts on 2008/12/29, closest preceeding Monday-'-p "monthly in 2008/11/25"' - starts on 2018/11/01-'-p "quarterly from 2009-05-05 to 2009-06-01"' - starts on 2009/04/01, ends on 2009/06/30, which are first and last days of Q2 2009-'-p "yearly from 2009-12-29"' - starts on 2009/01/01, first day of 2009-- The following more complex report intervals are also supported:-'biweekly', 'bimonthly', 'every day|week|month|quarter|year', 'every N-days|weeks|months|quarters|years'.-- All of these will start on the first day of the requested period and-end on the last one, as described above.-- Examples:--'-p "bimonthly from 2008"' - periods will have boundaries on 2008/01/01, 2008/03/01, ...-'-p "every 2 weeks"' - starts on closest preceeding Monday-'-p "every 5 month from 2009/03"' - periods will have boundaries on 2009/03/01, 2009/08/01, ...-- If you want intervals that start on arbitrary day of your choosing-and span a week, month or year, you need to use any of the following:-- 'every Nth day of week', 'every <weekday>', 'every Nth day [of-month]', 'every Nth weekday [of month]', 'every MM/DD [of year]', 'every-Nth MMM [of year]', 'every MMM Nth [of year]'.-- Examples:--'-p "every 2nd day of week"' - periods will go from Tue to Tue-'-p "every Tue"' - same-'-p "every 15th day"' - period boundaries will be on 15th of each month-'-p "every 2nd Monday"' - period boundaries will be on second Monday of each month-'-p "every 11/05"' - yearly periods with boundaries on 5th of Nov-'-p "every 5th Nov"' - same-'-p "every Nov 5th"' - same-- Show historical balances at end of 15th each month (N is exclusive-end date):-- 'hledger balance -H -p "every 16th day"'-- Group postings from start of wednesday to end of next tuesday (N is-start date and exclusive end date):-- 'hledger register checking -p "every 3rd day of week"'---File: hledger.info, Node: Depth limiting, Next: Pivoting, Prev: Period expressions, Up: OPTIONS--2.13 Depth limiting-===================--With the '--depth N' option (short form: '-N'), commands like account,-balance and register will show only the uppermost accounts in the-account tree, down to level N. Use this when you want a summary with-less detail. This flag has the same effect as a 'depth:' query argument-(so '-2', '--depth=2' or 'depth:2' are basically equivalent).---File: hledger.info, Node: Pivoting, Next: Cost, Prev: Depth limiting, Up: OPTIONS--2.14 Pivoting-=============--Normally hledger sums amounts, and organizes them in a hierarchy, based-on account name. The '--pivot FIELD' option causes it to sum and-organize hierarchy based on the value of some other field instead.-FIELD can be: 'code', 'description', 'payee', 'note', or the full name-(case insensitive) of any tag. As with account names, values containing-'colon:separated:parts' will be displayed hierarchically in reports.-- '--pivot' is a general option affecting all reports; you can think of-hledger transforming the journal before any other processing, replacing-every posting's account name with the value of the specified field on-that posting, inheriting it from the transaction or using a blank value-if it's not present.-- An example:--2016/02/16 Member Fee Payment- assets:bank account 2 EUR- income:member fees -2 EUR ; member: John Doe-- Normal balance report showing account names:--$ hledger balance- 2 EUR assets:bank account- -2 EUR income:member fees---------------------- 0-- Pivoted balance report, using member: tag values instead:--$ hledger balance --pivot member- 2 EUR- -2 EUR John Doe---------------------- 0-- One way to show only amounts with a member: value (using a query,-described below):--$ hledger balance --pivot member tag:member=.- -2 EUR John Doe---------------------- -2 EUR-- Another way (the acct: query matches against the pivoted "account-name"):--$ hledger balance --pivot member acct:.- -2 EUR John Doe---------------------- -2 EUR---File: hledger.info, Node: Cost, Next: Market value, Prev: Pivoting, Up: OPTIONS--2.15 Cost-=========--The '-B/--cost' flag converts amounts to their cost at transaction time,-if they have a transaction price specified.---File: hledger.info, Node: Market value, Next: Combining -B and -V, Prev: Cost, Up: OPTIONS--2.16 Market value-=================--The '-V/--value' flag converts reported amounts to their current market-value.-Specifically, when there is a market price (P directive) for the-amount's commodity, dated on or before today's date (or the report end-date if specified), the amount will be converted to the price's-commodity.-- When there are multiple applicable P directives, -V chooses the most-recent one, or in case of equal dates, the last-parsed one.-- For example:--# one euro is worth this many dollars from nov 1-P 2016/11/01 € $1.10--# purchase some euros on nov 3-2016/11/3- assets:euros €100- assets:checking--# the euro is worth fewer dollars by dec 21-P 2016/12/21 € $1.03-- How many euros do I have ?--$ hledger -f t.j bal -N euros- €100 assets:euros-- What are they worth at end of nov 3 ?--$ 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)--$ hledger -f t.j bal -N euros -V- $103.00 assets:euros-- Currently, hledger's -V only uses market prices recorded with P-directives, not transaction prices (unlike Ledger).-- Currently, -V has a limitation in multicolumn balance reports: it-uses the market prices on the report end date for all columns. (Instead-of the prices on each column's end date.)---File: hledger.info, Node: Combining -B and -V, Next: Output destination, Prev: Market value, Up: OPTIONS--2.17 Combining -B and -V-========================--Using -B/-cost and -V/-value together is currently allowed, but the-results are probably not meaningful. Let us know if you find a use for-this.---File: hledger.info, Node: Output destination, Next: Output format, Prev: Combining -B and -V, Up: OPTIONS--2.18 Output destination-=======================--Some commands (print, register, stats, the balance commands) can write-their output to a destination other than the console. This is-controlled by the '-o/--output-file' option.--$ hledger balance -o - # write to stdout (the default)-$ hledger balance -o FILE # write to FILE---File: hledger.info, Node: Output format, Next: Regular expressions, Prev: Output destination, Up: OPTIONS--2.19 Output format-==================--Some commands can write their output in other formats. Eg print and-register can output CSV, and the balance commands can output CSV or-HTML. This is controlled by the '-O/--output-format' option, or by-specifying a '.csv' or '.html' file extension with '-o/--output-file'.--$ hledger balance -O csv # write CSV to stdout-$ hledger balance -o FILE.csv # write CSV to FILE.csv---File: hledger.info, Node: Regular expressions, Prev: Output format, Up: OPTIONS--2.20 Regular expressions-========================--hledger uses regular expressions in a number of places:-- * query terms, on the command line and in the hledger-web search- form: 'REGEX', 'desc:REGEX', 'cur:REGEX', 'tag:...=REGEX'- * CSV rules conditional blocks: 'if REGEX ...'- * account alias directives and options: 'alias /REGEX/ =- REPLACEMENT', '--alias /REGEX/=REPLACEMENT'-- hledger's regular expressions come from the regex-tdfa library. In-general they:-- * are case insensitive- * are infix matching (do not need to match the entire thing being- matched)- * are POSIX extended regular expressions- * also support GNU word boundaries (\<, \>, \b, \B)- * and parenthesised capturing groups and numeric backreferences in- replacement strings- * do not support mode modifiers like (?s)-- Some things to note:-- * In the 'alias' directive and '--alias' option, regular expressions- must be enclosed in forward slashes ('/REGEX/'). Elsewhere in- hledger, these are not required.-- * In queries, to match a regular expression metacharacter like '$' as- a literal character, prepend a backslash. Eg to search for amounts- with the dollar sign in hledger-web, write 'cur:\$'.-- * On the command line, some metacharacters like '$' have a special- meaning to the shell and so must be escaped at least once more.- See Special characters.---File: hledger.info, Node: QUERIES, Next: COMMANDS, Prev: OPTIONS, Up: Top--3 QUERIES-*********--One of hledger's strengths is being able to quickly report on precise-subsets of your data. Most commands accept an optional query-expression, written as arguments after the command name, to filter the-data by date, account name or other criteria. The syntax is similar to-a web search: one or more space-separated search terms, quotes to-enclose whitespace, prefixes to match specific fields, a not: prefix to-negate the match.-- We do not yet support arbitrary boolean combinations of search terms;-instead most commands show transactions/postings/accounts which match-(or negatively match):-- * any of the description terms AND- * any of the account terms AND- * any of the status terms AND- * all the other terms.-- The print command instead shows transactions which:-- * match any of the description terms AND- * have any postings matching any of the positive account terms AND- * have no postings matching any of the negative account terms AND- * match all the other terms.-- The following kinds of search terms can be used. Remember these can-also be prefixed with *'not:'*, eg to exclude a particular subaccount.--*'REGEX', 'acct:REGEX'*-- match account names by this regular expression. (With no prefix,- 'acct:' is assumed.) same as above--*'amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N'*-- match postings with a single-commodity amount that is equal to,- less than, or greater than N. (Multi-commodity amounts are not- tested, and will always match.) The comparison has two modes: if N- is preceded by a + or - sign (or is 0), the two signed numbers are- compared. Otherwise, the absolute magnitudes are compared,- ignoring sign.-*'code:REGEX'*-- match by transaction code (eg check number)-*'cur:REGEX'*-- match postings or transactions including any amounts whose- currency/commodity symbol is fully matched by REGEX. (For a partial- match, use '.*REGEX.*'). Note, to match characters which are- regex-significant, like the dollar sign ('$'), you need to prepend- '\'. And when using the command line you need to add one more- level of quoting to hide it from the shell, so eg do: 'hledger- print cur:'\$'' or 'hledger print cur:\\$'.-*'desc:REGEX'*-- match transaction descriptions.-*'date:PERIODEXPR'*-- match dates within the specified period. PERIODEXPR is a period- expression (with no report interval). Examples: 'date:2016',- 'date:thismonth', 'date:2000/2/1-2/15', 'date:lastweek-'. If the- '--date2' command line flag is present, this matches secondary- dates instead.-*'date2:PERIODEXPR'*-- match secondary dates within the specified period.-*'depth:N'*-- match (or display, depending on command) accounts at or above this- depth-*'note:REGEX'*-- match transaction notes (part of description right of '|', or whole- description when there's no '|')-*'payee:REGEX'*-- match transaction payee/payer names (part of description left of- '|', or whole description when there's no '|')-*'real:, real:0'*-- match real or virtual postings respectively-*'status:, status:!, status:*'*-- match unmarked, pending, or cleared transactions respectively-*'tag:REGEX[=REGEX]'*-- match by tag name, and optionally also by tag value. Note a tag:- query is considered to match a transaction if it matches any of the- postings. Also remember that postings inherit the tags of their- parent transaction.-- The following special search term is used automatically in-hledger-web, only:--*'inacct:ACCTNAME'*-- tells hledger-web to show the transaction register for this- account. Can be filtered further with 'acct' etc.-- Some of these can also be expressed as command-line options (eg-'depth:2' is equivalent to '--depth 2'). Generally you can mix options-and query arguments, and the resulting query will be their intersection-(perhaps excluding the '-p/--period' option).---File: hledger.info, Node: COMMANDS, Next: ADD-ON COMMANDS, Prev: QUERIES, Up: Top--4 COMMANDS-**********--hledger provides a number of subcommands; 'hledger' with no arguments-shows a list.-- If you install additional 'hledger-*' packages, or if you put-programs or scripts named 'hledger-NAME' in your PATH, these will also-be listed as subcommands.-- Run a subcommand by writing its name as first argument (eg 'hledger-incomestatement'). You can also write one of the standard short aliases-displayed in parentheses in the command list ('hledger b'), or any any-unambiguous prefix of a command name ('hledger inc').-- Here are all the builtin commands in alphabetical order. See also-'hledger' for a more organised command list, and 'hledger CMD -h' for-detailed command help.-* Menu:--* accounts::-* activity::-* add::-* balance::-* balancesheet::-* balancesheetequity::-* cashflow::-* check-dates::-* check-dupes::-* close::-* files::-* help::-* import::-* incomestatement::-* prices::-* print::-* print-unique::-* register::-* register-match::-* rewrite::-* roi::-* stats::-* tags::-* test::---File: hledger.info, Node: accounts, Next: activity, Up: COMMANDS--4.1 accounts-============--accounts, a-Show account names.-- This command lists account names, either declared with account-directives (-declared), posted to (-used), or both (the default). With-query arguments, only matched account names and account names referenced-by matched postings are shown. It shows a flat list by default. With-'--tree', it uses indentation to show the account hierarchy. In flat-mode you can add '--drop N' to omit the first few account name-components. Account names can be depth-clipped with 'depth:N' or-'--depth N' or '-N'.-- Examples:--$ hledger accounts-assets:bank:checking-assets:bank:saving-assets:cash-expenses:food-expenses:supplies-income:gifts-income:salary-liabilities:debts---File: hledger.info, Node: activity, Next: add, Prev: accounts, Up: COMMANDS--4.2 activity-============--activity-Show an ascii barchart of posting counts per interval.-- The activity command displays an ascii histogram showing transaction-counts by day, week, month or other reporting interval (by day is the-default). With query arguments, it counts only matched transactions.-- Examples:--$ hledger activity --quarterly-2008-01-01 **-2008-04-01 *******-2008-07-01 -2008-10-01 **---File: hledger.info, Node: add, Next: balance, Prev: activity, Up: COMMANDS--4.3 add-=======--add-Prompt for transactions and add them to the journal.-- Many hledger users edit their journals directly with a text editor,-or generate them from CSV. For more interactive data entry, there is the-'add' command, which prompts interactively on the console for new-transactions, and appends them to the journal file (if there are-multiple '-f FILE' options, the first file is used.) Existing-transactions are not changed. This is the only hledger command that-writes to the journal file.-- To use it, just run 'hledger add' and follow the prompts. You can-add as many transactions as you like; when you are finished, enter '.'-or press control-d or control-c to exit.-- Features:-- * add tries to provide useful defaults, using the most similar (by- description) recent transaction (filtered by the query, if any) as- a template.- * You can also set the initial defaults with command line arguments.- * Readline-style edit keys can be used during data entry.- * The tab key will auto-complete whenever possible - accounts,- descriptions, dates ('yesterday', 'today', 'tomorrow'). If the- input area is empty, it will insert the default value.- * If the journal defines a default commodity, it will be added to any- bare numbers entered.- * A parenthesised transaction code may be entered following a date.- * Comments and tags may be entered following a description or amount.- * If you make a mistake, enter '<' at any prompt to restart the- transaction.- * Input prompts are displayed in a different colour when the terminal- supports it.-- Example (see the tutorial for a detailed explanation):--$ hledger add-Adding transactions to journal file /src/hledger/examples/sample.journal-Any command line arguments will be used as defaults.-Use tab key to complete, readline keys to edit, enter to accept defaults.-An optional (CODE) may follow transaction dates.-An optional ; COMMENT may follow descriptions or amounts.-If you make a mistake, enter < at any prompt to restart the transaction.-To end a transaction, enter . when prompted.-To quit, enter . at a date prompt or press control-d or control-c.-Date [2015/05/22]: -Description: supermarket-Account 1: expenses:food-Amount 1: $10-Account 2: assets:checking-Amount 2 [$-10.0]: -Account 3 (or . or enter to finish this transaction): .-2015/05/22 supermarket- expenses:food $10- assets:checking $-10.0--Save this transaction to the journal ? [y]: -Saved.-Starting the next transaction (. or ctrl-D/ctrl-C to quit)-Date [2015/05/22]: <CTRL-D> $---File: hledger.info, Node: balance, Next: balancesheet, Prev: add, Up: COMMANDS--4.4 balance-===========--balance, bal, b-Show accounts and their balances.-- The balance command is hledger's most versatile command. Note,-despite the name, it is not always used for showing real-world account-balances; the more accounting-aware balancesheet and incomestatement may-be more convenient for that.-- By default, it displays all accounts, and each account's change in-balance during the entire period of the journal. Balance changes are-calculated by adding up the postings in each account. You can limit the-postings matched, by a query, to see fewer accounts, changes over a-different time period, changes from only cleared transactions, etc.-- If you include an account's complete history of postings in the-report, the balance change is equivalent to the account's current ending-balance. For a real-world account, typically you won't have all-transactions in the journal; instead you'll have all transactions after-a certain date, and an "opening balances" transaction setting the-correct starting balance on that date. Then the balance command will-show real-world account balances. In some cases the -H/-historical flag-is used to ensure this (more below).-- The balance command can produce several styles of report:-* Menu:--* Classic balance report::-* Customising the classic balance report::-* Colour support::-* Flat mode::-* Depth limited balance reports::-* Multicolumn balance report::-* Budget report::-* Output format::---File: hledger.info, Node: Classic balance report, Next: Customising the classic balance report, Up: balance--4.4.1 Classic balance report-------------------------------This is the original balance report, as found in Ledger. It usually-looks like this:--$ hledger balance- $-1 assets- $1 bank:saving- $-2 cash- $2 expenses- $1 food- $1 supplies- $-2 income- $-1 gifts- $-1 salary- $1 liabilities:debts---------------------- 0-- By default, accounts are displayed hierarchically, with subaccounts-indented below their parent. At each level of the tree, accounts are-sorted by account code if any, then by account name. Or with-'-S/--sort-amount', by their balance amount.-- "Boring" accounts, which contain a single interesting subaccount and-no balance of their own, are elided into the following line for more-compact output. (Eg above, the "liabilities" account.) Use-'--no-elide' to prevent this.-- Account balances are "inclusive" - they include the balances of any-subaccounts.-- Accounts which have zero balance (and no non-zero subaccounts) are-omitted. Use '-E/--empty' to show them.-- A final total is displayed by default; use '-N/--no-total' to-suppress it, eg:--$ hledger balance -p 2008/6 expenses --no-total- $2 expenses- $1 food- $1 supplies---File: hledger.info, Node: Customising the classic balance report, Next: Colour support, Prev: Classic balance report, Up: balance--4.4.2 Customising the classic balance report-----------------------------------------------You can customise the layout of classic balance reports with '--format-FMT':--$ hledger balance --format "%20(account) %12(total)"- assets $-1- bank:saving $1- cash $-2- expenses $2- food $1- supplies $1- income $-2- gifts $-1- salary $-1- liabilities:debts $1----------------------------------- 0-- The FMT format string (plus a newline) specifies the formatting-applied to each account/balance pair. It may contain any suitable text,-with data fields interpolated like so:-- '%[MIN][.MAX](FIELDNAME)'-- * MIN pads with spaces to at least this width (optional)- * MAX truncates at this width (optional)- * FIELDNAME must be enclosed in parentheses, and can be one of:-- * 'depth_spacer' - a number of spaces equal to the account's- depth, or if MIN is specified, MIN * depth spaces.- * 'account' - the account's name- * 'total' - the account's balance/posted total, right justified-- Also, FMT can begin with an optional prefix to control how-multi-commodity amounts are rendered:-- * '%_' - render on multiple lines, bottom-aligned (the default)- * '%^' - render on multiple lines, top-aligned- * '%,' - render on one line, comma-separated-- There are some quirks. Eg in one-line mode, '%(depth_spacer)' has no-effect, instead '%(account)' has indentation built in. Experimentation-may be needed to get pleasing results.-- Some example formats:-- * '%(total)' - the account's total- * '%-20.20(account)' - the account's name, left justified, padded to- 20 characters and clipped at 20 characters- * '%,%-50(account) %25(total)' - account name padded to 50- characters, total padded to 20 characters, with multiple- commodities rendered on one line- * '%20(total) %2(depth_spacer)%-(account)' - the default format for- the single-column balance report---File: hledger.info, Node: Colour support, Next: Flat mode, Prev: Customising the classic balance report, Up: balance--4.4.3 Colour support-----------------------The balance command shows negative amounts in red, if:-- * the 'TERM' environment variable is not set to 'dumb'- * the output is not being redirected or piped anywhere---File: hledger.info, Node: Flat mode, Next: Depth limited balance reports, Prev: Colour support, Up: balance--4.4.4 Flat mode------------------To see a flat list instead of the default hierarchical display, use-'--flat'. In this mode, accounts (unless depth-clipped) show their full-names and "exclusive" balance, excluding any subaccount balances. In-this mode, you can also use '--drop N' to omit the first few account-name components.--$ hledger balance -p 2008/6 expenses -N --flat --drop 1- $1 food- $1 supplies---File: hledger.info, Node: Depth limited balance reports, Next: Multicolumn balance report, Prev: Flat mode, Up: balance--4.4.5 Depth limited balance reports--------------------------------------With '--depth N' or 'depth:N' or just '-N', balance reports show-accounts only to the specified numeric depth. This is very useful to-summarise a complex set of accounts and get an overview.--$ hledger balance -N -1- $-1 assets- $2 expenses- $-2 income- $1 liabilities-- Flat-mode balance reports, which normally show exclusive balances,-show inclusive balances at the depth limit.---File: hledger.info, Node: Multicolumn balance report, Next: Budget report, Prev: Depth limited balance reports, Up: balance--4.4.6 Multicolumn balance report-----------------------------------Multicolumn or tabular balance reports are a very useful hledger-feature, and usually the preferred style. They share many of the above-features, but they show the report as a table, with columns representing-time periods. This mode is activated by providing a reporting interval.-- There are three types of multicolumn balance report, showing-different information:-- 1. By default: each column shows the sum of postings in that period,- ie the account's change of balance in that period. This is useful- eg for a monthly income statement:-- $ hledger balance --quarterly income expenses -E- Balance changes in 2008:- - || 2008q1 2008q2 2008q3 2008q4 - ===================++=================================- expenses:food || 0 $1 0 0 - expenses:supplies || 0 $1 0 0 - income:gifts || 0 $-1 0 0 - income:salary || $-1 0 0 0 - -------------------++---------------------------------- || $-1 $1 0 0 -- 2. With '--cumulative': each column shows the ending balance for that- period, accumulating the changes across periods, starting from 0 at- the report start date:-- $ hledger balance --quarterly income expenses -E --cumulative- Ending balances (cumulative) in 2008:- - || 2008/03/31 2008/06/30 2008/09/30 2008/12/31 - ===================++=================================================- expenses:food || 0 $1 $1 $1 - expenses:supplies || 0 $1 $1 $1 - income:gifts || 0 $-1 $-1 $-1 - income:salary || $-1 $-1 $-1 $-1 - -------------------++-------------------------------------------------- || $-1 0 0 0 -- 3. With '--historical/-H': each column shows the actual historical- ending balance for that period, accumulating the changes across- periods, starting from the actual balance at the report start date.- This is useful eg for a multi-period balance sheet, and when you- are showing only the data after a certain start date:-- $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1- Ending balances (historical) in 2008/04/01-2008/12/31:- - || 2008/06/30 2008/09/30 2008/12/31 - ======================++=====================================- assets:bank:checking || $1 $1 0 - assets:bank:saving || $1 $1 $1 - assets:cash || $-2 $-2 $-2 - liabilities:debts || 0 0 $1 - ----------------------++-------------------------------------- || 0 0 0 -- Multicolumn balance reports display accounts in flat mode by default;-to see the hierarchy, use '--tree'.-- With a reporting interval (like '--quarterly' above), the report-start/end dates will be adjusted if necessary so that they encompass the-displayed report periods. This is so that the first and last periods-will be "full" and comparable to the others.-- The '-E/--empty' flag does two things in multicolumn balance reports:-first, the report will show all columns within the specified report-period (without -E, leading and trailing columns with all zeroes are not-shown). Second, all accounts which existed at the report start date-will be considered, not just the ones with activity during the report-period (use -E to include low-activity accounts which would otherwise-would be omitted).-- The '-T/--row-total' flag adds an additional column showing the total-for each row.-- The '-A/--average' flag adds a column showing the average value in-each row.-- Here's an example of all three:--$ hledger balance -Q income expenses --tree -ETA-Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4 Total Average -============++===================================================- expenses || 0 $2 0 0 $2 $1 - food || 0 $1 0 0 $1 0 - supplies || 0 $1 0 0 $1 0 - income || $-1 $-1 0 0 $-2 $-1 - gifts || 0 $-1 0 0 $-1 0 - salary || $-1 0 0 0 $-1 0 -------------++---------------------------------------------------- || $-1 $1 0 0 0 0 --# Average is rounded to the dollar here since all journal amounts are-- Limitations:-- In multicolumn reports the '-V/--value' flag uses the market price on-the report end date, for all columns (not the price on each column's end-date).-- Eliding of boring parent accounts in tree mode, as in the classic-balance report, is not yet supported in multicolumn reports.---File: hledger.info, Node: Budget report, Next: , Prev: Multicolumn balance report, Up: balance--4.4.7 Budget report----------------------With '--budget', extra columns are displayed showing budget goals for-each account and period, if any. Budget goals are defined by periodic-transactions. This is very useful for comparing planned and actual-income, expenses, time usage, etc. -budget is most often combined with-a report interval.-- For example, you can take average monthly expenses in the common-expense categories to construct a minimal monthly budget:--;; Budget-~ monthly- income $2000- expenses:food $400- expenses:bus $50- expenses:movies $30- assets:bank:checking--;; Two months worth of expenses-2017-11-01- income $1950- expenses:food $396- expenses:bus $49- expenses:movies $30- expenses:supplies $20- assets:bank:checking--2017-12-01- income $2100- expenses:food $412- expenses:bus $53- expenses:gifts $100- assets:bank:checking-- You can now see a monthly budget report:--$ hledger balance -M --budget-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] -- Note this is different from a normal balance report in several ways:-- * Only accounts with budget goals during the report period are shown,- by default.-- * In each column, in square brackets after the actual amount,- budgeted amounts are shown, along with the percentage of budget- used.-- * All parent accounts are always shown, even in flat mode. Eg- assets, assets:bank, and expenses above.-- * Amounts always include all subaccounts, budgeted or unbudgeted,- even in flat mode.-- This means that the numbers displayed will not always add up! Eg-above, the 'expenses' actual amount includes the gifts and supplies-transactions, but the 'expenses:gifts' and 'expenses:supplies' accounts-are not 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:--$ hledger balance -M --budget --empty-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480] - expenses || $495 [ 103% of $480] $565 [ 118% of $480] - expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50] - expenses:food || $396 [ 99% of $400] $412 [ 103% of $400] - expenses:gifts || 0 $100 - expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30] - expenses:supplies || $20 0 - income || $1950 [ 98% of $2000] $2100 [ 105% of $2000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] -- You can roll over unspent budgets to next period with '--cumulative':--$ hledger balance -M --budget --cumulative-Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec -======================++====================================================- assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960] - expenses || $495 [ 103% of $480] $1060 [ 110% of $960] - expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100] - expenses:food || $396 [ 99% of $400] $808 [ 101% of $800] - expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60] - income || $1950 [ 98% of $2000] $4050 [ 101% of $4000] -----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0] -- For more examples, see Budgeting and Forecasting.-* Menu:--* Nested budgets::---File: hledger.info, Node: Nested budgets, Up: Budget report--4.4.7.1 Nested budgets-......................--You can add budgets to any account in your account hierarchy. If you-have budgets on both parent account and some of its children, then-budget(s) of the child account(s) would be added to the budget of their-parent, much like account balances behave.-- In the most simple case this means that once you add a budget to any-account, all its parents would have budget as well.-- To illustrate this, consider the following budget:--~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities-- With this, monthly budget for electronics is defined to be $100 and-budget for personal expenses is an additional $1000, which implicity-means that budget for both 'expenses:personal' and 'expenses' is $1100.-- Transactions in 'expenses:personal:electronics' will be counted both-towards its $100 budget and $1100 of 'expenses:personal' , and-transactions in any other subaccount of 'expenses:personal' would be-counted towards only towards the budget of 'expenses:personal'.-- For example, let's consider these transactions:--~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities--2019/01/01 Google home hub- expenses:personal:electronics $90.00- liabilities $-90.00--2019/01/02 Phone screen protector- expenses:personal:electronics:upgrades $10.00- liabilities--2019/01/02 Weekly train ticket- expenses:personal:train tickets $153.00- liabilities--2019/01/03 Flowers- expenses:personal $30.00- liabilities-- 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:--$ hledger balance --budget -M-Budget performance in 2019/01:-- || Jan -===============================++===============================- expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - liabilities || $-283.00 [ 26% of $-1100.00] --------------------------------++-------------------------------- || 0 [ 0] -- And with '--empty', we can get a better picture of budget allocation-and consumption:--$ hledger balance --budget -M --empty-Budget performance in 2019/01:-- || Jan -========================================++===============================- expenses || $283.00 [ 26% of $1100.00] - expenses:personal || $283.00 [ 26% of $1100.00] - expenses:personal:electronics || $100.00 [ 100% of $100.00] - expenses:personal:electronics:upgrades || $10.00 - expenses:personal:train tickets || $153.00 - liabilities || $-283.00 [ 26% of $-1100.00] -----------------------------------------++-------------------------------- || 0 [ 0] --4.4.8 Output format----------------------The balance command supports output destination and output format-selection.---File: hledger.info, Node: balancesheet, Next: balancesheetequity, Prev: balance, Up: COMMANDS--4.5 balancesheet-================--balancesheet, bs-This command displays a simple balance sheet, showing historical ending-balances of asset and liability accounts (ignoring any report begin-date). It assumes that these accounts are under a top-level 'asset' or-'liability' account (case insensitive, plural forms also allowed).-- Note this report shows all account balances with normal positive sign-(like conventional financial statements, unlike balance/print/register)-(experimental).-- Example:--$ hledger balancesheet-Balance Sheet--Assets:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1--Liabilities:- $1 liabilities:debts---------------------- $1--Total:---------------------- 0-- With a reporting interval, multiple columns will be shown, one for-each report period. As with multicolumn balance reports, you can alter-the report mode with '--change'/'--cumulative'/'--historical'. Normally-balancesheet shows historical ending balances, which is what you need-for a balance sheet; note this means it ignores report begin dates.-- This command also supports output destination and output format-selection.---File: hledger.info, Node: balancesheetequity, Next: cashflow, Prev: balancesheet, Up: COMMANDS--4.6 balancesheetequity-======================--balancesheetequity, bse-Just like balancesheet, but also reports Equity (which it assumes is-under a top-level 'equity' account).-- Example:--$ hledger balancesheetequity-Balance Sheet With Equity--Assets:- $-2 assets- $1 bank:saving- $-3 cash---------------------- $-2--Liabilities:- $1 liabilities:debts---------------------- $1--Equity:- $1 equity:owner---------------------- $1--Total:---------------------- 0---File: hledger.info, Node: cashflow, Next: check-dates, Prev: balancesheetequity, Up: COMMANDS--4.7 cashflow-============--cashflow, cf-This command displays a simple cashflow statement, showing changes in-"cash" accounts. It assumes that these accounts are under a top-level-'asset' account (case insensitive, plural forms also allowed) and do not-contain 'receivable' or 'A/R' in their name. Note this report shows all-account balances with normal positive sign (like conventional financial-statements, unlike balance/print/register) (experimental).-- Example:--$ hledger cashflow-Cashflow Statement--Cash flows:- $-1 assets- $1 bank:saving- $-2 cash---------------------- $-1--Total:---------------------- $-1-- With a reporting interval, multiple columns will be shown, one for-each report period. Normally cashflow shows changes in assets per-period, though as with multicolumn balance reports you can alter the-report mode with '--change'/'--cumulative'/'--historical'.-- This command also supports output destination and output format-selection.---File: hledger.info, Node: check-dates, Next: check-dupes, Prev: cashflow, Up: COMMANDS--4.8 check-dates-===============--check-dates-Check that transactions are sorted by increasing date. With -date2,-checks secondary dates instead. With -strict, dates must also be-unique. With a query, only matched transactions' dates are checked.-Reads the default journal file, or another specified with -f.---File: hledger.info, Node: check-dupes, Next: close, Prev: check-dates, Up: COMMANDS--4.9 check-dupes-===============--check-dupes-Reports account names having the same leaf but different prefixes. In-other words, two or more leaves that are categorized differently. Reads-the default journal file, or another specified as an argument.-- An example: http://stefanorodighiero.net/software/hledger-dupes.html---File: hledger.info, Node: close, Next: files, Prev: check-dupes, Up: COMMANDS--4.10 close-==========--close, equity-Prints a "closing balances" transaction and an "opening balances"-transaction that bring account balances to and from zero, respectively.-Useful for bringing asset/liability balances forward into a new journal-file, or for closing out revenues/expenses to retained earnings at the-end of a period.-- The closing transaction transfers balances to "equity:closing-balances". The opening transaction transfers balances from-"equity:opening balances". You can chose to print just one of the-transactions by using the '--opening' or '--closing' flag.-- If you split your journal files by time (eg yearly), you will-typically run this command at the end of the year, and save the closing-transaction as last entry of the old file, and the opening transaction-as the first entry of the new file. This makes the files self-contained, so that correct balances are reported no matter which of them-are loaded. Ie, if you load just one file, the balances are initialised-correctly; or if you load several files, the redundant closing/opening-transactions cancel each other out. (They will show up in print or-register reports; you can exclude them with a query like-'not:desc:'(opening|closing) balances''.)-- If you're running a business, you might also use this command to-"close the books" at the end of an accounting period, transferring-income statement account balances to retained earnings. (You may want-to change the equity account name to something like "equity:retained-earnings".)-- By default, the closing transaction is dated yesterday, the balances-are calculated as of end of yesterday, and the opening transaction is-dated today. To close on some other date, use: 'hledger close -e-OPENINGDATE'. Eg, to close/open on the 2018/2019 boundary, use '-e-2019'. You can also use -p or 'date:PERIOD' (any starting date is-ignored).-- Both transactions will include balance assertions for the-closed/reopened accounts. You probably shouldn't use status or realness-filters (like -C or -R or 'status:') with this command, or the generated-balance assertions will depend on these flags. Likewise, if you run-this command with -auto, the balance assertions will probably always-require -auto.-- Examples:-- Carrying asset/liability balances into a new file for 2019, all from-command line:-- _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-$ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal-- Now:--$ 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:--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:--; in 2018.journal:-2018/12/30 a purchase made in 2018, clearing the following year- expenses:food 5- liabilities:pending--; in 2019.journal:-2019/1/2 clearance of last year's pending transactions- liabilities:pending 5 = 0- assets:checking---File: hledger.info, Node: files, Next: help, Prev: close, Up: COMMANDS--4.11 files-==========--files-List all files included in the journal. With a REGEX argument, only-file names matching the regular expression (case sensitive) are shown.---File: hledger.info, Node: help, Next: import, Prev: files, Up: COMMANDS--4.12 help-=========--help-Show any of the hledger manuals.-- The 'help' command displays any of the main hledger manuals, in one-of several ways. Run it with no argument to list the manuals, or-provide a full or partial manual name to select one.-- hledger manuals are available in several formats. hledger help will-use the first of these display methods that it finds: info, man, $PAGER,-less, stdout (or when non-interactive, just stdout). You can force a-particular viewer with the '--info', '--man', '--pager', '--cat' flags.-- Examples:--$ hledger help-Please choose a manual by typing "hledger help MANUAL" (a substring is ok).-Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot--$ hledger help h --man--hledger(1) hledger User Manuals hledger(1)--NAME- hledger - a command-line accounting tool--SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [ARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]- hledger--DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any-...---File: hledger.info, Node: import, Next: incomestatement, Prev: help, Up: COMMANDS--4.13 import-===========--import-Read new transactions added to each FILE since last run, and add them to-the main journal file. Or with -dry-run, just print the transactions-that would be added.-- The input files are specified as arguments - no need to write -f-before each one. So eg to add new transactions from all CSV files to-the main journal, it's just: 'hledger import *.csv'-- New transactions are detected in the same way as print -new: by-assuming transactions are always added to the input files in increasing-date order, and by saving '.latest.FILE' state files.-- The -dry-run output is in journal format, so you can filter it, eg to-see only uncategorised transactions:--$ hledger import --dry ... | hledger -f- print unknown --ignore-assertions---File: hledger.info, Node: incomestatement, Next: prices, Prev: import, Up: COMMANDS--4.14 incomestatement-====================--incomestatement, is-This command displays a simple income statement, showing revenues and-expenses during a period. It assumes that these accounts are under a-top-level 'revenue' or 'income' or 'expense' account (case insensitive,-plural forms also allowed). Note this report shows all account balances-with normal positive sign (like conventional financial statements,-unlike balance/print/register) (experimental).-- This command displays a simple income statement. It currently-assumes that you have top-level accounts named 'income' (or 'revenue')-and 'expense' (plural forms also allowed.)--$ hledger incomestatement-Income Statement--Revenues:- $-2 income- $-1 gifts- $-1 salary---------------------- $-2--Expenses:- $2 expenses- $1 food- $1 supplies---------------------- $2--Total:---------------------- 0-- With a reporting interval, multiple columns will be shown, one for-each report period. Normally incomestatement shows revenues/expenses-per period, though as with multicolumn balance reports you can alter the-report mode with '--change'/'--cumulative'/'--historical'.-- This command also supports output destination and output format-selection.---File: hledger.info, Node: prices, Next: print, Prev: incomestatement, Up: COMMANDS--4.15 prices-===========--prices-Print market price directives from the journal. With -costs, also print-synthetic market prices based on transaction prices. With--inverted-costs, also print inverse prices based on transaction prices.-Prices (and postings providing prices) can be filtered by a query.---File: hledger.info, Node: print, Next: print-unique, Prev: prices, Up: COMMANDS--4.16 print-==========--print, txns, p-Show transaction journal entries, sorted by date.-- The print command displays full journal entries (transactions) from-the journal file in date order, tidily formatted. With -date2,-transactions are sorted by secondary date instead.-- print's output is always a valid hledger journal.-It preserves all transaction information, but it does not preserve-directives or inter-transaction comments--$ hledger print-2008/01/01 income- assets:bank:checking $1- income:salary $-1--2008/06/01 gift- assets:bank:checking $1- income:gifts $-1--2008/06/02 save- assets:bank:saving $1- assets:bank:checking $-1--2008/06/03 * eat & shop- expenses:food $1- expenses:supplies $1- assets:cash $-2--2008/12/31 * pay off- liabilities:debts $1- assets:bank:checking $-1-- Normally, the journal entry's explicit or implicit amount style is-preserved. Ie when an amount is omitted in the journal, it will be-omitted in the output. You can use the '-x'/'--explicit' flag to make-all amounts explicit, which can be useful for troubleshooting or for-making your journal more readable and robust against data entry errors.-Note, '-x' will cause postings with a multi-commodity amount (these can-arise when a multi-commodity transaction has an implicit amount) will be-split into multiple single-commodity postings, for valid journal output.-- With '-B'/'--cost', amounts with transaction prices are converted to-cost using that price. This can be used for troubleshooting.-- With '-m'/'--match' and a STR argument, print will show at most one-transaction: the one one whose description is most similar to STR, and-is most recent. STR should contain at least two characters. If there-is no similar-enough match, no transaction will be shown.-- With '--new', for each FILE being read, hledger reads (and writes) a-special state file ('.latest.FILE' in the same directory), containing-the latest transaction date(s) that were seen last time FILE was read.-When this file is found, only transactions 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:--$ hledger -f bank1.csv print --new-# shows transactions added since last print --new on this file-- This assumes that transactions added to FILE always have same or-increasing dates, and that transactions on the same day do not get-reordered. See also the import command.-- This command also supports output destination and output format-selection. Here's an example of print's CSV output:--$ hledger print -Ocsv-"txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"-"1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""-"1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""-"2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""-"2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""-"3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""-"3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""-"4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""-"4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""-"4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""-"5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""-"5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""-- * There is one CSV record per posting, with the parent transaction's- fields repeated.- * The "txnidx" (transaction index) field shows which postings belong- to the same transaction. (This number might change if transactions- are reordered within the file, files are parsed/included in a- different order, etc.)- * The amount is separated into "commodity" (the symbol) and "amount"- (numeric quantity) fields.- * The numeric amount is repeated in either the "credit" or "debit"- column, for convenience. (Those names are not accurate in the- accounting sense; it just puts negative amounts under credit and- zero or greater amounts under debit.)---File: hledger.info, Node: print-unique, Next: register, Prev: print, Up: COMMANDS--4.17 print-unique-=================--print-unique-Print transactions which do not reuse an already-seen description.-- Example:--$ cat unique.journal-1/1 test- (acct:one) 1-2/2 test- (acct:two) 2-$ LEDGER_FILE=unique.journal hledger print-unique-(-f option not supported)-2015/01/01 test- (acct:one) 1---File: hledger.info, Node: register, Next: register-match, Prev: print-unique, Up: COMMANDS--4.18 register-=============--register, reg, r-Show postings and their running total.-- The register command displays postings in date order, one per line,-and their running total. This is typically used with a query selecting-a particular account, to see that account's activity:--$ hledger register checking-2008/01/01 income assets:bank:checking $1 $1-2008/06/01 gift assets:bank:checking $1 $2-2008/06/02 save assets:bank:checking $-1 $1-2008/12/31 pay off assets:bank:checking $-1 0-- With -date2, it shows and sorts by secondary date instead.-- The '--historical'/'-H' flag adds the balance from any undisplayed-prior postings to the running total. This is useful when you want to-see only recent activity, with a historically accurate running balance:--$ hledger register checking -b 2008/6 --historical-2008/06/01 gift assets:bank:checking $1 $2-2008/06/02 save assets:bank:checking $-1 $1-2008/12/31 pay off assets:bank:checking $-1 0-- The '--depth' option limits the amount of sub-account detail-displayed.-- The '--average'/'-A' flag shows the running average posting amount-instead of the running total (so, the final number displayed is the-average for the whole report period). This flag implies '--empty' (see-below). It is affected by '--historical'. It works best when showing-just one account and one commodity.-- The '--related'/'-r' flag shows the _other_ postings in the-transactions of the postings which would normally be shown.-- The '--invert' flag negates all amounts. For example, it can be used-on an income account where amounts are normally displayed as negative-numbers. It's also useful to show postings on the checking account-together with the related account:--$ hledger register --related --invert assets:checking-- With a reporting interval, register shows summary postings, one per-interval, aggregating the postings to each account:--$ hledger register --monthly income-2008/01 income:salary $-1 $-1-2008/06 income:gifts $-1 $-2-- Periods with no activity, and summary postings with a zero amount,-are not shown by default; use the '--empty'/'-E' flag to see them:--$ hledger register --monthly income -E-2008/01 income:salary $-1 $-1-2008/02 0 $-1-2008/03 0 $-1-2008/04 0 $-1-2008/05 0 $-1-2008/06 income:gifts $-1 $-2-2008/07 0 $-2-2008/08 0 $-2-2008/09 0 $-2-2008/10 0 $-2-2008/11 0 $-2-2008/12 0 $-2-- Often, you'll want to see just one line per interval. The '--depth'-option helps with this, causing subaccounts to be aggregated:--$ hledger register --monthly assets --depth 1h-2008/01 assets $1 $1-2008/06 assets $-1 0-2008/12 assets $-1 $-1-- Note when using report intervals, if you specify start/end dates-these will be adjusted outward if necessary to contain a whole number of-intervals. This ensures that the first and last intervals are full-length and comparable to the others in the report.-* Menu:--* Custom register output::---File: hledger.info, Node: Custom register output, Up: register--4.18.1 Custom register output--------------------------------register uses the full terminal width by default, except on windows.-You can override this by setting the 'COLUMNS' environment variable (not-a bash shell variable) or by using the '--width'/'-w' option.-- The description and account columns normally share the space equally-(about half of (width - 40) each). You can adjust this by adding a-description width as part of -width's argument, comma-separated:-'--width W,D' . Here's a diagram (won't display correctly in -help):--<--------------------------------- width (W) ---------------------------------->-date (10) description (D) account (W-41-D) amount (12) balance (12)-DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA-- and some examples:--$ hledger reg # use terminal width (or 80 on windows)-$ hledger reg -w 100 # use width 100-$ COLUMNS=100 hledger reg # set with one-time environment variable-$ export COLUMNS=100; hledger reg # set till session end (or window resize)-$ hledger reg -w 100,40 # set overall width 100, description width 40-$ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40-- This command also supports output destination and output format-selection.---File: hledger.info, Node: register-match, Next: rewrite, Prev: register, Up: COMMANDS--4.19 register-match-===================--register-match-Print the one posting whose transaction description is closest to DESC,-in the style of the register command. If there are multiple equally-good matches, it shows the most recent. Query options (options, not-arguments) can be used to restrict the search space. Helps-ledger-autosync detect already-seen transactions when importing.---File: hledger.info, Node: rewrite, Next: roi, Prev: register-match, Up: COMMANDS--4.20 rewrite-============--rewrite-Print all transactions, rewriting the postings of matched transactions.-For now the only rewrite available is adding new postings, like print--auto.-- This is a start at a generic rewriter of transaction entries. It-reads the default journal and prints the transactions, like print, 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-- rewrites.hledger may consist of entries like:--= ^income amt:<0 date:2017- (liabilities:tax) *0.33 ; tax on income- (reserve:grocery) *0.25 ; reserve 25% for grocery- (reserve:) *0.25 ; reserve 25% for grocery-- Note the single quotes to protect the dollar sign from bash, and the-two spaces between account and amount.-- More:--$ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...-$ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'-$ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'-$ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'-- Argument for '--add-posting' option is a usual posting of transaction-with an exception for amount specification. More precisely, you can use-''*'' (star symbol) before the amount to indicate that that this is a-factor for an amount of original matched posting. If the amount-includes a commodity name, the new posting amount will be in the new-commodity; otherwise, it will be in the matched posting amount's-commodity.--* Menu:--* Re-write rules in a file::---File: hledger.info, Node: Re-write rules in a file, Up: rewrite--4.20.1 Re-write rules in a file----------------------------------During the run this tool will execute so called "Automated Transactions"-found in any journal it process. I.e instead of specifying this-operations in command line you can put them in a journal file.--$ rewrite-rules.journal-- Make contents look like this:--= ^income- (liabilities:tax) *.33--= expenses:gifts- budget:gifts *-1- assets:budget *1-- Note that ''='' (equality symbol) that is used instead of date in-transactions you usually write. It indicates the query by which you-want to match the posting to add new ones.--$ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal-- This is something similar to the commands pipeline:--$ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \- | hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \- --add-posting 'assets:budget *1' \- > rewritten-tidy-output.journal-- It is important to understand that relative order of such entries in-journal is important. You can re-use result of previously added-postings.--* Menu:--* Diff output format::-* rewrite vs print --auto::---File: hledger.info, Node: Diff output format, Next: rewrite vs print --auto, Up: Re-write rules in a file--4.20.1.1 Diff output format-...........................--To use this tool for batch modification of your journal files you may-find useful output in form of unified diff.--$ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33'-- Output might look like:----- /tmp/examples/sample.journal-+++ /tmp/examples/sample.journal-@@ -18,3 +18,4 @@- 2008/01/01 income-- assets:bank:checking $1-+ assets:bank:checking $1- income:salary-+ (liabilities:tax) 0-@@ -22,3 +23,4 @@- 2008/06/01 gift-- assets:bank:checking $1-+ assets:bank:checking $1- income:gifts-+ (liabilities:tax) 0-- If you'll pass this through 'patch' tool you'll get transactions-containing the posting that matches your query be updated. Note that-multiple files might be update according to list of input files-specified via '--file' options and 'include' directives inside of these-files.-- Be careful. Whole transaction being re-formatted in a style of-output from 'hledger print'.-- See also:-- https://github.com/simonmichael/hledger/issues/99---File: hledger.info, Node: rewrite vs print --auto, Prev: Diff output format, Up: Re-write rules in a file--4.20.1.2 rewrite vs. print -auto-................................--This command predates print -auto, and currently does much the same-thing, but with these differences:-- * with multiple files, rewrite lets rules in any file affect all- other files. print -auto uses standard directive scoping; rules- affect only child files.-- * rewrite's query limits which transactions can be rewritten; all are- printed. print -auto's query limits which transactions are- printed.-- * rewrite applies rules specified on command line or in the journal.- print -auto applies rules specified in the journal.---File: hledger.info, Node: roi, Next: stats, Prev: rewrite, Up: COMMANDS--4.21 roi-========--roi-Shows the time-weighted (TWR) and money-weighted (IRR) rate of return on-your investments.-- This command assumes that you have account(s) that hold nothing but-your investments and whenever you record current appraisal/valuation of-these investments you offset unrealized profit and loss into account(s)-that, again, hold nothing but unrealized profit and loss.-- Any transactions affecting balance of investment account(s) and not-originating from unrealized profit and loss account(s) are assumed to be-your investments or withdrawals.-- At a minimum, you need to supply a query (which could be just an-account name) to select your investments with '--inv', and another query-to identify your profit and loss transactions with '--pnl'.-- It will compute and display the internalized rate of return (IRR) and-time-weighted rate of return (TWR) for your investments for the time-period requested. Both rates of return are annualized before display,-regardless of the length of reporting interval.---File: hledger.info, Node: stats, Next: tags, Prev: roi, Up: COMMANDS--4.22 stats-==========--stats-Show some journal statistics.-- The stats command displays summary information for the whole journal,-or a matched part of it. With a reporting interval, it shows a report-for each report period.-- Example:--$ hledger stats-Main journal file : /src/hledger/examples/sample.journal-Included journal files : -Transactions span : 2008-01-01 to 2009-01-01 (366 days)-Last transaction : 2008-12-31 (2333 days ago)-Transactions : 5 (0.0 per day)-Transactions last 30 days: 0 (0.0 per day)-Transactions last 7 days : 0 (0.0 per day)-Payees/descriptions : 5-Accounts : 8 (depth 3)-Commodities : 1 ($)-- This command also supports output destination and output format-selection.---File: hledger.info, Node: tags, Next: test, Prev: stats, Up: COMMANDS--4.23 tags-=========--tags-List all the tag names used in the journal. With a TAGREGEX argument,-only tag names matching the regular expression (case insensitive) are-shown. With QUERY arguments, only transactions matching the query are-considered.---File: hledger.info, Node: test, Prev: tags, Up: COMMANDS--4.24 test-=========--test-Run built-in unit tests.-- This command runs the unit tests built in to hledger-lib and hledger,-printing test names and results on stdout. If any test fails, the exit-code will be non-zero.-- Test names include a group prefix. If a (exact, case sensitive)-group prefix, or a full test name is provided as the first argument,-only that group or test is run.-- If a numeric second argument is provided, it will set the randomness-seed, for repeatable results from tests using randomness (currently none-of them).-- This is mainly used by developers, but it's nice to be able to-sanity-check your installed hledger executable at any time. All tests-are expected to pass - if you ever see otherwise, something has gone-wrong, please report a bug!---File: hledger.info, Node: ADD-ON COMMANDS, Prev: COMMANDS, Up: Top--5 ADD-ON COMMANDS-*****************--hledger also searches for external add-on commands, and will include-these in the commands list. These are programs or scripts in your PATH-whose name starts with 'hledger-' and ends with a recognised file-extension (currently: no extension, 'bat','com','exe',-'hs','lhs','pl','py','rb','rkt','sh').-- Add-ons can be invoked like any hledger command, but there are a few-things to be aware of. Eg if the 'hledger-web' add-on is installed,-- * 'hledger -h web' shows hledger's help, while 'hledger web -h' shows- hledger-web's help.-- * Flags specific to the add-on must have a preceding '--' to hide- them from hledger. So 'hledger web --serve --port 9000' will be- rejected; you must use 'hledger web -- --serve --port 9000'.-- * You can always run add-ons directly if preferred: 'hledger-web- --serve --port 9000'.-- Add-ons are a relatively easy way to add local features or experiment-with new ideas. They can be written in any language, but haskell-scripts have a big advantage: they can use the same hledger (and-haskell) library functions that built-in commands do, for command-line-options, journal parsing, reporting, etc.-- Here are some hledger add-ons available:-* Menu:--* Official add-ons::-* Third party add-ons::-* Experimental add-ons::---File: hledger.info, Node: Official add-ons, Next: Third party add-ons, Up: ADD-ON COMMANDS--5.1 Official add-ons-====================--These are maintained and released along with hledger.-* Menu:--* api::-* ui::-* web::---File: hledger.info, Node: api, Next: ui, Up: Official add-ons--5.1.1 api------------hledger-api serves hledger data as a JSON web API.---File: hledger.info, Node: ui, Next: web, Prev: api, Up: Official add-ons--5.1.2 ui-----------hledger-ui provides an efficient curses-style interface.---File: hledger.info, Node: web, Prev: ui, Up: Official add-ons--5.1.3 web------------hledger-web provides a simple web interface.---File: hledger.info, Node: Third party add-ons, Next: Experimental add-ons, Prev: Official add-ons, Up: ADD-ON COMMANDS--5.2 Third party add-ons-=======================--These are maintained separately, and usually updated shortly after a-hledger release.-* Menu:--* diff::-* iadd::-* interest::-* irr::---File: hledger.info, Node: diff, Next: iadd, Up: Third party add-ons--5.2.1 diff-------------hledger-diff shows differences in an account's transactions between one-journal file and another.---File: hledger.info, Node: iadd, Next: interest, Prev: diff, Up: Third party add-ons--5.2.2 iadd-------------hledger-iadd is a curses-style, more interactive replacement for the add-command.---File: hledger.info, Node: interest, Next: irr, Prev: iadd, Up: Third party add-ons--5.2.3 interest-----------------hledger-interest generates interest transactions for an account-according to various schemes.---File: hledger.info, Node: irr, Prev: interest, Up: Third party add-ons--5.2.4 irr------------hledger-irr calculates the internal rate of return of an investment-account, but it's superseded now by the built-in roi command.---File: hledger.info, Node: Experimental add-ons, Prev: Third party add-ons, Up: ADD-ON COMMANDS--5.3 Experimental add-ons-========================--These are available in source form in the hledger repo's bin/ directory;-installing them is pretty easy. They may be less mature and documented-than built-in commands. Reading and tweaking these is a good way to-start making your own!-* Menu:--* autosync::-* chart::-* check::---File: hledger.info, Node: autosync, Next: chart, Up: Experimental add-ons--5.3.1 autosync-----------------hledger-autosync is a symbolic link for easily running ledger-autosync,-if installed. ledger-autosync does deduplicating conversion of OFX data-and some CSV formats, and can also download the data if your bank offers-OFX Direct Connect.---File: hledger.info, Node: chart, Next: check, Prev: autosync, Up: Experimental add-ons--5.3.2 chart--------------hledger-chart.hs is an old pie chart generator, in need of some love.---File: hledger.info, Node: check, Prev: chart, Up: Experimental add-ons--5.3.3 check--------------hledger-check.hs checks more powerful account balance assertions.---Tag Table:-Node: Top68-Node: EXAMPLES1884-Ref: #examples1984-Node: OPTIONS3630-Ref: #options3732-Node: General options4167-Ref: #general-options4292-Node: Command options6974-Ref: #command-options7125-Node: Command arguments7523-Ref: #command-arguments7677-Node: Argument files7798-Ref: #argument-files7974-Node: Special characters in arguments and queries8240-Ref: #special-characters-in-arguments-and-queries8474-Node: More escaping8924-Ref: #more-escaping9086-Node: Even more escaping9382-Ref: #even-more-escaping9576-Node: Less escaping10247-Ref: #less-escaping10409-Node: Command line tips10654-Ref: #command-line-tips10840-Node: Unicode characters11217-Ref: #unicode-characters11373-Node: Input files12098-Ref: #input-files12234-Node: Smart dates14204-Ref: #smart-dates14345-Node: Report start & end date15751-Ref: #report-start-end-date15923-Node: Report intervals16989-Ref: #report-intervals17154-Node: Period expressions17555-Ref: #period-expressions17715-Node: Depth limiting21672-Ref: #depth-limiting21816-Node: Pivoting22158-Ref: #pivoting22276-Node: Cost23952-Ref: #cost24060-Node: Market value24178-Ref: #market-value24313-Node: Combining -B and -V25679-Ref: #combining--b-and--v25842-Node: Output destination25989-Ref: #output-destination26151-Node: Output format26434-Ref: #output-format26586-Node: Regular expressions26971-Ref: #regular-expressions27108-Node: QUERIES28469-Ref: #queries28571-Node: COMMANDS32533-Ref: #commands32645-Node: accounts33645-Ref: #accounts33743-Node: activity34442-Ref: #activity34552-Node: add34935-Ref: #add35034-Node: balance37621-Ref: #balance37732-Node: Classic balance report39173-Ref: #classic-balance-report39346-Node: Customising the classic balance report40715-Ref: #customising-the-classic-balance-report40943-Node: Colour support43017-Ref: #colour-support43184-Node: Flat mode43357-Ref: #flat-mode43505-Node: Depth limited balance reports43918-Ref: #depth-limited-balance-reports44118-Node: Multicolumn balance report44574-Ref: #multicolumn-balance-report44772-Node: Budget report49952-Ref: #budget-report50095-Node: Nested budgets55296-Ref: #nested-budgets55408-Ref: #output-format-158888-Node: balancesheet58966-Ref: #balancesheet59102-Node: balancesheetequity60336-Ref: #balancesheetequity60485-Node: cashflow61046-Ref: #cashflow61174-Node: check-dates62202-Ref: #check-dates62329-Node: check-dupes62608-Ref: #check-dupes62732-Node: close63025-Ref: #close63133-Node: files66546-Ref: #files66647-Node: help66794-Ref: #help66894-Node: import67987-Ref: #import68101-Node: incomestatement68845-Ref: #incomestatement68979-Node: prices70315-Ref: #prices70430-Node: print70709-Ref: #print70819-Node: print-unique75312-Ref: #print-unique75438-Node: register75723-Ref: #register75850-Node: Custom register output80021-Ref: #custom-register-output80150-Node: register-match81412-Ref: #register-match81546-Node: rewrite81897-Ref: #rewrite82012-Node: Re-write rules in a file83861-Ref: #re-write-rules-in-a-file83995-Node: Diff output format85205-Ref: #diff-output-format85374-Node: rewrite vs print --auto86466-Ref: #rewrite-vs.-print---auto86645-Node: roi87201-Ref: #roi87299-Node: stats88311-Ref: #stats88410-Node: tags89164-Ref: #tags89262-Node: test89492-Ref: #test89576-Node: ADD-ON COMMANDS90337-Ref: #add-on-commands90447-Node: Official add-ons91734-Ref: #official-add-ons91874-Node: api91961-Ref: #api92050-Node: ui92102-Ref: #ui92201-Node: web92259-Ref: #web92348-Node: Third party add-ons92394-Ref: #third-party-add-ons92569-Node: diff92704-Ref: #diff92801-Node: iadd92900-Ref: #iadd93014-Node: interest93097-Ref: #interest93218-Node: irr93313-Ref: #irr93411-Node: Experimental add-ons93542-Ref: #experimental-add-ons93694-Node: autosync93974-Ref: #autosync94085-Node: chart94324-Ref: #chart94443-Node: check94514-Ref: #check94616--End Tag Table
− hledger.txt
@@ -1,2421 +0,0 @@--hledger(1) hledger User Manuals hledger(1)----NAME- hledger - a command-line accounting tool--SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [ARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]- hledger--DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any- other commodity, using double-entry accounting and a simple, editable- file format. hledger is inspired by and largely compatible with- ledger(1).- Tested on unix, mac, windows, hledger aims to be a reliable, practical- tool for daily use.-- This is hledger's command-line interface (there are also curses and web- interfaces). Its basic function is to read a plain text file describ-- ing financial transactions (in accounting terms, a general journal) and- print useful reports on standard output, or export them as CSV.- hledger can also read some other file formats such as CSV files, trans-- lating them to journal format. Additionally, hledger lists other- hledger-* executables found in the user's $PATH and can invoke them as- subcommands.-- hledger reads data from one or more files in hledger journal, time-- clock, timedot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal). If using $LEDGER_FILE, note this must- be a real environment variable, not a shell variable. You can specify- standard input with -f-.-- Transactions are dated movements of money between two (or more) named- accounts, and are recorded with journal entries like this:-- 2015/10/16 bought food- expenses:food $10- assets:cash-- For more about this format, see hledger_journal(5).-- Most users use a text editor to edit the journal, usually with an edi-- tor mode such as ledger-mode for added convenience. hledger's interac-- tive add command is another way to record new transactions. hledger- never changes existing transactions.-- To get started, you can either save some entries like the above in- ~/.hledger.journal, or run hledger add and follow the prompts. Then- try some commands like hledger print or hledger balance. Run hledger- with no arguments for a list of commands.--EXAMPLES- Two simple transactions in hledger journal format:-- 2015/9/30 gift received- assets:cash $20- income:gifts-- 2015/10/16 farmers market- expenses:food $10- assets:cash-- Some basic reports:-- $ hledger print- 2015/09/30 gift received- assets:cash $20- income:gifts $-20-- 2015/10/16 farmers market- expenses:food $10- assets:cash $-10-- $ hledger accounts --tree- assets- cash- expenses- food- income- gifts-- $ hledger balance- $10 assets:cash- $10 expenses:food- $-20 income:gifts- --------------------- 0-- $ hledger register cash- 2015/09/30 gift received assets:cash $20 $20- 2015/10/16 farmers market assets:cash $-10 $10-- More commands:-- $ hledger # show available commands- $ hledger add # add more transactions to the journal file- $ hledger balance # all accounts with aggregated balances- $ hledger balance --help # show detailed help for balance command- $ hledger balance --depth 1 # only top-level accounts- $ hledger register # show account postings, with running total- $ hledger reg income # show postings to/from income accounts- $ hledger reg 'assets:some bank:checking' # show postings to/from this checking account- $ hledger print desc:shop # show transactions with shop in the description- $ hledger activity -W # show transaction counts per week as a bar chart--OPTIONS- General options- To see general usage help, including general options which are sup-- ported by most hledger commands, run hledger -h.-- General help options:-- -h --help- show general usage (or after COMMAND, command usage)-- --version- show version-- --debug[=N]- show debug output (levels 1-9, default: 1)-- General input options:-- -f FILE --file=FILE- use a different input file. For stdin, use - (default:- $LEDGER_FILE or $HOME/.hledger.journal)-- --rules-file=RULESFILE- Conversion rules file to use when reading CSV (default:- FILE.rules)-- --separator=CHAR- Field separator to expect when reading CSV (default: ',')-- --alias=OLD=NEW- rename accounts named OLD to NEW-- --anon anonymize accounts and payees-- --pivot FIELDNAME- use some other field or tag for the account name-- -I --ignore-assertions- ignore any failing balance assertions-- General reporting options:-- -b --begin=DATE- include postings/txns on or after this date-- -e --end=DATE- include postings/txns before this date-- -D --daily- multiperiod/multicolumn report by day-- -W --weekly- multiperiod/multicolumn report by week-- -M --monthly- multiperiod/multicolumn report by month-- -Q --quarterly- multiperiod/multicolumn report by quarter-- -Y --yearly- multiperiod/multicolumn report by year-- -p --period=PERIODEXP- set start date, end date, and/or reporting interval all at once- using period expressions syntax (overrides the flags above)-- --date2- match the secondary date instead (see command help for other- effects)-- -U --unmarked- include only unmarked postings/txns (can combine with -P or -C)-- -P --pending- include only pending postings/txns-- -C --cleared- include only cleared postings/txns-- -R --real- include only non-virtual postings-- -NUM --depth=NUM- hide/aggregate accounts or postings more than NUM levels deep-- -E --empty- show items with zero amount, normally hidden (and vice-versa in- hledger-ui/hledger-web)-- -B --cost- convert amounts to their cost at transaction time (using the- transaction price, if any)-- -V --value- convert amounts to their market value on the report end date- (using the most recent applicable market price, if any)-- --auto apply automated posting rules to modify transactions.-- --forecast- apply periodic transaction rules to generate future transac-- tions, to 6 months from now or report end date.-- When a reporting option appears more than once in the command line, the- last one takes precedence.-- Some reporting options can also be written as query arguments.-- Command options- To see options for a particular command, including command-specific- options, run: hledger COMMAND -h.-- Command-specific options must be written after the command name, eg:- hledger print -x.-- Additionally, if the command is an addon, you may need to put its- options after a double-hyphen, eg: hledger ui -- --watch. Or, you can- run the addon executable directly: hledger-ui --watch.-- Command arguments- Most hledger commands accept arguments after the command name, which- are often a query, filtering the data in some way.-- Argument files- You can save a set of command line options/arguments in a file, one per- line, and then reuse them by writing @FILENAME in a command line. To- prevent this expansion of @-arguments, precede them with a -- argument.- For more, see Save frequently used options.-- Special characters in arguments and queries- In shell command lines, option and argument values which contain "prob-- lematic" characters, ie spaces, and also characters significant to your- shell such as <, >, (, ), | and $, should be escaped by enclosing them- in quotes or by writing backslashes before the characters. Eg:-- hledger register -p 'last year' "accounts receivable (receiv-- able|payable)" amt:\>100.-- More escaping- Characters significant both to the shell and in regular expressions may- need one extra level of escaping. These include parentheses, the pipe- symbol and the dollar sign. Eg, to match the dollar symbol, bash users- should do:-- hledger balance cur:'\$'-- or:-- hledger balance cur:\\$-- Even more escaping- When hledger runs an addon executable (eg you type hledger ui, hledger- runs hledger-ui), it de-escapes command-line options and arguments- once, so you might need to triple-escape. Eg in bash, running the ui- command and matching the dollar sign, it's:-- hledger ui cur:'\\$'-- or:-- hledger ui cur:\\\\$-- If you asked why four slashes above, this may help:--- unescaped: $- escaped: \$- double-escaped: \\$- triple-escaped: \\\\$-- (The number of backslashes in fish shell is left as an exercise for the- reader.)-- You can always avoid the extra escaping for addons by running the addon- directly:-- hledger-ui cur:\\$-- Less escaping- Inside an argument file, or in the search field of hledger-ui or- hledger-web, or at a GHCI prompt, you need one less level of escaping- than at the command line. And backslashes may work better than quotes.- Eg:-- ghci> :main balance cur:\$-- Command line tips- If in doubt, keep things simple:-- o write options after the command (hledger CMD -OPTIONS ARGS)-- o run add-on executables directly (hledger-ui -OPTIONS ARGS)-- o enclose problematic args in single quotes-- o if needed, also add a backslash to escape regexp metacharacters-- To find out exactly how a command line is being parsed, add --debug=2- to troubleshoot.-- Unicode characters- hledger is expected to handle unicode (non-ascii) characters, but this- requires a well-configured environment.-- To handle unicode characters in the command line or input data, a sys-- tem locale that can decode them must be configured (POSIX's default C- locale will not work). Eg in bash, you could do:-- export LANG=en_US.UTF-8-- See Troubleshooting for more about this.-- Unicode characters should appear correctly in hledger's output. For- the hledger and hledger-ui tools, this requires that-- o your terminal supports unicode-- o the terminal's font includes the required unicode glyphs-- o the terminal is configured to display "wide" characters as double- width (otherwise report alignment will be off)-- Input files- 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:-- $ setenv LEDGER_FILE ~/finance/2016.journal- $ hledger stats-- or with the -f/--file option:-- $ hledger -f /some/file stats-- The file name - (hyphen) means standard input:-- $ cat some.journal | hledger -f--- Usually the data file is in hledger's journal format, but it can also- be one of several other formats, listed below. hledger detects the- format automatically based on the file extension, or if that is not- recognised, by trying each built-in "reader" in turn:--- Reader: Reads: Used for file extensions:- ------------------------------------------------------------------------------ journal hledger's journal format, also .journal .j .hledger- some Ledger journals .ledger- timeclock timeclock files (precise time .timeclock- logging)- timedot timedot files (approximate time .timedot- logging)- csv comma-separated values (data .csv- interchange)-- If needed (eg to ensure correct error messages when a file has the- "wrong" extension), you can force a specific reader/format by prepend-- ing it to the file path with a colon. Examples:-- $ hledger -f csv:/some/csv-file.dat stats- $ echo 'i 2009/13/1 08:00:00' | hledger print -ftimeclock:--- You can also specify multiple -f options, to read multiple files as one- big journal. There are some limitations with this:-- o directives in one file will not affect the other files-- o balance assertions will not see any account balances from previous- files-- If you need those, either use the include directive, or concatenate the- files, eg: cat a.journal b.journal | hledger -f- CMD.-- Smart dates- hledger's user interfaces accept a flexible "smart date" syntax (unlike- dates in the journal file). Smart dates allow some english words, can- be relative to today's date, and can have less-significant date parts- omitted (defaulting to 1).-- Examples:--- 2004/10/1, 2004-01-01, exact date, several sepa-- 2004.9.1 rators allowed. Year is- 4+ digits, month is 1-12,- day is 1-31- 2004 start of year-- 2004/10 start of month- 10/1 month and day in current- year- 21 day in current month- october, oct start of month in current- year- yesterday, today, tomorrow -1, 0, 1 days from today- last/this/next day/week/month/quar- -1, 0, 1 periods from the- ter/year current period- 20181201 8 digit YYYYMMDD with- valid year month and day- 201812 6 digit YYYYMM with valid- year and month-- Counterexamples - malformed digit sequences might give surprising- results:--- 201813 6 digits with an invalid- month is parsed as start- of 6-digit year- 20181301 8 digits with an invalid- month is parsed as start- of 8-digit year- 20181232 8 digits with an invalid- day gives an error- 201801012 9+ digits beginning with a- valid YYYYMMDD gives an- error-- Report start & end date- Most hledger reports show the full span of time represented by the- journal data, by default. So, the effective report start and end dates- will be the earliest and latest transaction or posting dates found in- the journal.-- Often you will want to see a shorter time span, such as the current- month. You can specify a start and/or end date using -b/--begin,- -e/--end, -p/--period or a date: query (described below). All of these- accept the smart date syntax. One important thing to be aware of when- specifying end dates: as in Ledger, end dates are exclusive, so you- need to write the date after the last day you want to include.-- Examples:--- -b 2016/3/17 begin on St. Patrick's- day 2016- -e 12/1 end at the start of decem-- ber 1st of the current- year (11/30 will be the- last date included)- -b thismonth all transactions on or- after the 1st of the cur-- rent month- -p thismonth all transactions in the- current month- date:2016/3/17- the above written as- queries instead- date:-12/1- date:thismonth-- date:thismonth-- Report intervals- A report interval can be specified so that commands like register, bal-- ance and activity will divide their reports into multiple subperiods.- The basic intervals can be selected with one of -D/--daily,- -W/--weekly, -M/--monthly, -Q/--quarterly, or -Y/--yearly. More com-- plex intervals may be specified with a period expression. Report- intervals can not be specified with a query, currently.-- Period expressions- The -p/--period option accepts period expressions, a shorthand way of- expressing a start date, end date, and/or report interval all at once.-- Here's a basic period expression specifying the first quarter of 2009.- Note, hledger always treats start dates as inclusive and end dates as- exclusive:-- -p "from 2009/1/1 to 2009/4/1"-- Keywords like "from" and "to" are optional, and so are the spaces, as- long as you don't run two dates together. "to" can also be written as- "-". These are equivalent to the above:--- -p "2009/1/1 2009/4/1"- -p2009/1/1to2009/4/1- -p2009/1/1-2009/4/1-- Dates are smart dates, so if the current year is 2009, the above can- also be written as:--- -p "1/1 4/1"- -p "january-apr"- -p "this year to 4/1"-- If you specify only one date, the missing start or end date will be the- earliest or latest transaction in your journal:--- -p "from 2009/1/1" everything after january- 1, 2009- -p "from 2009/1" the same- -p "from 2009" the same- -p "to 2009" everything before january- 1, 2009-- A single date with no "from" or "to" defines both the start and end- date like so:--- -p "2009" the year 2009; equivalent- to "2009/1/1 to 2010/1/1"- -p "2009/1" the month of jan; equiva-- lent to "2009/1/1 to- 2009/2/1"- -p "2009/1/1" just that day; equivalent- to "2009/1/1 to 2009/1/2"-- The argument of -p can also begin with, or be, a report interval- expression. The basic report intervals are daily, weekly, monthly,- quarterly, or yearly, which have the same effect as the -D,-W,-M,-Q, or- -Y flags. Between report interval and start/end dates (if any), the- word in is optional. Examples:--- -p "weekly from 2009/1/1 to 2009/4/1"- -p "monthly in 2008"- -p "quarterly"-- Note that weekly, monthly, quarterly and yearly intervals will always- start on the first day on week, month, quarter or year accordingly, and- will end on the last day of same period, even if associated period- expression specifies different explicit start and end date.-- For example:--- -p "weekly from 2009/1/1 to 2009/4/1"- -- starts on 2008/12/29, closest pre-- ceeding Monday- -p "monthly in 2008/11/25" -- starts on- 2018/11/01- -p "quar-- terly from 2009-05-05 to 2009-06-01" -- starts on 2009/04/01, ends on- 2009/06/30, which are first and last- days of Q2 2009- -p "yearly from 2009-12-29" - starts on- 2009/01/01, first day of 2009-- The following more complex report intervals are also supported:- biweekly, bimonthly, every day|week|month|quarter|year,- every N days|weeks|months|quarters|years.-- All of these will start on the first day of the requested period and- end on the last one, as described above.-- Examples:--- -p "bimonthly from 2008" -- periods- will have boundaries on 2008/01/01,- 2008/03/01, ...- -p "every 2 weeks" -- starts on closest- preceeding Monday- -p "every 5 month from 2009/03" --- periods will have boundaries on- 2009/03/01, 2009/08/01, ...-- If you want intervals that start on arbitrary day of your choosing and- span a week, month or year, you need to use any of the following:-- every Nth day of week, every <weekday>, every Nth day [of month],- every Nth weekday [of month], every MM/DD [of year],- every Nth MMM [of year], every MMM Nth [of year].-- Examples:--- -p "every 2nd day of week" -- periods- will go from Tue to Tue- -p "every Tue" -- same- -p "every 15th day" -- period bound-- aries will be on 15th of each month- -p "every 2nd Monday" -- period bound-- aries will be on second Monday of each- month- -p "every 11/05" -- yearly periods with- boundaries on 5th of Nov- -p "every 5th Nov" -- same- -p "every Nov 5th" -- same-- Show historical balances at end of 15th each month (N is exclusive end- date):-- hledger balance -H -p "every 16th day"-- Group postings from start of wednesday to end of next tuesday (N is- start date and exclusive end date):-- hledger register checking -p "every 3rd day of week"-- Depth limiting- With the --depth N option (short form: -N), commands like account, bal-- ance and register will show only the uppermost accounts in the account- tree, down to level N. Use this when you want a summary with less- detail. This flag has the same effect as a depth: query argument (so- -2, --depth=2 or depth:2 are basically equivalent).-- Pivoting- Normally hledger sums amounts, and organizes them in a hierarchy, based- on account name. The --pivot FIELD option causes it to sum and orga-- nize hierarchy based on the value of some other field instead. FIELD- can be: code, description, payee, note, or the full name (case insensi-- tive) of any tag. As with account names, values containing colon:sepa-- rated:parts will be displayed hierarchically in reports.-- --pivot is a general option affecting all reports; you can think of- hledger transforming the journal before any other processing, replacing- every posting's account name with the value of the specified field on- that posting, inheriting it from the transaction or using a blank value- if it's not present.-- An example:-- 2016/02/16 Member Fee Payment- assets:bank account 2 EUR- income:member fees -2 EUR ; member: John Doe-- Normal balance report showing account names:-- $ hledger balance- 2 EUR assets:bank account- -2 EUR income:member fees- --------------------- 0-- Pivoted balance report, using member: tag values instead:-- $ hledger balance --pivot member- 2 EUR- -2 EUR John Doe- --------------------- 0-- One way to show only amounts with a member: value (using a query,- described below):-- $ hledger balance --pivot member tag:member=.- -2 EUR John Doe- --------------------- -2 EUR-- Another way (the acct: query matches against the pivoted "account- name"):-- $ hledger balance --pivot member acct:.- -2 EUR John Doe- --------------------- -2 EUR-- Cost- The -B/--cost flag converts amounts to their cost at transaction time,- if they have a transaction price specified.-- Market value- The -V/--value flag converts reported amounts to their current market- value.- Specifically, when there is a market price (P directive) for the- amount's commodity, dated on or before today's date (or the report end- date if specified), the amount will be converted to the price's commod-- ity.-- When there are multiple applicable P directives, -V chooses the most- recent one, or in case of equal dates, the last-parsed one.-- For example:-- # one euro is worth this many dollars from nov 1- P 2016/11/01 $1.10-- # purchase some euros on nov 3- 2016/11/3- assets:euros 100- assets:checking-- # the euro is worth fewer dollars by dec 21- P 2016/12/21 $1.03-- How many euros do I have ?-- $ hledger -f t.j bal -N euros- 100 assets:euros-- What are they worth at end of nov 3 ?-- $ 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)-- $ hledger -f t.j bal -N euros -V- $103.00 assets:euros-- Currently, hledger's -V only uses market prices recorded with P direc-- tives, not transaction prices (unlike Ledger).-- Currently, -V has a limitation in multicolumn balance reports: it uses- the market prices on the report end date for all columns. (Instead of- the prices on each column's end date.)-- Combining -B and -V- Using -B/--cost and -V/--value together is currently allowed, but the- results are probably not meaningful. Let us know if you find a use for- this.-- Output destination- Some commands (print, register, stats, the balance commands) can write- their output to a destination other than the console. This is con-- trolled by the -o/--output-file option.-- $ hledger balance -o - # write to stdout (the default)- $ hledger balance -o FILE # write to FILE-- Output format- Some commands can write their output in other formats. Eg print and- register can output CSV, and the balance commands can output CSV or- HTML. This is controlled by the -O/--output-format option, or by spec-- ifying a .csv or .html file extension with -o/--output-file.-- $ hledger balance -O csv # write CSV to stdout- $ hledger balance -o FILE.csv # write CSV to FILE.csv-- Regular expressions- hledger uses regular expressions in a number of places:-- o query terms, on the command line and in the hledger-web search form:- REGEX, desc:REGEX, cur:REGEX, tag:...=REGEX-- o CSV rules conditional blocks: if REGEX ...-- o account alias directives and options: alias /REGEX/ = REPLACEMENT,- --alias /REGEX/=REPLACEMENT-- hledger's regular expressions come from the regex-tdfa library. In- general they:-- o are case insensitive-- o are infix matching (do not need to match the entire thing being- matched)-- o are POSIX extended regular expressions-- o also support GNU word boundaries (\<, \>, \b, \B)-- o and parenthesised capturing groups and numeric backreferences in- replacement strings-- o do not support mode modifiers like (?s)-- Some things to note:-- o In the alias directive and --alias option, regular expressions must- be enclosed in forward slashes (/REGEX/). Elsewhere in hledger,- these are not required.-- o In queries, to match a regular expression metacharacter like $ as a- literal character, prepend a backslash. Eg to search for amounts- with the dollar sign in hledger-web, write cur:\$.-- o On the command line, some metacharacters like $ have a special mean-- ing to the shell and so must be escaped at least once more. See Spe-- cial characters.--QUERIES- One of hledger's strengths is being able to quickly report on precise- subsets of your data. Most commands accept an optional query expres-- sion, written as arguments after the command name, to filter the data- by date, account name or other criteria. The syntax is similar to a- web search: one or more space-separated search terms, quotes to enclose- whitespace, prefixes to match specific fields, a not: prefix to negate- the match.-- We do not yet support arbitrary boolean combinations of search terms;- instead most commands show transactions/postings/accounts which match- (or negatively match):-- o any of the description terms AND-- o any of the account terms AND-- o any of the status terms AND-- o all the other terms.-- The print command instead shows transactions which:-- o match any of the description terms AND-- o have any postings matching any of the positive account terms AND-- o have no postings matching any of the negative account terms AND-- o match all the other terms.-- The following kinds of search terms can be used. Remember these can- also be prefixed with not:, eg to exclude a particular subaccount.-- REGEX, acct:REGEX- match account names by this regular expression. (With no pre-- fix, acct: is assumed.)- same as above-- amt:N, amt:<N, amt:<=N, amt:>N, amt:>=N- match postings with a single-commodity amount that is equal to,- less than, or greater than N. (Multi-commodity amounts are not- tested, and will always match.) The comparison has two modes: if- N is preceded by a + or - sign (or is 0), the two signed numbers- are compared. Otherwise, the absolute magnitudes are compared,- ignoring sign.-- code:REGEX- match by transaction code (eg check number)-- cur:REGEX- match postings or transactions including any amounts whose cur-- rency/commodity symbol is fully matched by REGEX. (For a par-- tial match, use .*REGEX.*). Note, to match characters which are- regex-significant, like the dollar sign ($), you need to prepend- \. And when using the command line you need to add one more- level of quoting to hide it from the shell, so eg do:- hledger print cur:'\$' or hledger print cur:\\$.-- desc:REGEX- match transaction descriptions.-- date:PERIODEXPR- match dates within the specified period. PERIODEXPR is a period- expression (with no report interval). Examples: date:2016,- date:thismonth, date:2000/2/1-2/15, date:lastweek-. If the- --date2 command line flag is present, this matches secondary- dates instead.-- date2:PERIODEXPR- match secondary dates within the specified period.-- depth:N- match (or display, depending on command) accounts at or above- this depth-- note:REGEX- match transaction notes (part of description right of |, or- whole description when there's no |)-- payee:REGEX- match transaction payee/payer names (part of description left of- |, or whole description when there's no |)-- real:, real:0- match real or virtual postings respectively-- status:, status:!, status:*- match unmarked, pending, or cleared transactions respectively-- tag:REGEX[=REGEX]- match by tag name, and optionally also by tag value. Note a- tag: query is considered to match a transaction if it matches- any of the postings. Also remember that postings inherit the- tags of their parent transaction.-- The following special search term is used automatically in hledger-web,- only:-- inacct:ACCTNAME- tells hledger-web to show the transaction register for this- account. Can be filtered further with acct etc.-- Some of these can also be expressed as command-line options (eg depth:2- is equivalent to --depth 2). Generally you can mix options and query- arguments, and the resulting query will be their intersection (perhaps- excluding the -p/--period option).--COMMANDS- hledger provides a number of subcommands; hledger with no arguments- shows a list.-- If you install additional hledger-* packages, or if you put programs or- scripts named hledger-NAME in your PATH, these will also be listed as- subcommands.-- Run a subcommand by writing its name as first argument (eg- hledger incomestatement). You can also write one of the standard short- aliases displayed in parentheses in the command list (hledger b), or- any any unambiguous prefix of a command name (hledger inc).-- Here are all the builtin commands in alphabetical order. See also- hledger for a more organised command list, and hledger CMD -h for- detailed command help.-- accounts- accounts, a- Show account names.-- This command lists account names, either declared with account direc-- tives (--declared), posted to (--used), or both (the default). With- query arguments, only matched account names and account names refer-- enced by matched postings are shown. It shows a flat list by default.- With --tree, it uses indentation to show the account hierarchy. In- flat mode you can add --drop N to omit the first few account name com-- ponents. Account names can be depth-clipped with depth:N or --depth N- or -N.-- Examples:-- $ hledger accounts- assets:bank:checking- assets:bank:saving- assets:cash- expenses:food- expenses:supplies- income:gifts- income:salary- liabilities:debts-- activity- activity- Show an ascii barchart of posting counts per interval.-- The activity command displays an ascii histogram showing transaction- counts by day, week, month or other reporting interval (by day is the- default). With query arguments, it counts only matched transactions.-- Examples:-- $ hledger activity --quarterly- 2008-01-01 **- 2008-04-01 *******- 2008-07-01- 2008-10-01 **-- add- add- Prompt for transactions and add them to the journal.-- Many hledger users edit their journals directly with a text editor, or- generate them from CSV. For more interactive data entry, there is the- add command, which prompts interactively on the console for new trans-- actions, and appends them to the journal file (if there are multiple- -f FILE options, the first file is used.) Existing transactions are not- changed. This is the only hledger command that writes to the journal- file.-- To use it, just run hledger add and follow the prompts. You can add as- many transactions as you like; when you are finished, enter . or press- control-d or control-c to exit.-- Features:-- o add tries to provide useful defaults, using the most similar (by- description) recent transaction (filtered by the query, if any) as a- template.-- o You can also set the initial defaults with command line arguments.-- o Readline-style edit keys can be used during data entry.-- o The tab key will auto-complete whenever possible - accounts, descrip-- tions, dates (yesterday, today, tomorrow). If the input area is- empty, it will insert the default value.-- o If the journal defines a default commodity, it will be added to any- bare numbers entered.-- o A parenthesised transaction code may be entered following a date.-- o Comments and tags may be entered following a description or amount.-- o If you make a mistake, enter < at any prompt to restart the transac-- tion.-- o Input prompts are displayed in a different colour when the terminal- supports it.-- Example (see the tutorial for a detailed explanation):-- $ hledger add- Adding transactions to journal file /src/hledger/examples/sample.journal- Any command line arguments will be used as defaults.- Use tab key to complete, readline keys to edit, enter to accept defaults.- An optional (CODE) may follow transaction dates.- An optional ; COMMENT may follow descriptions or amounts.- If you make a mistake, enter < at any prompt to restart the transaction.- To end a transaction, enter . when prompted.- To quit, enter . at a date prompt or press control-d or control-c.- Date [2015/05/22]:- Description: supermarket- Account 1: expenses:food- Amount 1: $10- Account 2: assets:checking- Amount 2 [$-10.0]:- Account 3 (or . or enter to finish this transaction): .- 2015/05/22 supermarket- expenses:food $10- assets:checking $-10.0-- Save this transaction to the journal ? [y]:- Saved.- Starting the next transaction (. or ctrl-D/ctrl-C to quit)- Date [2015/05/22]: <CTRL-D> $-- balance- balance, bal, b- Show accounts and their balances.-- The balance command is hledger's most versatile command. Note, despite- the name, it is not always used for showing real-world account bal-- ances; the more accounting-aware balancesheet and incomestatement may- be more convenient for that.-- By default, it displays all accounts, and each account's change in bal-- ance during the entire period of the journal. Balance changes are cal-- culated by adding up the postings in each account. You can limit the- postings matched, by a query, to see fewer accounts, changes over a- different time period, changes from only cleared transactions, etc.-- If you include an account's complete history of postings in the report,- the balance change is equivalent to the account's current ending bal-- ance. For a real-world account, typically you won't have all transac-- tions in the journal; instead you'll have all transactions after a cer-- tain date, and an "opening balances" transaction setting the correct- starting balance on that date. Then the balance command will show- real-world account balances. In some cases the -H/--historical flag is- used to ensure this (more below).-- The balance command can produce several styles of report:-- Classic balance report- This is the original balance report, as found in Ledger. It usually- looks like this:-- $ hledger balance- $-1 assets- $1 bank:saving- $-2 cash- $2 expenses- $1 food- $1 supplies- $-2 income- $-1 gifts- $-1 salary- $1 liabilities:debts- --------------------- 0-- By default, accounts are displayed hierarchically, with subaccounts- indented below their parent. At each level of the tree, accounts are- sorted by account code if any, then by account name. Or with- -S/--sort-amount, by their balance amount.-- "Boring" accounts, which contain a single interesting subaccount and no- balance of their own, are elided into the following line for more com-- pact output. (Eg above, the "liabilities" account.) Use --no-elide to- prevent this.-- Account balances are "inclusive" - they include the balances of any- subaccounts.-- Accounts which have zero balance (and no non-zero subaccounts) are- omitted. Use -E/--empty to show them.-- A final total is displayed by default; use -N/--no-total to suppress- it, eg:-- $ hledger balance -p 2008/6 expenses --no-total- $2 expenses- $1 food- $1 supplies-- Customising the classic balance report- You can customise the layout of classic balance reports with --for-- mat FMT:-- $ hledger balance --format "%20(account) %12(total)"- assets $-1- bank:saving $1- cash $-2- expenses $2- food $1- supplies $1- income $-2- gifts $-1- salary $-1- liabilities:debts $1- ---------------------------------- 0-- The FMT format string (plus a newline) specifies the formatting applied- to each account/balance pair. It may contain any suitable text, with- data fields interpolated like so:-- %[MIN][.MAX](FIELDNAME)-- o MIN pads with spaces to at least this width (optional)-- o MAX truncates at this width (optional)-- o FIELDNAME must be enclosed in parentheses, and can be one of:-- o depth_spacer - a number of spaces equal to the account's depth, or- if MIN is specified, MIN * depth spaces.-- o account - the account's name-- o total - the account's balance/posted total, right justified-- Also, FMT can begin with an optional prefix to control how multi-com-- modity amounts are rendered:-- o %_ - render on multiple lines, bottom-aligned (the default)-- o %^ - render on multiple lines, top-aligned-- o %, - render on one line, comma-separated-- There are some quirks. Eg in one-line mode, %(depth_spacer) has no- effect, instead %(account) has indentation built in.- Experimentation may be needed to get pleasing results.-- Some example formats:-- o %(total) - the account's total-- o %-20.20(account) - the account's name, left justified, padded to 20- characters and clipped at 20 characters-- o %,%-50(account) %25(total) - account name padded to 50 characters,- total padded to 20 characters, with multiple commodities rendered on- one line-- o %20(total) %2(depth_spacer)%-(account) - the default format for the- single-column balance report-- Colour support- The balance command shows negative amounts in red, if:-- o the TERM environment variable is not set to dumb-- o the output is not being redirected or piped anywhere-- Flat mode- To see a flat list instead of the default hierarchical display, use- --flat. In this mode, accounts (unless depth-clipped) show their full- names and "exclusive" balance, excluding any subaccount balances. In- this mode, you can also use --drop N to omit the first few account name- components.-- $ hledger balance -p 2008/6 expenses -N --flat --drop 1- $1 food- $1 supplies-- Depth limited balance reports- With --depth N or depth:N or just -N, balance reports show accounts- only to the specified numeric depth. This is very useful to summarise- a complex set of accounts and get an overview.-- $ hledger balance -N -1- $-1 assets- $2 expenses- $-2 income- $1 liabilities-- Flat-mode balance reports, which normally show exclusive balances, show- inclusive balances at the depth limit.-- Multicolumn balance report- Multicolumn or tabular balance reports are a very useful hledger fea-- ture, and usually the preferred style. They share many of the above- features, but they show the report as a table, with columns represent-- ing time periods. This mode is activated by providing a reporting- interval.-- There are three types of multicolumn balance report, showing different- information:-- 1. By default: each column shows the sum of postings in that period, ie- the account's change of balance in that period. This is useful eg- for a monthly income statement:-- $ hledger balance --quarterly income expenses -E- Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4- ===================++=================================- expenses:food || 0 $1 0 0- expenses:supplies || 0 $1 0 0- income:gifts || 0 $-1 0 0- income:salary || $-1 0 0 0- -------------------++---------------------------------- || $-1 $1 0 0-- 2. With --cumulative: each column shows the ending balance for that- period, accumulating the changes across periods, starting from 0 at- the report start date:-- $ hledger balance --quarterly income expenses -E --cumulative- Ending balances (cumulative) in 2008:-- || 2008/03/31 2008/06/30 2008/09/30 2008/12/31- ===================++=================================================- expenses:food || 0 $1 $1 $1- expenses:supplies || 0 $1 $1 $1- income:gifts || 0 $-1 $-1 $-1- income:salary || $-1 $-1 $-1 $-1- -------------------++-------------------------------------------------- || $-1 0 0 0-- 3. With --historical/-H: each column shows the actual historical ending- balance for that period, accumulating the changes across periods,- starting from the actual balance at the report start date. This is- useful eg for a multi-period balance sheet, and when you are showing- only the data after a certain start date:-- $ hledger balance ^assets ^liabilities --quarterly --historical --begin 2008/4/1- Ending balances (historical) in 2008/04/01-2008/12/31:-- || 2008/06/30 2008/09/30 2008/12/31- ======================++=====================================- assets:bank:checking || $1 $1 0- assets:bank:saving || $1 $1 $1- assets:cash || $-2 $-2 $-2- liabilities:debts || 0 0 $1- ----------------------++-------------------------------------- || 0 0 0-- Multicolumn balance reports display accounts in flat mode by default;- to see the hierarchy, use --tree.-- With a reporting interval (like --quarterly above), the report- start/end dates will be adjusted if necessary so that they encompass- the displayed report periods. This is so that the first and last peri-- ods will be "full" and comparable to the others.-- The -E/--empty flag does two things in multicolumn balance reports:- first, the report will show all columns within the specified report- period (without -E, leading and trailing columns with all zeroes are- not shown). Second, all accounts which existed at the report start- date will be considered, not just the ones with activity during the- report period (use -E to include low-activity accounts which would oth-- erwise would be omitted).-- The -T/--row-total flag adds an additional column showing the total for- each row.-- The -A/--average flag adds a column showing the average value in each- row.-- Here's an example of all three:-- $ hledger balance -Q income expenses --tree -ETA- Balance changes in 2008:-- || 2008q1 2008q2 2008q3 2008q4 Total Average- ============++===================================================- expenses || 0 $2 0 0 $2 $1- food || 0 $1 0 0 $1 0- supplies || 0 $1 0 0 $1 0- income || $-1 $-1 0 0 $-2 $-1- gifts || 0 $-1 0 0 $-1 0- salary || $-1 0 0 0 $-1 0- ------------++---------------------------------------------------- || $-1 $1 0 0 0 0-- # Average is rounded to the dollar here since all journal amounts are-- Limitations:-- In multicolumn reports the -V/--value flag uses the market price on the- report end date, for all columns (not the price on each column's end- date).-- Eliding of boring parent accounts in tree mode, as in the classic bal-- ance report, is not yet supported in multicolumn reports.-- Budget report- With --budget, extra columns are displayed showing budget goals for- each account and period, if any. Budget goals are defined by periodic- transactions. This is very useful for comparing planned and actual- income, expenses, time usage, etc. --budget is most often combined- with a report interval.-- For example, you can take average monthly expenses in the common- expense categories to construct a minimal monthly budget:-- ;; Budget- ~ monthly- income $2000- expenses:food $400- expenses:bus $50- expenses:movies $30- assets:bank:checking-- ;; Two months worth of expenses- 2017-11-01- income $1950- expenses:food $396- expenses:bus $49- expenses:movies $30- expenses:supplies $20- assets:bank:checking-- 2017-12-01- income $2100- expenses:food $412- expenses:bus $53- expenses:gifts $100- assets:bank:checking-- You can now see a monthly budget report:-- $ hledger balance -M --budget- Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec- ======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- expenses || $495 [ 103% of $480] $565 [ 118% of $480]- expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]- expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]- expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]- income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]- ----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0]-- Note this is different from a normal balance report in several ways:-- o Only accounts with budget goals during the report period are shown,- by default.-- o In each column, in square brackets after the actual amount, budgeted- amounts are shown, along with the percentage of budget used.-- o All parent accounts are always shown, even in flat mode. Eg assets,- assets:bank, and expenses above.-- o Amounts always include all subaccounts, budgeted or unbudgeted, even- in flat mode.-- This means that the numbers displayed will not always add up! Eg above,- the expenses actual amount includes the gifts and supplies transac-- tions, but the expenses:gifts and expenses:supplies accounts are not- 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:-- $ hledger balance -M --budget --empty- Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec- ======================++====================================================- assets || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- assets:bank:checking || $-2445 [ 99% of $-2480] $-2665 [ 107% of $-2480]- expenses || $495 [ 103% of $480] $565 [ 118% of $480]- expenses:bus || $49 [ 98% of $50] $53 [ 106% of $50]- expenses:food || $396 [ 99% of $400] $412 [ 103% of $400]- expenses:gifts || 0 $100- expenses:movies || $30 [ 100% of $30] 0 [ 0% of $30]- expenses:supplies || $20 0- income || $1950 [ 98% of $2000] $2100 [ 105% of $2000]- ----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0]-- You can roll over unspent budgets to next period with --cumulative:-- $ hledger balance -M --budget --cumulative- Budget performance in 2017/11/01-2017/12/31:-- || Nov Dec- ======================++====================================================- assets || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]- assets:bank || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]- assets:bank:checking || $-2445 [ 99% of $-2480] $-5110 [ 103% of $-4960]- expenses || $495 [ 103% of $480] $1060 [ 110% of $960]- expenses:bus || $49 [ 98% of $50] $102 [ 102% of $100]- expenses:food || $396 [ 99% of $400] $808 [ 101% of $800]- expenses:movies || $30 [ 100% of $30] $30 [ 50% of $60]- income || $1950 [ 98% of $2000] $4050 [ 101% of $4000]- ----------------------++----------------------------------------------------- || 0 [ 0] 0 [ 0]-- For more examples, see Budgeting and Forecasting.-- Nested budgets- You can add budgets to any account in your account hierarchy. If you- have budgets on both parent account and some of its children, then bud-- get(s) of the child account(s) would be added to the budget of their- parent, much like account balances behave.-- In the most simple case this means that once you add a budget to any- account, all its parents would have budget as well.-- To illustrate this, consider the following budget:-- ~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities-- With this, monthly budget for electronics is defined to be $100 and- budget for personal expenses is an additional $1000, which implicity- means that budget for both expenses:personal and expenses is $1100.-- Transactions in expenses:personal:electronics will be counted both- towards its $100 budget and $1100 of expenses:personal , and transac-- tions in any other subaccount of expenses:personal would be counted- towards only towards the budget of expenses:personal.-- For example, let's consider these transactions:-- ~ monthly from 2019/01- expenses:personal $1,000.00- expenses:personal:electronics $100.00- liabilities-- 2019/01/01 Google home hub- expenses:personal:electronics $90.00- liabilities $-90.00-- 2019/01/02 Phone screen protector- expenses:personal:electronics:upgrades $10.00- liabilities-- 2019/01/02 Weekly train ticket- expenses:personal:train tickets $153.00- liabilities-- 2019/01/03 Flowers- expenses:personal $30.00- liabilities-- As you can see, we have transactions in expenses:personal:electron-- ics:upgrades and expenses:personal:train tickets, and since both of- these accounts are without explicitly defined budget, these transac-- tions would be counted towards budgets of expenses:personal:electronics- and expenses:personal accordingly:-- $ hledger balance --budget -M- Budget performance in 2019/01:-- || Jan- ===============================++===============================- expenses || $283.00 [ 26% of $1100.00]- expenses:personal || $283.00 [ 26% of $1100.00]- expenses:personal:electronics || $100.00 [ 100% of $100.00]- liabilities || $-283.00 [ 26% of $-1100.00]- -------------------------------++-------------------------------- || 0 [ 0]-- And with --empty, we can get a better picture of budget allocation and- consumption:-- $ hledger balance --budget -M --empty- Budget performance in 2019/01:-- || Jan- ========================================++===============================- expenses || $283.00 [ 26% of $1100.00]- expenses:personal || $283.00 [ 26% of $1100.00]- expenses:personal:electronics || $100.00 [ 100% of $100.00]- expenses:personal:electronics:upgrades || $10.00- expenses:personal:train tickets || $153.00- liabilities || $-283.00 [ 26% of $-1100.00]- ----------------------------------------++-------------------------------- || 0 [ 0]-- Output format- The balance command supports output destination and output format- selection.-- balancesheet- balancesheet, bs- This command displays a simple balance sheet, showing historical ending- balances of asset and liability accounts (ignoring any report begin- date). It assumes that these accounts are under a top-level asset or- liability account (case insensitive, plural forms also allowed).-- Note this report shows all account balances with normal positive sign- (like conventional financial statements, unlike balance/print/register)- (experimental).-- Example:-- $ hledger balancesheet- Balance Sheet-- Assets:- $-1 assets- $1 bank:saving- $-2 cash- --------------------- $-1-- Liabilities:- $1 liabilities:debts- --------------------- $1-- Total:- --------------------- 0-- With a reporting interval, multiple columns will be shown, one for each- report period. As with multicolumn balance reports, you can alter the- report mode with --change/--cumulative/--historical. Normally bal-- ancesheet shows historical ending balances, which is what you need for- a balance sheet; note this means it ignores report begin dates.-- This command also supports output destination and output format selec-- tion.-- balancesheetequity- balancesheetequity, bse- Just like balancesheet, but also reports Equity (which it assumes is- under a top-level equity account).-- Example:-- $ hledger balancesheetequity- Balance Sheet With Equity-- Assets:- $-2 assets- $1 bank:saving- $-3 cash- --------------------- $-2-- Liabilities:- $1 liabilities:debts- --------------------- $1-- Equity:- $1 equity:owner- --------------------- $1-- Total:- --------------------- 0-- cashflow- cashflow, cf- This command displays a simple cashflow statement, showing changes in- "cash" accounts. It assumes that these accounts are under a top-level- asset account (case insensitive, plural forms also allowed) and do not- contain receivable or A/R in their name. Note this report shows all- account balances with normal positive sign (like conventional financial- statements, unlike balance/print/register) (experimental).-- Example:-- $ hledger cashflow- Cashflow Statement-- Cash flows:- $-1 assets- $1 bank:saving- $-2 cash- --------------------- $-1-- Total:- --------------------- $-1-- With a reporting interval, multiple columns will be shown, one for each- report period. Normally cashflow shows changes in assets per period,- though as with multicolumn balance reports you can alter the report- mode with --change/--cumulative/--historical.-- This command also supports output destination and output format selec-- tion.-- check-dates- check-dates- Check that transactions are sorted by increasing date. With --date2,- checks secondary dates instead. With --strict, dates must also be- unique. With a query, only matched transactions' dates are checked.- Reads the default journal file, or another specified with -f.-- check-dupes- check-dupes- Reports account names having the same leaf but different prefixes. In- other words, two or more leaves that are categorized differently.- Reads the default journal file, or another specified as an argument.-- An example: http://stefanorodighiero.net/software/hledger-dupes.html-- close- close, equity- Prints a "closing balances" transaction and an "opening balances"- transaction that bring account balances to and from zero, respectively.- Useful for bringing asset/liability balances forward into a new journal- file, or for closing out revenues/expenses to retained earnings at the- end of a period.-- The closing transaction transfers balances to "equity:closing bal-- ances". The opening transaction transfers balances from "equity:open-- ing balances". You can chose to print just one of the transactions by- using the --opening or --closing flag.-- If you split your journal files by time (eg yearly), you will typically- run this command at the end of the year, and save the closing transac-- tion as last entry of the old file, and the opening transaction as the- first entry of the new file. This makes the files self contained, so- that correct balances are reported no matter which of them are loaded.- Ie, if you load just one file, the balances are initialised correctly;- or if you load several files, the redundant closing/opening transac-- tions cancel each other out. (They will show up in print or register- reports; you can exclude them with a query like not:desc:'(open-- ing|closing) balances'.)-- If you're running a business, you might also use this command to "close- the books" at the end of an accounting period, transferring income- statement account balances to retained earnings. (You may want to- change the equity account name to something like "equity:retained earn-- ings".)-- By default, the closing transaction is dated yesterday, the balances- are calculated as of end of yesterday, and the opening transaction is- dated today. To close on some other date, use: hledger close -e OPEN-- INGDATE. Eg, to close/open on the 2018/2019 boundary, use -e 2019.- You can also use -p or date:PERIOD (any starting date is ignored).-- Both transactions will include balance assertions for the- closed/reopened accounts. You probably shouldn't use status or real-- ness filters (like -C or -R or status:) with this command, or the gen-- erated balance assertions will depend on these flags. Likewise, if you- run this command with --auto, the balance assertions will probably- always require --auto.-- Examples:-- Carrying asset/liability balances into a new file for 2019, all from- command line:-- 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- $ hledger close -f 2018.journal -e 2019 assets liabilities --closing >>2018.journal-- Now:-- $ 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:-- 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:-- ; in 2018.journal:- 2018/12/30 a purchase made in 2018, clearing the following year- expenses:food 5- liabilities:pending-- ; in 2019.journal:- 2019/1/2 clearance of last year's pending transactions- liabilities:pending 5 = 0- assets:checking-- files- files- List all files included in the journal. With a REGEX argument, only- file names matching the regular expression (case sensitive) are shown.-- help- help- Show any of the hledger manuals.-- The help command displays any of the main hledger manuals, in one of- several ways. Run it with no argument to list the manuals, or provide- a full or partial manual name to select one.-- hledger manuals are available in several formats. hledger help will- use the first of these display methods that it finds: info, man,- $PAGER, less, stdout (or when non-interactive, just stdout). You can- force a particular viewer with the --info, --man, --pager, --cat flags.-- Examples:-- $ hledger help- Please choose a manual by typing "hledger help MANUAL" (a substring is ok).- Manuals: hledger hledger-ui hledger-web hledger-api journal csv timeclock timedot-- $ hledger help h --man-- hledger(1) hledger User Manuals hledger(1)-- NAME- hledger - a command-line accounting tool-- SYNOPSIS- hledger [-f FILE] COMMAND [OPTIONS] [ARGS]- hledger [-f FILE] ADDONCMD -- [OPTIONS] [ARGS]- hledger-- DESCRIPTION- hledger is a cross-platform program for tracking money, time, or any- ...-- import- import- Read new transactions added to each FILE since last run, and add them- to the main journal file. Or with --dry-run, just print the transac-- tions that would be added.-- The input files are specified as arguments - no need to write -f before- each one. So eg to add new transactions from all CSV files to the main- journal, it's just: hledger import *.csv-- New transactions are detected in the same way as print --new: by assum-- ing transactions are always added to the input files in increasing date- order, and by saving .latest.FILE state files.-- The --dry-run output is in journal format, so you can filter it, eg to- see only uncategorised transactions:-- $ hledger import --dry ... | hledger -f- print unknown --ignore-assertions-- incomestatement- incomestatement, is- This command displays a simple income statement, showing revenues and- expenses during a period. It assumes that these accounts are under a- top-level revenue or income or expense account (case insensitive, plu-- ral forms also allowed). Note this report shows all account balances- with normal positive sign (like conventional financial statements,- unlike balance/print/register) (experimental).-- This command displays a simple income statement. It currently assumes- that you have top-level accounts named income (or revenue) and expense- (plural forms also allowed.)-- $ hledger incomestatement- Income Statement-- Revenues:- $-2 income- $-1 gifts- $-1 salary- --------------------- $-2-- Expenses:- $2 expenses- $1 food- $1 supplies- --------------------- $2-- Total:- --------------------- 0-- With a reporting interval, multiple columns will be shown, one for each- report period. Normally incomestatement shows revenues/expenses per- period, though as with multicolumn balance reports you can alter the- report mode with --change/--cumulative/--historical.-- This command also supports output destination and output format selec-- tion.-- prices- prices- Print market price directives from the journal. With --costs, also- print synthetic market prices based on transaction prices. With- --inverted-costs, also print inverse prices based on transaction- prices. Prices (and postings providing prices) can be filtered by a- query.-- print- print, txns, p- Show transaction journal entries, sorted by date.-- The print command displays full journal entries (transactions) from the- journal file in date order, tidily formatted. With --date2, transac-- tions are sorted by secondary date instead.-- print's output is always a valid hledger journal.- It preserves all transaction information, but it does not preserve- directives or inter-transaction comments-- $ hledger print- 2008/01/01 income- assets:bank:checking $1- income:salary $-1-- 2008/06/01 gift- assets:bank:checking $1- income:gifts $-1-- 2008/06/02 save- assets:bank:saving $1- assets:bank:checking $-1-- 2008/06/03 * eat & shop- expenses:food $1- expenses:supplies $1- assets:cash $-2-- 2008/12/31 * pay off- liabilities:debts $1- assets:bank:checking $-1-- Normally, the journal entry's explicit or implicit amount style is pre-- served. Ie when an amount is omitted in the journal, it will be omit-- ted in the output. You can use the -x/--explicit flag to make all- amounts explicit, which can be useful for troubleshooting or for making- your journal more readable and robust against data entry errors. Note,- -x will cause postings with a multi-commodity amount (these can arise- when a multi-commodity transaction has an implicit amount) will be- split into multiple single-commodity postings, for valid journal out-- put.-- With -B/--cost, amounts with transaction prices are converted to cost- using that price. This can be used for troubleshooting.-- With -m/--match and a STR argument, print will show at most one trans-- action: the one one whose description is most similar to STR, and is- most recent. STR should contain at least two characters. If there is- no similar-enough match, no transaction will be shown.-- With --new, for each FILE being read, hledger reads (and writes) a spe-- cial state file (.latest.FILE in the same directory), containing the- latest transaction date(s) that were seen last time FILE was read.- When this file is found, only transactions 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:-- $ hledger -f bank1.csv print --new- # shows transactions added since last print --new on this file-- This assumes that transactions added to FILE always have same or- increasing dates, and that transactions on the same day do not get- reordered. See also the import command.-- This command also supports output destination and output format selec-- tion. Here's an example of print's CSV output:-- $ hledger print -Ocsv- "txnidx","date","date2","status","code","description","comment","account","amount","commodity","credit","debit","posting-status","posting-comment"- "1","2008/01/01","","","","income","","assets:bank:checking","1","$","","1","",""- "1","2008/01/01","","","","income","","income:salary","-1","$","1","","",""- "2","2008/06/01","","","","gift","","assets:bank:checking","1","$","","1","",""- "2","2008/06/01","","","","gift","","income:gifts","-1","$","1","","",""- "3","2008/06/02","","","","save","","assets:bank:saving","1","$","","1","",""- "3","2008/06/02","","","","save","","assets:bank:checking","-1","$","1","","",""- "4","2008/06/03","","*","","eat & shop","","expenses:food","1","$","","1","",""- "4","2008/06/03","","*","","eat & shop","","expenses:supplies","1","$","","1","",""- "4","2008/06/03","","*","","eat & shop","","assets:cash","-2","$","2","","",""- "5","2008/12/31","","*","","pay off","","liabilities:debts","1","$","","1","",""- "5","2008/12/31","","*","","pay off","","assets:bank:checking","-1","$","1","","",""-- o There is one CSV record per posting, with the parent transaction's- fields repeated.-- o The "txnidx" (transaction index) field shows which postings belong to- the same transaction. (This number might change if transactions are- reordered within the file, files are parsed/included in a different- order, etc.)-- o The amount is separated into "commodity" (the symbol) and "amount"- (numeric quantity) fields.-- o The numeric amount is repeated in either the "credit" or "debit" col-- umn, for convenience. (Those names are not accurate in the account-- ing sense; it just puts negative amounts under credit and zero or- greater amounts under debit.)-- print-unique- print-unique- Print transactions which do not reuse an already-seen description.-- Example:-- $ cat unique.journal- 1/1 test- (acct:one) 1- 2/2 test- (acct:two) 2- $ LEDGER_FILE=unique.journal hledger print-unique- (-f option not supported)- 2015/01/01 test- (acct:one) 1-- register- register, reg, r- Show postings and their running total.-- The register command displays postings in date order, one per line, and- their running total. This is typically used with a query selecting a- particular account, to see that account's activity:-- $ hledger register checking- 2008/01/01 income assets:bank:checking $1 $1- 2008/06/01 gift assets:bank:checking $1 $2- 2008/06/02 save assets:bank:checking $-1 $1- 2008/12/31 pay off assets:bank:checking $-1 0-- With --date2, it shows and sorts by secondary date instead.-- The --historical/-H flag adds the balance from any undisplayed prior- postings to the running total. This is useful when you want to see- only recent activity, with a historically accurate running balance:-- $ hledger register checking -b 2008/6 --historical- 2008/06/01 gift assets:bank:checking $1 $2- 2008/06/02 save assets:bank:checking $-1 $1- 2008/12/31 pay off assets:bank:checking $-1 0-- The --depth option limits the amount of sub-account detail displayed.-- The --average/-A flag shows the running average posting amount instead- of the running total (so, the final number displayed is the average for- the whole report period). This flag implies --empty (see below). It- is affected by --historical. It works best when showing just one- account and one commodity.-- The --related/-r flag shows the other postings in the transactions of- the postings which would normally be shown.-- The --invert flag negates all amounts. For example, it can be used on- an income account where amounts are normally displayed as negative num-- bers. It's also useful to show postings on the checking account- together with the related account:-- $ hledger register --related --invert assets:checking-- With a reporting interval, register shows summary postings, one per- interval, aggregating the postings to each account:-- $ hledger register --monthly income- 2008/01 income:salary $-1 $-1- 2008/06 income:gifts $-1 $-2-- Periods with no activity, and summary postings with a zero amount, are- not shown by default; use the --empty/-E flag to see them:-- $ hledger register --monthly income -E- 2008/01 income:salary $-1 $-1- 2008/02 0 $-1- 2008/03 0 $-1- 2008/04 0 $-1- 2008/05 0 $-1- 2008/06 income:gifts $-1 $-2- 2008/07 0 $-2- 2008/08 0 $-2- 2008/09 0 $-2- 2008/10 0 $-2- 2008/11 0 $-2- 2008/12 0 $-2-- Often, you'll want to see just one line per interval. The --depth- option helps with this, causing subaccounts to be aggregated:-- $ hledger register --monthly assets --depth 1h- 2008/01 assets $1 $1- 2008/06 assets $-1 0- 2008/12 assets $-1 $-1-- Note when using report intervals, if you specify start/end dates these- will be adjusted outward if necessary to contain a whole number of- intervals. This ensures that the first and last intervals are full- length and comparable to the others in the report.-- Custom register output- register uses the full terminal width by default, except on windows.- You can override this by setting the COLUMNS environment variable (not- a bash shell variable) or by using the --width/-w option.-- The description and account columns normally share the space equally- (about half of (width - 40) each). You can adjust this by adding a- description width as part of --width's argument, comma-separated:- --width W,D . Here's a diagram (won't display correctly in --help):-- <--------------------------------- width (W) ---------------------------------->- date (10) description (D) account (W-41-D) amount (12) balance (12)- DDDDDDDDDD dddddddddddddddddddd aaaaaaaaaaaaaaaaaaa AAAAAAAAAAAA AAAAAAAAAAAA-- and some examples:-- $ hledger reg # use terminal width (or 80 on windows)- $ hledger reg -w 100 # use width 100- $ COLUMNS=100 hledger reg # set with one-time environment variable- $ export COLUMNS=100; hledger reg # set till session end (or window resize)- $ hledger reg -w 100,40 # set overall width 100, description width 40- $ hledger reg -w $COLUMNS,40 # use terminal width, & description width 40-- This command also supports output destination and output format selec-- tion.-- register-match- register-match- Print the one posting whose transaction description is closest to DESC,- in the style of the register command. If there are multiple equally- good matches, it shows the most recent. Query options (options, not- arguments) can be used to restrict the search space. Helps- ledger-autosync detect already-seen transactions when importing.-- rewrite- rewrite- Print all transactions, rewriting the postings of matched transactions.- For now the only rewrite available is adding new postings, like print- --auto.-- This is a start at a generic rewriter of transaction entries. It reads- the default journal and prints the transactions, like print, but adds- one or more specified postings to any transactions matching QUERY. The- posting amounts can be fixed, or a multiplier of the existing transac-- tion'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-- rewrites.hledger may consist of entries like:-- = ^income amt:<0 date:2017- (liabilities:tax) *0.33 ; tax on income- (reserve:grocery) *0.25 ; reserve 25% for grocery- (reserve:) *0.25 ; reserve 25% for grocery-- Note the single quotes to protect the dollar sign from bash, and the- two spaces between account and amount.-- More:-- $ hledger rewrite -- [QUERY] --add-posting "ACCT AMTEXPR" ...- $ hledger rewrite -- ^income --add-posting '(liabilities:tax) *.33'- $ hledger rewrite -- expenses:gifts --add-posting '(budget:gifts) *-1"'- $ hledger rewrite -- ^income --add-posting '(budget:foreign currency) *0.25 JPY; diversify'-- Argument for --add-posting option is a usual posting of transaction- with an exception for amount specification. More precisely, you can- use '*' (star symbol) before the amount to indicate that that this is a- factor for an amount of original matched posting. If the amount- includes a commodity name, the new posting amount will be in the new- commodity; otherwise, it will be in the matched posting amount's com-- modity.-- Re-write rules in a file- During the run this tool will execute so called "Automated Transac-- tions" found in any journal it process. I.e instead of specifying this- operations in command line you can put them in a journal file.-- $ rewrite-rules.journal-- Make contents look like this:-- = ^income- (liabilities:tax) *.33-- = expenses:gifts- budget:gifts *-1- assets:budget *1-- Note that '=' (equality symbol) that is used instead of date in trans-- actions you usually write. It indicates the query by which you want to- match the posting to add new ones.-- $ hledger rewrite -- -f input.journal -f rewrite-rules.journal > rewritten-tidy-output.journal-- This is something similar to the commands pipeline:-- $ hledger rewrite -- -f input.journal '^income' --add-posting '(liabilities:tax) *.33' \- | hledger rewrite -- -f - expenses:gifts --add-posting 'budget:gifts *-1' \- --add-posting 'assets:budget *1' \- > rewritten-tidy-output.journal-- It is important to understand that relative order of such entries in- journal is important. You can re-use result of previously added post-- ings.-- Diff output format- To use this tool for batch modification of your journal files you may- find useful output in form of unified diff.-- $ hledger rewrite -- --diff -f examples/sample.journal '^income' --add-posting '(liabilities:tax) *.33'-- Output might look like:-- --- /tmp/examples/sample.journal- +++ /tmp/examples/sample.journal- @@ -18,3 +18,4 @@- 2008/01/01 income- - assets:bank:checking $1- + assets:bank:checking $1- income:salary- + (liabilities:tax) 0- @@ -22,3 +23,4 @@- 2008/06/01 gift- - assets:bank:checking $1- + assets:bank:checking $1- income:gifts- + (liabilities:tax) 0-- If you'll pass this through patch tool you'll get transactions contain-- ing the posting that matches your query be updated. Note that multiple- files might be update according to list of input files specified via- --file options and include directives inside of these files.-- Be careful. Whole transaction being re-formatted in a style of output- from hledger print.-- See also:-- https://github.com/simonmichael/hledger/issues/99-- rewrite vs. print --auto- This command predates print --auto, and currently does much the same- thing, but with these differences:-- o with multiple files, rewrite lets rules in any file affect all other- files. print --auto uses standard directive scoping; rules affect- only child files.-- o rewrite's query limits which transactions can be rewritten; all are- printed. print --auto's query limits which transactions are printed.-- o rewrite applies rules specified on command line or in the journal.- print --auto applies rules specified in the journal.-- roi- roi- Shows the time-weighted (TWR) and money-weighted (IRR) rate of return- on your investments.-- This command assumes that you have account(s) that hold nothing but- your investments and whenever you record current appraisal/valuation of- these investments you offset unrealized profit and loss into account(s)- that, again, hold nothing but unrealized profit and loss.-- Any transactions affecting balance of investment account(s) and not- originating from unrealized profit and loss account(s) are assumed to- be your investments or withdrawals.-- At a minimum, you need to supply a query (which could be just an- account name) to select your investments with --inv, and another query- to identify your profit and loss transactions with --pnl.-- It will compute and display the internalized rate of return (IRR) and- time-weighted rate of return (TWR) for your investments for the time- period requested. Both rates of return are annualized before display,- regardless of the length of reporting interval.-- stats- stats- Show some journal statistics.-- The stats command displays summary information for the whole journal,- or a matched part of it. With a reporting interval, it shows a report- for each report period.-- Example:-- $ hledger stats- Main journal file : /src/hledger/examples/sample.journal- Included journal files :- Transactions span : 2008-01-01 to 2009-01-01 (366 days)- Last transaction : 2008-12-31 (2333 days ago)- Transactions : 5 (0.0 per day)- Transactions last 30 days: 0 (0.0 per day)- Transactions last 7 days : 0 (0.0 per day)- Payees/descriptions : 5- Accounts : 8 (depth 3)- Commodities : 1 ($)-- This command also supports output destination and output format selec-- tion.-- tags- tags- List all the tag names used in the journal. With a TAGREGEX argument,- only tag names matching the regular expression (case insensitive) are- shown. With QUERY arguments, only transactions matching the query are- considered.-- test- test- Run built-in unit tests.-- This command runs the unit tests built in to hledger-lib and hledger,- printing test names and results on stdout. If any test fails, the exit- code will be non-zero.-- Test names include a group prefix. If a (exact, case sensitive) group- prefix, or a full test name is provided as the first argument, only- that group or test is run.-- If a numeric second argument is provided, it will set the randomness- seed, for repeatable results from tests using randomness (currently- none of them).-- This is mainly used by developers, but it's nice to be able to san-- ity-check your installed hledger executable at any time. All tests are- expected to pass - if you ever see otherwise, something has gone wrong,- please report a bug!--ADD-ON COMMANDS- hledger also searches for external add-on commands, and will include- these in the commands list. These are programs or scripts in your PATH- whose name starts with hledger- and ends with a recognised file exten-- sion (currently: no extension, bat,com,exe, hs,lhs,pl,py,rb,rkt,sh).-- Add-ons can be invoked like any hledger command, but there are a few- things to be aware of. Eg if the hledger-web add-on is installed,-- o hledger -h web shows hledger's help, while hledger web -h shows- hledger-web's help.-- o Flags specific to the add-on must have a preceding -- to hide them- from hledger. So hledger web --serve --port 9000 will be rejected;- you must use hledger web -- --serve --port 9000.-- o You can always run add-ons directly if preferred:- hledger-web --serve --port 9000.-- Add-ons are a relatively easy way to add local features or experiment- with new ideas. They can be written in any language, but haskell- scripts have a big advantage: they can use the same hledger (and- haskell) library functions that built-in commands do, for command-line- options, journal parsing, reporting, etc.-- Here are some hledger add-ons available:-- Official add-ons- These are maintained and released along with hledger.-- api- hledger-api serves hledger data as a JSON web API.-- ui- hledger-ui provides an efficient curses-style interface.-- web- hledger-web provides a simple web interface.-- Third party add-ons- These are maintained separately, and usually updated shortly after a- hledger release.-- diff- hledger-diff shows differences in an account's transactions between one- journal file and another.-- iadd- hledger-iadd is a curses-style, more interactive replacement for the- add command.-- interest- hledger-interest generates interest transactions for an account accord-- ing to various schemes.-- irr- hledger-irr calculates the internal rate of return of an investment- account, but it's superseded now by the built-in roi command.-- Experimental add-ons- These are available in source form in the hledger repo's bin/ direc-- tory; installing them is pretty easy. They may be less mature and doc-- umented than built-in commands. Reading and tweaking these is a good- way to start making your own!-- autosync- hledger-autosync is a symbolic link for easily running ledger-autosync,- if installed. ledger-autosync does deduplicating conversion of OFX- data and some CSV formats, and can also download the data if your bank- offers OFX Direct Connect.-- chart- hledger-chart.hs is an old pie chart generator, in need of some love.-- check- hledger-check.hs checks more powerful account balance assertions.--ENVIRONMENT- COLUMNS The screen width used by the register command. Default: the- full terminal width.-- LEDGER_FILE The journal file path when not specified with -f. Default:- ~/.hledger.journal (on windows, perhaps C:/Users/USER/.hledger.jour-- nal).--FILES- Reads data from one or more files in hledger journal, timeclock, time-- dot, or CSV format specified with -f, or $LEDGER_FILE, or- $HOME/.hledger.journal (on windows, perhaps- C:/Users/USER/.hledger.journal).--BUGS- The need to precede addon command options with -- when invoked from- hledger is awkward.-- When input data contains non-ascii characters, a suitable system locale- must be configured (or there will be an unhelpful error). Eg on POSIX,- set LANG to something other than C.-- In a Microsoft Windows CMD window, non-ascii characters and colours are- not supported.-- In a Cygwin/MSYS/Mintty window, the tab key is not supported in hledger- add.-- Not all of Ledger's journal file syntax is supported. See file format- differences.-- On large data files, hledger is slower and uses more memory than- Ledger.--TROUBLESHOOTING- Here are some issues you might encounter when you run hledger (and- remember you can also seek help from the IRC channel, mail list or bug- tracker):-- Successfully installed, but "No command 'hledger' found"- stack and cabal install binaries into a special directory, which should- be added to your PATH environment variable. Eg on unix-like systems,- that is ~/.local/bin and ~/.cabal/bin respectively.-- I set a custom LEDGER_FILE, but hledger is still using the default file- LEDGER_FILE should be a real environment variable, not just a shell- variable. The command env | grep LEDGER_FILE should show it. You may- need to use export. Here's an explanation.-- "Illegal byte sequence" or "Invalid or incomplete multibyte or wide- character" errors- In order to handle non-ascii letters and symbols (like ), hledger needs- an appropriate locale. This is usually configured system-wide; you can- also configure it temporarily. The locale may need to be one that sup-- ports UTF-8, if you built hledger with GHC < 7.2 (or possibly always,- I'm not sure yet).-- Here's an example of setting the locale temporarily, on ubuntu- gnu/linux:-- $ file my.journal- my.journal: UTF-8 Unicode text # <- the file is UTF8-encoded- $ locale -a- C- en_US.utf8 # <- a UTF8-aware locale is available- POSIX- $ LANG=en_US.utf8 hledger -f my.journal print # <- use it for this command-- Here's one way to set it permanently, there are probably better ways:-- $ echo "export LANG=en_US.UTF-8" >>~/.bash_profile- $ bash --login-- If we preferred to use eg fr_FR.utf8, we might have to install that- first:-- $ apt-get install language-pack-fr- $ locale -a- C- en_US.utf8- fr_BE.utf8- fr_CA.utf8- fr_CH.utf8- fr_FR.utf8- fr_LU.utf8- POSIX- $ LANG=fr_FR.utf8 hledger -f my.journal print-- Note some platforms allow variant locale spellings, but not all (ubuntu- accepts fr_FR.UTF8, mac osx requires exactly fr_FR.UTF-8).----REPORTING BUGS- Report bugs at http://bugs.hledger.org (or on the #hledger IRC channel- or hledger mail list)---AUTHORS- Simon Michael <simon@joyful.com> and contributors---COPYRIGHT- Copyright (C) 2007-2016 Simon Michael.- Released under GNU GPL v3 or later.---SEE ALSO- hledger(1), hledger-ui(1), hledger-web(1), hledger-api(1),- hledger_csv(5), hledger_journal(5), hledger_timeclock(5), hledger_time-- dot(5), ledger(1)-- http://hledger.org----hledger 1.14 March 2019 hledger(1)
+ shell-completion/hledger-completion.bash view
@@ -0,0 +1,2215 @@+# -*- mode: sh; sh-basic-offset: 4; indent-tabs-mode: nil -*-+# ex: ft=sh ts=4 sw=4 et+# shellcheck disable=2034,2154++# Completion script for hledger.+# Created using a Makefile and real hledger.++# This script is sourced by an interactive shell, so do NOT do things like+# 'set -o pipefail' or mangle the global environment in any other way!+# That said, we *do* remove colon (:) from COMP_WORDBREAKS which impacts+# the rest of the session and completion for other programs.++# INSTALLATION:+# To install you can simply source this file from your shell's startup files.+#+# Alternatively, copy/symlink it into `${BASH_COMPLETION_USER_DIR}/completions`+# or `${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions`, rename+# it to either `hledger`, `_hledger` or `hledger.bash`, and it will be loaded+# dynamically the first time you use the `hledger` command. Optionally, create+# symlinks to this file for any extensions used e.g.:+#+# mkdir -p "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions" &&+# cd "${BASH_COMPLETION_USER_DIR:-${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion}/completions" &&+# cp /path/to/hledger-completion.bash hledger &&+# ln -s hledger hledger-ui &&+# ln -s hledger hledger-web &&+# : done.+++_hledger_completion() {+ local cur prev words cword+ _init_completion -n : || return 0++ # Current treatment for special characters:+ # - exclude colon (:) from COMP_WORDBREAKS+ # - option processing assumes that `=` is in COMP_WORDBREAKS+ # - use compopt -o filenames selectively to escape the rest+ COMP_WORDBREAKS=${COMP_WORDBREAKS//:}+ case $COMP_WORDBREAKS in+ *=*) : ;;+ *) COMP_WORDBREAKS=$COMP_WORDBREAKS= ;;+ esac++ local subcommand+ local subcommandOptions+ local i+ for ((i=1; i<${#words[@]}; i++)); do+ subcommand=${words[i]}+ if ! grep -Fxqe "$subcommand" <<< "$_hledger_complist_commands"; then+ subcommand=+ continue+ fi+ # There could be other commands begining with $subcommand, e.g.:+ # $subcommand == reg --> register, register-match,+ # $subcommand == bal --> balance, balancesheet, balancesheetequity, etc.+ # Do not ignore them!+ if ((i == cword)); then+ _hledger_compreply "$(+ _hledger_compgen "$_hledger_complist_commands"+ )"+ return 0+ fi++ # Replace dashes with underscores and use indirect expansion+ subcommandOptions=_hledger_complist_options_${subcommand//-/_}++ if [[ $cur == -* ]]; then+ _hledger_compreply "$(_hledger_compgen "${!subcommandOptions}")"+ # Suspend space on completion of long options requiring an argument+ [[ ${COMPREPLY[0]} == --*= ]] && compopt -o nospace++ return 0+ fi+ break+ done++ # Option argument completion+ _hledger_compreply_optarg && return++ if [[ -z $subcommand ]]; then+ if [[ $cur == -* ]]; then+ _hledger_compreply "$(+ _hledger_compgen "$_hledger_complist_generic_options"+ )"+ # Suspend space on completion of long options requiring an argument+ [[ ${COMPREPLY[0]} == --*= ]] && compopt -o nospace+ else+ _hledger_compreply "$(+ _hledger_compgen "$_hledger_complist_commands"+ )"+ fi++ return 0+ fi++ # Set this from here on because queries tend to have lots of special chars+ # TODO: better handling of special characters+ compopt -o filenames++ # Query completion+ _hledger_compreply_query && return++ # Subcommand specific+ case $subcommand in+ # These do not expect or support any query arguments+ commodities|check|files|help|import|print-unique|test)+ return 0+ ;;+ esac++ # Offer query filters and accounts for the rest+ _hledger_compreply "$(_hledger_compgen "$_hledger_complist_query_filters")"+ if [[ -z $cur ]]; then+ _hledger_compreply_append "$(+ _hledger_compgen "$(_hledger accounts --flat --depth 1)"+ )"+ else+ _hledger_compreply_append "$(+ _hledger_compgen "$(_hledger accounts --flat)"+ )"+ fi++ # Suspend space on completion of query prefix+ # Do not sort, keep accounts and query filters grouped separately+ [[ ${COMPREPLY[0]} == *: ]] && compopt -o nospace+ compopt -o nosort++ return 0+}++_hledger_extension_completion() {+ local cmd=${1##*/}+ local ext=${cmd#hledger-}+ # Pretend that hledger is called with the given extension+ # as the first argument and call main completion function+ COMP_WORDS=("hledger" "$ext" "${COMP_WORDS[@]:1}")+ COMP_CWORD=$((COMP_CWORD + 1))+ _hledger_completion "hledger" "${@:1}"+}++# Register completion function for hledger:+complete -F _hledger_completion hledger++# Register completion functions for hledger extensions:+complete -F _hledger_extension_completion hledger-ui hledger-web++# Helpers++# Comment out when done+_hledger_debug() {+ ((HLEDGER_DEBUG)) || return 0+ local var vars=(words)+ (($#)) && vars=("$@")+ for var in "${vars[@]}"; do+ printf '\ndebug: %s\n' "$(declare -p "$var")" >&2+ done+}++# Stolen from bash-completion+# This function quotes the argument in a way so that readline dequoting+# results in the original argument. This is necessary for at least+# `compgen' which requires its arguments quoted/escaped:+_hledger_quote_by_ref()+{+ printf -v "$2" %q "$1"++ # If result becomes quoted like this: $'string', re-evaluate in order to+ # drop the additional quoting. See also: http://www.mail-archive.com/+ # bash-completion-devel@lists.alioth.debian.org/msg01942.html+ [[ ${!2} == \$* ]] && eval "$2=${!2}"+}++# Set the value of COMPREPLY from newline delimited completion candidates+_hledger_compreply() {+ local IFS=$'\n'+ # shellcheck disable=2206+ COMPREPLY=($1)+}++# Append the value of COMPREPLY from newline delimited completion candidates+_hledger_compreply_append() {+ local IFS=$'\n'+ # shellcheck disable=2206+ COMPREPLY+=($1)+}++# Generate input suitable for _hledger_compreply() from newline delimited+# completion candidates. It doesn't seem there is a way to feed a literal+# word list to compgen -- it will eat your quotes, drink your booze and...+# Completion candidates are quoted accordingly first and then we leave it to+# compgen to deal with readline.+#+# Arguments:+# $1: a newline separated list with completion cadidates+# $2: (optional) a prefix string to add to generated completions+# $3: (optional) a word to match instead of $cur, the default.+# If $match is null and $prefix is defined the match is done against $cur+# stripped of $prefix. If both $prefix and $match are null we match against+# $cur and no prefix is added to completions.+_hledger_compgen() {+ local complist=$1+ local prefix=$2+ local match=$3+ local quoted=()+ local word+ local i=0++ while IFS= read -r word; do+ _hledger_quote_by_ref "$word" word+ quoted[i++]=$word+ done <<< "$complist"++ if (($# < 3)); then+ match=${cur:${#prefix}}+ fi++ local IFS=$'\n'+ compgen -P "$prefix" -W "${quoted[*]}" -- "$match"+}++# Try required option argument completion. Set COMPREPLY and return 0 on+# success, 1 if option doesn't require an argument or out of context+_hledger_compreply_optarg() {+ local option=${words[cword - 1]}+ local match=$cur+ local wordlist++ # Match the empty string on --file=<TAB>, not the equal sign itself+ if [[ $cur == = ]]; then+ match=""+ # Once input is present, cword is incremented so we compensate+ elif [[ $prev == = ]]; then+ option=${words[cword - 2]}+ fi++ [[ $option == -* ]] || return++ case $option in+ --alias)+ compopt -o nospace -o filenames+ _hledger_compreply "$(+ _hledger_compgen "$(_hledger accounts --flat)" "" "$match"+ )"+ ;;+ -f|--file|--rules-file|-o|--output-file)+ compopt -o filenames+ _hledger_compreply "$(compgen -f -- "$match")"+ ;;+ --pivot)+ compopt -o nosort+ wordlist="code description note payee"+ _hledger_compreply "$(compgen -W "$wordlist" -- "$match")"+ _hledger_compreply_append "$(+ _hledger_compgen "$(_hledger tags)" "" "$match"+ )"+ ;;+ --value)+ wordlist="cost then end now"+ _hledger_compreply "$(compgen -W "$wordlist" -- "$match")"+ ;;+ -X|--exchange)+ _hledger_compreply "$(+ _hledger_compgen "$(_hledger commodities)" "" "$match"+ )"+ ;;+ --color|--colour)+ compopt -o nosort+ wordlist="auto always yes never no"+ _hledger_compreply "$(compgen -W "$wordlist" -- "$match")"+ ;;+ -O|--output-format)+ wordlist="txt csv json sql"+ _hledger_compreply "$(compgen -W "$wordlist" -- "$match")"+ ;;+ --close-acct|--open-acct)+ compopt -o filenames+ _hledger_compreply "$(+ _hledger_compgen "$(_hledger accounts --flat)" "" "$match"+ )"+ ;;+ --debug)+ wordlist="{1..9}"+ _hledger_compreply "$(compgen -W "$wordlist" -- "$match")"+ ;;+ # Argument required, but no handler (yet)+ -b|-e|-p)+ _hledger_compreply ""+ ;;+ # Check if an unhandled long option requires an argument+ *)+ local optionList argRequired++ if [[ -n $subcommandOptions ]]; then+ optionList=${!subcommandOptions}+ else+ optionList=$_hledger_complist_generic_options+ fi++ while IFS= read -r argRequired; do+ if [[ $argRequired == "$option=" ]]; then+ _hledger_compreply ""+ return 0+ fi+ done <<< "$optionList"++ return 1+ ;;+ esac++ return 0+}++# Query filter completion through introspection+_hledger_compreply_query() {+ [[ $cur =~ .: ]] || return+ local query=${cur%%:*}:+ local match=${cur#*:}+ grep -Fxqe "$query" <<< "$_hledger_complist_query_filters" || return++ local hledgerArgs=()+ case $query in+ acct:)+ if (( ${#match} )); then+ hledgerArgs=(accounts --flat)+ else+ hledgerArgs=(accounts --flat --depth 1)+ fi+ ;;+ code:) hledgerArgs=(codes) ;;+ cur:) hledgerArgs=(commodities) ;;+ desc:) hledgerArgs=(descriptions) ;;+ note:) hledgerArgs=(notes) ;;+ payee:) hledgerArgs=(payees) ;;+ tag:) hledgerArgs=(tags) ;;+ *)+ local wordlist+ case $query in+ amt:) wordlist="< <= > >=" ;;+ real:) wordlist="\ 0" ;;+ status:) wordlist="\ * !" ;;+ *) return 1 ;;+ esac+ _hledger_compreply "$(+ compgen -P "$query" -W "$wordlist" -- "$match"+ )"+ return 0+ ;;+ esac++ _hledger_compreply "$(+ _hledger_compgen "$(_hledger "${hledgerArgs[@]}")" "$query"+ )"++ return 0+}++# Parse the command line so far and fill the array $optarg with the arguments to+# given options. $optarg should be declared by the caller+_hledger_optarg() {+ local options=("$@")+ local i j offset+ optarg=()++ # hledger balance --file ~/ledger _+ # 0 1 2 3 4+ for ((i=1; i < ${#words[@]} - 2; i++)); do+ offset=0+ for j in "${!options[@]}"; do+ if [[ ${words[i]} == "${options[j]}" ]]; then+ if [[ ${words[i+1]} == '=' ]]; then+ offset=2+ else+ offset=1+ fi+ # Pass it through compgen to unescape it+ optarg+=("$(compgen -W "${words[i + offset]}")")+ fi+ done+ ((i += offset))+ done+}++# Get ledger file from -f --file arguments from COMP_WORDS and pass it to the+# 'hledger' call. Note that --rules-file - if present - must also be passed!+# Multiple files are allowed so pass them all in the order of appearance.+_hledger() {+ local hledgerArgs=("$@")+ local file+ local -a optarg++ _hledger_optarg -f --file+ for file in "${optarg[@]}"; do+ [[ -f $file ]] && hledgerArgs+=(--file "$file")+ done++ _hledger_optarg --rules-file+ for file in "${optarg[@]}"; do+ [[ -f $file ]] && hledgerArgs+=(--rules-file "$file")+ done++ # Discard errors. Is there a way to validate files before using them?+ hledger "${hledgerArgs[@]}" 2>/dev/null+}++# Include lists of commands and options generated by the Makefile using the+# m4 macro processor.+# Included files must have exactly one newline at EOF to prevent weired errors.++read -r -d "" _hledger_complist_commands <<"__TEXT__"+accounts+activity+add+areg+aregister+bal+balance+balancesheet+balancesheetequity+bs+bse+cashflow+cf+check+close+codes+commodities+demo+descriptions+diff+files+help+import+incomestatement+is+notes+payees+prices+print+reg+register+rewrite+roi+stats+tags+test+__TEXT__++read -r -d "" _hledger_complist_query_filters <<"__TEXT__"+acct:+amt:+code:+cur:+date:+date2:+depth:+desc:+inacct:+not:+note:+payee:+real:+status:+tag:+__TEXT__++read -r -d "" _hledger_complist_generic_options <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--conf=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--no-conf+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++# Dashes are replaced by m4 with underscores to form valid identifiers+# Referenced by indirect expansion of $subcommandOptions++read -r -d "" _hledger_complist_options_accounts <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--declared+--depth=+--directives+--drop=+--empty+--end=+--exchange=+--file=+--find+--flat+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--locations+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--tree+--types+--undeclared+--unmarked+--unused+--used+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_activity <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_add <<"__TEXT__"+--alias=+--auto+--debug=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--no-new-accounts+--pivot=+--rules=+--strict+--tldr+--verbose-tags+--version+__TEXT__++read -r -d "" _hledger_complist_options_areg <<"__TEXT__"+--alias=+--align-all+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--no-elide+--output-file=+--output-format=+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--txn-dates+--unmarked+--value=+--verbose-tags+--version+--weekly+--width=+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_aregister <<"__TEXT__"+--alias=+--align-all+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--no-elide+--output-file=+--output-format=+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--txn-dates+--unmarked+--value=+--verbose-tags+--version+--weekly+--width=+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_bal <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--count+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--invert+--layout+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--related+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--transpose+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_balance <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--count+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--invert+--layout+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--related+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--transpose+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_balancesheet <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_balancesheetequity <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_bs <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_bse <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_cashflow <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_cf <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_check <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_close <<"__TEXT__"+--alias=+--assert+--assertion-type=+--assign+--auto+--begin=+--cleared+--close+--close-acct=+--close-desc=+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--explicit+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--interleaved+--man+--market+--migrate+--monthly+--open+--open-acct=+--open-desc=+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--retain+--round=+--rules=+--show-costs+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_codes <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_commodities <<"__TEXT__"+--alias=+--auto+--debug=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--pivot=+--rules=+--strict+--tldr+--verbose-tags+--version+__TEXT__++read -r -d "" _hledger_complist_options_demo <<"__TEXT__"+--debug=+--help+--info+--man+--speed=+--tldr+--version+__TEXT__++read -r -d "" _hledger_complist_options_descriptions <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_diff <<"__TEXT__"+--alias=+--auto+--debug=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--pivot=+--rules=+--strict+--tldr+--verbose-tags+--version+__TEXT__++read -r -d "" _hledger_complist_options_files <<"__TEXT__"+--alias=+--auto+--debug=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--pivot=+--rules=+--strict+--tldr+--verbose-tags+--version+__TEXT__++read -r -d "" _hledger_complist_options_help <<"__TEXT__"+--debug=+--help+--info+--man+--tldr+--version+__TEXT__++read -r -d "" _hledger_complist_options_import <<"__TEXT__"+--alias=+--auto+--begin=+--catchup+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--dry-run+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_incomestatement <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_is <<"__TEXT__"+--alias=+--auto+--average+--begin=+--budget+--change+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--declared+--depth=+--drop=+--empty+--end=+--exchange=+--file=+--flat+--forecast+--format=+--gain+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--layout=+--man+--market+--monthly+--no-elide+--no-total+--output-file=+--output-format=+--pending+--percent+--period=+--pivot=+--pretty+--quarterly+--real+--row-total+--rules=+--sort-amount+--strict+--sum+--summary-only+--tldr+--today=+--tree+--unmarked+--value=+--valuechange+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_notes <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_payees <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--declared+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--used+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_prices <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--show-reverse+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_print <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--explicit+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--match=+--monthly+--new+--output-file=+--output-format=+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--round=+--rules=+--show-costs+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_reg <<"__TEXT__"+--alias=+--align-all+--auto+--average+--begin=+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--invert+--man+--market+--match=+--monthly+--output-file=+--output-format=+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--related+--rules=+--sort=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--width=+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_register <<"__TEXT__"+--alias=+--align-all+--auto+--average+--begin=+--cleared+--color=+--commodity-style=+--cost+--cumulative+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--historical+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--invert+--man+--market+--match=+--monthly+--output-file=+--output-format=+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--related+--rules=+--sort=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--width=+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_rewrite <<"__TEXT__"+--add-posting=+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--diff+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_roi <<"__TEXT__"+--alias=+--auto+--begin=+--cashflow+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--investment=+--man+--market+--monthly+--pending+--period=+--pivot=+--pretty+--profit-loss=+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_stats <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--output-file=+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--verbose+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_tags <<"__TEXT__"+--alias=+--auto+--begin=+--cleared+--color=+--commodity-style=+--cost+--daily+--date2+--debug=+--depth=+--empty+--end=+--exchange=+--file=+--forecast+--help+--ignore-assertions+--infer-costs+--infer-equity+--infer-market-prices+--info+--man+--market+--monthly+--parsed+--pending+--period=+--pivot=+--pretty+--quarterly+--real+--rules=+--strict+--tldr+--today=+--unmarked+--value=+--values+--verbose-tags+--version+--weekly+--yearly+__TEXT__++read -r -d "" _hledger_complist_options_test <<"__TEXT__"+--debug=+--help+--info+--man+--tldr+--version+__TEXT__++return 0
− test/test.hs
@@ -1,8 +0,0 @@-{--Run hledger's (and hledger-lib's) unit tests as a cabal test suite,-by running the test command with no options.--}--import Hledger.Cli--main = testcmd defcliopts (error "journal-less command tried to use the journal")
+ test/unittest.hs view
@@ -0,0 +1,14 @@+{-+Run the hledger package's unit tests using the tasty test runner+(by running the test command limited to Hledger.Cli tests).+-}++import Hledger.Cli (tests_Hledger_Cli)+import System.Environment (setEnv)+import Test.Tasty (defaultMain)++main :: IO ()+main = do+ setEnv "TASTY_HIDE_SUCCESSES" "true"+ setEnv "TASTY_ANSI_TRICKS" "false" -- helps the above+ defaultMain tests_Hledger_Cli