Documentation
¶
Index ¶
- func BindSupportedValue(v any) any
- func ColorEnabled(w io.Writer) bool
- func DetermineShell() string
- func FlattenValues(m map[string][]string) map[string]string
- func Format(colorEnabled bool, fn func(StyleWriter)) string
- func FormatDefault(fn func(StyleWriter)) string
- func FormatMap(m map[string]string, delim string) string
- func GuessWidth() int
- func MustValueCloneZero(p any) any
- func MustValueReset(p any)
- func ParseKeyValue(field string) (string, string, bool)
- func ParseMap(text string) map[string][]string
- func SplitList(s, sep string, n int) []string
- func Unescape(s []string) []string
- type ColorCapableWriter
- type StyleWriter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BindSupportedValue ¶
func ColorEnabled ¶ added in v0.13.0
func DetermineShell ¶
func DetermineShell() string
DetermineShell determines shell by parent process name.
func Format ¶ added in v0.13.0
func Format(colorEnabled bool, fn func(StyleWriter)) string
func FormatDefault ¶ added in v0.13.0
func FormatDefault(fn func(StyleWriter)) string
func GuessWidth ¶
func GuessWidth() int
func MustValueCloneZero ¶ added in v0.9.3
func MustValueReset ¶ added in v0.9.3
func MustValueReset(p any)
func ParseMap ¶
ParseMap applies parsing of maps.
The map syntax is comma-delimited list of key-value pairs. For key-value pairs without an equal sign, the first occurrence of a properly formed KVP implies the rest are keys without values. As a special case, the initial keys without values are added to "".
NoKey,A=1,B,C --> ""=["NoKey"], "B"=[], and "C"=[]
Another special case is when the first (and only) instance is a key
A=1,2,3 --> "A"=["1","2","3"] (instead of "A"=["1"], "2"=[], "3"=[])
Types ¶
type ColorCapableWriter ¶ added in v0.13.0
type StyleWriter ¶ added in v0.13.0
type StyleWriter interface {
io.Writer
io.StringWriter
ClearStyle(ansiterm.Style)
Reset()
SetColorCapable(bool)
ResetColorCapable()
ColorCapable() bool
SetBackground(ansiterm.Color)
SetForeground(ansiterm.Color)
SetStyle(ansiterm.Style)
Underline(...any) (int, error)
Bold(...any) (int, error)
Styled(ansiterm.Style, ...any) (int, error)
}
func NewWriter ¶ added in v0.13.0
func NewWriter(w io.Writer) StyleWriter
Click to show internal directories.
Click to hide internal directories.