Documentation
¶
Index ¶
- Constants
- func ErrJQConflict(flag string) *apierr.Error
- func ErrJQNotSupported(command string) *apierr.Error
- func ErrJQRuntime(cause error) *apierr.Error
- func ErrJQValidation(cause error) *apierr.Error
- func ExitCodeFor(err error) int
- func MarshalIndentJSON(v any) ([]byte, error)
- func MarshalJSON(v any) ([]byte, error)
- func NormalizeJSONNumbers(data []byte) (any, error)
- func TruncationNotice(shown, total int) string
- func ValidateJQFilter(filter string) error
- type Breadcrumb
- type ErrorResponse
- type Format
- type Options
- type Response
- type ResponseOption
- type Writer
Constants ¶
View Source
const ( ExitUsage = 1 ExitNotFound = 2 ExitAuth = 3 ExitForbidden = 4 ExitRateLimit = 5 ExitNetwork = 6 ExitAPI = 7 ExitAmbiguous = 8 )
Variables ¶
This section is empty.
Functions ¶
func ErrJQConflict ¶ added in v0.1.1
ErrJQConflict reports an output flag that cannot be combined with --jq.
func ErrJQNotSupported ¶ added in v0.1.1
ErrJQNotSupported reports a command that produces a dedicated raw format.
func ErrJQRuntime ¶ added in v0.1.1
ErrJQRuntime reports a failure while evaluating a built-in jq expression.
func ErrJQValidation ¶ added in v0.1.1
ErrJQValidation reports an invalid built-in jq expression.
func ExitCodeFor ¶
func MarshalIndentJSON ¶ added in v0.2.0
MarshalIndentJSON is json.MarshalIndent with the C1 controls escaped, indented the way every envelope is.
func MarshalJSON ¶ added in v0.2.0
MarshalJSON is json.Marshal with the C1 controls escaped.
func NormalizeJSONNumbers ¶
func TruncationNotice ¶
func ValidateJQFilter ¶ added in v0.1.1
ValidateJQFilter confirms that a built-in jq expression is ready to run.
Types ¶
type Breadcrumb ¶
type ErrorResponse ¶
type Format ¶
type Format int
const ( FormatAuto Format = iota FormatJSON FormatStyled FormatQuiet FormatIDs FormatCount FormatMarkdown // FormatHTML is the raw writer behind --html: the original HTML of the one thing a // command reads, written to a pipe or a file. A thread is written as an HTML document // with an <article> per entry, since it has entries to frame; a single body — a // journal entry, a contact's note — is written as a fragment, as HEY served it, since // one body is what gets pasted elsewhere. It carries no envelope, so OK refuses it // and --stats has nowhere to go; the commands that support it write the HTML // themselves. FormatHTML )
func FormatFromFlags ¶
type ResponseOption ¶
type ResponseOption func(*Response)
func WithBreadcrumbs ¶
func WithBreadcrumbs(b ...Breadcrumb) ResponseOption
func WithMeta ¶
func WithMeta(key string, value any) ResponseOption
func WithNotice ¶
func WithNotice(s string) ResponseOption
func WithSummary ¶
func WithSummary(s string) ResponseOption
type Writer ¶
type Writer struct {
// contains filtered or unexported fields
}
func (*Writer) EffectiveFormat ¶
func (*Writer) RequestedFormat ¶ added in v0.2.0
RequestedFormat reports the format the caller asked for by flag, FormatAuto when they asked for nothing and the writer is left to read the terminal.
Click to show internal directories.
Click to hide internal directories.