;doc: cherry pick recent edited changelogs from 1.21-branch

This commit is contained in:
Simon Michael 2021-03-08 15:15:57 -08:00
parent 325aa15f74
commit ec4d131d22
5 changed files with 1109 additions and 5 deletions

View File

@ -1,7 +1,566 @@
General project-related changes and major/notable all-package releases.
For package-specific changes and minor releases, see the package changelogs.
# a5f9f8ce0
# fce0a690d
- Merge branch 'bash-completion' (#1410)
An extensive overhaul by @zhelezov of the bash programmable
completions in shell-completions/.
"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 :)
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 > <TAB>
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.

View File

@ -1,7 +1,259 @@
Internal/api/developer-ish changes in the hledger-lib (and hledger) packages.
For user-visible changes, see the hledger package changelog.
# a5f9f8ce0
# efb37c334
- 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)
- lib: transactionFile
- 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.
- 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)
- 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
TotalPrice if it is present, and the old
(multiply|divide)(Mixed)?AmountAndPrice functions are removed.
- 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.
- lib: Distinguish between an Amount having quantity (or rounded quantity 0), and having both quantity and totalprice 0 (or rounded to 0). (Stephen Morgan)
- lib: Make fields of Amount, AmountPrice, AmountStyle, and DigitGroupStyle strict. (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.
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
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.
- 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
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

View File

@ -1,7 +1,71 @@
User-visible changes in hledger-ui.
See also the hledger changelog.
# a5f9f8ce0
# ffb985f1a
- ui, web: make --man and --info work, similar to hledger
(cf #1410)
- Make sure to round up for the 'to' date (Arnout Engelen)
- lib: refactor: more consistent amount precision helpers
Hledger.Data.Amount:
renamed:
setAmountPrecision -> amountSetPrecision
setFullPrecision -> amountSetFullPrecision
setMixedAmountPrecision -> mixedAmountSetPrecision
added:
mixedAmountSetFullPrecision
- 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)
# 1.20.4 2021-01-29

View File

@ -1,7 +1,20 @@
User-visible changes in hledger-web.
See also the hledger changelog.
# a5f9f8ce0
# ffb985f1a
- ui, web: make --man and --info work, similar to hledger
(cf #1410)
- Make sure to round up for the 'to' date (Arnout Engelen)
- Allow selecting the date range from the chart (Arnout Engelen)
By dragging a region with the mouse
- 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)
# 1.20.4 2021-01-29

View File

@ -1,7 +1,223 @@
User-visible changes in the hledger command line tool and library.
# a5f9f8ce0
# 3a7c578f2
- test: Test bal --valuechange throws an error for bad --value options. (Stephen Morgan)
- 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)
- 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;
if there is a command argument, they now always refer to the command