package
0.43.0
Repository: https://github.com/wtfutil/wtf.git
Documentation: pkg.go.dev

# Functions

CalculateDimensions reads the module dimensions from the module and global config.
CenterText takes a string and a width and pads the left and right of the string with empty spaces to ensure that the string is in the middle of the returned value Example: x := CenterText("cat", 11) > " cat ".
Clamp restricts values to a minimum and maximum value Examples: clamp(6, 3, 8) => 6 clamp(1, 3, 8) => 3 clamp(9, 3, 8) => 8.
ColorizePercent provides a standard way to colorize percentages for which large numbers are good (green) and small numbers are bad (red).
DoesNotInclude takes a slice of strings and a target string and returns TRUE if the slice does not include the target, FALSE if it does Example: x := DoesNotInclude([]string{"cat", "dog", "rat"}, "dog") > false x := DoesNotInclude([]string{"cat", "dog", "rat"}, "pig") > true.
ExecuteCommand executes an external command on the local machine as the current user.
ExpandHomeDir expands the path to include the home directory if the path is prefixed with `~`.
FindBetween finds and returns the text between two strings Example: a := "{ cat } { dog }" b := FindBetween(a, "{", "}") > [" cat ", " dog "].
FindMatch takes a regex pattern and a string of data and returns back all the matches in that string.
No description provided by the author
HighlightableHelper pads the given text with blank spaces to the width of the view containing it.
Includes takes a slice of strings and a target string and returns TRUE if the slice includes the target, FALSE if it does not Example: x := Includes([]string{"cat", "dog", "rat"}, "dog") > true x := Includes([]string{"cat", "dog", "rat"}, "pig") > false.
Init initializes global settings in the wtf package.
IntsToUints takes a slice of ints and returns a slice of uints.
MapToStrs takes a map of interfaces and returns a map of strings.
MaxInt returns the larger of x or y Examples: MaxInt(3, 2) => 3 MaxInt(2, 3) => 3.
NameFromEmail takes an email address and returns the part that comes before the @ symbol Example: NameFromEmail("[email protected]") > "Test_user".
NamesFromEmails takes a slice of email addresses and returns a slice of the parts that come before the @ symbol Example: NamesFromEmail("[email protected]", "[email protected]") > []string{"Test_user", "Other_user"}.
OpenFile opens the file defined in `path` via the operating system.
ParseJSON is a standard JSON reader from text.
PrettyNumber formats number as string with 1000 delimiters and, if necessary, rounds it to 2 decimals.
ReadFileBytes reads the contents of a file and returns those contents as a slice of bytes.
RowPadding returns a padding for a row to make it the full width of the containing widget.
StringValueForProperty returns a string value for the given property If the property doesn't exist, it returns an error.
StripColorTags removes tcell color tags from a given string.
SumInts takes a slice of ints and returns the sum of them.
ToInts takes a slice of interfaces and returns a slice of ints.
ToStrs takes a slice of interfaces and returns a slice of strings.
ToUints takes a slice of interfaces and returns a slice of ints.
Truncate chops a given string at len length.

# Constants

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Variables

OpenFileUtil defines the system utility to use to open files.
No description provided by the author