module Ermine.Console.Options
( MonitorOptions(..)
, HasMonitorOptions(..)
, Options(..)
, HasOptions(..)
, parseOptions
) where
import Control.Lens hiding (argument)
import Data.Data
import Ermine.Monitor
import Options.Applicative
import Paths_ermine
data Options = Options
{ _optionsMonitorOptions :: MonitorOptions
, _libdir :: FilePath
, _files :: [FilePath]
} deriving (Eq,Ord,Show,Read,Data,Typeable)
makeClassy ''Options
instance HasMonitorOptions Options where
monitorOptions = optionsMonitorOptions
parseOptions :: IO (Parser Options)
parseOptions = do
dd <- getDataDir
return $ Options
<$> parseMonitorOptions
<*> option (long "libdir" <> short 'l' <> help "location of the ermine library" <> metavar "DIR" <> action "directory" <> value dd)
<*> many (argument Just $ help "files" <> metavar "FILE" <> action "file")