The decline
extension adds the ability of using CronExpr
as
an option in the command line. To be able to use it add the following dependency to your classpath:
libraryDependencies ++= Seq(
"com.github.alonsodomin.cron4s" %% "cron4s-decline" % "0.6.1",
"com.monovore" %% "decline" % "1.2.0"
)
And now you will need some imports:
import cron4s.CronExpr
import cron4s.decline._
import com.monovore.decline._
Now you can define options based on cron expressions:
val cronOpt = Opts.option[CronExpr]("frequency", "A cron expression")
// cronOpt: Opts[CronExpr] = Validate(
// Single(
// Regular(
// List(LongName("frequency")),
// "cron-expr",
// "A cron expression",
// Normal
// )
// ),
// com.monovore.decline.Opts$$$Lambda$9881/1045862152@1c79416
// )