-
-
Notifications
You must be signed in to change notification settings - Fork 331
feat: lib: Allow special string %account in auto-posting rules (#1975) #2412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
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
Thanks for this. I have seen the %(...) syntax somewhere, but do we use it anywhere in hledger ? %account seems better to me. Is the example in the test correct ? 19% of 1190 should be 226.10 I though. |
Happy for you to make the call on exactly which format to use. The
advantage of the brackets is that strings like `%accountfoo` are hard to
parse from a human perspective, while `%(account)foo` makes clear where the
special string lies, bit this is clearly not a common use.
My understanding of the example (taken from OP) is that you are selling an
item costing 1000, and 19% VAT is applied, bringing the total amount of
money you receive to 1190. However, you owe 190 of that to the government.
You are therefore seeking to recover the original 1000, which means
multiplying by 1/1.19, and the VAT is (1 - 1/1.19) times the original
amount.
…On Fri, 20 June 2025, 11:18 Simon Michael, ***@***.***> wrote:
*simonmichael* left a comment (simonmichael/hledger#2412)
<#2412 (comment)>
Thanks for this. I have seen the %(...) syntax somewhere, but do we use it
anywhere in hledger ? %account seems better to me.
Is the example in the test correct ? 19% of 1190 should be 226.10 I though.
—
Reply to this email directly, view it on GitHub
<#2412 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AEM7WVFSTF6JP7ZGS46WG433ENOPFAVCNFSM6AAAAAB7SUZBUOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDSOBZGU2DENRXHA>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
Ah I see. I think for consistency I'd prefer to support just %account for now nevertheless. I think it will be rare for people to use %account immediately followed by letters. |
Updated. |
…michael#1975) This allows using the special string `%account` in auto posting rules. When run, this will be substituted with the account name of the matched posting.
Thank you very much! |
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.
This allows using the special string
%account
in auto posting rules. When run, this will be substituted with the account name of the matched posting.This is a minimal implementation of #1975. More bells and whistles can be added if we decide what features exactly we want to support here.
We may want to use the string
%(acct)
or%acct
instead of%account
.