aboutsummaryrefslogtreecommitdiffstats
path: root/app/Main.hs
diff options
context:
space:
mode:
Diffstat (limited to 'app/Main.hs')
-rw-r--r--app/Main.hs28
1 files changed, 22 insertions, 6 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 737becc..6f96aa5 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -488,6 +488,8 @@ data Command
closed :: Bool
}
| Log
+ { patch :: Bool
+ }
| Show
{ id :: String,
edit :: Bool
@@ -519,7 +521,8 @@ listCmd =
logCmd :: O.Parser Command
logCmd =
- pure Log
+ Log
+ <$> patchFlag
showCmd :: O.Parser Command
showCmd =
@@ -556,6 +559,14 @@ editFlag =
<> O.help "Edit issue in $EDITOR."
)
+patchFlag :: O.Parser Bool
+patchFlag =
+ O.switch
+ ( O.short 'p'
+ <> O.long "patch"
+ <> O.help "Show patches."
+ )
+
die :: String -> IO a
die s = do
printf "error: %s\n" s
@@ -641,7 +652,7 @@ main = do
)
)
issues
- Options {colorize, noPager, width, command = Log} -> do
+ Options {colorize, noPager, width, command = Log {patch}} -> do
ess' <- map (\(commitHash, issueEvents, _) -> (commitHash, issueEvents)) <$> getHistory
putDoc colorize noPager width . P.vsep $
concatMap
@@ -651,10 +662,15 @@ main = do
( \e ->
let kwd = P.annotate (P.color P.Green) . P.pretty . T.pack
title issue = P.annotate (P.color P.Blue) . P.annotate P.bold $ P.pretty issue.title
- in case e of
- IssueCreated {issue} -> shortHash <+> kwd "created" <+> title issue
- IssueChanged {issue} -> shortHash <+> kwd "changed" <+> title issue
- IssueDeleted {issue} -> shortHash <+> kwd "deleted" <+> title issue
+ in ( case e of
+ IssueCreated {issue} ->
+ shortHash <+> kwd "created" <+> title issue
+ IssueChanged {issue} ->
+ shortHash <+> kwd "changed" <+> title issue
+ IssueDeleted {issue} ->
+ shortHash <+> kwd "deleted" <+> title issue
+ )
+ <+> if patch then P.pretty e.patch else P.emptyDoc
)
es'
)