github.com/kopoli/go-terminal-size@v0.0.0-20170219200355-5c97524c8b54/README.md (about)

     1  # Go terminal size
     2  
     3  [![GoDoc](https://godoc.org/github.com/kopoli/go-terminal-size?status.svg)](https://godoc.org/github.com/kopoli/go-terminal-size)
     4  [![Build Status](https://travis-ci.org/kopoli/go-terminal-size.svg?branch=master)](https://travis-ci.org/kopoli/go-terminal-size)
     5  [![Go Report Card](https://goreportcard.com/badge/github.com/kopoli/go-terminal-size)](https://goreportcard.com/report/github.com/kopoli/go-terminal-size)
     6  
     7  Features:
     8  - Get the size of the current terminal as rows and columns.
     9  - Listen on terminal size changes and receive the new size via a channel.
    10  - Supports Linux and Windows.
    11  
    12  ## Installation
    13  
    14  ```
    15  $ go get github.com/kopoli/go-terminal-size
    16  ```
    17  
    18  ## Usage
    19  
    20  For a complete example see `_example/example.go`.
    21  
    22  Abbreviated example:
    23  ```golang
    24  package main
    25  
    26  import (
    27  	"fmt"
    28  
    29  	tsize "github.com/kopoli/go-terminal-size"
    30  )
    31  
    32  func main() {
    33  	var s tsize.Size
    34  
    35  	s, err := tsize.GetSize()
    36  	if err == nil {
    37  		fmt.Println("Current size is", s.Width, "by", s.Height)
    38  	}
    39  }
    40  ```
    41  
    42  ## License
    43  
    44  MIT license