fix and validate core selection
This commit is contained in:
@@ -5,6 +5,13 @@ import org.rogach.scallop.*
|
||||
|
||||
trait CoreSelection { this: MySubcommand =>
|
||||
val core: ScallopOption[String] = opt[String](group = mainGroup, required = true, descr = "The core to be extended; core datasheets are in coreDatasheets/")
|
||||
def getCoreDatasheet: os.Path = CORE_DATASHEETS / s"${core()}.yaml"
|
||||
|
||||
def getCoreDatasheet: os.Path = CORE_DATASHEETS / s"$core.yaml"
|
||||
addValidation {
|
||||
if (os.isFile(getCoreDatasheet)) {
|
||||
Right(())
|
||||
} else {
|
||||
Left(s"Core ${core()} not supported, no core datasheet at ${getCoreDatasheet}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -19,6 +19,8 @@ trait TaskImpl[T <: Task : ClassTag] extends Task with Logging[T] {
|
||||
|
||||
def runExecutable(execPath: Path, args: Shellable*): os.CommandResult = {
|
||||
val command = s"$execPath ${args.flatMap(_.value).mkString(" ")}"
|
||||
log.info(s"Running external program: ")
|
||||
log.info(command)
|
||||
os.proc("bash", "-c", command).call(stdout = os.Inherit)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user