jw3 commented on a change in pull request #431:
URL: https://github.com/apache/incubator-daffodil/pull/431#discussion_r510176658
##########
File path: daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
##########
@@ -230,11 +236,21 @@ class CLIConf(arguments: Array[String]) extends
scallop.ScallopConf(arguments)
}
implicit def validateConverter = singleArgConverter[ValidationMode.Type]((s:
String) => {
+ import ValidatorPatterns._
s.toLowerCase match {
case "on" => ValidationMode.Full
case "limited" => ValidationMode.Limited
case "off" => ValidationMode.Off
- case _ => throw new Exception("Unrecognized ValidationMode %s. Must be
'on', 'limited' or 'off'.".format(s))
+ case DefaultArgPattern(name, arg) if Validators.isRegistered(name) =>
+ val config = arg.split(".").last match {
+ case "conf" => ConfigFactory.load(arg)
+ case _ => ConfigFactory.parseMap(Map(name -> arg).asJava)
+ }
+ val validator = Validators.get(name).make(Some(config))
+ ValidationMode.Custom(validator)
+ case NoArgsPattern(name) if Validators.isRegistered(name) =>
Review comment:
no arg usage looks like `--validate schematron`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]