Documentation
¶
Index ¶
- Constants
- Variables
- func ConfigureCommand(root *cli.Command)
- func ConfigureCommandErrors(root *cli.Command)
- func ConfigureHelp(root *cli.Command, args []string) ([]string, bool, error)
- func FlagOptions(cmd *cli.Command, nestedFormat apiquery.NestedQueryFormat, ...) (options []option.RequestOption, err error)
- func GetDefaultRequestOptions(cmd *cli.Command) []option.RequestOption
- func NewRequestHeaderFlag() cli.Flag
- func ShowCommandError(root *cli.Command, failure error, out io.Writer) error
- func ShowJSON(res gjson.Result, opts ShowJSONOpts) error
- func ShowJSONIterator[T any](iter jsonview.Iterator[T], itemsToDisplay int64, opts ShowJSONOpts) error
- func ValidateBaseURL(value, source string) error
- func WriteBinaryResponse(response *http.Response, stdout io.Writer, outfile string) (string, error)
- type BodyContentType
- type FileEmbedStyle
- type FilePathValue
- type OutputKind
- type ShowJSONOpts
Constants ¶
const ( OutputUnspecified = transformers.OutputUnspecified OutputResponse = transformers.OutputResponse OutputPageItem = transformers.OutputPageItem OutputStreamEvent = transformers.OutputStreamEvent )
const Version = "1.28.0" // x-release-please-version
Variables ¶
var OutputFormats = []string{"auto", "text", "explore", "json", "jsonl", "pretty", "raw", "yaml"}
Functions ¶
func ConfigureCommand ¶
ConfigureCommand installs SDK-owned behavior after the generated command tree is complete.
func ConfigureCommandErrors ¶ added in v1.20.0
ConfigureCommandErrors composes with success wrappers without owning success output. Calling it again after help setup covers newly added local commands without wrapping existing actions or usage handlers twice.
func ConfigureHelp ¶ added in v1.18.0
ConfigureHelp decorates help without changing API commands or their defaults.
func FlagOptions ¶
func FlagOptions( cmd *cli.Command, nestedFormat apiquery.NestedQueryFormat, arrayFormat apiquery.ArrayQueryFormat, bodyType BodyContentType, ignoreStdin bool, observeJSON ...func([]byte), ) (options []option.RequestOption, err error)
func GetDefaultRequestOptions ¶
func GetDefaultRequestOptions(cmd *cli.Command) []option.RequestOption
func NewRequestHeaderFlag ¶
NewRequestHeaderFlag returns the repeatable, global flag for literal HTTP headers.
func ShowCommandError ¶ added in v1.20.0
ShowCommandError presents a failure without changing its identity or exit code. Explicit data formats preserve the API payload. Human summaries never echo API prose, request values, URLs or arbitrary local diagnostics. Both renderer sinks use out, including explorer output and warnings. Writer failures are returned.
func ShowJSON ¶
func ShowJSON(res gjson.Result, opts ShowJSONOpts) error
ShowJSON displays a single JSON result to the user.
func ShowJSONIterator ¶
func ShowJSONIterator[T any](iter jsonview.Iterator[T], itemsToDisplay int64, opts ShowJSONOpts) error
ShowJSONIterator displays an iterator of values to the user. Use itemsToDisplay = -1 for no limit.
func ValidateBaseURL ¶
ValidateBaseURL checks that a base URL is correctly prefixed with a protocol scheme and produces a better error message than the person would see otherwise if it doesn't.
Types ¶
type BodyContentType ¶
type BodyContentType int
const ( EmptyBody BodyContentType = iota MultipartFormEncoded ApplicationJSON ApplicationOctetStream )
type FileEmbedStyle ¶
type FileEmbedStyle int
const ( // EmbedText reads referenced files fully into memory and substitutes the file's contents back into the // value as a string. Binary files are base64-encoded. Used for JSON request bodies and for headers and // query parameters, where the file contents need to be serialized inline. EmbedText FileEmbedStyle = iota // EmbedIOReader replaces file references with an io.Reader that streams the file's contents. Used for // `multipart/form-data` and `application/octet-stream` request bodies, where files are uploaded as binary // parts rather than embedded into a text value. EmbedIOReader )
type FilePathValue ¶
type FilePathValue string
FilePathValue is a string wrapper that marks a value as a file path whose contents should be read and embedded in the request. Unlike a regular string, embedFilesValue always treats a FilePathValue as a file path without needing the "@" prefix.
type OutputKind ¶
type OutputKind = transformers.OutputKind
type ShowJSONOpts ¶
type ShowJSONOpts struct {
Context context.Context // request cancellation; defaults to context.Background()
Operation string // generated operation identifier; empty for error presentation
OutputKind OutputKind // response, page item, or stream event; unspecified for errors
ExplicitFormat bool // true if the user explicitly passed --format
Format string // output format (auto, text, explore, json, jsonl, pretty, raw, yaml)
RawOutput bool // like jq -r: print strings without JSON quotes
Stderr io.Writer // stderr for warnings; injectable for testing; defaults to os.Stderr
Stdout io.Writer // output destination; defaults to os.Stdout
Title string // display title
Transform string // GJSON path to extract before displaying
}
ShowJSONOpts configures how JSON output is displayed.
Source Files
¶
- cmdutil.go
- cmdutil_unix.go
- command.go
- command_error.go
- display_image_progress.go
- display_saved_image.go
- flagoptions.go
- help.go
- image_generation_settings.go
- image_models.go
- image_preferences.go
- image_saving_commands.go
- image_upload_help.go
- local_errors.go
- mtls.go
- multipartbody.go
- multipartfile.go
- output_transform.go
- prepare_image_upload.go
- preview_saved_image.go
- readable_audio.go
- readable_errors.go
- readable_output.go
- readable_speech.go
- requestheaders.go
- resource_summaries.go
- save_final_image_stream.go
- save_generated_images.go
- stdinsecurity.go
- streaming_text.go
- suggest.go
- version.go