From dc7e4be27070421022d7d37a9b8d13f73c7667c7 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 18 Apr 2017 11:39:16 -0400 Subject: add --show-hashes --- CmdLine.hs | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) (limited to 'CmdLine.hs') diff --git a/CmdLine.hs b/CmdLine.hs index 667693e..77f65f8 100644 --- a/CmdLine.hs +++ b/CmdLine.hs @@ -6,16 +6,28 @@ data CmdLine = CmdLine { mode :: Mode } -data Mode = Test | Graphviz FilePath +data Mode + = Test + | Graphviz GraphvizOpts + +data GraphvizOpts = GraphvizOpts + { graphvizLogFile :: FilePath + , graphvizShowHashes :: Bool + } parseCmdLine :: Parser CmdLine -parseCmdLine = CmdLine <$> (parsegraphviz <|> pure Test) +parseCmdLine = CmdLine <$> ((Graphviz <$> parsegraphviz) <|> pure Test) where - parsegraphviz = Graphviz <$> option str - ( long "graphviz" - <> metavar "logfile" - <> help "visualize log file with graphviz" - ) + 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 -- cgit v1.2.3