module Devel.CmdArgs
( cmdArgs
, CmdArgs (..)
) where
import Data.List.Split (splitOn)
import Options.Applicative
data CmdArgs = CmdArgs
{ buildFile :: FilePath
, runFunction :: String
, watchDirectories :: [String]
, versionNumber :: Bool
, isReverseProxy :: Bool
} deriving (Show, Eq)
cmdArgs :: Parser CmdArgs
cmdArgs = CmdArgs
<$> strOption
(long "path"
<> short 'p'
<> value "Application.hs"
<> metavar "FILEPATH"
<> help "The file with the function you want to run. Default is `Application.hs`.")
<*> strOption
(long "function"
<> short 'f'
<> value "develMain"
<> metavar "FUNCTION"
<> help "The function you want run. Default is `develMain`.")
<*> (splitOn "," <$> strOption
(long "watch-directories"
<> short 'w'
<> value []
<> metavar "DIRECTORY-LIST"
<> help "A comma-separated list of directories to watch for any changes (not just .hs files)."))
<*> flag False True
(long "version"
<> short 'v'
<> help "Print the version of wai-devel you are using." )
<*> flag True False
(long "no-reverse-proxy"
<> short 'r'
<> help "use `-r` to disable reverse proxying." )