...
1# term - utilities for dealing with terminals
2
3 [](https://godoc.org/github.com/moby/term) [](https://goreportcard.com/report/github.com/moby/term)
4
5term provides structures and helper functions to work with terminal (state, sizes).
6
7#### Using term
8
9```go
10package main
11
12import (
13 "log"
14 "os"
15
16 "github.com/moby/term"
17)
18
19func main() {
20 fd := os.Stdin.Fd()
21 if term.IsTerminal(fd) {
22 ws, err := term.GetWinsize(fd)
23 if err != nil {
24 log.Fatalf("term.GetWinsize: %s", err)
25 }
26 log.Printf("%d:%d\n", ws.Height, ws.Width)
27 }
28}
29```
30
31## Contributing
32
33Want to hack on term? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.
34
35## Copyright and license
36Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.
View as plain text