From e5f02ede3595239e6ca8705a54db42857266ab84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Sat, 29 Oct 2022 21:35:43 +0200 Subject: Show commands sent to test tool in verbose mode --- src/Output.hs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/Output.hs') diff --git a/src/Output.hs b/src/Output.hs index 661e4fc..3b0585e 100644 --- a/src/Output.hs +++ b/src/Output.hs @@ -35,6 +35,7 @@ data OutputState = OutputState data OutputType = OutputChildStdout | OutputChildStderr + | OutputChildStdin | OutputChildInfo | OutputChildFail | OutputMatch @@ -56,6 +57,7 @@ startOutput verbose = Output outColor :: OutputType -> Text outColor OutputChildStdout = T.pack "0" outColor OutputChildStderr = T.pack "31" +outColor OutputChildStdin = T.pack "0" outColor OutputChildInfo = T.pack "0" outColor OutputChildFail = T.pack "31" outColor OutputMatch = T.pack "32" @@ -66,6 +68,7 @@ outColor OutputAlways = "0" outSign :: OutputType -> Text outSign OutputChildStdout = T.empty outSign OutputChildStderr = T.pack "!" +outSign OutputChildStdin = T.empty outSign OutputChildInfo = T.pack "." outSign OutputChildFail = T.pack "!!" outSign OutputMatch = T.pack "+" @@ -73,16 +76,18 @@ outSign OutputMatchFail = T.pack "/" outSign OutputError = T.pack "!!" outSign OutputAlways = T.empty +outArr :: OutputType -> Text +outArr OutputChildStdin = "<" +outArr _ = ">" + printWhenQuiet :: OutputType -> Bool printWhenQuiet = \case - OutputChildStdout -> False OutputChildStderr -> True - OutputChildInfo -> False OutputChildFail -> True - OutputMatch -> False OutputMatchFail -> True OutputError -> True OutputAlways -> True + _ -> False clearPrompt :: OutputState -> IO () clearPrompt OutputState { outCurPrompt = Just _ } = T.putStr $ T.pack "\ESC[2K\r" @@ -102,7 +107,7 @@ outLine otype prompt line = ioWithOutput $ \out -> clearPrompt st TL.putStrLn $ TL.fromChunks [ T.pack "\ESC[", outColor otype, T.pack "m" - , maybe "" (<> outSign otype <> "> ") prompt + , maybe "" (<> outSign otype <> outArr otype <> " ") prompt , line , T.pack "\ESC[0m" ] -- cgit v1.2.3