module Coda.Server.Options
( ServerOptions(..)
, HasServerOptions(..)
, parseServerOptions
) where
import Control.Lens
import Data.Data
import Data.Default
import Data.Monoid
import Options.Applicative as Options
data ServerOptions = ServerOptions
{ _serverOptionsDebug :: !Bool
, _serverOptionsLog :: !(Maybe FilePath)
} deriving (Eq,Ord,Show,Read,Data)
instance Default ServerOptions where
def = ServerOptions False Nothing
parseServerOptions :: Options.Parser ServerOptions
parseServerOptions = ServerOptions
<$> switch (long "debug" <> help "enable debugging")
<*> optional (strOption (long "log" <> short 'l' <> help "log file" <> metavar "FILE" <> action "file"))
makeClassy ''ServerOptions