duhemm / term   0.1.0

GitHub
Scala versions: 2.13 2.12 2.11

term-size - How large is the terminal window?

term-size exposes a platform-independent API to get the size of the current terminal window. On platform where the native library is available, term-size doesn't require forking a new process to get the terminal size. When the native library is unavailable, term-size uses tput to get the size of the current terminal.

Installation

term-size is available on Maven Central. Add the following to your build:

libraryDependencies += "com.github.duhemm" %% "term-size" % "<version>"

The latest version available is Maven Central

Example usage

object Main {
  def main(args: Array[String]): Unit = {
    val size = term.TermSize.size()
    println(s"Current terminal size: ${size.rows} rows and ${size.cols} columns.")
  }
}

Documentation: javadoc

Compatibility

Operating system / CPU architecture x86_64 x86_32 ARM
MacOS πŸš€ βœ… βœ…
Linux πŸš€ βœ… βœ…
Windows πŸš€ ❌ ❌

πŸš€: Available, native
βœ…: Available, via Tput
❌: Unavailable