b5bc279901
Changes: - winterm: GetStdFile(): Added compatibility with "golang.org/x/sys/windows" - winterm: fix GetStdFile() falltrough - update deprecation message to refer to the correct replacement - add go.mod - Fix int overflow - Convert int to string using rune() full diff: - https://github.com/moby/term/compare/bea5bbe245bf407372d477f1361d2ff042d2f556...3f7ff695adc6a35abc925370dd0a4dafb48ec64d - https://github.com/Azure/go-ansiterm/compare/d6e3b3328b783f23731bc4d058875b0371ff8109...d185dfc1b5a126116ea5a19e148e29d16b4574c9 Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
term - utilities for dealing with terminals
term provides structures and helper functions to work with terminal (state, sizes).
Using term
package main
import (
"log"
"os"
"github.com/moby/term"
)
func main() {
fd := os.Stdin.Fd()
if term.IsTerminal(fd) {
ws, err := term.GetWinsize(fd)
if err != nil {
log.Fatalf("term.GetWinsize: %s", err)
}
log.Printf("%d:%d\n", ws.Height, ws.Width)
}
}
Contributing
Want to hack on term? Docker's contributions guidelines apply.
Copyright and license
Code and documentation copyright 2015 Docker, inc. Code released under the Apache 2.0 license. Docs released under Creative commons.