This module contains helper functions for performing validations (see the
"validate..." functions in Cli.Option).
A helper for regex validations.
programConfig : Program.Config String
programConfig =
Program.config
|> Program.add
(OptionsParser.build identity
|> OptionsParser.with
(Option.requiredKeywordArg "name"
|> Option.validate
(Cli.Validate.regex "^[A-Z][A-Za-z_]*")
)
)If the validation fails, the user gets output like this:
$ ./greet --name john
Validation errors:
`name` failed a validation. Must be of form /^[A-Z][A-Za-z_]*/
Value was:
"john"
Turns a predicate function into a validate function.