package main import ( "os" "golang.org/x/term" ) func getTerminalWidth() int { width, _, err := term.GetSize(int(os.Stdout.Fd())) if err != nil { // Return a default width if there's an error return 80 } return width }