rainbow 0.12.0.0 → 0.14.0.0
raw patch · 7 files changed
+65/−42 lines, 7 files
Files
- README.md +12/−0
- current-versions.txt +30/−29
- lib/System/Console/Rainbow.hs +1/−0
- lib/System/Console/Rainbow/Types.hs +15/−7
- minimum-versions.txt +3/−3
- rainbow.cabal +2/−2
- sunlight-test.hs +2/−1
README.md view
@@ -30,4 +30,16 @@ appropriate; and 3) feel free to add command-line contraints to your cabal command to get it to build. +## Building +If you get the package from Hackage, it is ready to build with+`cabal install` like any other Haskell package.++If you get it from Github, first you will need to create the cabal+file. It's built using m4 to avoid redundancies in the file. To+build the cabal file, simply invoke `make`.++## Generators package++The source tree also includes a package `rainbow-tests` which+includes several generators that other packages might find useful.
current-versions.txt view
@@ -1,39 +1,40 @@ This package was tested to work with these dependency versions and compiler version. These are the default versions fetched by cabal install.-Tested as of: 2014-03-08 16:06:41.98594 UTC-Path to compiler: ghc-7.6.3-Compiler description: 7.6.3+Tested as of: 2014-04-13 00:14:17.264281 UTC+Path to compiler: ghc-7.8.2+Compiler description: 7.8.2 -/opt/ghc-7.6.3/lib/ghc-7.6.3/package.conf.d:- Cabal-1.16.0- array-0.4.0.1- base-4.6.0.1+/opt/ghc/7.8.2/lib/ghc-7.8.2/package.conf.d:+ Cabal-1.18.1.3+ array-0.5.0.0+ base-4.7.0.0 bin-package-db-0.0.0.0- binary-0.5.1.1- bytestring-0.10.0.2- containers-0.5.0.0- deepseq-1.3.0.1- directory-1.2.0.1- filepath-1.3.0.1- (ghc-7.6.3)- ghc-prim-0.3.0.0- (haskell2010-1.1.1.0)- (haskell98-2.0.0.2)- hoopl-3.9.0.0- hpc-0.6.0.0- integer-gmp-0.5.0.0- old-locale-1.0.0.5- old-time-1.1.0.1- pretty-1.1.1.0- process-1.1.0.2+ binary-0.7.1.0 rts-1.0- template-haskell-2.8.0.0- time-1.4.0.1- unix-2.6.0.1+ bytestring-0.10.4.0+ containers-0.5.5.1+ deepseq-1.3.0.2+ directory-1.2.1.0+ filepath-1.3.0.2+ (ghc-7.8.2)+ ghc-prim-0.3.1.0+ (haskell2010-1.1.2.0)+ (haskell98-2.0.0.3)+ hoopl-3.10.0.1+ hpc-0.6.0.1+ integer-gmp-0.5.1.0+ old-locale-1.0.0.6+ old-time-1.1.0.2+ pretty-1.1.1.1+ process-1.2.0.0+ template-haskell-2.9.0.0+ time-1.4.2+ transformers-0.3.0.0+ unix-2.7.0.1 -/home/massysett/rainbow/sunlight-12650/db:- rainbow-0.12.0.0+/home/massysett/rainbow/sunlight-14614/db:+ rainbow-0.14.0.0 terminfo-0.4.0.0 text-1.1.0.1
lib/System/Console/Rainbow.hs view
@@ -71,6 +71,7 @@ -- * Chunks , Chunk(..) , fromText+ , fromLazyText -- * Printing chunks , putChunks
lib/System/Console/Rainbow/Types.hs view
@@ -11,6 +11,7 @@ import Data.Text (Text) import Data.Maybe (fromMaybe) import qualified Data.Text as X+import qualified Data.Text.Lazy as XL import qualified System.Console.Terminfo as T import System.IO as IO import System.Environment as Env@@ -146,20 +147,28 @@ -- underlined, etc. The chunk knows what foreground and background -- colors and what attributes to use for both an 8 color terminal and -- a 256 color terminal.+--+-- The text is held as a list of strict 'Text'. data Chunk = Chunk { textSpec :: TextSpec- , text :: Text+ , text :: [Text] } deriving (Eq, Show, Ord) instance Str.IsString Chunk where- fromString s = Chunk mempty (X.pack s)+ fromString s = Chunk mempty [(X.pack s)] --- | Creates a 'Chunk' with default colors and no special effects.+-- | Creates a 'Chunk' from a strict 'X.Text' with default colors+-- and no special effects. fromText :: Text -> Chunk-fromText = Chunk mempty+fromText = Chunk mempty . (:[]) +-- | Creates a 'Chunk' from a lazy 'XL.Text' with default colors and+-- no special effects.+fromLazyText :: XL.Text -> Chunk+fromLazyText = Chunk mempty . XL.toChunks+ instance Monoid Chunk where mempty = Chunk mempty mempty mappend (Chunk s1 t1) (Chunk s2 t2) = Chunk (s1 <> s2) (t1 <> t2)@@ -223,13 +232,12 @@ hPrintChunk :: IO.Handle -> T.Terminal -> Chunk -> IO ()-hPrintChunk h t (Chunk ts x) =+hPrintChunk h t (Chunk ts xs) = T.hRunTermOutput h t . mconcat- $ [defaultColors t, codes, txt]+ $ defaultColors t : codes : (map (T.termText . X.unpack) $ xs) where codes = getTermCodes t ts- txt = T.termText . X.unpack $ x -- | Sends a list of chunks to the given handle for printing. Sets up -- the terminal (this only needs to be done once.) Lazily processes
minimum-versions.txt view
@@ -1,7 +1,7 @@ This package was tested to work with these dependency versions and compiler version. These are the minimum versions given in the .cabal file.-Tested as of: 2014-03-08 16:06:41.98594 UTC+Tested as of: 2014-04-13 00:14:17.264281 UTC Path to compiler: ghc-7.4.1 Compiler description: 7.4.1 @@ -33,8 +33,8 @@ time-1.4 unix-2.5.1.0 -/home/massysett/rainbow/sunlight-12650/db:- rainbow-0.12.0.0+/home/massysett/rainbow/sunlight-14614/db:+ rainbow-0.14.0.0 terminfo-0.3.2 text-0.11.2.0
rainbow.cabal view
@@ -1,5 +1,5 @@ name: rainbow-version: 0.12.0.0+version: 0.14.0.0 synopsis: Print text to terminal with colors and effects description: rainbow helps you print Text chunks to a terminal with colors and effects@@ -29,7 +29,7 @@ README.md, sunlight-test.hs, minimum-versions.txt, current-versions.txt -tested-with: GHC ==7.4.1, GHC ==7.6.3+tested-with: GHC ==7.4.1, GHC ==7.6.3, GHC ==7.8.2 source-repository head type: git
sunlight-test.hs view
@@ -7,7 +7,8 @@ , tiCabal = "cabal" , tiLowest = ("7.4.1", "ghc-7.4.1", "ghc-pkg-7.4.1") , tiDefault = [ ("7.4.1", "ghc-7.4.1", "ghc-pkg-7.4.1")- , ("7.6.3", "ghc-7.6.3", "ghc-pkg-7.6.3") ]+ , ("7.6.3", "ghc-7.6.3", "ghc-pkg-7.6.3")+ , ("7.8.2", "ghc-7.8.2", "ghc-pkg-7.8.2") ] , tiTest = [] }