Features:
- Get the size of the current terminal as rows and columns.
- Listen on terminal size changes and receive the new size via a channel.
- Supports Linux and Windows.
$ go get github.com/kopoli/go-terminal-size
For a complete example see _example/example.go
.
Abbreviated example:
package main
import (
"fmt"
tsize "github.com/kopoli/go-terminal-size"
)
func main() {
var s tsize.Size
s, err := tsize.GetSize()
if err == nil {
fmt.Println("Current size is", s.Width, "by", s.Height)
}
}
MIT license