From 00997dff13f151c784408ee94c92383abf0260c4 Mon Sep 17 00:00:00 2001 From: rhiannon morris Date: Mon, 11 Apr 2022 14:09:37 +0200 Subject: [PATCH] banner stuff --- src/Quox.idr | 60 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 49 insertions(+), 11 deletions(-) diff --git a/src/Quox.idr b/src/Quox.idr index 2840c2c..2b4c6d3 100644 --- a/src/Quox.idr +++ b/src/Quox.idr @@ -9,19 +9,57 @@ import public Quox.Pretty import Data.Nat import Data.Vect +import Control.ANSI +public export +record BannerOpts where + constructor MakeBannerOpts + unicode, color : Bool + +public export +defBannerOpts : BannerOpts +defBannerOpts = MakeBannerOpts {unicode = True, color = True} + +private +text : BannerOpts -> List String +text _ = + ["", + #" ___ ___ _____ __ __"#, + #"/ _ `/ // / _ \\ \ /"#, + #"\_, /\_,_/\___/_\_\"#, + #" /_/"#, + ""] + +private +qtuwu : BannerOpts -> List String +qtuwu opts = + if opts.unicode then + [#" ___,-´⎠ "#, + #"(·`──´ ◡ -´⎠"#, + #" \⋀/───´⎞/`──´ "#, + #" ⋃────,-₎ ⎞ "#, + #" (‾‾) ⎟ "#, + #" (‾‾‾) ⎟ "#] + else + [#" ___,-´/ "#, + #"(.`--´ u -´/"#, + #" \/\/--´|/`--´ "#, + #" U----,-, \ "#, + #" (--) | "#, + #" (---) | "#] + +private +join1 : BannerOpts -> String -> String -> String +join1 opts l r = + if opts.color then + " " <+> show (colored Green l) <+> " " <+> show (colored Magenta r) + else + " " <+> l <+> " " <+> r + export -banner : String -banner = #""" - _ ___,-´/ - (.`--´ ∪ -´/ ___ ___ _____ __ __ - \/\/--´`´`--´ / _ `/ // / _ \\ \ / - U ---, / \_, /\_,_/\___/_\_\ - /--/ | /_/ - /--/ | - - """# +banner : BannerOpts -> String +banner opts = unlines $ zipWith (join1 opts) (qtuwu opts) (text opts) export tm : Term 1 2 @@ -32,6 +70,6 @@ tm = main : IO Unit main = do - putStrLn banner + putStrLn $ banner defBannerOpts prettyTerm tm prettyTerm $ pushSubstsT tm