1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
12import Text.PrettyPrint.ANSI.Leijen (Doc, (<>), hardline, dullcyan, text)
14import qualified Reporting.Region as R
15import qualified Reporting.Render.Code as Code
31toDoc :: FilePath -> Report -> Doc
32toDoc filePath (Report title _ _ message) =
33 messageBar title filePath
34 <> hardline <> hardline <>
38messageBar :: String -> FilePath -> Doc
39messageBar title filePath =
42 4 + length title + 1 + length filePath
46 ++ " " ++ replicate (max 1 (80 - usedSpace)) '-'
54toCodeSnippet :: Code.Source -> R.Region -> Maybe R.Region -> (Doc, Doc) -> Doc
55toCodeSnippet source region highlight (preHint, postHint) =
57 <> hardline <> hardline <>
58 Code.render source region highlight
61 <> hardline <> hardline
64toCodePair :: Code.Source -> R.Region -> R.Region -> (Doc, Doc) -> (Doc, Doc, Doc) -> Doc
65toCodePair source r1 r2 (oneStart, oneEnd) (twoStart, twoMiddle, twoEnd) =
66 case Code.renderPair source r1 r2 of
67 Code.OneLine codeDocs ->
69 <> hardline <> hardline <>
74 Code.TwoChunks code1 code2 ->
76 <> hardline <> hardline <>
80 <> hardline <> hardline <>
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list