Hi, unlikely others here I have lots of personal experience with 
`autobean.refactor` as its author. This is definitely one of the target use 
case of `autobean.refactor` and I'm happy to help if there is any issue. 
Note that it's now extracted to a separate repository (
https://github.com/SEIAROTg/autobean-refactor) so you'll need to install 
from there.

> But, I also realized I could accomplish what I wanted by implementing a 
plugin which transforms the transactions while reading/parsing the bean 
files. This actually is maybe preferable for me while I find out how I want 
to categorize everything as it seems to be non destructive.. it does not 
modify the bean files. I probably will reach a point I want to 'snapshot' 
everything and will then use bean-report to export a new bean file and then 
remove the plugin.

If the only problem is pad, it's fairly easy because pad is merely a 
built-in plugin (
https://github.com/beancount/beancount/blob/44cb769dc7828734a9251b6a77a43101590c19f1/beancount/loader.py#L45),
 
which can be disabled with `option "plugin_processing_mode" "raw"`.

Sadly, a universal solution is not possible with a beancount plugin because 
processing already happens before even the first plugin was invoked: 
options are turned into a dict, includes are flattened, entries are sorted, 
total prices are converted to unit prices, pushtag / poptag / pushmeta / 
popmeta are applied, comments and spacing are dropped, and more. To make 
the process truly lossless a different parser will be needed, which is 
exactly why I made `autobean.refactor`.

On Wednesday, January 11, 2023 at 2:51:12 AM UTC Red S wrote:

> This might not be apparent, but "snapshotting everything" might not work 
> the way you expect: beancount isn't designed to print out just what it read 
> plus a few changes to postings. Instead, it will print out interpolated, 
> transformed, plugin-processed output, which might not be what you want.
>
> On the other hand, autobean.refactor, as suggested here, is designed to do 
> exactly what you seek. I don't have personal experience on how mature it is 
> yet though.
>
> On Tuesday, January 10, 2023 at 5:48:42 PM UTC-8 Tim Legg wrote:
>
>> Cool thanks, I'll check that out.
>>
>> For future reference for anyone who needs it.. I realized a few things 
>> after posting this. I had the same errors regarding unused pad entries when 
>> I ran 'bean-report main.bean print' I realized that my script and 
>> bean-report were both explicitly printing out the 'P' padded entries as 
>> well as the PAD directives. Also bean-report doesn't seem to print out the 
>> options.. so in short, this script probably would work if you go back and 
>> delete the PAD directives and add the options back.
>>
>> But, I also realized I could accomplish what I wanted by implementing a 
>> plugin which transforms the transactions while reading/parsing the bean 
>> files. This actually is maybe preferable for me while I find out how I want 
>> to categorize everything as it seems to be non destructive.. it does not 
>> modify the bean files. I probably will reach a point I want to 'snapshot' 
>> everything and will then use bean-report to export a new bean file and then 
>> remove the plugin.
>>
>>
>> On Tuesday, January 10, 2023 at 7:49:50 PM UTC-5 [email protected] wrote:
>>
>>> * Tim Legg <[email protected]> [2023-01-09 11:44]: 
>>> > 2008-04-25 * "#AMAZON.COM" "" 
>>> > Liabilities:BofA:PlatinumPlus -14.36 USD 
>>> > Expenses:Buckets:Unaccounted 14.36 USD 
>>> > 
>>> > I would like to script up something to go through all transactions 
>>> where 
>>> > payee is ~ 'amazon' and change the Unaccounted to something else. 
>>>
>>> I haven't looked at it yet but check out the emails about 
>>> "autobean.refactor" from October 2022 on this mailing list. 
>>> You should be able to fix up your file with autobean.refactor. 
>>>
>>> -- 
>>> Martin Michlmayr 
>>> https://www.cyrius.com/ 
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Beancount" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/beancount/d05c25d0-673e-4802-8a8e-41955169103cn%40googlegroups.com.

Reply via email to