| 1 |
# consolesize-go |
| 2 |
|
| 3 |
[](https://github.com/sponsors/nathan-fiscaletti) |
| 4 |
[](https://godoc.org/github.com/nathan-fiscaletti/consolesize-go) |
| 5 |
[](https://goreportcard.com/report/github.com/nathan-fiscaletti/consolesize-go) |
| 6 |
|
| 7 |
**consolesize-go** is a library that will allow you to read the size of any console window on both **Unix** and **Windows** systems. |
| 8 |
|
| 9 |
## Install |
| 10 |
|
| 11 |
```sh |
| 12 |
$ go get github.com/nathan-fiscaletti/consolesize-go |
| 13 |
``` |
| 14 |
|
| 15 |
## Usage |
| 16 |
|
| 17 |
```go |
| 18 |
package main |
| 19 |
|
| 20 |
import ( |
| 21 |
"fmt" |
| 22 |
|
| 23 |
"github.com/nathan-fiscaletti/consolesize-go" |
| 24 |
) |
| 25 |
|
| 26 |
func main() { |
| 27 |
cols, rows := consolesize.GetConsoleSize() |
| 28 |
fmt.Printf("Rows: %v, Cols: %v\n", rows, cols) |
| 29 |
} |
| 30 |
``` |
| 31 |
|