summaryrefslogtreecommitdiff
path: root/Propellor/Property
diff options
context:
space:
mode:
authorJoey Hess2014-04-09 01:15:11 -0400
committerJoey Hess2014-04-09 01:15:11 -0400
commitad02c89c6aa6902b9b16375f61df2139e47dfcb3 (patch)
tree2cc68a0c0ce31e227df1623cd4dbf781478f082b /Propellor/Property
parent335cce275afb78931416748c9e9acabb22c68f64 (diff)
update
Diffstat (limited to 'Propellor/Property')
-rw-r--r--Propellor/Property/Scheduled.hs11
1 files changed, 10 insertions, 1 deletions
diff --git a/Propellor/Property/Scheduled.hs b/Propellor/Property/Scheduled.hs
index 2e7ae060..bef2a297 100644
--- a/Propellor/Property/Scheduled.hs
+++ b/Propellor/Property/Scheduled.hs
@@ -1,5 +1,6 @@
module Propellor.Property.Scheduled
( period
+ , periodParse
, Recurrance(..)
, WeekDay
, MonthDay
@@ -31,7 +32,15 @@ period prop recurrance = Property desc $ do
else noChange
where
schedule = Schedule recurrance AnyTime
- desc = propertyDesc prop ++ " (period " ++ show recurrance ++ ")"
+ desc = propertyDesc prop ++ " (period " ++ fromRecurrance recurrance ++ ")"
+
+-- | Like period, but parse a human-friendly string.
+periodParse :: Property -> String -> Property
+periodParse prop s = case toRecurrance s of
+ Just recurrance -> period prop recurrance
+ Nothing -> Property "periodParse" $ do
+ warningMessage $ "failed periodParse: " ++ s
+ noChange
lastCheckedFile :: FilePath
lastCheckedFile = localdir </> ".lastchecked"