fix:close: --infer-costs no longer implies -x/--explicit [#1826]

This commit is contained in:
Simon Michael 2024-12-27 12:09:45 -10:00
parent 5644dc2493
commit 5db62b37e1

View File

@ -14,7 +14,6 @@ import Data.Maybe (fromMaybe)
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Text.IO as T import qualified Data.Text.IO as T
import Data.Time.Calendar (addDays) import Data.Time.Calendar (addDays)
import Lens.Micro ((^.))
import System.Console.CmdArgs.Explicit as C import System.Console.CmdArgs.Explicit as C
import Hledger import Hledger
@ -74,7 +73,7 @@ closeModeFromRawOpts rawopts = lastDef Close $ collectopts (\(name,_) -> readMay
-- Debugger, beware: close is incredibly devious; simple rules combine to make a horrid maze. -- Debugger, beware: close is incredibly devious; simple rules combine to make a horrid maze.
-- Tests are in hledger/test/close.test. -- Tests are in hledger/test/close.test.
close copts@CliOpts{rawopts_=rawopts, reportspec_=rspec0} j = do close CliOpts{rawopts_=rawopts, reportspec_=rspec0} j = do
let let
mode_ = closeModeFromRawOpts rawopts mode_ = closeModeFromRawOpts rawopts
defacctsq_ = if mode_ == Retain then Type [Revenue, Expense] else Type [Asset, Liability] defacctsq_ = if mode_ == Retain then Type [Revenue, Expense] else Type [Asset, Liability]
@ -119,7 +118,7 @@ close copts@CliOpts{rawopts_=rawopts, reportspec_=rspec0} j = do
opendate = addDays 1 closedate opendate = addDays 1 closedate
-- should we show the amount(s) on the equity posting(s) ? -- should we show the amount(s) on the equity posting(s) ?
explicit = boolopt "explicit" rawopts || copts ^. infer_costs explicit = boolopt "explicit" rawopts
-- the accounts to close -- the accounts to close
argsacctq = filterQuery (\q -> queryIsAcct q || queryIsType q) argsq argsacctq = filterQuery (\q -> queryIsAcct q || queryIsType q) argsq