Documentation
¶
Overview ¶
Package tools implements utility routines
Index ¶
Constants ¶
const ( // Escape is ansi terminal escape sequence. Escape = "\x1b[" // Reset is ansi termnial code for reset. Reset = Escape + "0m" // Green is ansi terminal code for green text. Green = Escape + "32m" )
Variables ¶
var ( ErrNotDefined = errors.New("neither $XDG_DATA_HOME nor $HOME are defined") //nolint:revive ErrRelative = errors.New("path in $XDG_DATA_HOME is relative") )
Functions ¶
func PrettyByteSize ¶
PrettyByteSize formats a byte size (int) into a human-readable colored string using binary prefixes (KiB, MiB, etc.).
func UseColour ¶ added in v0.2.1
func UseColour() bool
UseColour checks if output is a terminal or whether colour output has been suppresed in env.
func UserDataDir ¶ added in v0.3.0
UserDataDir returns the default root directory to use for user-specific data. Users should create their own application-specific subdirectory within this one and use that.
On Unix systems, it returns $XDG_DATA_HOME as specified by https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html if non-empty, else $HOME/.local/share.
If the location cannot be determined (for example, $HOME is not defined) or the path in $XDG_DATA_HOME is relative, then it will return an error.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package config reads a yaml config file from the XDG_CONFIG_HOME and unmarshals it into a user supplied struct
|
Package config reads a yaml config file from the XDG_CONFIG_HOME and unmarshals it into a user supplied struct |
|
Package logging provides slog helpers.
|
Package logging provides slog helpers. |
|
Package money is a simple currency package
|
Package money is a simple currency package |