summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess2014-04-04 00:18:51 -0400
committerJoey Hess2014-04-04 00:18:51 -0400
commitdd08ae61dbbf01e9ed8a69549b14892057a375bb (patch)
tree83c74e669478b4528ed1b8171483de21db1a6c47
parent3aff9915532ae7256deb982e9c8d05e174249a32 (diff)
propellor spin
-rw-r--r--.gitignore1
-rw-r--r--Propellor/Message.hs18
2 files changed, 12 insertions, 7 deletions
diff --git a/.gitignore b/.gitignore
index a2bed361..e9925509 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,4 @@ privdata/keyring.gpg~
Setup
Setup.hi
Setup.o
+docker
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