From 4f9473240f8de7e739f7cc0a8dd90d6b71c60800 Mon Sep 17 00:00:00 2001 From: samahri Date: Sat, 26 Apr 2025 22:20:18 -0700 Subject: [PATCH] cli: "balanced" check is enabled only with "check" command --- hledger-lib/Hledger/Read/Common.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hledger-lib/Hledger/Read/Common.hs b/hledger-lib/Hledger/Read/Common.hs index b9981a85d..3035be48c 100644 --- a/hledger-lib/Hledger/Read/Common.hs +++ b/hledger-lib/Hledger/Read/Common.hs @@ -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.