Documentation
¶
Overview ¶
Package output renders command results: JSON (optionally filtered by jq or a Go template), and tables.
The exporter follows github.com/cli/cli pkg/cmdutil/json_flags.go (Copyright (c) 2019 GitHub Inc., MIT); see NOTICE.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Copy ¶
Copy writes r to ios.Out unchanged, adding a final newline on a terminal when the content lacks one so the shell prompt starts on its own line.
func SanitizeCell ¶
SanitizeCell is SanitizeText for a single-line table cell: tabs and line breaks become spaces.
func SanitizeText ¶
SanitizeText makes server-supplied text safe to print on a terminal: it drops C0 and C1 control characters (ESC, CSI, OSC and the rest, also as raw 8-bit bytes) and DEL, keeping newlines and tabs. \r\n becomes \n. Like go-gh's asciisanitizer it guards against escape-sequence injection, but it removes the characters instead of printing caret notation.
Types ¶
type Exportable ¶
Exportable is implemented by results that can be projected onto a list of JSON field names.
type Format ¶
type Format struct {
// JQ filters the JSON through a jq expression.
JQ string
// Template formats the JSON with a Go template (go-gh template functions).
Template string
}
Format selects how JSON is written.
type Table ¶
type Table struct {
tableprinter.TablePrinter
}
Table prints aligned columns on a terminal and tab-separated values when piped. Headers are shown only on a terminal, so piped output is pure data.