Add initial implementation for running SBT commands.

This commit is contained in:
Stewart Hutchins 2022-11-23 18:13:43 +00:00
parent 81db32e148
commit 163e418754
10 changed files with 185 additions and 1 deletions

View file

@ -0,0 +1,6 @@
- id: sbt-create-files
name: touch
entry: touch
args: ["file1.txt", "\"file2 with space.txt\""]
description: "creates files provided by `args` or `files`"
language: sbt

View file

@ -0,0 +1,6 @@
import TouchCommand._
lazy val root = (project in file("."))
.settings(
commands ++= Seq(touchCommand)
)

View file

@ -0,0 +1,13 @@
import sbt.Command
import java.nio.file.{Files, Paths}
object TouchCommand {
def touchCommand = Command.args("touch", "args") { (state, args) =>
args.map(Paths.get(_).toAbsolutePath).foreach { path =>
println(f"Creating file: $path")
Files.createFile(path)
}
state
}
}