func updateTerminalSize(term terminal.Terminal, tc terminal.Control) { width, height, err := tc.GetSize(0) if err != nil { return } term.SetSize(width, height) }
func terminalMessage(term terminal.Terminal, tc terminal.Control, color []byte, msg string, critical bool) { line := make([]byte, 0, len(msg)+16) line = append(line, ' ') line = append(line, color...) line = append(line, '*') line = append(line, tc.Escape(term).Reset...) line = append(line, []byte(fmt.Sprintf(" (%s) ", time.Now().Format(time.Kitchen)))...) if critical { line = append(line, tc.Escape(term).Red...) } line = appendTerminalEscaped(line, []byte(msg)) if critical { line = append(line, tc.Escape(term).Reset...) } line = append(line, '\n') term.Write(line) }