util

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package util provides some utility functions specific to this application.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ChangeFileExt

func ChangeFileExt(filePath string, newExt string) string

ChangeFileExt changes the file extension of the given file path to the given new extension.

func ConvColorToHex

func ConvColorToHex(c color.Color) string

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

func FormatNamedColor(c color.Color) string

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

func JoinWrapSlice(elems []string, separator string, maxLen int) string

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

func NormalizeQuery(raw ...string) string

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 SetLog

func SetLog(l *zap.SugaredLogger)

SetLog sets the logger from outside the package.

func SplitConfigKey

func SplitConfigKey(key string) (k1 string, kr string)

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.

Jump to

Keyboard shortcuts

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