Skip to content

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
merged 1 commit into from
Jun 24, 2025

Conversation

Xitian9
Copy link
Collaborator

@Xitian9 Xitian9 commented Jun 18, 2025

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.

@Xitian9 Xitian9 changed the title imp: lib: Allow special string %acct in auto-posting rules (#1975) imp: lib: Allow special string %(account) in auto-posting rules (#1975) Jun 19, 2025
@Xitian9 Xitian9 changed the title imp: lib: Allow special string %(account) in auto-posting rules (#1975) feat: lib: Allow special string %(account) in auto-posting rules (#1975) Jun 19, 2025
@simonmichael simonmichael added A-WISH Some kind of improvement request or proposal. journal The journal file format, and its features. labels Jun 20, 2025
@simonmichael
Copy link
Owner

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.

@simonmichael simonmichael added the needs-discussion To unblock: needs more discussion/review/exploration label Jun 20, 2025
@Xitian9
Copy link
Collaborator Author

Xitian9 commented Jun 20, 2025 via email

@simonmichael
Copy link
Owner

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.

@Xitian9 Xitian9 changed the title feat: lib: Allow special string %(account) in auto-posting rules (#1975) feat: lib: Allow special string %account in auto-posting rules (#1975) Jun 24, 2025
@Xitian9
Copy link
Collaborator Author

Xitian9 commented Jun 24, 2025

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.
@simonmichael simonmichael removed the needs-discussion To unblock: needs more discussion/review/exploration label Jun 24, 2025
@simonmichael simonmichael merged commit 8ab2fb6 into simonmichael:master Jun 24, 2025
1 check passed
@simonmichael
Copy link
Owner

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-WISH Some kind of improvement request or proposal. journal The journal file format, and its features.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants