Merge pull request #3365 from sbt/wip/terminalwidth

InteractionService#terminalWidth
This commit is contained in:
eugene yokota 2017-07-25 05:16:08 -04:00 committed by GitHub
commit 996b760a9e
2 changed files with 9 additions and 1 deletions

View File

@ -1,6 +1,6 @@
package sbt
import sbt.internal.util.SimpleReader
import sbt.internal.util.{ JLine, SimpleReader }
trait CommandLineUIService extends InteractionService {
override def readLine(prompt: String, mask: Boolean): Option[String] = {
@ -19,6 +19,10 @@ trait CommandLineUIService extends InteractionService {
case _ => false
}
}
override def terminalWidth: Int = JLine.usingTerminal(_.getWidth)
override def terminalHeight: Int = JLine.usingTerminal(_.getHeight)
}
object CommandLineUIService extends CommandLineUIService

View File

@ -13,5 +13,9 @@ abstract class InteractionService {
/** Ask the user to confirm something (yes or no) before continuing. */
def confirm(msg: String): Boolean
def terminalWidth: Int
def terminalHeight: Int
// TODO - Ask for input with autocomplete?
}