diff --git a/CHANGES.md b/CHANGES.md index ca5775b90..024b9cc97 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,618 +2,118 @@ General project-related changes and major/notable all-package releases. For package-specific changes and minor releases, see the package changelogs. # ec4d131d2 -- Merge branch 'bash-completion' (#1410) - An extensive overhaul by @zhelezov of the bash programmable - completions in shell-completions/. + +- roi has a new cookbook doc, and example files have been updated. + (Dmitry Astapov) + +- Example CSV rules for the Daedalus wallet have been added. + +- The default stackage resolver/GHC version has been bumped to + lts-17.4/ghc-8.10.4. + +- tools/generatejournal now includes more commodities and prices in + generated journals. (Stephen Morgan) + +- Our functional tests now also run on BSD. (#1434, Felix Van der Jeugt) + +- Addon scripts in bin/ have been updated for latest hledger API (Stephen Morgan). + +- Addon scripts are now compiled as part of our CI tests, and always + with the same version of hledger source they were shipped with. We + now require script users to check out the hledger source tree and + run the scripts (or, `bin/compile.sh`) from there. This keeps users + and tests in sync, making things more reliable for everyone. (#1453) + +- Last but not least, hledger's bash completions (provided in ./shell-completions/) + have been thoroughly updated (#1404, #1410, Vladimir Zhelezov). "This was supposed to be just a fix for #1404 but upon visiting the source - several issues became apparent and that is why the commit grew a bit more than - expected. A complete list of changes bellow: - - Fix #1404 - No more orphaned temporary directories. Commands, options, etc. that used to be - stored in there are included at build-time as here documents in the source. - - Fix artifacts in /tmp after build - Upon fixing the above I became aware that the build itself was leaving behind a - heap of artifacts in /tmp that were not taken care of with a make clean. - Fixed by using temporary files and directories in the build directory. Makefile - and build scripts adjusted. - - Produce command aliases - Regular expressions in build scripts changed to produce all command aliases - except single letter ones (see below) - - Do not propose single letters completions - It is simply not useful and adds a lot of noise. It makes completion slower as - well because you need to hit yes on the prompt: - Display all 200 possibilities? (y or n) - output-options.sh now excludes those. - - Query filters simplified - Keep only the prefix of the filter with the colon in query-filters.txt. This - change has two reasons: - - Single letter completions are not useful (see above) - It allows for completion suggestions specific to each - Bonus reason: it's a completion engine, not a user manual. - Fix completion impacts on global environment - The completion script was making a couple of changes to the global environment - which had an impact for the rest of the shell session. - - set -o pipefail: the change is hidden from the user and could lead to subtle - errors throughout the shell session - COMP_WORDBREAKS=" ": this affects subsequent completions for us and other - programs too. I exclude the colon : from its value and use - compopt -o filenames to handle escaping of special characters for us. I would - like to find a solution without messing with COMP_WORDBREAKS but it is not - straight forward. - Fix hiding of legit subcommands - Completion was hiding all possibilities if a subcommand happens to be the prefix - of another. On typing balance, one should be proposed balancesheet and - balancesheetequity as well. - - Return early - Try to complete depending on the current context and return immediately if - successful. Keep completion list relevant and as short as possible. - - Context aware completion - - Add handlers for option parameter completion, see _hledger_compreply_optarg() - Add handlers for query filters:, see _hledger_compreply_query() - Use --file and --rules-file arguments when proposing completions for the - above, see _hledger() - Propose only top level accounts at first. Again, keep it short and focused. - Custom compgen wrapper - compgen is fairly complicated. There is no way to feed it a word list with - literals. It will mangle your input in so many ways that we cannot trust it. To - work around this several wrappers are used: _hledger_compgen() works with - _hledger_quote_by_ref() to process and escape newline separated input which is - then fed to compgen and finally in COMPREPLY through _hledger_compreply() - and _hledger_compreply_append(). It sounds messy and I guess it is, I would like - to find a more straight forward way to do it. I think it is still a way better - and safer interface with readline than trying to grep our way through. - - Replace declare with local - Again, this script is sourced by the shell -- keep variable scopes as narrow as - possible. Oops, they are actually synonymous when used in a function but - local declares our intentions explicitly. - - Use compopt -o nosort - Often I resort to using it to keep different groups of completions together. - Whether this is more ergonomic or not is subjective. But our input lists are - already sorted at build-time so why not. Sort manually query-filters.txt when - editing it. - - Remove irrelevant comments - And add some new ones :) + several issues became apparent and that is why the commit grew a bit more than + expected. A complete list of changes below: + + - Fix #1404. + No more orphaned temporary directories. Commands, options, etc. that used to be + stored in there are included at build-time as here documents in the source. + + - Fix artifacts in /tmp after build. + Upon fixing the above I became aware that the build itself was leaving behind a + heap of artifacts in /tmp that were not taken care of with a make clean. + Fixed by using temporary files and directories in the build directory. Makefile + and build scripts adjusted. + + - Produce command aliases. + Regular expressions in build scripts changed to produce all command aliases + except single letter ones (see below) + + - Do not propose single letters completions. + It is simply not useful and adds a lot of noise. It makes completion slower as + well because you need to hit yes on the prompt: + Display all 200 possibilities? (y or n) + output-options.sh now excludes those. + + - Query filters simplified. + Keep only the prefix of the filter with the colon in query-filters.txt. This + change has two reasons: + + - Single letter completions are not useful (see above). + It allows for completion suggestions specific to each + Bonus reason: it's a completion engine, not a user manual. + Fix completion impacts on global environment + The completion script was making a couple of changes to the global environment + which had an impact for the rest of the shell session. + + - set -o pipefail: the change is hidden from the user and could lead to subtle + errors throughout the shell session. + COMP_WORDBREAKS=" ": this affects subsequent completions for us and other + programs too. I exclude the colon : from its value and use + compopt -o filenames to handle escaping of special characters for us. I would + like to find a solution without messing with COMP_WORDBREAKS but it is not + straight forward. + - Fix hiding of legit subcommands. + Completion was hiding all possibilities if a subcommand happens to be the prefix + of another. On typing balance, one should be proposed balancesheet and + balancesheetequity as well. + + - Return early. + Try to complete depending on the current context and return immediately if + successful. Keep completion list relevant and as short as possible. + + - Context aware completion + + Add handlers for option parameter completion, see _hledger_compreply_optarg() + Add handlers for query filters:, see _hledger_compreply_query() + Use --file and --rules-file arguments when proposing completions for the + above, see _hledger() + Propose only top level accounts at first. Again, keep it short and focused. + Custom compgen wrapper + compgen is fairly complicated. There is no way to feed it a word list with + literals. It will mangle your input in so many ways that we cannot trust it. To + work around this several wrappers are used: _hledger_compgen() works with + _hledger_quote_by_ref() to process and escape newline separated input which is + then fed to compgen and finally in COMPREPLY through _hledger_compreply() + and _hledger_compreply_append(). It sounds messy and I guess it is, I would like + to find a more straight forward way to do it. I think it is still a way better + and safer interface with readline than trying to grep our way through. + + - Replace declare with local. + Again, this script is sourced by the shell -- keep variable scopes as narrow as + possible. Oops, they are actually synonymous when used in a function but + local declares our intentions explicitly. + + - Use compopt -o nosort. + Often I resort to using it to keep different groups of completions together. + Whether this is more ergonomic or not is subjective. But our input lists are + already sorted at build-time so why not. Sort manually query-filters.txt when + editing it. + + - Remove irrelevant comments. + And add some new ones :) + I think that is all. Give it a spin, try to abuse it, in and outside of quotes, with some funky accounts, payees, tags, whatever, and tell me where it breaks or behaves unexpectedly." -- stack: bump default to lts-17.4/ghc-8.10.4 - -- tools: Include more commodities and prices in generated journals. (Stephen Morgan) - -- Rebuild completion after the rebase on upstream/master (Vladimir Zhelezov) -- `help` command's output is no longer listing help topics, so - those completions are removed. -- `check` command supersedes `check-dates`, `check-dupes`, etc. - -- Disable shell expansion in here-docs (Vladimir Zhelezov) - Better be safe that sorry... - -- Makefile: move all variable definitions to the top, before targets (Vladimir Zhelezov) - -- README: fix syntax highlighting, quotes (Vladimir Zhelezov) - -- Update README (Vladimir Zhelezov) - -- BSDmakefile (Vladimir Zhelezov) - Just print a reminder to use `gmake` instead of spurting a bunch - of errors. - -- Prevent unwanted m4 macro expansion + `-g` GNU compatibility flag (Vladimir Zhelezov) - Most of the included files are meant to be output literally, without any - macro processing. Using `undivert` in place of `include` achieves that. - This is a safety net against unsanitized input generated during the - build. Also, developers editing the shell code stub shouldn't be - constantly alert about triggering accidental macro expansion. - - In order that `undivert` mimics GNU behaviour on BSDs, the `-g` flag is - used for the m4 invocation. - -- Portability: replace GNU extension `\s` with `[[:space:]]` (Vladimir Zhelezov) - -- Revert "Do not use `set -e` in helper shell scripts" (Vladimir Zhelezov) - This reverts commit 0aeb88e663b9b19e173de20b132bef2189c6d7c9. - -- Install/uninstall completion for all extensions by default (Vladimir Zhelezov) - Install the symlinks unconditionally. This way the user don't need - to reinstall completion after adding an extension. Of course fine- - grained control is possible with: `make install EXTENSIONS=web` e.g. - -- Exit build with an error if unable to parse hledger sub-commands (Vladimir Zhelezov) - -- Do not use `set -e` in helper shell scripts (Vladimir Zhelezov) - It is not a substitute for proper error checking, it can easily cause - more trouble than good and it would be a burden for contributors and a - source for potential misbehavior. See this take on the topic for - example: http://mywiki.wooledge.org/BashFAQ/105 - -- Add phony clean-all build target (Vladimir Zhelezov) - A `make clean` before commit removes hledger-completion.bash and - it is supposed to be in the repository. `make clean` removes build - artifacts while keeping the latter. Do a `make clean-all` to purge - everything. - -- Remove `api` from hledger extensions (Vladimir Zhelezov) - Superseded by hledger-web - -- Update .gitignore (Vladimir Zhelezov) - Options/commands parsing no longer creates any temporary files - -- Add basic editor configuration to shell scripts (Vladimir Zhelezov) - -- Move back commands/options parsing to separate shell scripts (Vladimir Zhelezov) - It made the Makefile more difficult to read and this way we can - take advantage of `set -e`, `-o pipefail` and friends. - - Clean up debugging targets - -- Avoid hard-coded reference to `commands.tmp` (Vladimir Zhelezov) - -- Add example usage comment for debug targets (Vladimir Zhelezov) - -- Modify .gitignore (Vladimir Zhelezov) - query-filters.txt is a build dependency and shouldn't be ignored. - -- Add install and uninstall build targets (Vladimir Zhelezov) - -- Move commands and options parsing into the Makefile (Vladimir Zhelezov) - It is just a pipe of sed regex filters and all can be viewed/edited - in one place. Add a couple of debug targets to see easily the - effects of regex changes. - -- Add stub file to m4 build target prerequisites (Vladimir Zhelezov) - And as it becomes unwieldy, put all the dependencies in a variable - -- Eliminate dependency on ‘paste’ and ‘parallel’ (Caleb Maclennan) - -- Isolate shell code in a stub file included by m4 (Vladimir Zhelezov) - This way we can easily edit m4 in m4-mode and the shell script stub - in sh-mode and prevent subtle errors coming from accidental quoting - issues or macros (mis)interpreted by m4. - -- Fix build race condition (Vladimir Zhelezov) - Make `command-options` a prerequisite of `hledger-completion.bash`. - Currently the build succeeds only because the former takes less time - to finish than all the prerequisites of the latter. If you run a - `make clean && make -j 4`, the build would fail as they are built - in parallel. - -- Amend installation comment (Vladimir Zhelezov) - -- Add a comment with example installation instructions (Vladimir Zhelezov) - -- Remove _function from function names (Vladimir Zhelezov) - -- Fix _hledger_extension_completion when called by path... (Vladimir Zhelezov) - Could break if called with ./funky-path/with-dashes/hledger-ui - -- return 0 (Vladimir Zhelezov) - Shame on me... - -- Fix a7dc62d: set $subcommandOptions unconditionally (Vladimir Zhelezov) - -- Add an automatic check for required option argument (Vladimir Zhelezov) - Get rid of manually listing unhandled long options: - - Instead of listing options requiring an argument one by one in the - case statement in _hledger_compreply_optarg(), the option completion - lists are searched and if the option does require an argument an - empty COMPREPLY is send. Short options are uncounted for and still - need a manual entry. - - This necessitated setting $subcommandOptions beforehand, so it is - moved back where it was -- in the sub-command loop in main(). - -- Remove `compopt -o nospace` from --{close,open}-acct handler (Vladimir Zhelezov) - -- Delay setting `compopt -o filenames` (Vladimir Zhelezov) - ...until just before query completion. It is not desired for - commands and options completion and is better used selectively - only when really needed. - -- Use compopt -o nospace only for a query prefix (Vladimir Zhelezov) - Similarly to long options treatment, suspend space only when - completing what looks like a query or account prefix i.e. something - ending with a colon (:). - -- White space (Vladimir Zhelezov) - -- White space, fix alignment (Vladimir Zhelezov) - -- Edit comments (Vladimir Zhelezov) - -- Remove redundant call of _get_comp_words_by_ref() (Vladimir Zhelezov) - -- Break overly long lines for better readability (Vladimir Zhelezov) - Hopefully differences are aligned and easily discernible this way - -- Remove _hledger_quote(), unused. (Vladimir Zhelezov) - -- Remove unnecessary quoting, a matter of consistency... (Vladimir Zhelezov) - -- Add an early return from option argument completion (Vladimir Zhelezov) - Do not even enter the case statement if preceding words don't look - like an option - -- White space (Vladimir Zhelezov) - -- Simplify sub-command loop logic (Vladimir Zhelezov) - If the cursor is on the sub-command, just offer sub-command - completions and be done with it. It was way over complicated. - -- Move sub-command options reply out of the for-loop (Vladimir Zhelezov) - It was just before the `break` statement anyways - -- _hledger_compreply_query: minor refactor (Vladimir Zhelezov) - -- Add a couple of sub-commands to the no-query list (Vladimir Zhelezov) - -- Further refinement of option extraction regex (Vladimir Zhelezov) - -- Improve option extraction (Vladimir Zhelezov) - Do not consider lines starting with anything other than white space - followed by a dash. - -- Fix regular expression in output-options.sh (Vladimir Zhelezov) - Match only lines starting with white space because there are a lot - of option like strings in the discussion section that follows that - are not necessarily what we are after. - -- Adjust comment obsoleted by previous commit: 4d2a4b0 (Vladimir Zhelezov) - -- Append `=` to long options requiring an argument (Vladimir Zhelezov) - Make it obvious that the option expects an argument by appending - the equal sign on completion. Suspend space in this case. The - regular expression in `output-options.sh` is adjusted to take into - account this on processing option strings. - -- f656ff8 made another early return possible, so do it (Vladimir Zhelezov) - Also it made a couple of statements redundant, cleaned up. - -- Postpone options display until after entering a dash (Vladimir Zhelezov) - I was looking at how other programs that have an overwhelming - number of sub-commands and options deal with completion, namely - how git does it, and I liked the clean workflow not spitting every - available option until asked for. Hledger's main workflow is: - - > hledger COMMAND QUERY - - so I have tried to reproduce this with this change. Options are of - course still there, but not shown until you ask for them by entering - a dash on the command line. Also, the `acct:` filter proposes only top - level accounts until there is some input from the user because accounts - tend to be numerous as well. - -- Rename $wordlist to $complist in _hledger_compgen() (Vladimir Zhelezov) - Keep to established conventions - -- Typo in comments (Vladimir Zhelezov) - -- Make sure `=` is present in COMP_WORDBREAKS (Vladimir Zhelezov) - Currently option processing logic is based on the assumption that `=` is - a word-breaking character, so make sure it is present in COMP_WORDBREAKS - -- A non-recursive version of _hledger_compreply_optarg() (Vladimir Zhelezov) - Feels more streamlined and readable - -- Make hard-coded completion word lists easy to find (Vladimir Zhelezov) - A quick search for `wordlist=` should be enough to find hard-coded - completions if we need to change them - -- Simplify condition (Vladimir Zhelezov) - Knowing the cursor position is enough to decide whether to complete - subcommand or not, and subcommand is already known. - -- Minor refactor of main function (Vladimir Zhelezov) - No functional changes except special treatment of `help` subcommand - -- Revert "Refactor _hledger_compreply_optarg()" (Vladimir Zhelezov) - This reverts commit 2fd01d8ef51b897a63a2590556dbb3af7c13ffc9. - - Well, I was so wrong... - -- Refactor _hledger_compreply_optarg() (Vladimir Zhelezov) - It used to do a lot more work parsing the command line that is - no longer necessary. Clean up redundant code. - -- Clarify comment in extension completion function (Vladimir Zhelezov) - -- Refactor _hledger_extension_completion_function() (Vladimir Zhelezov) - Reduce number of instructions, remove variables used only once - -- Fix extension completion (Vladimir Zhelezov) - When inserting $extensionName in $COMP_WORDS manually, $COMP_CWORD lags - behind by one. Needs a manual adjustment too. - -- Fix duplicate call of _hledger_compreply_optarg() (Vladimir Zhelezov) - It was called in both conditional branches so it's moved out before - the conditional. - -- Helper _hledger_debug() now accepts any number of arguments (Vladimir Zhelezov) - -- Fix --long-opt= completion (Vladimir Zhelezov) - Commit #64282f3f broke that somehow so I need to force the match on - an empty string after the equal sign, not the equal sign itself. - - I think that _init_completion() does a bit more than I need... - -- Style: unset compopt filenames if completing command or option (Vladimir Zhelezov) - This is about the looks of the completion list -- if we have a - directory with the name of a subcommand it will be presented with - a trailing slash. This avoids that. - -- Style: replace $cur with $subcommand (Vladimir Zhelezov) - It changes nothing but spells out intention more clearly - -- More option argument completions (Vladimir Zhelezov) - Added handlers for: - --output-format - --close-acct - --open-acct - --debug - - Added --drop to blocking list - -- Add optional arguments $prefix and $match to _hledger_compgen() (Vladimir Zhelezov) - This allows more flexibility when generating completion candidates - and we don't need to resort to external help from `sed` or others. - _hledger_compgen's arguments become: - - $1 -> $wordlist: - a newline separated wordlist with completion cadidates - $2 -> $prefix: - (optional) a prefix string to add to generated completions - $3 -> $match: - (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. Of course you can also pass - an empty string as $prefix and set $match to whatever you wish. - -- Use _init_completion() (Vladimir Zhelezov) - This handles a lot that we have to do manually otherwise. Without - this we need to handle e.g. redirections to get completion for say: - > hledger payees > - - Also because this function assumes that we use `cur`, `prev`, `words` - and `cword` and sets them up for us, `wordToComplete`, `COMP_WORDS` - and `COMP_CWORD` are renamed accordingly. Those names are pretty much - hard-coded in bash completion so it is easier to follow the lead than - go with custom variable names. - -- Fix or silence shellcheck warnings (Vladimir Zhelezov) - There are a couple of places where (un)quoting is intentionally - skipped so make those explicit. - -- Query filter completion for amt, real and status; clean whitespace (Vladimir Zhelezov) - -- Basic settings for major editors: prevent mixing tabs and spaces (Vladimir Zhelezov) - -- Fix: pass *all* accounts and rules files to hledger calls (Vladimir Zhelezov) - _hledger_optarg() is used to parse the options on the command line - and provide their arguments for context aware completion suggestions - -- Fix quoted/escaped file path handling in _hledger() (Vladimir Zhelezov) - When reading hledger (rules-)file from COMP_WORDS we need to unescape it - first. For once compgen is doing exactly what we need :) - -- Fix #1404, and more... (Vladimir Zhelezov) - This was supposed to be just a fix for #1404 but upon visiting the source - several issues became apparent and that is why the commit grew a bit more than - expected. A complete list of changes bellow: - -- Fix #1404 - No more orphaned temporary directories. Commands, options, etc. that used to be - stored in there are included at build-time as here documents in the source. - -- Fix artifacts in =/tmp= after build - Upon fixing the above I became aware that the build itself was leaving behind a - heap of artifacts in =/tmp= that were not taken care of with a ~make clean~. - Fixed by using temporary files and directories in the build directory. Makefile - and build scripts adjusted. - -- Produce command aliases - Regular expressions in build scripts changed to produce all command aliases - except single letter ones (see below) - -- Do not propose single letters completions - It is simply not useful and adds a lot of noise. It makes completion slower as - well because you need to hit yes on the prompt: - > Display all 200 possibilities? (y or n) - =output-options.sh= now excludes those. - -- Query filters simplified - Keep only the prefix of the filter with the colon in =query-filters.txt=. This - change has two reasons: - - Single letter completions are not useful (see above) - - It allows for completion suggestions specific to each - - Bonus reason: it's a completion engine, not a user manual. - -- Fix completion impacts on global environment - The completion script was making a couple of changes to the global environment - which had an impact for the rest of the shell session. - - ~set -o pipefail~: the change is hidden from the user and could lead to subtle - errors throughout the shell session - - COMP_WORDBREAKS=" ": this affects subsequent completions for us and other - programs too. I exclude the colon =:= from its value and use - ~compopt -o filenames~ to handle escaping of special characters for us. I would - like to find a solution without messing with COMP_WORDBREAKS but it is not - straight forward. - -- Fix hiding of legit subcommands - Completion was hiding all possibilities if a subcommand happens to be the prefix - of another. On typing ~balance~, one should be proposed ~balancesheet~ and - ~balancesheetequity~ as well. - -- Return early - Try to complete depending on the current context and return immediately if - successful. Keep completion list relevant and as short as possible. - -- Context aware completion - - Add handlers for option parameter completion, see _hledger_compreply_optarg() - - Add handlers for query filters:, see _hledger_compreply_query() - - Use --file and --rules-file arguments when proposing completions for the - above, see _hledger() - - Propose only top level accounts at first. Again, keep it short and focused. - -- Custom ~compgen~ wrapper - ~compgen~ is fairly complicated. There is no way to feed it a word list with - literals. It will mangle your input in so many ways that we cannot trust it. To - work around this several wrappers are used: _hledger_compgen() works with - _hledger_quote_by_ref() to process and escape newline separated input which is - then fed to ~compgen~ and finally in ~COMPREPLY~ through _hledger_compreply() - and _hledger_compreply_append(). It sounds messy and I guess it is, I would like - to find a more straight forward way to do it. I think it is still a way better - and safer interface with ~readline~ than trying to ~grep~ our way through. - -- Replace ~declare~ with ~local~ - Again, this script is sourced by the shell -- keep variable scopes as narrow as - possible. - -- Use ~compopt -o nosort~ - Often I resort to using it to keep different groups of completions together. - Whether this is more ergonomic or not is subjective. But our input lists are - already sorted at build-time so why not. Sort manually =query-filters.txt= when - changing it. - -- Remove irrelevant comments - And add some new ones :) - - I think that is all. Give it a spin, try to abuse it, in and outside of quotes, - with some funky accounts, payees, tags, whatever, and tell me where it breaks or - behaves unexpectedly. - -- doc: explain roi-unrealised.ledger, reference to cookbook (Dmitry Astapov) - -- roi: roi-unrealised.example now works based on price directives (Dmitry Astapov) - -- bin: more robust --package syntax, comma form sometimes fails - -- examples: csv: daedalus wallet csv rules - -- cli: rename --infer-value to --infer-market-price - For clarity; infer-value was too vague. The old spelling remains - supported for compatibility, but is now deprecated. - When typing, --infer-market or even --infer (for now) is sufficient. - -- install: 1.20.4 - -- install: 1.20.3 - -- bin: switch to "runghc", drop "env -S" (#1453) - env -S isn't a thing on linux of course. Go back to using standard - env, which means using a stack options line, which means not using - "ghc". This new setup is probably simpler anyway. I've just had to - give up on the goal of having each script's required packages being - defined in one place; now (to they extent they are required) they - must be defined both in the script header and in compile.sh. - -- bin: switch scripts to "stack ghc" and "env -S" (#1453) - Using stack's script command meant that the scripts needed to be - compatible, and regularly tested, with a hledger release in stackage, - rather than the latest hledger source. This created hassles for - maintainers, contributors and sometimes for users. - - To simplify things overall, we now require script users to check out - the hledger source tree and run the scripts (or, bin/compile.sh) from - there once so they compile themselves. Some notes on alternative - setups are included (in one of the scripts, and referenced by the - others). This ensures that users and our CI tests are building scripts - the same way. - - Current stack does not allow a stack options line to be used with the - "stack ghc" command, unfortunately, so instead we are using env's -S - flag, which hopefully has sufficiently wide support by now, and - putting all arguments in the shebang line. - - This method will probably require complete explicit --package options, - unlike "stack script", so more testing and tweaking is expected. - Probably we're going to end up with some long shebang lines. - - This isn't pretty but seems like a possible way to keep things - manageable. - -- ci: really add addon-building tests to CI (#1453) - -- stack: 8.10: bump to latest nightly and ghc 8.10.3 - -- bin: Update bin scripts for new API. (Stephen Morgan) - -- bin: Update bin scripts for current hledger-lib. (Stephen Morgan) - (cherry picked from commit bc4aef17b7fa13ec0754b93325e1c5e5ee04f1e7) - -- ci: also test compilation of bin/ add-on scripts - -- doc: merge file format manuals into the hledger manual - Also flatten the journal manual topics a bit. - -- doc: rewrite commands intro - -- bin: switch to "runghc", drop "env -S" (#1453) - env -S isn't a thing on linux of course. Go back to using standard - env, which means using a stack options line, which means not using - "ghc". This new setup is probably simpler anyway. I've just had to - give up on the goal of having each script's required packages being - defined in one place; now (to they extent they are required) they - must be defined both in the script header and in compile.sh. - - (cherry picked from commit 32ccbba8050a26d09eb0fa8fdbc2c4b7ffe4f44c) - -- bin: switch scripts to "stack ghc" and "env -S" (#1453) - Using stack's script command meant that the scripts needed to be - compatible, and regularly tested, with a hledger release in stackage, - rather than the latest hledger source. This created hassles for - maintainers, contributors and sometimes for users. - - To simplify things overall, we now require script users to check out - the hledger source tree and run the scripts (or, bin/compile.sh) from - there once so they compile themselves. Some notes on alternative - setups are included (in one of the scripts, and referenced by the - others). This ensures that users and our CI tests are building scripts - the same way. - - Current stack does not allow a stack options line to be used with the - "stack ghc" command, unfortunately, so instead we are using env's -S - flag, which hopefully has sufficiently wide support by now, and - putting all arguments in the shebang line. - - This method will probably require complete explicit --package options, - unlike "stack script", so more testing and tweaking is expected. - Probably we're going to end up with some long shebang lines. - - This isn't pretty but seems like a possible way to keep things - manageable. - - (cherry picked from commit 2db87333d702d27ee45d8089ad4ad189bcb50cf2) - -- ci: really add addon-building tests to CI (#1453) - (cherry picked from commit 3ae6cf3200fad46cfbfa15c89e6d06dac309d76c) - -- ci: also test compilation of bin/ add-on scripts - (cherry picked from commit 06b466d847c46dc384cdef95658dade68111b173) - -- bin: Update bin scripts for current hledger-lib. (Stephen Morgan) - (cherry picked from commit bc4aef17b7fa13ec0754b93325e1c5e5ee04f1e7) - (cherry picked from commit a64d1aa6d0bcaf643bbe2607238026b4d26a3637) - # 1.20.4 2021-01-29 # 1.20.3 2021-01-14 diff --git a/hledger-lib/CHANGES.md b/hledger-lib/CHANGES.md index 805cacc51..b3e939d80 100644 --- a/hledger-lib/CHANGES.md +++ b/hledger-lib/CHANGES.md @@ -2,314 +2,96 @@ Internal/api/developer-ish changes in the hledger-lib (and hledger) packages. For user-visible changes, see the hledger package changelog. # ec4d131d2 -- lib: Default to PeriodChange report when using ValueChangeReport. (Stephen Morgan) -- lib,cli: Restore old --change option for per-period summation, use --sum for basic ValueChange balance report. (Stephen Morgan) +- Building Hledger.Data.Journal no longer fails if the monad-extras + package is installed. -- lib: transactionFile +- Many parts of the hledger-lib and hledger APIs have become more + Text-ified, expecting or returning Text instead of String, reducing + hledger's time and resident memory requirements by roughly 10%. + Some functions now use WideBuilder (a text "builder" which keeps track + of width), to concatenate text more efficiently. There are some + helpers for converting to and from WideBuilder (wbUnpack, wbToText..) + showAmountB/showMixedAmountB are new amount-displaying functions + taking an AmountDisplayOpts. These will probably replace the old + show(Mixed)Amount* functions. (#1427, Stephen Morgan) -- lib: Do not include price directives in journalDateSpan. Only include price directives after the last transaction/posting date if using --value=end. (Stephen Morgan) - Also enlarges the reportspan to encompass full intervals for budget - goals. +- AtThen valuation is now implemented for all report types. + amountApplyValuation now takes the posting date as an argument. + (transaction/posting)ApplyValuation's valuation type and + transaction/posting arguments have been reordered like + amountApplyValuation's. (Stephen Morgan) -- lib,cli: Add --valuechange report type for calculating change of value of accounts, restore --value=end behaviour to that of hledger-1.19. (Stephen Morgan) +- Amount, AmountPrice, AmountStyle, DigitGroupStyle fields are now + strict. (Stephen Morgan) -- lib,cli: Add --periodic option to indicate PeriodChange accumulation (renamed from --change). (Stephen Morgan) +- Amount prices are now stored with their sign, so negative prices can + be represented. (They seem to have always worked, but now the + internal representation is more accurate.) (Stephen Morgan) + +- normaliseMixedAmount now combines Amounts with TotalPrices in the + same commodity. (Stephen Morgan) -- lib: (amount|mixedAmount)(Looks|Is)Zero functions now check whether both the quantity and the cost are zero. This is usually what you want, but if you do only want to check whether the quantity is zero, you can run mixedAmountStripPrices (or similar) before this. (Stephen Morgan) - (multiply|divide)(Mixed)?Amount now also multiply or divide the +- normaliseMixedAmount now uses a strict Map for combining amounts + internally, closing a big space leak. (Stephen Morgan) + +- (multiply|divide)(Mixed)?Amount now also multiply or divide the TotalPrice if it is present, and the old - (multiply|divide)(Mixed)?AmountAndPrice functions are removed. + (multiply|divide)(Mixed)?AmountAndPrice functions are removed. (Stephen Morgan) -- lib: normaliseHelper now uses a strict Map for combining amounts internally, closing a big space leak. (Stephen Morgan) - This also now combines Amounts with TotalPrices in the same commodity - when normalising; amounts with TotalPrices were previously never - combined. +- (amount|mixedAmount)(Looks|Is)Zero functions now check whether both + the quantity and the cost are zero. This is usually what you want, + but if you do only want to check whether the quantity is zero, you + can run mixedAmountStripPrices (or similar) before this. (Stephen Morgan) -- lib: Distinguish between an Amount having quantity (or rounded quantity 0), and having both quantity and totalprice 0 (or rounded to 0). (Stephen Morgan) +- commodityStylesFromAmounts now consumes the list immediately, + reducing the maximum heap size per thread from ~850K to ~430K in a + real-world register report. (Stephen Morgan) -- lib: Make fields of Amount, AmountPrice, AmountStyle, and DigitGroupStyle strict. (Stephen Morgan) +- *ApplyValuation functions take two less arguments, and + *ApplyCostValuation functions have been added, performing both + costing and valuation. (Stephen Morgan) -- lib: Include sign in TotalPrice in Amount, rather than relying on the sign of aquantity. (Stephen Morgan) - Journal entries still require a positive @@ price, but now the sign is - set after parsing, rather than when converting in amountToCost. +- traceAtWith now has a level argument and works properly. - The reason for this change is that, if we're going to perform arithmetic - on Amount with TotalCost, then the presence of aquantity=0 means that - amountToCost would render the total cost as 0, because signum 0 == 0. - This makes journal entries like the following impossible to balance: - 2000-01-01 - a 0 @@ 10 A - b -10 A - -- lib: Consume list immediately in commodityStylesFromAmounts. (Stephen Morgan) - This reduced the maximum heap size per thread from ~850K to ~430K in a - real-world register test. - -- add, print --match: prioritise infix matches - If the search description occurs in full within the other description, - that match gets a +0.5 score boost. - -- add, lib: debug output, refactor similar transactions lookup - add --debug=1 shows the top hits for similar past transactions. - - added: - Hledger.Cli.Utils.journalSimilarTransaction - provides --debug=1 output - - changed: - Hledger.Cli.Commands.Add.transactionsSimilarTo -> Hledger.Data.Journal.journalTransactionsSimilarTo - now takes an extra number-of-results argument - -- Make sure to round up for the 'to' date (Arnout Engelen) - -- lib: avoid shady Not (Or []) in account type queries - -- bs: don't let just a Cash declaration hide Asset accounts - Clarify the account type queries a bit, and don't let a - declaration of account as Cash cause the fallback regex - for Asset accounts to be ignored. - -- bs: just declaring a Cash account no longer hides Asset accounts - Since Cash is also an Asset, declaring an account as Cash also disabled the fallback regexp for Asset accounts. - -- lib: refactor: more consistent amount precision helpers +- API changes include: + ``` Hledger.Data.Amount: - renamed: - setAmountPrecision -> amountSetPrecision - setFullPrecision -> amountSetFullPrecision - setMixedAmountPrecision -> mixedAmountSetPrecision - added: - mixedAmountSetFullPrecision + setAmountPrecision -> amountSetPrecision + setFullPrecision -> amountSetFullPrecision + setMixedAmountPrecision -> mixedAmountSetPrecision + showMixed -> showMixedAmountB + showMixedLines -> showMixedAmountLinesB + -mixedAmountSetFullPrecision -- cli: rename --infer-value to --infer-market-price - For clarity; infer-value was too vague. The old spelling remains - supported for compatibility, but is now deprecated. - When typing, --infer-market or even --infer (for now) is sufficient. - -- ui: transaction: show all decimal places (like print, cf #931) - On the accounts screen and register screen we round amounts according - to commodity styles, but when you drill down to a transaction you - probably want to see the unrounded amounts. - -- lib: refactor: rename journal/transaction mapping helpers Hledger.Data.Journal: - changed: - mapJournalTransactions -> journalMapTransactions - mapJournalPostings -> journalMapPostings - removed: - mapTransactionPostings + mapJournalTransactions -> journalMapTransactions + mapJournalPostings -> journalMapPostings + -mapTransactionPostings + +journalPayeesUsed + +journalPayeesDeclaredOrUsed Hledger.Data.Transaction: - added: - transactionMapPostings - -- print: always show all decimal places (#931) - Ensures parseable and more sensible-looking output in more cases, and behaves more like Ledger's print. - - There is still an issue with adding trailing zeroes, which would be nice to prevent. - -- print: don't add decimal places in assertion/assignment amounts either (#1465) - -- print: show all decimal places in assertion/assignment amounts (#1465) - Overriding the commodity style, per https://hledger.org/hledger.html#commodity-display-style. - -- doc: Remove references to --value=cost, replacing them with --cost. (Stephen Morgan) - Since this is option is now just an alias for -B/--cost, and since it - may be removed soon, we make it undocumented, though it will still - behave as before. --value=cost,COMM is unsupported as well. - -- lib,cli,ui: Separate costing from valuation; each can now be specified independently. (Stephen Morgan) - You can now combine costing and valuation, for example "--cost - --value=then" will first convert to costs, and then value according to - the "--value=then" strategy. Any valuation strategy can be used with or - without costing. - - If multiple valuation and costing strategies are specified on the - command line, then if any of them include costing - (-B/--cost/--value=cost) then amounts will be converted to cost, and for - valuation strategy the rightmost will be used. - - --value=cost is deprecated, but still supported and is equivalent to - --cost/-B. --value=cost,COMM is no longer supported, but this behaviour can be - achieved with "--cost --value=then,COMM". - -- lib,cli,ui: Introduce *ApplyCostValuation functions, which perform both costing and valuation. (Stephen Morgan) - This currently is given a dummy NoCost argument and is equivalent to - "maybe id (*ApplyValuation ...)", but provides a constant interface so - that internal behaviour can be changed freely. - -- lib: Use mapMixedAmount more, decreasing reliance on internal representation of Mixed. (Stephen Morgan) - -- lib: bal --value=end without --historical should not report on fluctuation in value of historical postings. (Stephen Morgan) - -- lib: matchesDescription, matchesPayeeWIP - -- lib: journalPayeesUsed, journalPayeesDeclaredOrUsed - -- lib: Journal: avoid a build failure if monad-extras is installed - -- lib: Expose textConcatBottomPadded. (Stephen Morgan) - -- lib: Rename alignCell to textCell, minor cleanups. (Stephen Morgan) - -- lib: Update textConcatTopPadded to use Tabular.AsciiWide, same as concatTopPadded. (Stephen Morgan) - -- lib: Refactor unlinesB to be cleaner and more efficient. (Stephen Morgan) - -- journal: allow commodity directive to set style of no-symbol commodity (#1461) - (cherry picked from commit c5571f6468ab11ffe3cd3f86a86f0b3253be10d1) - -- lib: Calculate value at posting date for register --value=then -M. (Stephen Morgan) - -- lib: Make sure to add a newline to the end of aregister report. (Stephen Morgan) - -- csv: handle more sign variations, eg a sign by itself - simplifySign now covers a few more sign combinations that might arise. - And in particular, it strips a standalone sign with no number, - which simplifies sign flipping with amount-in/amount-out. - -- lib: add level argument to fix traceAtWith - -- lib: Make sure AtEnd valuation behaviour is consistent between single- and multi-period reports (#1424). (Stephen Morgan) - -- lib,cli: Extend AtThen valuation to all report types. (Stephen Morgan) - Also adds a postingDate argument to amountApplyValuation, and re-orders - the ValuationType and (Transaction/Posting) arguments to - (transaction/posting)ApplyValuation, to be consistent with - amountApplyValuation. - -- new price search that really finds the shortest path (#1443) - This one should also reliably prevent runaway searches in the event of more bugs, giving up after 1000 iterations. - -- lib: valuation: simplify price search code - This version tries counting recursions instead of path length, but I - think they are the same. - -- lib: valuation: don't hang when finding prices (fixes #1439) - Searching for prices during valuation no longer now properly excludes - price loops, avoiding near infinite looping with certain - configurations of market prices. Also we now always use a direct price - when available, rather than searching unnecessarily. - - Price searching progress info, useful for troubleshooting, is now - displayed with --debug=2. - - There could still be some corner cases we don't handle correctly. We - now give up with an error message if the searched price chains get too - long (> 1000). More importantly, we should also give up if the search - iterates too many times, but this is not done yet. - -- lib: Make consistent naming scheme for showMixedAmount* functions, add conversion between old API and new API in the documentation. (Stephen Morgan) - -- doc: Fix some outdated documentation. (Stephen Morgan) - -- lib,cli: Assorted fixes for older GHC. (Stephen Morgan) - -- lib,cli,ui: Replace some uses of String with Text, get rid of some unpacks, clean up showMixed options. (Stephen Morgan) - -- lib: Use Text and Text builder only in postingAsLines. (Stephen Morgan) - -- lib,cli,ui: Use WideBuilder for Tabular.AsciiWide. (Stephen Morgan) - Move WideBuilder to Text.WideString. - -- lib,cli,ui: Implement all showMixed* functions in terms of DisplayAmountOpts and WideBuilder. (Stephen Morgan) - -- lib: Use AmountDisplayOpts for showAmount*, reducing need for many different named functions. (Stephen Morgan) - -- lib: Implement showAmountHelper using AmountBuilder. (Stephen Morgan) - -- lib: showamountquantity shows directly, rather than parsing string output of show instance for Quantity. (Stephen Morgan) - -- lib: Remove unused optional width argument for StringFormat. (Stephen Morgan) - -- lib,cli: Use Text Builder for Balance commands. (Stephen Morgan) - -- lib,cli: Use Text for CompoundPeriodicReport titles. (Stephen Morgan) - -- lib,cli: Use Text for CSV values. (Stephen Morgan) - -- lib,cli,ui: Use Text for showDate and related. (Stephen Morgan) - -- lib,cli: Make showTransaction return Text rather than String. (Stephen Morgan) - -- lib: Remove unused label on TranspactionReport and AccountTransactionsReport. (Stephen Morgan) - -- lib,cli: Use Text Builder for Account Transaction Reports. (Stephen Morgan) - -- lib: Add wrap convenience function. (Stephen Morgan) - -- cli: Using Text Builder for posting reports. (Stephen Morgan) - -- journal: Ignore AUTO commodity when strict checking (aragaer) - AUTO commodity is a placeholder for postings with missing amounts. It - should be ignored when doing a strict commodity check. - - Fixes #1419 - -- check: also check "accounts"/"commodities" on demand - (cherry picked from commit 0c2bf54f2955e3a25fd0282acc42608f957abaea) - -- check: add "payees" check requiring payee declarations - -- bin: Update bin scripts for current hledger-lib. (Stephen Morgan) - (cherry picked from commit bc4aef17b7fa13ec0754b93325e1c5e5ee04f1e7) - -- Removed: - valuationTypeIsCost - valuationTypeIsDefaultValue - ValuationType's AtDefault constructor - -- Changed: - *ApplyValuation functions take two less arguments - -- journal: allow commodity directive to set style of no-symbol commodity (#1461) - (cherry picked from commit c5571f6468ab11ffe3cd3f86a86f0b3253be10d1) - (cherry picked from commit 034c317496e99271ebabc53af112ad88e054b7ab) - -- lib: Calculate value at posting date for register --value=then -M. (Stephen Morgan) - -- bin: Update bin scripts for current hledger-lib. (Stephen Morgan) - (cherry picked from commit bc4aef17b7fa13ec0754b93325e1c5e5ee04f1e7) - (cherry picked from commit a64d1aa6d0bcaf643bbe2607238026b4d26a3637) - -- lib,cli: Revert --value=end PeriodChange behaviour to hledger-1.19, i.e. calculating the value of the change, rather than the change of the value. (Stephen Morgan) - -- new price search that really finds the shortest path (#1443) - This one should also reliably prevent runaway searches in the event of more bugs, giving up after 1000 iterations. - - (cherry picked from commit 3d7d5c0db7509299acf3d33530728f834345959a) - -- lib: valuation: simplify price search code - This version tries counting recursions instead of path length, but I - think they are the same. - - (cherry picked from commit 7c9303a15c64859f11aec8fa75546793827e3086) - -- lib: valuation: don't hang when finding prices (fixes #1439) - Searching for prices during valuation no longer now properly excludes - price loops, avoiding near infinite looping with certain - configurations of market prices. Also we now always use a direct price - when available, rather than searching unnecessarily. - - Price searching progress info, useful for troubleshooting, is now - displayed with --debug=2. - - There could still be some corner cases we don't handle correctly. We - now give up with an error message if the searched price chains get too - long (> 1000). More importantly, we should also give up if the search - iterates too many times, but this is not done yet. - - (cherry picked from commit 73678393b1ec9ea414d798ade9da6e5666c079c2) - -- journal: Ignore AUTO commodity when strict checking (aragaer) - AUTO commodity is a placeholder for postings with missing amounts. It - should be ignored when doing a strict commodity check. - - Fixes #1419 - - (cherry picked from commit 2084b845e09d2249a5d0e120805798730eeb4b6d) - + +transactionFile + +transactionMapPostings + + Hledger.Data.Valuation: + -valuationTypeIsCost + -valuationTypeIsDefaultValue + -ValuationType's AtDefault constructor + + Hledger.Query: + +matchesDescription + +matchesPayeeWIP + + Hledger.Utils.Text: + +textConcatBottomPadded + +wbToText + +wbUnpack + + Text.Tabular.AsciiWide: + alignCell -> textCell + ``` # 1.20.4 2021-01-29 - See hledger. diff --git a/hledger-ui/CHANGES.md b/hledger-ui/CHANGES.md index 981c5940b..163f6b96f 100644 --- a/hledger-ui/CHANGES.md +++ b/hledger-ui/CHANGES.md @@ -2,70 +2,19 @@ User-visible changes in hledger-ui. See also the hledger changelog. # ec4d131d2 -- ui, web: make --man and --info work, similar to hledger - (cf #1410) -- Make sure to round up for the 'to' date (Arnout Engelen) +- Register screen: also show transactions below the depth limit, as in + 1.19, keeping the register balance in agreement with the balance + shown on the accounts screen. This regressed in 1.20. (#1468) -- lib: refactor: more consistent amount precision helpers - Hledger.Data.Amount: - renamed: - setAmountPrecision -> amountSetPrecision - setFullPrecision -> amountSetFullPrecision - setMixedAmountPrecision -> mixedAmountSetPrecision - added: - mixedAmountSetFullPrecision +- Transaction screen: all decimal places are now shown. On the + accounts screen and register screen we round amounts according to + commodity display styles, but when you drill down to a transaction + you probably want to see the unrounded amounts. (Like print, #cf + 931.) -- ui: transaction: show all decimal places (like print, cf #931) - On the accounts screen and register screen we round amounts according - to commodity styles, but when you drill down to a transaction you - probably want to see the unrounded amounts. - -- lib,cli,ui: Separate costing from valuation; each can now be specified independently. (Stephen Morgan) - You can now combine costing and valuation, for example "--cost - --value=then" will first convert to costs, and then value according to - the "--value=then" strategy. Any valuation strategy can be used with or - without costing. - - If multiple valuation and costing strategies are specified on the - command line, then if any of them include costing - (-B/--cost/--value=cost) then amounts will be converted to cost, and for - valuation strategy the rightmost will be used. - - --value=cost is deprecated, but still supported and is equivalent to - --cost/-B. --value=cost,COMM is no longer supported, but this behaviour can be - achieved with "--cost --value=then,COMM". - -- lib,cli,ui: Introduce *ApplyCostValuation functions, which perform both costing and valuation. (Stephen Morgan) - This currently is given a dummy NoCost argument and is equivalent to - "maybe id (*ApplyValuation ...)", but provides a constant interface so - that internal behaviour can be changed freely. - -- ui: register: show all txns in/under an account at depth limit (#1468) - As in 1.19. This was broken since 2020-09-02 c45663d41. - -- lib,cli: Extend AtThen valuation to all report types. (Stephen Morgan) - Also adds a postingDate argument to amountApplyValuation, and re-orders - the ValuationType and (Transaction/Posting) arguments to - (transaction/posting)ApplyValuation, to be consistent with - amountApplyValuation. - -- lib: Make consistent naming scheme for showMixedAmount* functions, add conversion between old API and new API in the documentation. (Stephen Morgan) - -- lib,cli,ui: Replace some uses of String with Text, get rid of some unpacks, clean up showMixed options. (Stephen Morgan) - -- lib,cli,ui: Use WideBuilder for Tabular.AsciiWide. (Stephen Morgan) - Move WideBuilder to Text.WideString. - -- lib,cli,ui: Implement all showMixed* functions in terms of DisplayAmountOpts and WideBuilder. (Stephen Morgan) - -- lib,cli,ui: Use Text for showDate and related. (Stephen Morgan) - -- lib,cli: Make showTransaction return Text rather than String. (Stephen Morgan) - -- lib: Remove unused label on TranspactionReport and AccountTransactionsReport. (Stephen Morgan) - -- lib,cli: Use Text Builder for Account Transaction Reports. (Stephen Morgan) +- New flags `--man` and `--info` open the man page or info manual. + (See hledger changelog) # 1.20.4 2021-01-29 diff --git a/hledger-web/CHANGES.md b/hledger-web/CHANGES.md index bcb4a51b7..0a5407cf9 100644 --- a/hledger-web/CHANGES.md +++ b/hledger-web/CHANGES.md @@ -2,19 +2,15 @@ User-visible changes in hledger-web. See also the hledger changelog. # ec4d131d2 -- ui, web: make --man and --info work, similar to hledger - (cf #1410) -- Make sure to round up for the 'to' date (Arnout Engelen) +- Register: a date range can be selected by dragging over a region on + the chart. (Arnout Engelen, #1471) -- Allow selecting the date range from the chart (Arnout Engelen) - By dragging a region with the mouse +- Add form: the description field's autocompletions now also offer + declared and used payee names. -- web: add form: in description field also offer declared/used payees - -- lib,cli: Make showTransaction return Text rather than String. (Stephen Morgan) - -- lib: Remove unused label on TranspactionReport and AccountTransactionsReport. (Stephen Morgan) +- New flags `--man` and `--info` open the man page or info manual. + (See hledger changelog) # 1.20.4 2021-01-29 diff --git a/hledger/CHANGES.md b/hledger/CHANGES.md index e81b46bbf..e8e3a2cab 100644 --- a/hledger/CHANGES.md +++ b/hledger/CHANGES.md @@ -2,277 +2,170 @@ User-visible changes in the hledger command line tool and library. # ec4d131d2 -- test: Test bal --valuechange throws an error for bad --value options. (Stephen Morgan) -- lib: Default to PeriodChange report when using ValueChangeReport. (Stephen Morgan) +## general -- lib,cli: Restore old --change option for per-period summation, use --sum for basic ValueChange balance report. (Stephen Morgan) +- 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) -- cli: Allow overriding with --periodic (rather than the old --change) and properly calculate requestedspan in CompoundBalanceReport. (Stephen Morgan) - -- check: ordereddates now checks each file separately (fix #1493) - -- lib: Do not include price directives in journalDateSpan. Only include price directives after the last transaction/posting date if using --value=end. (Stephen Morgan) - Also enlarges the reportspan to encompass full intervals for budget - goals. - -- bal: docs rewritten, and updated for new flags - -- lib,cli: Add --valuechange report type for calculating change of value of accounts, restore --value=end behaviour to that of hledger-1.19. (Stephen Morgan) - -- lib,cli: Add --periodic option to indicate PeriodChange accumulation (renamed from --change). (Stephen Morgan) - -- roi: cmdline help simplified (Dmitry Astapov) - -- roi: check valuation on dates we have price directives for (Dmitry Astapov) - -- roi: honor all kinds of --value switches (Dmitry Astapov) - -- print --match: show --match's argument in debug output - If you forget that the argument is required by the --match - option, and not the command as a whole - eg if instead of - - hledger print --match somebank -x - - you write: - - hledger print --match -x somebank - - that gets quietly parsed as: - - hledger print --match="-x" - - which is not great. Adding --debug now at least gives some insight: - - hledger print --match -x somebank --debug - finding best match for description: "-x" - similar transactions: - ... - -- add, lib: debug output, refactor similar transactions lookup - add --debug=1 shows the top hits for similar past transactions. - - added: - Hledger.Cli.Utils.journalSimilarTransaction - provides --debug=1 output - - changed: - Hledger.Cli.Commands.Add.transactionsSimilarTo -> Hledger.Data.Journal.journalTransactionsSimilarTo - now takes an extra number-of-results argument - -- Make sure to round up for the 'to' date (Arnout Engelen) - -- bs: just declaring a Cash account no longer hides Asset accounts - Since Cash is also an Asset, declaring an account as Cash also disabled the fallback regexp for Asset accounts. - -- lib: refactor: more consistent amount precision helpers - Hledger.Data.Amount: - renamed: - setAmountPrecision -> amountSetPrecision - setFullPrecision -> amountSetFullPrecision - setMixedAmountPrecision -> mixedAmountSetPrecision - added: - mixedAmountSetFullPrecision - -- cli: rename --infer-value to --infer-market-price - For clarity; infer-value was too vague. The old spelling remains - supported for compatibility, but is now deprecated. - When typing, --infer-market or even --infer (for now) is sufficient. - -- print: always show all decimal places (#931) - Ensures parseable and more sensible-looking output in more cases, and behaves more like Ledger's print. - - There is still an issue with adding trailing zeroes, which would be nice to prevent. - -- print: don't add decimal places in assertion/assignment amounts either (#1465) - -- print: show all decimal places in assertion/assignment amounts (#1465) - Overriding the commodity style, per https://hledger.org/hledger.html#commodity-display-style. - -- doc: Document new independent costing and valuation features in manual. (Stephen Morgan) - -- doc: Remove references to --value=cost, replacing them with --cost. (Stephen Morgan) - Since this is option is now just an alias for -B/--cost, and since it - may be removed soon, we make it undocumented, though it will still - behave as before. --value=cost,COMM is unsupported as well. - -- lib,cli,ui: Separate costing from valuation; each can now be specified independently. (Stephen Morgan) - You can now combine costing and valuation, for example "--cost - --value=then" will first convert to costs, and then value according to - the "--value=then" strategy. Any valuation strategy can be used with or - without costing. - - If multiple valuation and costing strategies are specified on the - command line, then if any of them include costing - (-B/--cost/--value=cost) then amounts will be converted to cost, and for - valuation strategy the rightmost will be used. - - --value=cost is deprecated, but still supported and is equivalent to - --cost/-B. --value=cost,COMM is no longer supported, but this behaviour can be - achieved with "--cost --value=then,COMM". - -- lib,cli,ui: Introduce *ApplyCostValuation functions, which perform both costing and valuation. (Stephen Morgan) - This currently is given a dummy NoCost argument and is equivalent to - "maybe id (*ApplyValuation ...)", but provides a constant interface so - that internal behaviour can be changed freely. - -- test: Period change reports should not see historical postings when performing valuation. (Stephen Morgan) - -- lib: bal --value=end without --historical should not report on fluctuation in value of historical postings. (Stephen Morgan) - -- areg: ignore a depth limit, as in 1.19 (#1468) - aregister always shows transactions to subaccounts as well, ignoring any depth limit, so that the register's final total matches a corresponding balance report. - This was broken since 2020-09-02 c45663d41. - -- payees: add --used/--declared flags, like accounts - -- make testscript POSIX and shellchecked (Felix Van der Jeugt) - -- lib: Rename alignCell to textCell, minor cleanups. (Stephen Morgan) - -- journal: doc: clarify number formats, display styles (#1461) - -- lib: Calculate value at posting date for register --value=then -M. (Stephen Morgan) - -- roi: use MixedAmount more and keep styles when reporting commodities (Dmitry Astapov) - -- roi: fix insane precision bug, discovered in #1417 (Dmitry Astapov) - -- cli,csv: Fix --drop option in csv output format (aragaer) - -- lib: roi now supports --value/--infer-value (Dmitry Astapov) - -- lib: better message when roi fails to value commodity, fixes #1446 (Dmitry Astapov) - -- lib: Make sure to add a newline to the end of aregister report. (Stephen Morgan) - -- doc,tests: Document new --value=then functionality and add tests. (Stephen Morgan) - -- check: uniqueleafnames: fancy error message like the others - -- csv: handle more sign variations, eg a sign by itself - simplifySign now covers a few more sign combinations that might arise. - And in particular, it strips a standalone sign with no number, - which simplifies sign flipping with amount-in/amount-out. - -- check: accept case-insensitive prefixes as arguments - Might a bad idea, but avoiding wasteful typing.. - -- lib,cli: Extend AtThen valuation to all report types. (Stephen Morgan) - Also adds a postingDate argument to amountApplyValuation, and re-orders - the ValuationType and (Transaction/Posting) arguments to - (transaction/posting)ApplyValuation, to be consistent with - amountApplyValuation. - -- new price search that really finds the shortest path (#1443) - This one should also reliably prevent runaway searches in the event of more bugs, giving up after 1000 iterations. - -- cli: Remove redundant import, add some CPP. (Stephen Morgan) - -- test: Update for tests failing now that it's 2021. (Stephen Morgan) - -- lib: Make consistent naming scheme for showMixedAmount* functions, add conversion between old API and new API in the documentation. (Stephen Morgan) - -- lib,cli: Assorted fixes for older GHC. (Stephen Morgan) - -- lib,cli,ui: Replace some uses of String with Text, get rid of some unpacks, clean up showMixed options. (Stephen Morgan) - -- lib: Use Text and Text builder only in postingAsLines. (Stephen Morgan) - -- lib,cli,ui: Use WideBuilder for Tabular.AsciiWide. (Stephen Morgan) - Move WideBuilder to Text.WideString. - -- lib,cli,ui: Implement all showMixed* functions in terms of DisplayAmountOpts and WideBuilder. (Stephen Morgan) - -- lib: Remove unused optional width argument for StringFormat. (Stephen Morgan) - -- lib,cli: Use Text Builder for Balance commands. (Stephen Morgan) - -- lib,cli: Use Text for CompoundPeriodicReport titles. (Stephen Morgan) - -- lib,cli: Use Text for CSV values. (Stephen Morgan) - -- lib,cli,ui: Use Text for showDate and related. (Stephen Morgan) - -- lib,cli: Make showTransaction return Text rather than String. (Stephen Morgan) - -- cli: Refactor compoundBalanceCommand. (Stephen Morgan) - -- lib: Remove unused label on TranspactionReport and AccountTransactionsReport. (Stephen Morgan) - -- lib,cli: Use Text Builder for Account Transaction Reports. (Stephen Morgan) - -- cli: Use Text Builder for Entries Reports. (Stephen Morgan) - -- lib: Add wrap convenience function. (Stephen Morgan) - -- cli: Using Text Builder for posting reports. (Stephen Morgan) - -- doc: journal: document payee directive - -- check: ordereddates: test --date2, clarify --unique and QUERY dropped - -- check: drop old checkdates/checkdupes commands, consolidate - -- check: also check "accounts"/"commodities" on demand - (cherry picked from commit 0c2bf54f2955e3a25fd0282acc42608f957abaea) - -- check: add "payees" check requiring payee declarations - -- The --help/-h and --version flags are no longer position-sensitive; +- 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 new `--info` flag opens the hledger info manual, if "info" is in $PATH. + `hledger COMMAND --info` will open COMMAND's info node. -- The new --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" +- 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.) -- help: show only the hledger manual +- Some command aliases, which were 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. -- help: replace --info/--man/--pager flags with -i/-m/-p; drop --cat +## 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` (for now) 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, it will open the manual at TOPIC (any heading or heading prefix, case insensitive) if possible - (cf --man/--info). + (like the new `--man` and `--info` flags, described above). -- drop deprecated command aliases: a, b, p, r, txns +- payees: Add `--used`/`--declared` flags, like the `accounts` command. -- hide deprecated command alias: equity +- 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 is an unfixed cosmetic issue with + adding trailing zeroes.) (#931, #1465) -- doc: merge file format manuals into the hledger manual - Also flatten the journal manual topics a bit. +- print: With `--match`, infix matches are now scored higher, as with + the add command. -- doc: sync/update manual & cli command lists +- print: Now provides some debug output for troubleshooting `--match`. -- doc: reorganise/flatten hledger manual, rewrite commands section + If you forget to give `--match` an argument, it can confusingly + consume a following flag. Eg if you write: -- Valuation has changed: -V is now always equivalent to --value=end. (Stephen Morgan) + hledger print --match -x somebank # should be: hledger print --match=somebank -x -- Include empty columns in MultiBalanceReports. (Stephen Morgan) - This was previously done for CompoundBalanceReport and when --empty was - called; this makes the behaviour consistent. + it gets quietly parsed as: -- Include market price directives when calculating journal end date. (Stephen Morgan) + hledger print --match="-x" -- lib: Calculate value at posting date for register --value=then -M. (Stephen Morgan) + Now you can at least use --debug to figure it out: -- lib: better message when roi fails to value commodity, fixes #1446 (Dmitry Astapov) - (cherry picked from commit 9869624c5c42751dac5b431827b2fb368da43070) + hledger print --match -x somebank --debug + finding best match for description: "-x" + similar transactions: + ... -- cli,csv: Fix --drop option in csv output format (aragaer) - (cherry picked from commit 7bde3345b89422c21ffee6f61712c8c225bc9577) +- roi: The manual has been simplified, with some content moved to the + hledger.org Cookbook. (Dmitry Astapov) -- lib,cli: Revert --value=end PeriodChange behaviour to hledger-1.19, i.e. calculating the value of the change, rather than the change of the value. (Stephen Morgan) +- roi: Now supports the valuation options. (Dmitry Astapov) -- test: Update for tests failing now that it's 2021. (Stephen Morgan) +- roi: use MixedAmount more and keep styles when reporting commodities. (Dmitry Astapov) -- new price search that really finds the shortest path (#1443) - This one should also reliably prevent runaway searches in the event of more bugs, giving up after 1000 iterations. +- roi: fix insane precision bug. (#1417, 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