Changelog for hledger-1.2

User-visible changes in the hledger and hledger-lib packages. See also the project change log. # 1.2 (2016/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: ```journal = ^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 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: - The hledger packages now have man pages, based on the current user manual, thanks to the mighty pandoc (#282). 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 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 or doc/