-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
Proposal: persisting the autopostings to journal files would allow for review of changes made to rewriting rules #63
Comments
Interesting use case - I haven't yet used auto postings. I'd like to add some to my personal journals so that I can run into the same issues you're describing. The next week or two will be difficult though - but you're welcome to remind me about this if you haven't seen any activity in a few weeks. |
I don't use autopostings much yet, but seeing the effects of my changes in journals would allow me to experiment much more with them. |
This is not urgent |
I have the following (working) workaround First, make it possible to override the hledger command in the scope of my root import directory (in the root import directory)
$ cat .envrc
PATH_add $(expand_path .) Then, override the hledger command in such a way that hledger-flow picks it up $ cat hledger
#!/usr/bin/env bash
MYDIR=$(readlink -e $(dirname "$0"))
set -euxo pipefail
case $@ in
print\ *--file\ -*)
cat "${MYDIR}/explicit-autopostings.journal" - | "${HOME}/.local/bin/hledger" "$@" --auto
;;
--version|--help)
"${HOME}/.local/bin/hledger" "$@"
;;
print\ --forecast*)
"${HOME}/.local/bin/hledger" "$@"
;;
print\ --rules-file*)
"${HOME}/.local/bin/hledger" "$@"
;;
*)
echo "unhandled: " "$@" 1>&2
exit 1
;;
esac A few notes:
As a result, my |
Is your feature request related to a problem? Please describe.
I use autoposting rules to keep track of some out-of-pocket expenses that my company owes me.
If I make a change to an autoposting rule, I would like to review the ripple effect of the change, and of course version control it (not just the rule, all affected postings). If a change has many ripple effects, I'm much more likely to spot a problem at the
gif diff
stage. Currently I only see a problem when runninghledger-ui
after painfully looking for the transaction. If there is a problem with hledger itself (as when the synthetic transaction contains amounts that are formatted in an ambiguous way), I can't do anything, as the transaction does not 'exist' on the filesystem. This is how for example, a sum of2.500 EUR
from an autoposting gets interpreted as 2.5 EUR and I can't do anything about it, I can only specify a multiplier (*1
,*-1
, etc). If I could at least have these autopostings generated and visible in a file somewhere, i could apply an additional regex based search and replace in my build pipeline.Version and Runtime Information
Please mention the version number of
hledger-flow
you are using:Is this the latest version? YES
If your request includes commands you ran and the output, please also include
the runtime options with
--show-options
e.g:Describe the solution you'd like
construct
andpreprocess
) ->rewrite-rules
(name inspired from https://hledger.org/manual.html#re-write-rules-in-a-file'srewrite-rules.journal
file parameter example)rewrite-rules
is found, the journal generation command for3-journal
includes--auto
command-line option-f
command-line option pointing to therewrite-rules
rewrite-rules
is not included inYYYY-include.journal
, since the3-journal
files then already contain the side-effects of applying the rewriting rules.(Note: I don't know how the
3-journal
files are generated today, and I can't see any3-journal
related output in the verbose logs, so I indicated how I would do it using command-line options to thehledger print
command)Describe alternatives you've considered
The way I would do this today is by invoking
If the aggregated journal is rather large, it will become impractical to run a diff on it.
Potential problems
If rewrite rules are put in some other shared include file (à la #50) and not
rewrite-rules
files, hledger-flow might not detect that--auto
needs to be added when generating the journals.The behaviour is undefined in that case. The user is expected to put autopostings in a file by that name, which should standardize things. Since
hledger-flow
is opinionated anyway, that should be fine.The text was updated successfully, but these errors were encountered: