summaryrefslogtreecommitdiff
path: root/Propellor/Types.hs
diff options
context:
space:
mode:
authorJoey Hess2014-03-31 18:31:08 -0400
committerJoey Hess2014-03-31 18:31:08 -0400
commitc246a8ee745723140150c8b8d35b7a7121c90c11 (patch)
treedf25d3e13ef919e14ee51f1c70e82073c1077209 /Propellor/Types.hs
parent549df2612c0e12d44bf4e998cabdfcf3bb0a7344 (diff)
propellor spin
Diffstat (limited to 'Propellor/Types.hs')
-rw-r--r--Propellor/Types.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Propellor/Types.hs b/Propellor/Types.hs
index ec472ffe..5874863c 100644
--- a/Propellor/Types.hs
+++ b/Propellor/Types.hs
@@ -1,6 +1,7 @@
module Propellor.Types where
import Data.Monoid
+import System.Console.ANSI
type HostName = String
type UserName = String
@@ -24,3 +25,15 @@ instance Monoid Result where
mappend MadeChange _ = MadeChange
mappend _ MadeChange = MadeChange
mappend NoChange NoChange = NoChange
+
+class ActionResult a where
+ getActionResult :: a -> (String, ColorIntensity, Color)
+
+instance ActionResult Bool where
+ getActionResult False = ("ok", Vivid, Red)
+ getActionResult True = ("failed", Vivid, Green)
+
+instance ActionResult Result where
+ getActionResult NoChange = ("unchanged", Dull, Green)
+ getActionResult MadeChange = ("done", Vivid, Green)
+ getActionResult FailedChange = ("failed", Vivid, Red)