Documentation
¶
Index ¶
- Constants
- Variables
- func CreateStyledTable(header []string, rows [][]string) string
- func RenderInstancesTree(stacksWithComponents map[string]map[string][]*listtree.ImportNode, ...) string
- func RenderStacksTree(stacksWithImports map[string][]*listtree.ImportNode, showImports bool) string
- func ValidateFormat(format string) error
- type DefaultFormatter
- type DelimitedFormatter
- type Format
- type FormatOptions
- type Formatter
- type JSONFormatter
- type TableFormatter
- type YAMLFormatter
Constants ¶
const ( DefaultCSVDelimiter = "," DefaultTSVDelimiter = "\t" ValueKey = "value" )
const ( MaxColumnWidth = 60 // Maximum width for a column. TableColumnPadding = 3 // Padding for table columns. DefaultKeyWidth = 15 // Default base width for keys. KeyValue = "value" CompactColumnMaxWidth = 20 // Maximum width for non-Description columns. DescriptionColumnMinWidth = 30 // Minimum width for Description column. MinColumnWidth = 5 // Absolute minimum width for any column. )
Constants for table formatting.
Variables ¶
var (
ErrTableTooWide = errors.New("the table is too wide to display properly")
)
Error variables for table formatting.
Functions ¶
func CreateStyledTable ¶ added in v1.176.0
createStyledTable creates a styled table with headers and rows. Uses intelligent column width calculation to optimize space usage.
func RenderInstancesTree ¶ added in v1.201.0
func RenderInstancesTree(stacksWithComponents map[string]map[string][]*listtree.ImportNode, showImports bool) string
RenderInstancesTree renders stacks with their components and import hierarchies as a tree. Structure: Stacks → Components → Imports. If showImports is false, only shows stacks and components without import details.
func RenderStacksTree ¶ added in v1.201.0
func RenderStacksTree(stacksWithImports map[string][]*listtree.ImportNode, showImports bool) string
RenderStacksTree renders stacks with their import hierarchies as a tree. If showImports is false, only stack names are shown without import details.
func ValidateFormat ¶
ValidateFormat checks if the provided format is valid.
Types ¶
type DefaultFormatter ¶
type DefaultFormatter struct {
// contains filtered or unexported fields
}
DefaultFormatter provides a base implementation of Formatter.
type DelimitedFormatter ¶
type DelimitedFormatter struct {
DefaultFormatter
// contains filtered or unexported fields
}
DelimitedFormatter handles CSV and TSV format output.
func (*DelimitedFormatter) Format ¶
func (f *DelimitedFormatter) Format(data map[string]interface{}, options FormatOptions) (string, error)
Format implements the Formatter interface for DelimitedFormatter.
type FormatOptions ¶
type FormatOptions struct {
MaxColumns int
Delimiter string
TTY bool
Format Format
CustomHeaders []string
}
FormatOptions contains options for formatting output.
type Formatter ¶
type Formatter interface {
Format(data map[string]interface{}, options FormatOptions) (string, error)
}
Formatter defines the interface for formatting output.
func NewFormatter ¶
NewFormatter creates a new formatter for the specified format.
type JSONFormatter ¶
type JSONFormatter struct {
DefaultFormatter
}
JSONFormatter handles JSON format output.
func (*JSONFormatter) Format ¶
func (f *JSONFormatter) Format(data map[string]interface{}, options FormatOptions) (string, error)
Format implements the Formatter interface for JSONFormatter.
type TableFormatter ¶
type TableFormatter struct {
DefaultFormatter
}
TableFormatter handles table format output.
func (*TableFormatter) Format ¶
func (f *TableFormatter) Format(data map[string]interface{}, options FormatOptions) (string, error)
Format implements the Formatter interface for TableFormatter.
type YAMLFormatter ¶
type YAMLFormatter struct {
DefaultFormatter
}
YAMLFormatter handles YAML format output.
func (*YAMLFormatter) Format ¶
func (f *YAMLFormatter) Format(data map[string]interface{}, options FormatOptions) (string, error)
Format implements the Formatter interface for YAMLFormatter.