diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2022-10-29 21:35:43 +0200 | 
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2022-10-29 21:35:43 +0200 | 
| commit | e5f02ede3595239e6ca8705a54db42857266ab84 (patch) | |
| tree | 3da6abd78dfbca384dea8bea94a510b30eb217e3 /src | |
| parent | 86351a85ec5c92a390e7bfc70648a67be84619c0 (diff) | |
Show commands sent to test tool in verbose mode
Diffstat (limited to 'src')
| -rw-r--r-- | src/Main.hs | 1 | ||||
| -rw-r--r-- | src/Output.hs | 13 | 
2 files changed, 10 insertions, 4 deletions
| diff --git a/src/Main.hs b/src/Main.hs index d293226..60040b0 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -325,6 +325,7 @@ evalSteps = mapM_ $ \case      Send pname expr -> do          p <- eval pname          line <- eval expr +        outProc OutputChildStdin p line          send p line      Expect line pname expr captures inner -> do 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"                  ] |