summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2025-01-09 19:39:52 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2025-01-10 20:17:54 +0100
commitded067166901805bba63a35b37fe83ebfc4e6aa8 (patch)
tree6ef85e05f4caa49662fabfa2a0b91cdf83e03fe6 /src/Main.hs
parent03c781c1a60759622e772ac7fb6a167111ed0bea (diff)
Run jobs based on configuration in associated commit
Changelog: Run jobs based on configuration in associated commit
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs13
1 files changed, 9 insertions, 4 deletions
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