sbtのコマンドを自作することが出来るらしいので、
gist.github.com
とりあえず、作ってみました。
commands += Command.command("hello"){ state =>
println("hello, world")
state
}
sbt helloってやると、hello, worldが出力されたりします。
なにげに、既存のsbtコマンドをラッピングすることも可能なようです。
commands += Command.command("test"){ state =>
val analysis = Project.extract(state).runTask(compile in Test, state)._2
val testNames = Tests.allDefs(analysis).collect{ case c: xsbti.api.ClassLike => c.name }
Seq("test-only " + testNames.sorted.mkString(" ")) ::: state
}
詳しく読めていないのでアレなんですが、たぶんcommandsにtestを追加しているだけで上書きしていないような気がしているんですよね。
もしかしたら上書きしているのかもしませんが。