lentil 1.5.5.4 → 1.5.6.0
raw patch · 4 files changed
+48/−30 lines, 4 filesdep +prettyprinterdep +prettyprinter-ansi-terminaldep −ansi-wl-pprintdep ~deepseqdep ~filepathdep ~megaparsec
Dependencies added: prettyprinter, prettyprinter-ansi-terminal
Dependencies removed: ansi-wl-pprint
Dependency ranges changed: deepseq, filepath, megaparsec, text
Files
- changes.txt +7/−0
- lentil.cabal +9/−7
- src/Lentil/Print.hs +31/−22
- src/Main.hs +1/−1
changes.txt view
@@ -1,3 +1,10 @@+1.5.6.0+-------++- bump megaparsec and deepseq+- switched from ansi-wl-pprint to prettyprinter,+ if you notice anything off warn me.+ 1.5.5.4 -------
lentil.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: lentil-version: 1.5.5.4+version: 1.5.6.0 synopsis: frugal issue tracker description: minumum effort, cohesive issue tracker based on ubiquitous @TODO@s and @FIXME@s conventions.@@ -68,14 +68,15 @@ executable lentil main-is: Main.hs build-depends: base >= 4.9 && < 5.0,- ansi-wl-pprint >= 0.6 && < 1.1,+ prettyprinter == 1.7.*,+ prettyprinter-ansi-terminal >= 1.1.3 && < 1.2, csv==0.1.*,- deepseq==1.4.*,+ deepseq >=1.4 && <1.6, dlist >= 0.8 && < 1.1, directory >= 1.2 && < 1.4, filemanip==0.3.*, filepath==1.4.*,- megaparsec >= 8.0 && < 9.4,+ megaparsec >= 8.0 && < 9.5, mtl >=2.2 && <2.4, natural-sort==0.1.*, optparse-applicative >= 0.16 && < 0.19,@@ -104,14 +105,15 @@ HS-Source-Dirs: test, src main-is: Tests.hs build-depends: base >= 4.9 && < 5.0,- ansi-wl-pprint >= 0.6 && < 1.1,+ prettyprinter == 1.7.*,+ prettyprinter-ansi-terminal >= 1.1.3 && < 1.2, csv==0.1.*, directory >= 1.2 && < 1.4,- deepseq==1.4.*,+ deepseq >=1.4 && <1.6, dlist >= 0.8 && < 1.1, filemanip==0.3.*, filepath==1.4.*,- megaparsec >= 8.0 && < 9.4,+ megaparsec >= 8.0 && < 9.5, mtl >=2.2 && <2.4, natural-sort==0.1.*, optparse-applicative >= 0.16 && < 0.19,
src/Lentil/Print.hs view
@@ -12,9 +12,11 @@ import Lentil.Types import Lentil.Query -import Text.PrettyPrint.ANSI.Leijen as PP-import qualified Data.List as L+import Prettyprinter +import qualified Data.List as L+import qualified Data.Text as T+import qualified Prettyprinter.Render.Terminal as PT -- number of spaces + digits in indentation levels indNum :: Int@@ -30,38 +32,45 @@ where sn = show n -- Bool: wheter or not to use colours in rendering-myRender :: Bool -> Doc -> String-myRender col d = ($ "") . displayS . renderPretty 1 75 $ d'- where d' | col = d- | otherwise = plain d+myRender :: Bool -> Doc PT.AnsiStyle -> String+myRender col d = T.unpack . PT.renderStrict . layoutPretty lOpts $ d'+ where+ lOpts :: LayoutOptions+ lOpts = LayoutOptions (AvailablePerLine 75 1) + d' | col = d+ | otherwise = unAnnotate d + ------------------ -- PRETTY PRINT -- ------------------ data TagCol = Red | Blue deriving (Eq)-ppTag :: TagCol -> Tag -> Doc-ppTag c t = col (char openDel) <> string (tagString t) <>- col (char closeDel)- where col | c == Red = red- | otherwise = blue+ppTag :: TagCol -> Tag -> Doc PT.AnsiStyle+ppTag c t = col (pretty openDel) <> pretty (tagString t) <>+ col (pretty closeDel)+ where+ col :: Doc PT.AnsiStyle -> Doc PT.AnsiStyle+ col | c == Red = annotate (PT.color PT.Red)+ | otherwise = annotate (PT.color PT.Blue) -ppIssue :: Int -> Issue -> Doc-ppIssue ind is = indent spInd ( fillSep [string iNum, string "",+ppIssue :: Int -> Issue -> Doc PT.AnsiStyle+ppIssue ind is = indent spInd ( fillSep [pretty iNum, pretty "", hang 0 (fillSep $ ppDescTags is)] ) where- ppDescTags :: Issue -> [Doc]- ppDescTags i = map string (words (iPPDesc is)) +++ ppDescTags :: Issue -> [Doc PT.AnsiStyle]+ ppDescTags i = map pretty (words (iPPDesc is)) ++ map (ppTag Blue) (iTags i) spInd = indNum - ind iNum = alignNumber ind $ iRow is -ppFile :: Int -> [Issue] -> Doc-ppFile ind is = text (prettyFP $ iFile (head is)) PP.<$>- vsep (map (ppIssue ind) is)+ppFile :: Int -> [Issue] -> Doc PT.AnsiStyle+ppFile ind is = vsep+ [pretty (prettyFP $ iFile (head is)),+ vsep (map (ppIssue ind) is)] ppIssues :: Bool -> [Issue] -> String ppIssues col is = myRender col $ vsep (L.intersperse softline igr)@@ -76,17 +85,17 @@ -- tagpop pp report ppPopularity :: Bool -> [Issue] -> String-ppPopularity col is = myRender col $ text "Tags popularity:" PP.<$>- vsep ppPops -- PP.<$> (string "")+ppPopularity col is = myRender col $ vsep [pretty "Tags popularity:",+ vsep ppPops] -- PP.<$> (string "") where listpop = tagPop is ind = maximum . map (length . show . snd) $ listpop spInd = indNum - ind - ppPop (t, n) = indent spInd (fillSep [iNum n, string "",+ ppPop (t, n) = indent spInd (fillSep [iNum n, pretty "", hang 0 (ppTag Red t)]) ppPops = map ppPop listpop - iNum n = string $ alignNumber ind n+ iNum n = pretty $ alignNumber ind n
src/Main.hs view
@@ -44,7 +44,7 @@ short 'v' S.<> help "show version and copyright info" ) where- versionCopy = "\nlentil - frugal issue tracker, version 1.5.5.2\n\+ versionCopy = "\nlentil - frugal issue tracker, version 1.5.6.0\n\ \(C) 2015-2021 Francesco Ariis - http://www.ariis.it\n\ \released under the GNU General Public License v3\n"