Documentation ¶
Index ¶
- Constants
- func Style(sType string, s string) string
- type LineWriter
- func (w *LineWriter) Close() error
- func (w *LineWriter) Flush() error
- func (w *LineWriter) Lines() int
- func (w *LineWriter) SetFlushDuration(d time.Duration)
- func (w *LineWriter) WriteLastLine(s string) (int, error)
- func (w *LineWriter) WriteLine(n int, s string) error
- func (w *LineWriter) WriteNewLine(s string) (int, error)
Constants ¶
View Source
const ( Bold = "\033[1m" Dim = "\033[2m" Underline = "\033[4m" Blink = "\033[5m" // Reverse invert the foreground and background colors Reverse = "\033[7m" Hidden = "\033[8m" ResetAllStyle = "\033[0m" Default = "\033[39m" Black = "\033[30m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" LightGray = "\033[37m" DarkGray = "\033[90m" LightRed = "\033[91m" LightGreen = "\033[92m" LightYellow = "\033[93m" LightBlue = "\033[94m" LightMagenta = "\033[95m" LightCyan = "\033[96m" White = "\033[97m" BgDefault = "\033[49m" BgBlack = "\033[40m" BgRed = "\033[41m" BgGreen = "\033[42m" BgYellow = "\033[43m" BgBlue = "\033[44m" BgMagenta = "\033[45m" BgCyan = "\033[46m" BgLightGray = "\033[47m" BgDarkGray = "\033[100m" BgLightRed = "\033[101m" BgLightGreen = "\033[102m" BgLightYellow = "\033[103m" BgLightBlue = "\033[104m" BgLightMagenta = "\033[105m" BgLightCyan = "\033[106m" BgWhite = "\033[107m" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LineWriter ¶
LineWriter maintains <n> new lines. Each line can be overwritten. Zero value is not ready for use.
func New ¶
func New(lines int) (*LineWriter, error)
New creates a *LineWriter for os.Stdout, inits and maintains n lines. Also starts a flush timer with default duration of 200*time.Millisecond. Number of lines should > 0.
LineWriter.Close should be used after finished.
Note: This is a buffer method.
func (*LineWriter) Close ¶
func (w *LineWriter) Close() error
Close end with a newline, stop timer, flush all remaining buffered string
func (*LineWriter) Flush ¶
func (w *LineWriter) Flush() error
Flush all buffered string to the underlying io.Writer
func (*LineWriter) SetFlushDuration ¶
func (w *LineWriter) SetFlushDuration(d time.Duration)
func (*LineWriter) WriteLastLine ¶
func (w *LineWriter) WriteLastLine(s string) (int, error)
WriteLastLine overwrites the last line. Returns the last line number.
Any position control string will lead to unexpected behavior. Such as \n, \033[K ... Note: This is a buffer method.
func (*LineWriter) WriteLine ¶
func (w *LineWriter) WriteLine(n int, s string) error
WriteLine overwrites the nth line.
Any position control string will lead to unexpected behavior. Such as \n, \033[K... Note: This is a buffer method.
func (*LineWriter) WriteNewLine ¶
func (w *LineWriter) WriteNewLine(s string) (int, error)
WriteNewLine Move cursor to new line at the bottom and write to it. Returns new line number.
Note: This is a buffer method.
Click to show internal directories.
Click to hide internal directories.