MCPcopy Index your code
hub / github.com/cortexlabs/cortex / getTerminalWidth

Function getTerminalWidth

cli/cmd/lib_watch.go:32–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

30)
31
32func getTerminalWidth() int {
33 cmd := exec.Command("stty", "size")
34 cmd.Stdin = os.Stdin
35 out, err := cmd.Output()
36 if err != nil {
37 return 0
38 }
39 dimensions := strings.Split(strings.TrimSpace(string(out)), " ")
40 if len(dimensions) != 2 {
41 return 0
42 }
43 widthStr := dimensions[1]
44 width, ok := s.ParseInt(widthStr)
45 if !ok {
46 return 0
47 }
48 return width
49}
50
51func watchHeader() string {
52 timeStr := libtime.LocalHourNow()

Callers 2

watchHeaderFunction · 0.85
rerunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected