Documentation ¶
Index ¶
- Variables
- func AddTitleToLine(title, line string, length int, left bool) string
- func AddTitleToLineCenter(title, line string, length int) string
- func CenterText(text string, width int) string
- func Complementary(r, g, b uint8) (uint8, uint8, uint8)
- func Exit(code int)
- func GetStringMaxWidth(s string) int
- func MapRangeToRange(fromMin, fromMax, toMin, toMax, current float32) int
- func NewCancelationSignal(interruptFunc func()) (func(), func())
- func Percentage(total, current float64) float64
- func PercentageRound(total, current float64) float64
- func RemoveAndCountPrefix(input, subString string) (string, int)
- func ReturnLongestLine(text, sep string) string
- func RunsInCi() bool
- func WithBoolean(b []bool) bool
- type ExitFuncType
Constants ¶
This section is empty.
Variables ¶
var RandomStrings = []string{
"hello world", "²³14234!`§=)$-.€@_&", "This is a sentence.", "This\nstring\nhas\nmultiple\nlines",
"windows\r\nline\r\nendings", "\rtext",
}
RandomStrings contains a list of random strings to use while testing.
Functions ¶
func AddTitleToLine ¶ added in v0.12.24
AddTitleToLine adds a title to a site of a line ex: "─ This is the title ──────"
func AddTitleToLineCenter ¶ added in v0.12.24
AddTitleToLineCenter adds a title to the center of a line ex: "─ This is the title ──────"
func CenterText ¶ added in v0.12.23
CenterText returns a centered string with a padding left and right If width is 0, it will be calculated automatically
func GetStringMaxWidth ¶ added in v0.11.0
GetStringMaxWidth returns the maximum width of a string with multiple lines.
func MapRangeToRange ¶ added in v0.5.1
func NewCancelationSignal ¶ added in v0.12.45
func NewCancelationSignal(interruptFunc func()) (func(), func())
NewCancelationSignal for keeping track of a cancelation
func PercentageRound ¶
PercentageRound returns a rounded Percentage.
func RemoveAndCountPrefix ¶ added in v0.8.0
func ReturnLongestLine ¶ added in v0.12.23
ReturnLongestLine returns the longest line with a given separator
func RunsInCi ¶ added in v0.12.39
func RunsInCi() bool
RunsInCi returns true if the current build is running on a CI server.
func WithBoolean ¶ added in v0.3.0
WithBoolean helps an option setter (WithXXX(b ...bool) to return true, if no boolean is set, but false if it's explicitly set to false.
Types ¶
type ExitFuncType ¶ added in v0.12.72
type ExitFuncType func(int)
ExitFuncType is the type of function used to exit the program.
var DefaultExitFunc ExitFuncType = os.Exit
DefaultExitFunc is the default function used to exit the program.