From bb7510194e920a6fca662191e07842adbb5505d8 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Thu, 17 Apr 2025 17:19:28 -1000 Subject: [PATCH] imp: setup: setup ignores the config file itself, for robustness --- hledger/Hledger/Cli.hs | 4 +++- hledger/hledger.m4.md | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli.hs b/hledger/Hledger/Cli.hs index bb1f07ec0..a0c968917 100644 --- a/hledger/Hledger/Cli.hs +++ b/hledger/Hledger/Cli.hs @@ -271,7 +271,9 @@ main = exitOnExceptions $ withGhcDebug' $ do -- Read extra general and command-specific args/opts from the config file, if any. (conf, mconffile) <- seq cliconfrawopts $ -- order debug output - getConf cliconfrawopts + if clicmdarg=="setup" -- the setup command checks config files, but never uses one itself + then return (nullconf,Nothing) + else getConf cliconfrawopts --------------------------------------------------------------- dbgIO "\n3. Identify a command name from config file or command line" () diff --git a/hledger/hledger.m4.md b/hledger/hledger.m4.md index 65956a380..cc00235c1 100644 --- a/hledger/hledger.m4.md +++ b/hledger/hledger.m4.md @@ -615,6 +615,8 @@ This is useful when using hledger in scripts, or when troubleshooting. When both `--conf` and `--no-conf` options are used, the right-most wins. To inspect the processing of config files, use `--debug` or `--debug=8`. +Or, run the `setup` command, which will display any active config files. +(Apart from this, `setup` is not affected by config files, unlike other commands.) **Warning!**