Documentation
¶
Index ¶
- func GetLimit(ctx context.Context) int
- func GetQuery(ctx context.Context) string
- func GetYes(ctx context.Context) bool
- func IsJSON(ctx context.Context) bool
- func IsJSONL(ctx context.Context) bool
- func NewContext(ctx context.Context, format Format) context.Context
- func Output(ctx context.Context, data any, textFormatter func()) error
- func Print(format string, args ...any)
- func Println(args ...any)
- func WithColorMode(ctx context.Context, mode ColorMode) context.Context
- func WithFormat(ctx context.Context, format string) context.Context
- func WithLimit(ctx context.Context, limit int) context.Context
- func WithQuery(ctx context.Context, query string) context.Context
- func WithYes(ctx context.Context, yes bool) context.Context
- func WriteJSON(data any, query string) error
- func WriteJSONTo(w io.Writer, data any, query string) error
- type ColorMode
- type ColumnType
- type Format
- type Formatter
- type OutputOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext creates a context with output format
func WithColorMode ¶
WithColorMode adds color mode to context
func WithFormat ¶
WithFormat adds output format to context (string-based for CLI flags)
Types ¶
type ColorMode ¶
type ColorMode string
ColorMode controls colored output.
func GetColorMode ¶
GetColorMode retrieves color mode from context
func ParseColorMode ¶
ParseColorMode parses a color mode string.
type ColumnType ¶
type ColumnType int
ColumnType defines how a column should be formatted
const ( ColumnPlain ColumnType = iota ColumnStatus ColumnAmount ColumnCurrency ColumnDate ColumnID )
type Format ¶
type Format int
Format represents output format type
func ParseFormat ¶
ParseFormat parses an output format string.
type Formatter ¶
type Formatter struct {
// contains filtered or unexported fields
}
Formatter provides tabular text output
func FromContext ¶
func FromContext(ctx context.Context, opts ...OutputOption) *Formatter
FromContext creates a Formatter from context with optional options
func NewFormatter ¶
func NewFormatter() *Formatter
NewFormatter creates a new text formatter (legacy, use FromContext instead)
type OutputOption ¶
type OutputOption func(*Formatter)
OutputOption configures the Formatter
func WithWriter ¶
func WithWriter(w io.Writer) OutputOption
WithWriter sets a custom writer for output