Documentation
¶
Index ¶
- func ConvertTime(utcStr string, loc *time.Location) string
- func Sanitize(s string) string
- func SanitizeMultiline(s string) string
- func Truncate(s string, maxRunes int) string
- type Envelope
- type Format
- type Printer
- func (p *Printer) Print(headers []string, rows [][]string, jsonData interface{}, count int, ...) error
- func (p *Printer) PrintJSON(results interface{}, count int, nextLink string) error
- func (p *Printer) PrintPlain(headers []string, rows [][]string) error
- func (p *Printer) PrintTable(headers []string, rows [][]string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertTime ¶ added in v0.6.0
ConvertTime parses a UTC time string and converts it to the given location. For date-only inputs, returns "2006-01-02". For datetime inputs, returns "2006-01-02 15:04". Returns the original string unchanged if loc is nil or parsing fails.
func Sanitize ¶
Sanitize removes control characters from a string, replacing newlines with spaces (safe for single-line table cells). Use SanitizeMultiline for free-text body output where newlines should be preserved.
func SanitizeMultiline ¶
SanitizeMultiline removes control characters but preserves newlines, suitable for multi-line body text output.
Types ¶
type Envelope ¶
type Envelope struct {
Results interface{} `json:"results"`
Count int `json:"count"`
NextLink string `json:"nextLink,omitempty"`
Timezone string `json:"timezone,omitempty"`
}
Envelope is the JSON output wrapper
type Printer ¶
type Printer struct {
Format Format
Writer io.Writer
Select string // comma-separated field names
ResultsOnly bool
Timezone string // IANA timezone name for JSON envelope metadata
}
Printer handles output formatting
func NewPrinter ¶
NewPrinter creates a printer from flags
func (*Printer) Print ¶
func (p *Printer) Print(headers []string, rows [][]string, jsonData interface{}, count int, nextLink string) error
Print dispatches to the appropriate format
func (*Printer) PrintPlain ¶
PrintPlain outputs data as TSV (no headers)