wolf-0.2.1: main/Decide.hs
module Decide
( main
) where
import BasicPrelude
import Control.Monad.Trans.Resource
import Data.Yaml hiding ( Parser )
import Network.AWS.Flow
import Options
import Options.Applicative
data Args = Args
{ aConfig :: FilePath
, aPlan :: FilePath
} deriving ( Eq, Read, Show )
args :: Parser Args
args = Args <$> configFile <*> planFile
parser :: ParserInfo Args
parser =
info ( helper <*> args ) $ fullDesc
<> header "decide: Decide a workflow"
<> progDesc "Decide a workflow"
call :: Args -> IO ()
call Args{..} = do
config <- decodeFile aConfig >>= maybeThrow (userError "Bad Config")
plan <- decodeFile aPlan >>= maybeThrow (userError "Bad Plan")
env <- flowEnv config
forever $ runResourceT $ runFlowT env $ decide plan
main :: IO ()
main = execParser parser >>= call