object ClearShell { lazy val clearShell = TaskKey[Unit]( "clear", "Clears your shell. Useful to clear screen between test runs e.g. ~; clear ; test" ) lazy val clearShellTask = clearShell := { """printf \033c""".! } val settings = Seq( clearShellTask ) }
Useful little util I add to any Build.scala. When doing test-first development having
your terminal full of old test runs can be a real pain. This little task lets me use
~; clear ; test-only io.michaelallen.foo._
to clear the screen before each test run.
Explanation of the printf \033c
part: Answer by Sandeep Datta to Stack Overflow
question Clear the Ubuntu bash screen for real
To use it simply add it to your Build.scala then add .settings(ClearShell.settings:_*)
to your project definition.