highlight-versions 0.1.2.3 → 0.1.3
raw patch · 3 files changed
+30/−11 lines, 3 files
Files
- CHANGES +6/−0
- highlight-versions.cabal +13/−4
- src/Highlight.hs +11/−7
CHANGES view
@@ -1,3 +1,9 @@+* 0.1.3: 21 February 2013++ - Highlight packages which match the latest version in green,+ so there is some positive feedback when everything is OK+ instead of just lack of negative feedback.+ * 0.1.2.3: 24 January 2013 - Allow ansi-terminal-0.6
highlight-versions.cabal view
@@ -1,5 +1,5 @@ name: highlight-versions-version: 0.1.2.3+version: 0.1.3 synopsis: Highlight package versions which differ from the latest version on Hackage description: This package provides an executable which reads from@@ -8,8 +8,10 @@ identifiers (e.g. foo-0.3.2) are highlighted if the version does not match the latest version on Hackage: red if the version is less than the- version on Hackage, or cyan if greater. In- addition, the Hackage version is shown in blue.+ version on Hackage, green if equal,+ or cyan if greater. In+ addition, when the versions are unequal the+ Hackage version is shown in blue. . In particular, it can be useful to pipe the output of @cabal(-dev) install --dry-run@ through@@ -17,6 +19,13 @@ plan. It's usually a good idea to understand why an outdated package is being installed; otherwise it can indicate that something needs to be updated.+ .+ PLEASE NOTE that highlight-versions does not+ actually consult Hackage, but rather your local+ index of Hackage cached by cabal. You must call+ 'cabal update' to be sure that+ highlight-versions has access to the latest+ information about package versions on Hackage. license: BSD3 license-file: LICENSE extra-source-files: CHANGES@@ -29,7 +38,7 @@ source-repository head type: darcs- location: http://code.haskell.org/~byorgey/code/highlight-versions+ location: http://hub.darcs.net/byorgey/highlight-versions executable highlight-versions main-is: Highlight.hs
src/Highlight.hs view
@@ -37,7 +37,7 @@ -- get the latest version and compare it to the stated version let latest = maximum . P.map fst . M.assocs $ versions case compare (pkgVersion pkgId) latest of- EQ -> putStrLn l+ EQ -> putStrColor Green p >> putStrLn rest LT -> doHighlight p latest Red rest -- show outdated versions in red GT -> doHighlight p latest Cyan rest -- show newer versions in cyan @@ -45,15 +45,19 @@ -- another version in blue. doHighlight :: String -> Version -> Color -> String -> IO () doHighlight s latest color rest = do- setSGR [SetColor Foreground Vivid color]- putStr s- setSGR []+ putStrColor color s putStr " ("- setSGR [SetColor Foreground Vivid Blue]- putStr (showVersion latest)- setSGR []+ putStrColor Blue (showVersion latest) putStr ")" putStrLn rest++-- | Output a string highlighted in a given color.+putStrColor :: Color -> String -> IO ()+putStrColor color s = do+ setSGR [SetColor Foreground Vivid color]+ putStr s+ setSGR []+ getPkgName :: PackageIdentifier -> String getPkgName pkgId = case pkgName pkgId of PackageName name -> name