summaryrefslogtreecommitdiff
path: root/Propellor/Types.hs
diff options
context:
space:
mode:
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)