cli: "balanced" check is enabled only with "check" command

This commit is contained in:
samahri 2025-04-26 22:20:18 -07:00 committed by Simon Michael
parent 2e6bc32820
commit 4f9473240f

View File

@ -199,14 +199,14 @@ rawOptsToInputOpts day usecoloronstdout postingaccttags rawopts =
let
-- Allow/disallow implicit-cost conversion transactions, according to policy in Check.md.
-- Disallow them if we see the --strict flag, or if we see a "balanced" argument,
-- Disallow them if we see the --strict flag, or if we see a "balanced" argument with the "check" command,
-- which we assume means the user is running "hledger check balanced".
-- XXX #2377 The check was originally named "balancednoautoconversion",
-- but later it was renamed, so this is no longer good; any command with "balanced"
-- as an argument will also enable this check, normally enabled only in strict mode.
noinferbalancingcosts = -- keep synced with Check.*
boolopt "strict" rawopts
|| stringopt "args" rawopts == "balanced"
|| (stringopt "args" rawopts == "balanced" && stringopt "command" rawopts == "check")
-- Do we really need to do all this work just to get the requested end date? This is duplicating
-- much of reportOptsToSpec.