packages feed

highlight-versions 0.1.3.6 → 0.1.4

raw patch · 3 files changed

+26/−19 lines, 3 filesdep ~Cabaldep ~ansi-terminaldep ~hackage-db

Dependency ranges changed: Cabal, ansi-terminal, hackage-db

Files

CHANGES view
@@ -1,3 +1,7 @@+* 0.4.1: 27 July 2018++  - Upgrade to Cabal-2.2.x and hackage-db-2.x+ * 0.1.3.6: 2 May 2016    - Allow Cabal-1.24
highlight-versions.cabal view
@@ -1,5 +1,5 @@ name:                highlight-versions-version:             0.1.3.6+version:             0.1.4 synopsis:            Highlight package versions which differ from the latest                      version on Hackage description:         This package provides an executable which reads from@@ -33,7 +33,7 @@ copyright:           Copyright 2012 Brent Yorgey category:            Distribution build-type:          Simple-cabal-version:       >=1.10+cabal-version:       1.18  source-repository head   type: darcs@@ -43,8 +43,10 @@   main-is:             Highlight.hs   build-depends:       base >= 4 && < 5,                        containers >= 0.4 && < 0.6,-                       hackage-db >= 1.4 && < 2,-                       Cabal >= 1.14 && < 1.25,-                       ansi-terminal >= 0.5 && < 0.7++                       hackage-db >= 2 && < 2.1,+                       Cabal >= 2.2 && < 2.3,+                       ansi-terminal >= 0.5 && < 0.9   hs-source-dirs:      src   default-language:    Haskell2010+
src/Highlight.hs view
@@ -1,16 +1,21 @@ module Main where -import           Data.Char (isSpace)-import qualified Data.Map as M-import           Distribution.Hackage.DB-import           Distribution.Text (simpleParse)+import           Data.Char                    (isSpace)+import qualified Data.Map                     as M+import           Distribution.Hackage.DB      (HackageDB, hackageTarball,+                                               readTarball)+import           Distribution.Pretty          (prettyShow)+import           Distribution.Text            (simpleParse)+import           Distribution.Types.PackageId (pkgName, pkgVersion)+import           Distribution.Types.Version   (Version) import           Prelude-import qualified Prelude as P (map)+import qualified Prelude                      as P (map) import           System.Console.ANSI  main = do-  db <- readHackage-  input <- getContents+  tarball <- hackageTarball+  db      <- readTarball Nothing tarball+  input   <- getContents   let ls = lines input   mapM_ (highlightOutdated db) ls @@ -20,7 +25,7 @@ -- if the version differs (in red if the version is older than the -- latest on Hackage, or cyan if newer), also printing the version of -- the latest Hackage release in blue.-highlightOutdated :: Hackage -> String -> IO ()+highlightOutdated :: HackageDB -> String -> IO () highlightOutdated db s = do   let (sp,l)   = span isSpace s       (p,rest) = break isSpace l@@ -31,7 +36,7 @@     Nothing    -> putStrLn l     Just pkgId ->       -- look up this package name in the Hackage DB-      case (M.lookup (getPkgName pkgId) db) of+      case M.lookup (pkgName pkgId) db of         Nothing -> putStrLn l         Just versions -> do           -- get the latest version and compare it to the stated version@@ -47,7 +52,7 @@ doHighlight s latest color rest = do   putStrColor color s   putStr " ("-  putStrColor Blue (showVersion latest)+  putStrColor Blue (prettyShow latest)   putStr ")"   putStrLn rest @@ -57,7 +62,3 @@   setSGR [SetColor Foreground Vivid color]   putStr s   setSGR []---getPkgName :: PackageIdentifier -> String-getPkgName pkgId = case pkgName pkgId of PackageName name -> name