Documentation ¶
Overview ¶
Package util provides some utility functions specific to this application.
Index ¶
- func ChangeFileExt(filePath string, newExt string) string
- func ConvColorToHex(c color.Color) string
- func FormatLightState(st blink1.LightState) string
- func FormatNamedColor(c color.Color) string
- func JoinWrapSlice(elems []string, separator string, maxLen int) string
- func NormalizeQuery(raw ...string) string
- func PrintDeviceList(dis []*se.DeviceDetail) error
- func PrintDeviceListWithFirmware(dis []*se.DeviceDetail) error
- func PrintPatternSet(ps *se.PatternSet) error
- func PrintStateSequence(seq blink1.StateSequence) error
- func SetLog(l *zap.SugaredLogger)
- func SplitConfigKey(key string) (k1 string, kr string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ChangeFileExt ¶
ChangeFileExt changes the file extension of the given file path to the given new extension.
func ConvColorToHex ¶
ConvColorToHex converts color.Color to hex string.
func FormatLightState ¶
func FormatLightState(st blink1.LightState) string
FormatLightState in terminal-friendly style prints blink(1) light state.
func FormatNamedColor ¶
FormatNamedColor in terminal-friendly style prints color block and its hex, and if the color's name is known, it is also included. It uses the muesli/termenv to format the string with the appropriate escape codes.
func JoinWrapSlice ¶
JoinWrapSlice joins the given slice of strings with the given separator and wraps the result string to multiple lines if it exceeds the given maxLen.
func NormalizeQuery ¶
NormalizeQuery joins the given query strings and returns a normalized query string.
func PrintDeviceList ¶
func PrintDeviceList(dis []*se.DeviceDetail) error
PrintDeviceList prints a list of devices to stdout in table format.
func PrintDeviceListWithFirmware ¶
func PrintDeviceListWithFirmware(dis []*se.DeviceDetail) error
PrintDeviceListWithFirmware prints a list of devices with firmware version to stdout in table format.
func PrintPatternSet ¶
func PrintPatternSet(ps *se.PatternSet) error
PrintPatternSet prints a pattern set to stdout in table format.
func PrintStateSequence ¶
func PrintStateSequence(seq blink1.StateSequence) error
PrintStateSequence prints a state sequence to stdout in table format.
func SplitConfigKey ¶
SplitConfigKey splits the given config key into two parts: the first part is the top-level key, the second part is the rest.
Types ¶
This section is empty.