feat: areg: Add --matching flag#2592
Open
alerque wants to merge 15 commits into
Open
Conversation
…oday Similar transactions were being date-weighted by their distance from the journal's latest transaction date. This meant a future-dated transaction, perhaps caused by a typo, could be greatly prioritised, causing an unexpected choice of transaction to use for defaults. Now, we date-weight by absolute distance (past or future) from today's date.
…r it Port three Gain-related changes from hledger2 to improve compatibility between hledger 1 and 2: 1. Don't infer Gain (G) type from account names; it must be declared explicitly with a type: tag. 2. Exclude Gain postings from transaction balancing. 3. Because Gain postings can be left amountless, always exclude amountless postings from reports.
This was backported recently from the hledger2 branch to better match hledger 2's behaviour and allow easier interop on the same journal files. Since then hledger 2 has switched to a better strategy. So we can revert and pretend this never happened. The Gain account type itself remains; and also some defensive changes making reports ignore postings which have had no amount inferred for them. This shouldn't happen any more with the Gain balancing exception gone, but I have left those changes in, on the assumption that if it arises again it's better to omit such postings than show a report with broken layout.
U/UnrealisedGain is a subtype of Equity. Like G/Gain, it's added here just to allow hledger 1.x to read hledger 2's journal files. For this one, the type: tag will accept any of these spellings: U, UnrealisedGain, UnrealizedGain.
Works like the inverse of the --related flag on register.
Owner
|
Could you rebase this against main when you get a chance. |
Owner
|
I like the result. I wonder how we can make the default and optional behaviours a bit more intuitive/consistent/easy to explain. I'm thinking also of the slightly complex behaviour described on #2540, and the slightly unintuitively named -r/--related flag (an option on register, the default mode on aregister). Here are four modes (of the current PR) for us to contemplate: |
Owner
|
--matching and --related aren't immediately obvious as flags or antonyms. --related/-r came from Ledger, and we'll keep it for compatibility. But perhaps we should consider adding --show-matched and --show-other ? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Re-opening of #2541. Fixes #2540.