You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a custom parser in a command leads to an error when called with --help (if any (custom) required argument is not passed):
Main.scala:
sealed trait UtilsCommand extends Command
case class Test(file: java.io.File) extends UtilsCommand {
println(file)
}
object Main extends CommandAppOf[UtilsCommand]
someThingInScope.scala:
implicit val clJFileParser: ArgParser[java.io.File] =
ArgParser.instance[java.io.File] { s =>
Try(new java.io.File(s)) match {
case Success(x) if x.exists() => Right(x)
case Success(x) => Left(s"$s does not exist!")
case _ => Left(s"$s is not a valid file?")
}
}
command line:
java -jar .\utils.jar test --help
Required option file / List(Name(file)) not specified // In HListParser::get ?
The text was updated successfully, but these errors were encountered:
Can't give your example a try right now, but you should need to either define an implicit caseapp.core.Default[java.io.File], or give file a default value, or wrap it in an option (file: Option[java.io.File], so that it can be given a default value).
I'll check if that can be circumvented (and fix that), or mention it in the doc else.
Using a custom parser in a command leads to an error when called with --help (if any (custom) required argument is not passed):
Main.scala:
someThingInScope.scala:
command line:
The text was updated successfully, but these errors were encountered: