summaryrefslogtreecommitdiff
path: root/src/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.hs')
-rw-r--r--src/Main.hs19
1 files changed, 9 insertions, 10 deletions
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