Documentation
¶
Index ¶
- Constants
- func DebugFlags() []clicontract.Flag
- func MergeFlags(standard []clicontract.Flag, commandSpecific []clicontract.Flag) []clicontract.Flag
- func Render(writer io.Writer, envelope Envelope, option Option) error
- func SetApplicationVersion(versionString string)
- func SplitFields(fieldsString string) []string
- func StandardFlags() []clicontract.Flag
- type Envelope
- type Error
- type ErrorCause
- type Flags
- type Format
- type JsonPrinter
- type ListPayload
- type Meta
- type Option
- type Printer
- type SortOrder
- type TableBlock
- type TableBlockBuilder
- type TableBuilder
- type TableData
- type TablePrinter
- type Version
- type Warning
Constants ¶
View Source
const ( FlagNameFormat = "format" FlagNameNoColor = "no-color" FlagNameVerbose = "verbose" FlagNameVerbosity = "verbosity" FlagNameQuiet = "quiet" FlagNameFields = "fields" FlagNameSortKey = "sort" FlagNameOrder = "order" FlagNameLimit = "limit" FlagNameOffset = "offset" )
View Source
const TableRowSeparatorToken = "__melody_table_separator__"
Variables ¶
This section is empty.
Functions ¶
func DebugFlags ¶
func DebugFlags() []clicontract.Flag
func MergeFlags ¶
func MergeFlags( standard []clicontract.Flag, commandSpecific []clicontract.Flag, ) []clicontract.Flag
func SetApplicationVersion ¶
func SetApplicationVersion(versionString string)
func SplitFields ¶
func StandardFlags ¶
func StandardFlags() []clicontract.Flag
Types ¶
type Envelope ¶
type Envelope struct {
Meta Meta `json:"meta"`
Data any `json:"data"`
Table *TableData `json:"-"`
Warnings []Warning `json:"warnings"`
Error *Error `json:"error"`
}
func NewEnvelope ¶
func (*Envelope) AddWarning ¶
type Error ¶
type Error struct {
Code string `json:"code"`
Message string `json:"message"`
Details map[string]any `json:"details"`
Cause *ErrorCause `json:"cause"`
}
type ErrorCause ¶
func NewErrorCause ¶
func NewErrorCause(message string, details map[string]any) *ErrorCause
type JsonPrinter ¶
type JsonPrinter struct {
}
type ListPayload ¶
type ListPayload[T any] struct { Items []T `json:"items"` Total int `json:"total"` Limit int `json:"limit"` Offset int `json:"offset"` }
func NewListPayload ¶
func NewListPayload[T any]( items []T, total int, limit int, offset int, ) ListPayload[T]
type Meta ¶
type Option ¶
type Option struct {
Format Format
NoColor bool
VerbosityLevel int
Verbose bool
Quiet bool
Fields []string
SortKey string
Order SortOrder
Limit int
Offset int
}
func DefaultOption ¶
func DefaultOption() Option
func NormalizeOption ¶
func ParseOptionFromCommand ¶
func ParseOptionFromCommand(commandContext *clicontract.CommandContext) Option
type Printer ¶
func SelectPrinter ¶
type TableBlock ¶
type TableBlockBuilder ¶
type TableBlockBuilder struct {
// contains filtered or unexported fields
}
func (*TableBlockBuilder) AddRow ¶
func (instance *TableBlockBuilder) AddRow(cells ...string) *TableBlockBuilder
type TableBuilder ¶
type TableBuilder struct {
// contains filtered or unexported fields
}
func NewTableBuilder ¶
func NewTableBuilder() *TableBuilder
func (*TableBuilder) AddBlock ¶
func (instance *TableBuilder) AddBlock( title string, columns []string, ) *TableBlockBuilder
func (*TableBuilder) AddSummaryLine ¶
func (instance *TableBuilder) AddSummaryLine(line string) *TableBuilder
func (*TableBuilder) Build ¶
func (instance *TableBuilder) Build() *TableData
type TableData ¶
type TableData struct {
SummaryLines []string
Blocks []TableBlock
}
type TablePrinter ¶
type TablePrinter struct {
// contains filtered or unexported fields
}
func NewDefaultTablePrinter ¶
func NewDefaultTablePrinter() *TablePrinter
func NewTablePrinter ¶
func NewTablePrinter(tableMaxWidth int) *TablePrinter
Click to show internal directories.
Click to hide internal directories.