Skip to content

Commit

Permalink
Replace 'colourista' with 'pretty-terminal' (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
chshersh authored Mar 24, 2023
1 parent e9b6c25 commit ba68943
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
10 changes: 5 additions & 5 deletions examples/simple-grep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ When run, you can expect to see output similar to the following:
Our simple example uses the following Haskell packages:

* `base`: the Haskell standard library
* `colourista`: a terminal output colouring library
* `pretty-terminal`: a terminal output colouring library
* `iris`: a Haskell CLI framework
* `mtl`: a library with monad transformers
* `text`: a library with the efficient `Text` type
Expand Down Expand Up @@ -69,13 +69,13 @@ import Control.Monad.Reader (MonadReader)
import Data.Foldable (traverse_)
import Data.Text (Text)

import qualified Colourista
import qualified Data.Text as Text
import qualified Data.Text.IO as Text
import qualified Options.Applicative as Opt
import qualified System.Console.Pretty as Pretty
```

> We're writing a simple grep utility, we need here the `colourista` library for
> We're writing a simple grep utility, we need here the `pretty-terminal` library for
> printing colored messages. Other libraries such as `text` are standard for any
> CLI tool. `optparse-applicative` is needed here for defining the set of
> commands that Iris will consume.
Expand Down Expand Up @@ -282,7 +282,7 @@ add a few more requirements to our output:
`stderr`.
2. Line numbers should be coloured and bold.

We're going to use `colourista` for colouring. Iris provides helper functions
We're going to use `pretty-terminal` for colouring. Iris provides helper functions
for handling terminal colouring support and printing coloured output.

Writing this in the code:
Expand All @@ -298,7 +298,7 @@ output = traverse_ outputLine

outputLineNumber :: Int -> App ()
outputLineNumber i = Iris.putStderrColoured
(Colourista.formatWith [Colourista.yellow, Colourista.bold])
(Pretty.color Pretty.Yellow . Pretty.style Pretty.Bold)
(Text.pack (show i) <> ": ")
```

Expand Down
2 changes: 1 addition & 1 deletion examples/simple-grep/simple-grep.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ executable simple-grep

build-depends:
, base
, colourista
, iris
, mtl
, optparse-applicative
, pretty-terminal
, text

build-tool-depends: markdown-unlit:markdown-unlit
Expand Down
16 changes: 8 additions & 8 deletions src/Iris/Colour/Formatting.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ import qualified Data.Text.IO as TIO
{- | Print 'Text' to 'System.IO.stdout' by providing a custom
formatting function.
This works especially well with the @colourista@ package:
This works especially well with the @pretty-terminal@ package:
@
'putStdoutColouredLn'
(Colourista.formatWith [Colourista.bold, Colourista.green])
(style Bold . color Green)
"my message"
@
Expand All @@ -59,11 +59,11 @@ putStdoutColouredLn formatWithColour str = do
{- | Print 'Text' to 'System.IO.stderr' by providing a custom
formatting function.
This works especially well with the @colourista@ package:
This works especially well with the @pretty-terminal@ package:
@
'putStderrColouredLn'
(Colourista.formatWith [Colourista.bold, Colourista.green])
(style Bold . color Green)
"my message"
@
Expand All @@ -86,11 +86,11 @@ putStderrColouredLn formatWithColour str = do
formatting function. Doesn't breaks output line that differs from
`putStdoutColouredLn`
This works especially well with the @colourista@ package:
This works especially well with the @pretty-terminal@ package:
@
'putStdoutColoured'
(Colourista.formatWith [Colourista.bold, Colourista.green])
(style Bold . color Green)
"my message"
@
Expand All @@ -113,11 +113,11 @@ putStdoutColoured formatWithColour str = do
formatting function. Doesn't breaks output line that differs from
`putStderrColouredLn`
This works especially well with the @colourista@ package:
This works especially well with the @pretty-terminal@ package:
@
'putStderrColoured'
(Colourista.formatWith [Colourista.bold, Colourista.green])
(style Bold . color Green)
"my message"
@
Expand Down
3 changes: 0 additions & 3 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
resolver: lts-20.5

extra-deps:
- colourista-0.1.0.2

0 comments on commit ba68943

Please sign in to comment.