Copyright | (c) Joseph Canero 2016 |
---|---|
License | MIT |
Maintainer | Joseph Canero <jmc41493@gmail.com> |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
import System.Cron main :: IO () main = do let Right cs1 = parseCronSchedule "*/2 * 3 * 4,5,6" print $ describe defaultOpts cs1 let Right cs2 = parseCronSchedule "*/2 12 3 * 4,5,6" print $ describe (twentyFourHourFormat <> verbose) cs2
Options handling
defaultOpts :: OptionBuilder Source #
Return a builder that creates the default options for
describe
. The default options are:
notVerbose
and twelveHourFormat
.
twentyFourHourFormat :: OptionBuilder Source #
Return a builder that sets the options to use a 24-hour time format. This changes how hours are described. Using the 24-hour format, all hours are returned as their left-padded numeric value (01:00, 22:00, etc)
twelveHourFormat :: OptionBuilder Source #
Return a builder that sets the options to use a 12-hour time format. This changes how hours are described. Using the 12-hour format, all hours are returned as their left-padded numeric value with their period (01:00 AM, 10:00 PM, etc)
verbose :: OptionBuilder Source #
Return a builder that sets the options to be verbose. A verbose description doesn't eliminate unnecessary information. The only caveat being that month information is only ever displayed if it isn't "*".
notVerbose :: OptionBuilder Source #
Return a builder that sets the options to not be verbose. All information about the described cron schedule is returned. The only caveat being that month information is only ever displayed if it isn't "*".
data OptionBuilder Source #
Type that holds onto information for constructing options for
describe
.
Instances
Monoid OptionBuilder Source # | |
Defined in System.Cron.Internal.Describe.Options mempty :: OptionBuilder # mappend :: OptionBuilder -> OptionBuilder -> OptionBuilder # mconcat :: [OptionBuilder] -> OptionBuilder # | |
Semigroup OptionBuilder Source # | |
Defined in System.Cron.Internal.Describe.Options (<>) :: OptionBuilder -> OptionBuilder -> OptionBuilder # sconcat :: NonEmpty OptionBuilder -> OptionBuilder # stimes :: Integral b => b -> OptionBuilder -> OptionBuilder # |
Describe a CronSchedule
describe :: OptionBuilder -> CronSchedule -> String Source #
Given an OptionBuilder
and a CronSchedule
parsed with
parseCronSchedule
, return a human-readable string
describing when that schedule will match.