From ccdb5a3c6a28cc6745d337bdb67e62d70216ef7e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Apr 2017 13:54:16 -0400 Subject: refactor out Log --- CmdLine.hs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'CmdLine.hs') diff --git a/CmdLine.hs b/CmdLine.hs index 77f65f8..2cfea7a 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -9,14 +9,24 @@ data CmdLine = CmdLine data Mode = Test | Graphviz GraphvizOpts + | Replay ReplayOpts data GraphvizOpts = GraphvizOpts { graphvizLogFile :: FilePath , graphvizShowHashes :: Bool } +data ReplayOpts = ReplayOpts + { replayLogFile :: FilePath + } + parseCmdLine :: Parser CmdLine -parseCmdLine = CmdLine <$> ((Graphviz <$> parsegraphviz) <|> pure Test) +parseCmdLine = CmdLine <$> parseMode + +parseMode :: Parser Mode +parseMode = (Graphviz <$> parsegraphviz) + <|> (Replay <$> parsereplay) + <|> pure Test where parsegraphviz = GraphvizOpts <$> option str @@ -28,6 +38,12 @@ parseCmdLine = CmdLine <$> ((Graphviz <$> parsegraphviz) <|> pure Test) ( long "show-hashes" <> help "display hashes in graphviz" ) + parsereplay = ReplayOpts + <$> option str + ( long "replay" + <> metavar "logfile" + <> help "replay log file" + ) getCmdLine :: IO CmdLine getCmdLine = execParser opts -- cgit v1.2.3