Compare commits
No commits in common. "49ffea3f2eb03e0c24dc5da804ee6ab9fb181759" and "86f952e572b3d9176c225640baec7a1b96ed1f0c" have entirely different histories.
49ffea3f2e
...
86f952e572
|
@ -33,10 +33,7 @@ executable hxbrief
|
||||||
async >=2.2.3 && <2.3,
|
async >=2.2.3 && <2.3,
|
||||||
transformers >=0.5.6.2 &&<0.6,
|
transformers >=0.5.6.2 &&<0.6,
|
||||||
clock >=0.8 &&<0.9,
|
clock >=0.8 &&<0.9,
|
||||||
pretty >=1.1.3.6 && <1.2,
|
pretty >=1.1.3.6 && <1.2
|
||||||
text >=1.2.4,
|
|
||||||
regex-base >=0.94 && <0.95,
|
|
||||||
regex-pcre-builtin >=0.95 && < 0.96
|
|
||||||
hs-source-dirs: src-hxbrief
|
hs-source-dirs: src-hxbrief
|
||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
ghc-options: -rtsopts -threaded -Wall
|
ghc-options: -rtsopts -threaded -Wall
|
||||||
|
|
13
seaaye.nix
13
seaaye.nix
|
@ -4,24 +4,23 @@
|
||||||
{
|
{
|
||||||
hackage-8-10 = {
|
hackage-8-10 = {
|
||||||
resolver = "hackage";
|
resolver = "hackage";
|
||||||
index-state = "2022-07-01T00:00:00Z";
|
index-state = "2021-07-01T00:00:00Z";
|
||||||
ghc-ver = "ghc8107";
|
ghc-ver = "ghc8107";
|
||||||
};
|
};
|
||||||
hackage-9-00 = {
|
hackage-9-01 = {
|
||||||
resolver = "hackage";
|
resolver = "hackage";
|
||||||
index-state = "2022-07-01T00:00:00Z";
|
index-state = "2021-07-01T00:00:00Z";
|
||||||
ghc-ver = "ghc902";
|
ghc-ver = "ghc901";
|
||||||
enabled = false;
|
enabled = false;
|
||||||
};
|
};
|
||||||
hackage-9-02 = {
|
hackage-9-02 = {
|
||||||
resolver = "hackage";
|
resolver = "hackage";
|
||||||
index-state = "2022-07-01T00:00:00Z";
|
index-state = "2021-11-01T00:00:00Z";
|
||||||
ghc-ver = "ghc925";
|
ghc-ver = "ghc921";
|
||||||
enabled = false;
|
enabled = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
module-flags = [
|
module-flags = [
|
||||||
# { enableLibraryProfiling = true; }
|
|
||||||
# N.B.: There are haskell-nix module options. See the haskell-nix docs
|
# N.B.: There are haskell-nix module options. See the haskell-nix docs
|
||||||
# for details. Also, be careful about typos: In many cases you
|
# for details. Also, be careful about typos: In many cases you
|
||||||
# will not get errors but the typo'd flag will just not have any
|
# will not get errors but the typo'd flag will just not have any
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -3,9 +3,6 @@
|
||||||
module Util where
|
module Util where
|
||||||
|
|
||||||
|
|
||||||
import qualified Data.Char as Char
|
|
||||||
import Data.Text ( Text )
|
|
||||||
import qualified Data.Text as Text
|
|
||||||
import qualified System.Console.ANSI as Ansi
|
import qualified System.Console.ANSI as Ansi
|
||||||
import System.Exit ( ExitCode
|
import System.Exit ( ExitCode
|
||||||
( ExitFailure
|
( ExitFailure
|
||||||
|
@ -14,60 +11,27 @@ import System.Exit ( ExitCode
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
t :: String -> Text
|
|
||||||
t = Text.pack
|
|
||||||
|
|
||||||
fGrey :: Text
|
fGrey :: String
|
||||||
fGrey =
|
fGrey = Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Dull Ansi.White]
|
||||||
t $ Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Dull Ansi.White]
|
fWhite :: String
|
||||||
fWhite :: Text
|
fWhite = Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Vivid Ansi.White]
|
||||||
fWhite =
|
fWhiteDis :: String
|
||||||
t $ Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Vivid Ansi.White]
|
fWhiteDis = ""
|
||||||
fWhiteDis :: Text
|
fRedDis :: String
|
||||||
fWhiteDis = t ""
|
fRedDis = "" -- TODO disabled until the bug is fixed.
|
||||||
fRedDis :: Text
|
|
||||||
fRedDis = t "" -- TODO disabled until the bug is fixed.
|
|
||||||
-- setFGColorDull Ansi.Red
|
-- setFGColorDull Ansi.Red
|
||||||
|
|
||||||
fReset :: Text
|
fReset :: String
|
||||||
fReset = t $ Ansi.setSGRCode [Ansi.Reset]
|
fReset = Ansi.setSGRCode [Ansi.Reset]
|
||||||
|
|
||||||
setFGColorVivid :: Ansi.Color -> Text
|
setFGColorVivid :: Ansi.Color -> String
|
||||||
setFGColorVivid c =
|
setFGColorVivid c =
|
||||||
t $ Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Vivid c]
|
Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Vivid c]
|
||||||
setFGColorDull :: Ansi.Color -> Text
|
setFGColorDull :: Ansi.Color -> String
|
||||||
setFGColorDull c =
|
setFGColorDull c = Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Dull c]
|
||||||
t $ Ansi.setSGRCode [Ansi.SetColor Ansi.Foreground Ansi.Dull c]
|
|
||||||
|
|
||||||
showEC :: ExitCode -> Text
|
showEC :: ExitCode -> String
|
||||||
showEC = \case
|
showEC = \case
|
||||||
ExitSuccess -> setFGColorVivid Ansi.Green <> t "0" <> fReset
|
ExitSuccess -> setFGColorVivid Ansi.Green ++ "0" ++ fReset
|
||||||
ExitFailure i -> setFGColorVivid Ansi.Red <> t (show i) <> fReset
|
ExitFailure i -> setFGColorVivid Ansi.Red ++ show i ++ fReset
|
||||||
|
|
||||||
filterEscapeFunc :: Text -> Text
|
|
||||||
filterEscapeFunc input = go Text.empty input
|
|
||||||
where
|
|
||||||
isSpecial c = Char.isControl c
|
|
||||||
go clean open = case Text.break isSpecial open of
|
|
||||||
(a, b) -> case Text.uncons b of
|
|
||||||
Nothing -> clean <> a
|
|
||||||
Just ('\x07', rest) -> go (clean <> a) rest -- bell
|
|
||||||
Just ('\x08', rest) -> if Text.null a -- backspace
|
|
||||||
then if Text.null clean
|
|
||||||
then go clean rest
|
|
||||||
else go (Text.init clean) rest
|
|
||||||
else go (clean <> Text.init a) rest
|
|
||||||
Just ('\x09', rest) -> -- tab
|
|
||||||
go (clean <> a <> Text.pack " ") rest
|
|
||||||
Just ('\x1b', rest) -> -- esc
|
|
||||||
clean <> a <> case Text.uncons rest of
|
|
||||||
Nothing -> Text.empty
|
|
||||||
Just ('\x5b', more) -> finishEscape more
|
|
||||||
Just ('\x9b', more) -> finishEscape more
|
|
||||||
Just (_ , more) -> filterEscapeFunc more
|
|
||||||
Just (_, rest) -> go (clean <> a) rest
|
|
||||||
finishEscape remain = case Text.uncons remain of
|
|
||||||
Nothing -> remain
|
|
||||||
Just (c, rest) -> if c >= '\x40' && c <= '\x7e'
|
|
||||||
then filterEscapeFunc rest
|
|
||||||
else finishEscape rest
|
|
||||||
|
|
Loading…
Reference in New Issue