-
-
Notifications
You must be signed in to change notification settings - Fork 307
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
matching, tags, comments, scope confusion with hledger rewrite / hledger print --auto #745
Comments
Thanks for the report. That sounds like a reasonable expectation, and it would be a welcome enhancement for the rewrite command. I have never used rewrite myself. IIRC it is a more featureful alternative to the built-in http://hledger.org/manual.html#automated-postings. Could those work for you/do they work any better ? |
Cf http://hledger.org/manual.html#rewrite and the more informative |
Tag
If you would write:
Then you may expect it to be applied to transaction level and avoid rewriting whole transaction. But it should be said somewhere in docs that |
thanks for the quick feedback. @ony I've updated the sample.rewrite file to look like this (your comment overlapped so I edited this comment to reflect your input):
Then, I've tried using automated postings with the --auto option and the files mentioned above on hledger version 1.9 with the following command:
But this gives the following result:
I'm unsure whether I should expect this. On a side note: When removing the account name from the sample.rewrite file like this:
gives:
I would not expected this output as well. Possibly, a good place to start debugging. For the time being, I'll change my workflow to side step the issue. Thanks again. |
Definitely, adding comment to the last posting in transaction of matched posting is unexpected and useless behavior that should be changed. @msmart , @simonmichael , since issue is not matching but adding comments what you think about changing title of this issue to something like "Transaction-level comments in automated postings"? Let's also clarify some ambiguity.
In this case we have two postings that may trigger adding
If we'll change current behavior and don't user result of previous automated postings to apply next ones (already quiet broken) then it can be like:
@simonmichael, what you think about dropping feature of adding automated postings for automated postings? |
All sounds good @ony. If somebody needs to add postings in several stages, they can pipeline multiple commands. |
This is quite hard to follow and requires careful reading. More notes:
|
|
In short: I've updated rewrite's help, which now says:
And, I'm not currently seeing any bug here, aside from the confusing overlap of rewrite and print --auto. |
Oh, and the misparsing of a "transaction comment" inside an automated posting rule. |
Previously they were misparsed as account names.
I was negligent and did not test enough. This should ignore transaction comments in auto posting rules more safely. It also adds support for trailing comments on the first line of auto posting rules, which previously were misparsed as part of the query.
I'm trying to use
hledger rewrite
to rewrite postings which match certain tags combinations. I would like to runhledger rewrite
several times without adding additional rewrites.To this end, I thought I can add the tag "rewritten" to the rewritten posting and ignore them in the query of the rewrite rule. But in my environment this is not working as I would expect it to.
Given the following sample.ledger file:
and the following sample.rewrite file
The
hledger rewrite -f sample.journal -f sample.rewrite| hledger print -f -
gives:However,
hledger rewrite -f sample.journal -f sample.rewrite|hledger print -f -|hledger rewrite -f - -f sample.rewrite
givesI would have expected that the posting with details:beer and tag:rewritten would not match a second time.
Am I missing something here?
PS: Thanks to all involved in the development of hledger from a happy user.
The text was updated successfully, but these errors were encountered: