func init() { // do not enable UTF-8 per locale by default, breaks tests sz, err := term.GetSize() if err == nil && sz.Columns != 0 { MaxColumns = sz.Columns } }
func main() { size, err := term.GetSize() if err != nil { fmt.Fprintf(os.Stderr, "failed: %s\n", err) os.Exit(1) } fmt.Printf("Lines %d Columns %d\n", size.Lines, size.Columns) }