diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2022-09-26 22:17:52 +0200 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2022-09-27 21:42:47 +0200 |
commit | 90b15b0ecc6fc153120e0d01288697dfe10e28f9 (patch) | |
tree | 75dd9fc315665ad7837b44bd372e5289a522b1ed /src/Output.hs | |
parent | 1621f4c017f88b7c89d095748112812c58e5d530 (diff) |
Process lifetime determined by scope
Diffstat (limited to 'src/Output.hs')
-rw-r--r-- | src/Output.hs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/Output.hs b/src/Output.hs index 0bf757a..ca7f862 100644 --- a/src/Output.hs +++ b/src/Output.hs @@ -18,8 +18,6 @@ import Data.Text.Lazy.IO qualified as TL import System.IO -import Test - data Output = Output { outState :: MVar OutputState , outConfig :: OutputConfig @@ -91,14 +89,14 @@ showPrompt _ = return () ioWithOutput :: MonadOutput m => (Output -> IO a) -> m a ioWithOutput act = liftIO . act =<< getOutput -outLine :: MonadOutput m => OutputType -> Maybe ProcName -> Text -> m () -outLine otype mbproc line = ioWithOutput $ \out -> +outLine :: MonadOutput m => OutputType -> Text -> Text -> m () +outLine otype prompt line = ioWithOutput $ \out -> when (outVerbose (outConfig out) || printWhenQuiet otype) $ do withMVar (outState out) $ \st -> do clearPrompt st TL.putStrLn $ TL.fromChunks [ T.pack "\ESC[", outColor otype, T.pack "m" - , maybe T.empty textProcName mbproc + , prompt , outSign otype , T.pack "> " , line |