internal

package
v0.12.68 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 31, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func AddTitleToLine(title, line string, length int, left bool) string

AddTitleToLine adds a title to a site of a line ex: "─ This is the title ──────"

func AddTitleToLineCenter

func AddTitleToLineCenter(title, line string, length int) string

AddTitleToLineCenter adds a title to the center of a line ex: "─ This is the title ──────"

func CenterText

func CenterText(text string, width int) string

CenterText returns a centered string with a padding left and right If width is 0, it will be calculated automatically

func GetStringMaxWidth

func GetStringMaxWidth(s string) int

GetStringMaxWidth returns the maximum width of a string with multiple lines.

func MapRangeToRange

func MapRangeToRange(fromMin, fromMax, toMin, toMax, current float32) int

func NewCancelationSignal

func NewCancelationSignal(interruptFunc func()) (func(), func())

NewCancelationSignal for keeping track of a cancelation

func Percentage

func Percentage(total, current float64) float64

Percentage calculates percentage.

func PercentageRound

func PercentageRound(total, current float64) float64

PercentageRound returns a rounded Percentage.

func RemoveAndCountPrefix

func RemoveAndCountPrefix(input, subString string) (string, int)

func ReturnLongestLine

func ReturnLongestLine(text, sep string) string

ReturnLongestLine returns the longest line with a given separator

func RunsInCi

func RunsInCi() bool

RunsInCi returns true if the current build is running on a CI server.

func WithBoolean

func WithBoolean(b []bool) bool

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

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL