module DevelMain where
import Devel
import Devel.CmdArgs
import Options.Applicative
import Paths_wai_devel (version)
import Data.Version (showVersion)
develMain :: IO ()
develMain = do
cmdArgs' <- execParser opts
let isReverseProxy' = isReverseProxy cmdArgs'
buildFile' = buildFile cmdArgs'
watchDirectories' = filter (/= "") $ watchDirectories cmdArgs'
runFunction' = runFunction cmdArgs'
isPrintVersion = versionNumber cmdArgs'
if isPrintVersion
then putStrLn $ "wai-devel version: " ++ showVersion version
else buildAndRun buildFile' runFunction' watchDirectories' isReverseProxy'
where opts :: ParserInfo CmdArgs
opts = info (helper <*> cmdArgs)
(fullDesc
<> progDesc "For WAI complaint haskell web applications"
<> header "wai-devel: development server for haskell web applications." )