dev: notes, debug output tweaks

This commit is contained in:
Simon Michael 2024-10-14 08:26:51 -10:00
parent c6bc020609
commit b71634a4ee
2 changed files with 5 additions and 2 deletions

View File

@ -485,6 +485,9 @@ cmdargsParse desc m args0 = process m (ensureDebugFlagHasVal args0)
-- and will be moved - but later rejected by cmdargs. -- and will be moved - but later rejected by cmdargs.
-- Instead these should be written to the right of a "--" argument, which hides them. -- Instead these should be written to the right of a "--" argument, which hides them.
-- --
-- - XXX Relative order of flags is mostly but not entirely preserved, currently:
-- pre-command flags get moved to the end, after post-command flags.
--
moveFlagsAfterCommand :: [String] -> (String, [String], [String]) moveFlagsAfterCommand :: [String] -> (String, [String], [String])
moveFlagsAfterCommand args = moveFlagsAfterCommand args =
case moveFlagAndVal (args, []) of case moveFlagAndVal (args, []) of

View File

@ -104,7 +104,7 @@ getConf rawopts = do
exists <- doesFileExist f exists <- doesFileExist f
return $ if exists then Just f else Nothing return $ if exists then Just f else Nothing
case conffiles of case conffiles of
f:_ -> dbg8IO "found config files" conffiles >> dbg1IO "using config file" f >> readConfFile f f:_ -> dbg8IO "found config files" conffiles >> dbg1IO "using nearest config file" f >> readConfFile f
[] -> return $ traceAt 1 "no config file found" (nullconf, Nothing) [] -> return $ traceAt 1 "no config file found" (nullconf, Nothing)
-- | Read this config file and parse its contents, or raise an error. -- | Read this config file and parse its contents, or raise an error.
@ -130,7 +130,7 @@ defaultConfFilePaths :: IO [FilePath]
defaultConfFilePaths = do defaultConfFilePaths = do
ds <- confDirs ds <- confDirs
home <- getHomeDirectory home <- getHomeDirectory
return $ dbg8 "possible config files" $ return $ dbg8 "possible config file paths" $
flip map ds $ \d -> d </> if d==home then ".hledger.conf" else "hledger.conf" flip map ds $ \d -> d </> if d==home then ".hledger.conf" else "hledger.conf"
-- | Get the directories to check for a hledger config file. -- | Get the directories to check for a hledger config file.