de.halcony.argparse.parsing.DefaultArgument.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scala-argparse_2.13 Show documentation
Show all versions of scala-argparse_2.13 Show documentation
A re-imagined implementation of the handy python-argparse functionality for scala
package de.halcony.argparse.parsing
import de.halcony.argparse.ParsingResult
case class DefaultArgument[T] protected (override val name: String,
value: T,
override val description: String = "")
extends BaseArgument(name, description) {
override def parse(cmd: Iterable[String])(
implicit pargv: ParsingResult): Iterable[String] = {
pargv.addResult(name, ResultValue[T](value))
cmd
}
}
object DefaultArgument {
def apply[T](name: String, value: T): DefaultArgument[T] = {
new DefaultArgument[T](name, value)
}
}