diff options
| author | Joey Hess <joey@kitenet.net> | 2014-03-31 18:31:08 -0400 |
|---|---|---|
| committer | Joey Hess <joey@kitenet.net> | 2014-03-31 18:31:08 -0400 |
| commit | c246a8ee745723140150c8b8d35b7a7121c90c11 (patch) | |
| tree | df25d3e13ef919e14ee51f1c70e82073c1077209 /Propellor/Types.hs | |
| parent | 549df2612c0e12d44bf4e998cabdfcf3bb0a7344 (diff) | |
propellor spin
Diffstat (limited to 'Propellor/Types.hs')
| -rw-r--r-- | Propellor/Types.hs | 13 |
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) |
