module CmdLine where import Options.Applicative data CmdLine = CmdLine { mode :: Mode } data Mode = Test | Graphviz GraphvizOpts data GraphvizOpts = GraphvizOpts { graphvizLogFile :: FilePath , graphvizShowHashes :: Bool } parseCmdLine :: Parser CmdLine parseCmdLine = CmdLine <$> ((Graphviz <$> parsegraphviz) <|> pure Test) where parsegraphviz = GraphvizOpts <$> option str ( long "graphviz" <> metavar "logfile" <> help "visualize log file with graphviz" ) <*> switch ( long "show-hashes" <> help "display hashes in graphviz" ) getCmdLine :: IO CmdLine getCmdLine = execParser opts where opts = info (helper <*> parseCmdLine) ( fullDesc <> header "debug-me - provable remote debugging sessions" )