Documentation
¶
Overview ¶
Package output handles formatted output for the CLI.
This package provides utilities for:
- Structured field output (label: value format)
- Unified diff generation with color highlighting
- User feedback messages (Warning, Hint, Error) with TTY-aware coloring
Colors are automatically disabled when output is not a TTY, ensuring clean output when piped or redirected.
Index ¶
- func Diff(oldName, newName, oldContent, newContent string) string
- func DiffRaw(oldName, newName, oldContent, newContent string) string
- func Error(w io.Writer, format string, args ...any)
- func Failed(w io.Writer, name string, err error)
- func Hint(w io.Writer, format string, args ...any)
- func Indent(s, prefix string) string
- func Info(w io.Writer, format string, args ...any)
- func Print(w io.Writer, msg string)
- func Printf(w io.Writer, format string, args ...any)
- func Println(w io.Writer, msg string)
- func Success(w io.Writer, format string, args ...any)
- func Warn(w io.Writer, format string, args ...any)
- func Warning(w io.Writer, format string, args ...any)
- type Format
- type Writer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
Error prints an error message in red. Used for user-facing error messages that are not Go errors. For Go errors, use the standard error return pattern instead.
func Hint ¶
Hint prints a hint message in cyan. Used to provide helpful suggestions to the user, typically following a warning. Example: "Hint: To compare with previous version, use: suve param diff /param~1".
func Info ¶
Info prints an informational message in cyan. Used for status updates, progress messages, and neutral information. Example: "No changes staged.", "Agent started".
func Success ¶
Success prints a success message with green checkmark. Example: "✓ Created parameter /app/config".
Types ¶
type Format ¶
type Format string
Format represents the output format.
func ParseFormat ¶
ParseFormat parses a format string and returns the Format. Returns FormatText for empty string or invalid values.