From 66df5ed40ff30d83978d74bd6eb0517616ff710a Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 17 Oct 2024 23:42:53 -1000 Subject: [PATCH] imp: expose config file args to getArgs; make --no-pager work there --- hledger/Hledger/Cli.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli.hs b/hledger/Hledger/Cli.hs index 6669d261d..5ce71a20a 100644 --- a/hledger/Hledger/Cli.hs +++ b/hledger/Hledger/Cli.hs @@ -338,7 +338,12 @@ main = withGhcDebug' $ do manFlag = boolopt "man" rawopts versionFlag = boolopt "version" rawopts - if + -- Ensure that anything calling getArgs later will see all args, including config file args. + -- Some things (--color, --debug, some checks in journalFinalise) are detected by unsafePerformIO, + -- eg in Hledger.Utils.IO.progArgs, which means they aren't be seen in a config file + -- (because many things before this point have forced the one-time evaluation of progArgs). + withArgs (progname:finalargs) $ + if -- 6.1. no command and a help/doc flag found - show general help/docs | nocmdprovided && helpFlag -> pager $ showModeUsage (mainmode []) ++ "\n" | nocmdprovided && tldrFlag -> runTldrForPage "hledger"