Automatically clearing the screen on recompile in sbt
sbt
Solution
You could define new command `clear`, which would use `jline` to clear the screen. Sbt is using `jline` internally so you shouldn't have to include any extra dependency.
`build.sbt`
def clearConsoleCommand = Command.command("clear") { state =>
val cr = new jline.console.ConsoleReader()
cr.clearScreen
state
}
val root = project.in(file(".")).settings(commands += clearConsoleCommand)
Now you could run your compile like this `~;clear;compile`. This will trigger clear the console followed by compile on each file change (assuming this is what you want).
Problem
I am using sbt with the sbt-revolver plugin and I want to clear the terminal screen (^L) when the project is recompiled (~ re-start). How can this be done?