Help us shape the future of Go! Take the 2026 Go Developer Survey

custom

package
v1.39.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 19, 2026 License: Apache-2.0 Imports: 76 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EmptyBody              = requestconfig.EmptyBody
	MultipartFormEncoded   = requestconfig.MultipartFormEncoded
	ApplicationJSON        = requestconfig.ApplicationJSON
	ApplicationOctetStream = requestconfig.ApplicationOctetStream
)
View Source
const (
	OutputUnspecified = transformers.OutputUnspecified
	OutputResponse    = transformers.OutputResponse
	OutputPageItem    = transformers.OutputPageItem
	OutputStreamEvent = transformers.OutputStreamEvent
)
View Source
const Version = "1.39.0" // x-release-please-version

Variables

View Source
var OutputFormats = clioutput.Formats

Temporary forwarding value for the generated runtime bridge.

Functions

func AudioVoicesFlagOptions added in v1.32.0

func AudioVoicesFlagOptions(ctx context.Context, cmd *cli.Command) ([]option.RequestOption, error)

Voice type checks require the actual request context when type is an uploaded scalar. Keep preparation scoped to this action, as for image uploads.

func ConfigureCommand

func ConfigureCommand(root *cli.Command)

ConfigureCommand installs SDK-owned behavior after the generated command tree is complete.

func ConfigureCommandErrors added in v1.20.0

func ConfigureCommandErrors(root *cli.Command)

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

func ConfigureHelp(root *cli.Command, args []string) ([]string, bool, error)

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

GetDefaultRequestOptions keeps feature middleware composition with its current owner.

func InteractiveListOutput added in v1.39.0

func InteractiveListOutput(opts ShowJSONOpts) bool

InteractiveListOutput leaves explicit machine formats and redirected input or output on their existing iterator path. It never opens a controlling terminal.

func IsImagePickerShellSetupCommand added in v1.36.0

func IsImagePickerShellSetupCommand(args []string) bool

IsImagePickerShellSetupCommand recognizes explicit local setup in the root's remaining arguments, after global flags have been parsed. Setup validates its own options before changing files. API argument values never qualify.

func IsLocalUtilityCommand added in v1.39.0

func IsLocalUtilityCommand(command *cli.Command) bool

IsLocalUtilityCommand identifies a registered utility after root flag parsing. Request values and unregistered command names never select the local path.

func NewRequestHeaderFlag

func NewRequestHeaderFlag() cli.Flag

NewRequestHeaderFlag forwards the generated runtime bridge to request ownership. Remove this forwarding function when the authoritative generator updates its caller.

func ReportSaveReceipt added in v1.39.0

func ReportSaveReceipt(command *cli.Command, stderr io.Writer, message string, operationErr error) error

ReportSaveReceipt keeps successful save receipts separate from response bytes. Callers use this after completing their work; binary responses use the same policy.

func RunWithOutputPolicy added in v1.39.0

func RunWithOutputPolicy(ctx context.Context, root *cli.Command, run func(context.Context) error) error

RunWithOutputPolicy reports after the complete CLI run and its cleanup return. Direct Command.Run callers retain the existing action-scoped reporting boundary.

func SetupImagePickerShellOnFirstRun added in v1.36.0

func SetupImagePickerShellOnFirstRun(ctx context.Context, args []string, roots ...*cli.Command)

SetupImagePickerShellOnFirstRun quietly prepares future interactive shells. It does not change the current command, terminal bindings, or exit status. Failures remain optional, and later ordinary runs may safely retry setup.

func ShowCommandError added in v1.20.0

func ShowCommandError(root *cli.Command, failure error, out io.Writer) error

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 ShowCommandErrorFallback added in v1.39.0

func ShowCommandErrorFallback(failure, presentationErr error, out io.Writer) error

ShowCommandErrorFallback keeps secondary cancellation diagnostics bounded too. Its result retains the original presentation failure and any fallback failure.

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 ShowJSONPages added in v1.39.0

func ShowJSONPages[P JSONListPage[P]](first func(context.Context) (P, error), itemsToDisplay int64, opts ShowJSONOpts, cursorField string) error

ShowJSONPages requests pages only when the viewer needs them. The first request receives the same cancelable context as all subsequent SDK requests. cursorField is empty for item-ID cursors, or the SDK's envelope cursor field.

func ValidateBaseURL

func ValidateBaseURL(value, source string) error

ValidateBaseURL forwards scheme validation for the generated runtime bridge.

func WriteBinaryResponse

func WriteBinaryResponse(response *http.Response, stdout io.Writer, outfile string) (message string, err error)

WriteBinaryResponse writes a binary response to stdout or a file.

Takes in a stdout reference so we can test this function without overriding os.Stdout in tests.

Types

type BodyContentType

type BodyContentType = requestconfig.BodyContentType

Temporary aliases for the generated runtime bridge. Migrate generated callers through their producer before removing these names.

type JSONListPage added in v1.39.0

type JSONListPage[P any] interface {
	comparable
	RawJSON() string
	GetNextPage() (P, error)
}

JSONListPage is implemented by the SDK's explicit API page types.

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

	// The caller cancels Context on signals, so the explorer must not also handle them.
	CallerHandlesSignals bool
}

ShowJSONOpts configures how JSON output is displayed.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL