From b54a31d58533ad68011dc5285845eaf26807deb4 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Mon, 1 Jul 2024 16:11:34 +0100 Subject: [PATCH] imp: conf: --debug 1: show all conf files found --- hledger/Hledger/Cli/Conf.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hledger/Hledger/Cli/Conf.hs b/hledger/Hledger/Cli/Conf.hs index adc9042a9..66d2054c4 100644 --- a/hledger/Hledger/Cli/Conf.hs +++ b/hledger/Hledger/Cli/Conf.hs @@ -13,7 +13,7 @@ module Hledger.Cli.Conf ( ) where -import Control.Monad (void) +import Control.Monad (void, forM) import Control.Monad.Identity (Identity) import Data.Functor ((<&>)) import qualified Data.Map as M @@ -79,6 +79,10 @@ confLookup cmd Conf{confSections} = getConf :: RawOpts -> IO (Conf, Maybe FilePath) getConf rawopts = do defconfpaths <- confFilePaths + existingconfpaths <- fmap catMaybes $ forM defconfpaths $ \f -> do + x <- doesFileExist f + return $ if x then Just f else Nothing + dbg1IO "found config files" existingconfpaths let noconf = boolopt "no-conf" rawopts let mconffile0 = maybestringopt "conf" rawopts mconffile <- case mconffile0 of