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) PrintDelta(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 {
UntrustedNotice string `json:"untrustedNotice,omitempty"`
Results interface{} `json:"results"`
Count int `json:"count"`
NextLink string `json:"nextLink,omitempty"`
// Delta-sync continuation (set only by delta/changes commands). DeltaToken is
// the opaque cursor to pass back next time; DeltaComplete reports whether the
// caller is caught up (token is a deltaLink) or more pages remain now.
DeltaToken string `json:"deltaToken,omitempty"`
DeltaComplete *bool `json:"deltaComplete,omitempty"`
Timezone string `json:"timezone,omitempty"`
}
Envelope is the JSON output wrapper. UntrustedNotice is emitted first (and only when --wrap-untrusted is set) so a consuming LLM reads the security directive before the wrapped, externally-controlled results.
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
WrapUntrusted bool // wrap externally-controlled free-text fields in JSON output
Concise bool // drop large free-text fields (bodies, previews, attendees) from JSON output
}
Printer handles output formatting
func NewPrinter ¶
func NewPrinter(jsonFlag, plainFlag, resultsOnly bool, selectFields, timezone string, wrapUntrusted, concise bool) *Printer
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) PrintDelta ¶ added in v1.9.6
func (p *Printer) PrintDelta(headers []string, rows [][]string, jsonData interface{}, count int, token string, complete bool) error
PrintDelta renders a delta-sync page: in JSON mode it emits the envelope with the continuation token and completeness (results still wrapped/concised like PrintJSON); in table/plain mode it prints the rows followed by the token and complete flag so a human/script can resume.
func (*Printer) PrintJSON ¶
PrintJSON outputs data as JSON with envelope. When WrapUntrusted is set, fields tagged `untrusted:"true"` are wrapped with markers so an LLM/agent consumer can distinguish externally-controlled text from trusted output.
func (*Printer) PrintPlain ¶
PrintPlain outputs data as TSV (no headers)