From 9c31e8cbf9708922e5a080dff28f102dfa58eeec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 23 Jan 2025 19:29:26 +0100 Subject: Look for repo in directory containing config file --- src/Main.hs | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index d24642d..a6dfe07 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -138,13 +138,12 @@ runSomeCommand ciOptions (SC tproxy) args = do putStr $ usageInfo (T.unpack $ commandUsage tproxy) (fullCommandOptions tproxy) exitSuccess - Just configPath <- findConfig - BL.readFile configPath >>= return . parseConfig >>= \case - Left err -> do - putStr err - exitFailure - Right ciConfig -> do - let cmd = commandInit tproxy (fcoSpecific opts) cmdargs - let CommandExec exec = commandExec cmd - ciTerminalOutput <- initTerminalOutput - flip runReaderT CommandInput {..} exec + ciConfigPath <- findConfig + ciConfig <- case ciConfigPath of + Just path -> parseConfig <$> BL.readFile path + Nothing -> return $ Left "no config file found" + + let cmd = commandInit tproxy (fcoSpecific opts) cmdargs + let CommandExec exec = commandExec cmd + ciTerminalOutput <- initTerminalOutput + flip runReaderT CommandInput {..} exec -- cgit v1.2.3