Documentation
¶
Overview ¶
termlib is a light weight terminal interface library. Sort of a ncurse light. Copyright (C) 2025 R. S. Doiel
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License ¶
termlib is a light weight terminal interface library. Copyright (C) 2025 R. S. Doiel
Index ¶
- Constants
- func FmtHelp(src string, appName string, version string, releaseDate string, ...) string
- type Terminal
- func (t *Terminal) Clear()
- func (t *Terminal) ClrToBOL()
- func (t *Terminal) ClrToEOL()
- func (t *Terminal) GetBgColor() string
- func (t *Terminal) GetCurPos() (int, int)
- func (t *Terminal) GetFgColor() string
- func (t *Terminal) GetTerminalHeight() int
- func (t *Terminal) GetTerminalWidth() int
- func (t *Terminal) Move(row, col int)
- func (t *Terminal) Print(s string)
- func (t *Terminal) Printf(format string, a ...interface{})
- func (t *Terminal) Println(a ...interface{})
- func (t *Terminal) Refresh()
- func (t *Terminal) ResetStyle()
- func (t *Terminal) SetBgColor(color string)
- func (t *Terminal) SetBold()
- func (t *Terminal) SetFgColor(color string)
- func (t *Terminal) SetItalic()
- func (t *Terminal) UpdateTerminalSize()
Constants ¶
const ( Reset = "\033[0m" Bold = "\033[1m" Italic = "\033[3m" Black = "\033[30m" Red = "\033[31m" Green = "\033[32m" Yellow = "\033[33m" Blue = "\033[34m" Magenta = "\033[35m" Cyan = "\033[36m" White = "\033[37m" BlackBg = "\033[40m" RedBg = "\033[41m" GreenBg = "\033[42m" YellowBg = "\033[43m" BlueBg = "\033[44m" MagentaBg = "\033[45m" CyanBg = "\033[46m" WhiteBg = "\033[47m" )
ANSI escape codes for colors and styles
const ( // Version number of release Version = "0.0.4" // ReleaseDate, the date version.go was generated ReleaseDate = "2025-12-24" // ReleaseHash, the Git hash when version.go was generated ReleaseHash = "001ee9a" LicenseText = `` /* 34525-byte string literal not displayed */ )
const (
DemoHelpText = `` /* 435-byte string literal not displayed */
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Terminal ¶ added in v0.0.4
type Terminal struct {
// contains filtered or unexported fields
}
Terminal represents a terminal controller.
func (*Terminal) Clear ¶ added in v0.0.4
func (t *Terminal) Clear()
Clear clears the screen and moves the cursor to the top-left corner.
func (*Terminal) ClrToBOL ¶ added in v0.0.4
func (t *Terminal) ClrToBOL()
ClrToBOL clears from the current cursor position to the start of the line.
func (*Terminal) ClrToEOL ¶ added in v0.0.4
func (t *Terminal) ClrToEOL()
ClrToEOL clears from the current cursor position to the end of the line.
func (*Terminal) GetBgColor ¶ added in v0.0.4
GetBgColor retrieves the background color code.
func (*Terminal) GetFgColor ¶ added in v0.0.4
GetFgColor retrives the foreground color code.
func (*Terminal) GetTerminalHeight ¶ added in v0.0.4
GetTerminalHeight returns the terminal height.
func (*Terminal) GetTerminalWidth ¶ added in v0.0.4
GetTerminalWidth returns the terminal width.
func (*Terminal) Move ¶ added in v0.0.4
Move moves the cursor to the specified row and column (1-based).
func (*Terminal) Print ¶ added in v0.0.4
Print writes a string to the terminal with current style and updates the cursor position.
func (*Terminal) Printf ¶ added in v0.0.4
Printf writes a format string to the terminal with the current style and updates the cursor position.
func (*Terminal) Println ¶ added in v0.0.4
func (t *Terminal) Println(a ...interface{})
Println writes parameters as a string with a trailing new line
func (*Terminal) Refresh ¶ added in v0.0.4
func (t *Terminal) Refresh()
Refresh ensures all buffered output is written to the terminal.
func (*Terminal) ResetStyle ¶ added in v0.0.4
func (t *Terminal) ResetStyle()
ResetStyle resets all styles to default.
func (*Terminal) SetBgColor ¶ added in v0.0.4
SetBgColor sets the background color.
func (*Terminal) SetFgColor ¶ added in v0.0.4
SetFgColor sets the foreground color.
func (*Terminal) SetItalic ¶ added in v0.0.4
func (t *Terminal) SetItalic()
SetItalic enables italic text.
func (*Terminal) UpdateTerminalSize ¶ added in v0.0.4
func (t *Terminal) UpdateTerminalSize()
UpdateTerminalSize updates the terminal width and height.