summaryrefslogtreecommitdiffhomepage
path: root/CmdLine.hs
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2017-04-18 13:54:16 -0400
committerJoey Hess <joeyh@joeyh.name>2017-04-18 14:04:42 -0400
commitccdb5a3c6a28cc6745d337bdb67e62d70216ef7e (patch)
tree1a63fac950bf66bba59812d8e2f6b66aa1a05c63 /CmdLine.hs
parent88a9ce01d153ad609aa02084de0a93448c29cba4 (diff)
downloaddebug-me-ccdb5a3c6a28cc6745d337bdb67e62d70216ef7e.tar.gz
refactor out Log
Diffstat (limited to 'CmdLine.hs')
-rw-r--r--CmdLine.hs18
1 files changed, 17 insertions, 1 deletions
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