Skip to content

kopoli/go-terminal-size

Repository files navigation

Go terminal size

GoDoc Build Status Go Report Card

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.

Installation

$ go get github.com/kopoli/go-terminal-size

Usage

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)
	}
}

License

MIT license

About

Get terminal size on Linux and Windows

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages