Documentation
¶
Index ¶
- Constants
- Variables
- func AudioVoicesFlagOptions(ctx context.Context, cmd *cli.Command) ([]option.RequestOption, error)
- 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 InteractiveListOutput(opts ShowJSONOpts) bool
- func IsImagePickerShellSetupCommand(args []string) bool
- func IsLocalUtilityCommand(command *cli.Command) bool
- func NewRequestHeaderFlag() cli.Flag
- func ReportSaveReceipt(command *cli.Command, stderr io.Writer, message string, operationErr error) error
- func RunWithOutputPolicy(ctx context.Context, root *cli.Command, run func(context.Context) error) error
- func SetupImagePickerShellOnFirstRun(ctx context.Context, args []string, roots ...*cli.Command)
- func ShowCommandError(root *cli.Command, failure error, out io.Writer) error
- func ShowCommandErrorFallback(failure, presentationErr 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 ShowJSONPages[P JSONListPage[P]](first func(context.Context) (P, error), itemsToDisplay int64, ...) error
- func ValidateBaseURL(value, source string) error
- func WriteBinaryResponse(response *http.Response, stdout io.Writer, outfile string) (message string, err error)
- type BodyContentType
- type JSONListPage
- type OutputKind
- type ShowJSONOpts
Constants ¶
const ( EmptyBody = requestconfig.EmptyBody MultipartFormEncoded = requestconfig.MultipartFormEncoded ApplicationJSON = requestconfig.ApplicationJSON ApplicationOctetStream = requestconfig.ApplicationOctetStream )
const ( OutputUnspecified = transformers.OutputUnspecified OutputResponse = transformers.OutputResponse OutputPageItem = transformers.OutputPageItem OutputStreamEvent = transformers.OutputStreamEvent )
const Version = "1.39.0" // x-release-please-version
Variables ¶
var OutputFormats = clioutput.Formats
Temporary forwarding value for the generated runtime bridge.
Functions ¶
func AudioVoicesFlagOptions ¶ added in v1.32.0
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 ¶
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
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
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
IsLocalUtilityCommand identifies a registered utility after root flag parsing. Request values and unregistered command names never select the local path.
func NewRequestHeaderFlag ¶
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
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
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
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 ¶
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
¶
- admin_credentials.go
- admin_setup.go
- admin_setup_input_flush_linux.go
- admin_setup_interactive.go
- admin_setup_key.go
- admin_setup_key_reader_other.go
- admin_setup_output_other.go
- audio_actions.go
- audio_commands.go
- audio_failure_view.go
- audio_feedback.go
- audio_generate.go
- audio_licenses.go
- audio_navigation.go
- audio_skip_setup.go
- audio_voices.go
- audio_workbench.go
- audio_workbench_run.go
- audio_workbench_view.go
- batch_policy.go
- certificate_compatibility.go
- cmdutil.go
- command.go
- command_error.go
- display_image_progress.go
- display_saved_image.go
- finite_json_list.go
- flagoptions.go
- help.go
- image_generation_settings.go
- image_loading_feedback.go
- image_models.go
- image_picker.go
- image_picker_command.go
- image_picker_completion.go
- image_picker_first_run.go
- image_picker_folder.go
- image_picker_generate.go
- image_picker_inline.go
- image_picker_session.go
- image_picker_shell_profile.go
- image_picker_shell_setup.go
- image_picker_state.go
- image_picker_view.go
- image_preferences.go
- image_saving_commands.go
- image_upload_help.go
- input_file_errors.go
- interactive_image_preview.go
- interactive_image_preview_input.go
- list_navigation.go
- list_table.go
- local_errors.go
- local_utilities.go
- models_list_filter.go
- models_list_loading.go
- models_list_options.go
- models_list_selection.go
- models_list_table.go
- models_list_viewer.go
- order_image_commands.go
- output_policy.go
- output_transform.go
- prepare_image_upload.go
- prepare_native_image_output.go
- preview_saved_image.go
- project_api_key_update.go
- readable_audio.go
- readable_errors.go
- readable_output.go
- readable_speech.go
- report_save_receipt.go
- requestheaders.go
- save_download.go
- save_final_image_stream.go
- save_generated_images.go
- shell_suggestions.go
- unavailable_option.go
- version.go