X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FTerminal.hs;h=064c5ff87e27af60f328f14e9c4d3f05f19cf10d;hp=6031d62c5e9a7cdd3919099622c701cb6e9ad60f;hb=ac3a81eb6d0f8ca4e212752d5b390a4fc220cceb;hpb=f6cb0ba712e06e52d080b86e9eba6c3585a7514b diff --git a/src/Terminal.hs b/src/Terminal.hs index 6031d62..064c5ff 100644 --- a/src/Terminal.hs +++ b/src/Terminal.hs @@ -33,24 +33,47 @@ with_color h color = with_sgr h [SetColor Foreground Vivid color] +-- | Write the given String to a handle in color. The funnyCaps are +-- for synergy with putstrLn and friends. +-- hPutStrColor :: Handle -> Color -> String -> IO () hPutStrColor h c = with_color h c . hPutStr h + +-- | Write the given line to a handle in color. The funnyCaps are for +-- synergy with putstrLn and friends. +-- hPutStrColorLn :: Handle -> Color -> String -> IO () hPutStrColorLn h c s = hPutStrColor h c (s ++ "\n") --- | Don't automatically append a newline. + +-- | Display text sent to the feed on the console. Don't automatically +-- append a newline. +-- display_sent :: String -> IO () display_sent = hPutStrColor stdout Green + +-- | Display debug text on the console. Don't automatically append a +-- newline in case the raw text is needed for, uh, debugging. +-- display_debug :: String -> IO () display_debug = putStr + +-- | Display an informational message on the console. +-- display_info :: String -> IO () display_info = hPutStrColorLn stdout Cyan + +-- | Display a warning on the console. Uses stderr instead of stdout. +-- display_warning :: String -> IO () display_warning = hPutStrColorLn stderr Yellow + +-- | Display an error on the console. Uses stderr instead of stdout. +-- display_error :: String -> IO () display_error = hPutStrColorLn stderr Red