Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kopoli/go-terminal-size
Get terminal size on Linux and Windows
https://github.com/kopoli/go-terminal-size
Last synced: about 2 months ago
JSON representation
Get terminal size on Linux and Windows
- Host: GitHub
- URL: https://github.com/kopoli/go-terminal-size
- Owner: kopoli
- License: mit
- Created: 2017-02-12T15:10:05.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-02-19T20:05:03.000Z (almost 8 years ago)
- Last Synced: 2024-06-19T15:12:29.220Z (7 months ago)
- Language: Go
- Homepage:
- Size: 21.5 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Go terminal size
[![GoDoc](https://godoc.org/github.com/kopoli/go-terminal-size?status.svg)](https://godoc.org/github.com/kopoli/go-terminal-size)
[![Build Status](https://travis-ci.org/kopoli/go-terminal-size.svg?branch=master)](https://travis-ci.org/kopoli/go-terminal-size)
[![Go Report Card](https://goreportcard.com/badge/github.com/kopoli/go-terminal-size)](https://goreportcard.com/report/github.com/kopoli/go-terminal-size)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:
```golang
package mainimport (
"fmt"tsize "github.com/kopoli/go-terminal-size"
)func main() {
var s tsize.Sizes, err := tsize.GetSize()
if err == nil {
fmt.Println("Current size is", s.Width, "by", s.Height)
}
}
```## License
MIT license