diff options
author | tv <tv@krebsco.de> | 2019-01-25 13:55:35 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-25 13:56:48 +0100 |
commit | e75d0cf94582a5aa6dde781b8428ffff45cf7e76 (patch) | |
tree | e53cecef284df4082296b56e7562f70eb2ed10b7 | |
parent | 6b767df2fc47a77a4f856e040346ce49c0e7bf00 (diff) |
Blessings: add stripSGRv2.1.0
-rw-r--r-- | blessings.cabal | 2 | ||||
-rw-r--r-- | src/Blessings.hs | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/blessings.cabal b/blessings.cabal index e8be029..e5b0c7d 100644 --- a/blessings.cabal +++ b/blessings.cabal @@ -3,7 +3,7 @@ build-type: Simple cabal-version: >= 1.2 license: MIT name: blessings -version: 2.0.0 +version: 2.1.0 library build-depends: diff --git a/src/Blessings.hs b/src/Blessings.hs index 21cbabd..302b8bc 100644 --- a/src/Blessings.hs +++ b/src/Blessings.hs @@ -251,6 +251,14 @@ renderSGR pm = ("\ESC["<>) . (<>"m") . Bless.intercalate ";" . map Bless.fromInt $ pm +stripSGR :: Blessings a -> Blessings a +stripSGR = \case + Append t1 t2 -> Append (stripSGR t1) (stripSGR t2) + SGR _ t -> stripSGR t + Plain x -> Plain x + Empty -> Empty + + pp :: (Blessable a) => Blessings a -> a pp t = render emptyRenderState t "" |