Terminal is used to write messages and display status lines which can be updated. When the output is redirected to a file, the status lines are not printed.
| 19 | // updated. When the output is redirected to a file, the status lines are not |
| 20 | // printed. |
| 21 | type Terminal struct { |
| 22 | rd io.ReadCloser |
| 23 | inFd uintptr |
| 24 | wr io.Writer |
| 25 | fd uintptr |
| 26 | errWriter io.Writer |
| 27 | msg chan message |
| 28 | status chan status |
| 29 | lastStatus []string |
| 30 | inputIsTerminal bool |
| 31 | outputIsTerminal bool |
| 32 | canUpdateStatus bool |
| 33 | |
| 34 | outputWriter io.WriteCloser |
| 35 | outputWriterOnce sync.Once |
| 36 | |
| 37 | // will be closed when the goroutine which runs Run() terminates, so it'll |
| 38 | // yield a default value immediately |
| 39 | closed chan struct{} |
| 40 | |
| 41 | clearCurrentLine func(io.Writer, uintptr) error |
| 42 | moveCursorUp func(io.Writer, uintptr, int) error |
| 43 | moveCursorDown func(io.Writer, uintptr, int) error |
| 44 | } |
| 45 | |
| 46 | type message struct { |
| 47 | line string |
nothing calls this directly
no outgoing calls
no test coverage detected