Option --cumulative for `hledger aregister`
I like to have support for a cumulative running total additional to the standard historical running total in aregister.
See https://groups.google.com/d/msgid/hledger/0F2587EB-DF9A-4CE7-9A95-3C13B8042589%40joyful.com .
I thought it would be an easy addition since Aregister.hs already contains out-commented cumulative and historical options and Register.hs already supports cumulative totals. However, after adding the options they are still ignored.
Additionally I do not understand how Register.hs sets cumulative as default, because it mentions cumulative only in the flag section of Register.registermode and nowhere else and def :: BalanceAccumulation is defined as PerPeriod.
I can change the line in aregister.ropts' to balanceaccum_= Cumulative and get cumulative totals. Thus it seems to work in principle, but somehow the option cumulative is not translated to Cumulative, although balanceAccumulationOverride says how to do it.
hledger:Hledger.Cli.Commands.* (Register.hs, Aregister, etc) are just the "front end" of commands. Usually they call one or more generic reports implemented in hledger-lib:Hledger.Reports (PostingsReport, AccountTransactionsReport etc). So eg in PostingsReport.hs you can see postingsReport checking balanceaccum_, which comes from the ReportOpts argument, which was gathered from the raw CLI arguments in main. To navigate the code, I can recommend VS Code + HLS. Otherwise an editor with up to date tags file or good project-wide search. Hope it helps.
On Aug 27, 2023, at 19:31, thielema @.***> wrote:
I thought it would be an easy addition since Aregister.hs already contains out-commented cumulative and historical options and Register.hs already supports cumulative totals. However, after adding the options they are still ignored. Additionally I do not understand how Register.hs sets cumulative as default, because it mentions cumulative only in the flag section of Register.registermode and nowhere else and def :: BalanceAccumulation is defined as PerPeriod. I can change the line in aregister.ropts' to balanceaccum_= Cumulative and get cumulative totals. Thus it seems to work in principle, but somehow the option cumulative is not translated to Cumulative, although balanceAccumulationOverride says how to do it.
— Reply to this email directly, view it on GitHub https://github.com/simonmichael/hledger/issues/2077#issuecomment-1694732409, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAACPIEOLVEODXVPSEM5VJDXXOHAXANCNFSM6AAAAAA4AO4KAY. You are receiving this because you are subscribed to this thread.