From ded067166901805bba63a35b37fe83ebfc4e6aa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Thu, 9 Jan 2025 19:39:52 +0100 Subject: Run jobs based on configuration in associated commit Changelog: Run jobs based on configuration in associated commit --- src/Main.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/Main.hs') diff --git a/src/Main.hs b/src/Main.hs index cdce0f9..971bffe 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -4,6 +4,7 @@ import Control.Monad import Control.Monad.Except import Control.Monad.Reader +import Data.ByteString.Lazy qualified as BL import Data.List import Data.Proxy import Data.Text qualified as T @@ -132,7 +133,11 @@ runSomeCommand (SC tproxy) args = do exitSuccess Just configPath <- findConfig - config <- parseConfig configPath - let cmd = commandInit tproxy (fcoSpecific opts) cmdargs - let CommandExec exec = commandExec cmd - flip runReaderT config exec + BL.readFile configPath >>= return . parseConfig >>= \case + Left err -> do + putStr err + exitFailure + Right config -> do + let cmd = commandInit tproxy (fcoSpecific opts) cmdargs + let CommandExec exec = commandExec cmd + flip runReaderT config exec -- cgit v1.2.3