fix and validate core selection

This commit is contained in:
2025-10-06 17:45:04 +02:00
parent e6f3474fd9
commit 32e626a5a1
2 changed files with 10 additions and 1 deletions

View File

@@ -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}")
}
}
}

View File

@@ -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)
}
}