1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
11import qualified Data.Text as Text
12import Text.PrettyPrint.ANSI.Leijen (Doc, (<>), hardline, dullcyan)
14import qualified Reporting.Helpers as H
15import qualified Reporting.Region as R
16import qualified Reporting.Render.Code as Code
27 , _sgstns :: [Text.Text]
32toDoc :: FilePath -> Report -> Doc
33toDoc filePath (Report title _ _ message) =
34 messageBar title filePath
35 <> hardline <> hardline <>
39messageBar :: String -> FilePath -> Doc
40messageBar title filePath =
43 4 + length title + 1 + length filePath
47 ++ " " ++ replicate (max 1 (80 - usedSpace)) '-'
55toCodeSnippet :: Code.Source -> R.Region -> Maybe R.Region -> (Doc, Doc) -> Doc
56toCodeSnippet source region highlight (preHint, postHint) =
58 <> hardline <> hardline <>
59 Code.render source region highlight
62 <> hardline <> hardline
65toCodePair :: Code.Source -> R.Region -> R.Region -> (Doc, Doc) -> (Doc, Doc, Doc) -> Doc
66toCodePair source r1 r2 (oneStart, oneEnd) (twoStart, twoMiddle, twoEnd) =
67 case Code.renderPair source r1 r2 of
68 Code.OneLine codeDocs ->
70 <> hardline <> hardline <>
75 Code.TwoChunks code1 code2 ->
77 <> hardline <> hardline <>
81 <> 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