hledger-flow icon indicating copy to clipboard operation
hledger-flow copied to clipboard

Checking for rules file after preprocessing?

Open a-t-0 opened this issue 1 year ago • 1 comments

Thank you for sharing this work with the world! Is your feature request related to a problem? Please describe. While using a small bunch of python code to perform my preprocessing, I auto-generate the rules file from that preprocessing logic. However, in the first run, if I delete the old .rules file, hledger-flow, rightfully indicates the .rules file is missing (because it is not created yet).

Version and Runtime Information

Please mention the version number of hledger-flow you are using:

hledger-flow --version
hledger-flow 0.15.0 linux x86_64 ghc 9.0 2b025fee477538a493cb7b5eaf163fd959aaec42

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:

clear && hledger-flow import

Can you give examples of what you would like by running hledger-flow on these files?

Describe the solution you'd like 0 .I would like hledger to first run the preprocessing and then, when it needs to apply the rules, check if the rules exist.

  1. Or, if you deliberately prefer fail-fast/early etc. Perhaps an additional argument like --create-rules that triggers the create_rules script to be ran.
  2. Or, an override argument like --preprocess-first that ensures the preprocessing script to be ran before checking if the rules exist.

Describe alternatives you've considered 0. Running the hledger-flow command twice. However, I think it is an important characteristic of hledger-flow that running the same thing yields the same output.

  1. Running a separate create_rules script/command. However, why do more manual work than necessary.

Nogmaals dank voor de effort die je geleverd hebt om hledger-flow te maken!

a-t-0 avatar Nov 23 '24 19:11 a-t-0

My apologies, after trying to create a pull request with the requested feature, I saw in the code that you included a construct script. After migrating my "create rules" script into that script, the import worked flawlessly. Then I saw your construct script description is included in your README.md

-------- Edit---------- I read the construct script is assumed to convert the 2-preprocessed files into 3-journal files itself, however I would like to use your software for this. Hence I created a pull request that: allows calling a createRules script that creates the .rules file for the bank.

a-t-0 avatar Nov 25 '24 17:11 a-t-0