Documentation
¶
Overview ¶
Package util contains shared helpers used by CLI command subpackages.
Index ¶
- func BuildSelector(...) (session.Selector, error)
- func IsTerminalWriter(out io.Writer) bool
- func MarshalPrettyJSON(v any) ([]byte, error)
- func ParseHealth(v string) (session.Health, error)
- func ResolveOrDefault(v string, fallback func() (string, error)) (string, error)
- func ShouldUseColor(mode string, out io.Writer) bool
- func StripANSI(v string) string
- func WithExitCode(err error, code int) error
- func WriteFileAtomic(path string, data []byte, mode os.FileMode) error
- type ExitError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildSelector ¶
func BuildSelector(id, idPrefix, hostContains, pathContains, headContains, olderThan, health string) (session.Selector, error)
BuildSelector builds a session selector from common flags.
func IsTerminalWriter ¶
IsTerminalWriter reports whether out is a TTY char device.
func MarshalPrettyJSON ¶
MarshalPrettyJSON marshals v with multiline indentation.
func ParseHealth ¶
ParseHealth parses health flag value.
func ResolveOrDefault ¶
ResolveOrDefault resolves an explicit path or uses fallback.
func ShouldUseColor ¶
ShouldUseColor decides output coloring.
func WithExitCode ¶
WithExitCode wraps an error with a process exit code for main() handling.
Types ¶
Click to show internal directories.
Click to hide internal directories.