summaryrefslogtreecommitdiff
path: root/Propellor/Message.hs
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2014-04-04 01:12:44 -0400
committerJoey Hess <joey@kitenet.net>2014-04-04 01:12:44 -0400
commit8bb175d1078de6add55f5c5f689693495d141436 (patch)
tree74173c19b2b293b94d993398c41a3063d2f5b364 /Propellor/Message.hs
parenteea8637afe78ceff25ddd11d365a3fc022cc5fa4 (diff)
parentccc82907124ccd2ad4951c2c4946ae20af007530 (diff)
Merge branch 'joeyconfig'
Conflicts: config.hs
Diffstat (limited to 'Propellor/Message.hs')
-rw-r--r--Propellor/Message.hs18
1 files changed, 11 insertions, 7 deletions
diff --git a/Propellor/Message.hs b/Propellor/Message.hs
index eb3f3177..5a7d8c4b 100644
--- a/Propellor/Message.hs
+++ b/Propellor/Message.hs
@@ -15,21 +15,25 @@ actionMessage desc a = do
r <- a
+ setTitle "propellor: running"
let (msg, intensity, color) = getActionResult r
putStr $ desc ++ " ... "
- setSGR [SetColor Foreground intensity color]
- putStrLn msg
- setSGR []
- setTitle "propellor: running"
+ colorLine intensity color msg
hFlush stdout
return r
warningMessage :: String -> IO ()
-warningMessage s = do
- setSGR [SetColor Foreground Vivid Red]
- putStrLn $ "** warning: " ++ s
+warningMessage s = colorLine Vivid Red $ "** warning: " ++ s
+
+colorLine :: ColorIntensity -> Color -> String -> IO ()
+colorLine intensity color msg = do
+ setSGR [SetColor Foreground intensity color]
+ putStr msg
setSGR []
+ -- Note this comes after the color is reset, so that
+ -- the color set and reset happen in the same line.
+ putStrLn ""
hFlush stdout
errorMessage :: String -> IO a