diff options
author | Joey Hess <joeyh@joeyh.name> | 2017-04-18 13:54:16 -0400 |
---|---|---|
committer | Joey Hess <joeyh@joeyh.name> | 2017-04-18 14:04:42 -0400 |
commit | ccdb5a3c6a28cc6745d337bdb67e62d70216ef7e (patch) | |
tree | 1a63fac950bf66bba59812d8e2f6b66aa1a05c63 /CmdLine.hs | |
parent | 88a9ce01d153ad609aa02084de0a93448c29cba4 (diff) | |
download | debug-me-ccdb5a3c6a28cc6745d337bdb67e62d70216ef7e.tar.gz |
refactor out Log
Diffstat (limited to 'CmdLine.hs')
-rw-r--r-- | CmdLine.hs | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -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 |