Documentation
¶
Overview ¶
Package app owns the CLI invocation lifecycle.
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 ImageModelOptions() images.ModelOptions
- func ImagePreviewOptions() images.PreviewOptions
- func ImageSavingOptions() images.SavingOptions
- func InteractiveListOutput(opts ShowJSONOpts) 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 Run(ctx context.Context, argv []string, app *cli.Command) int
- 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), maximum int64, opts ShowJSONOpts, ...) 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.47.0" // x-release-please-version
Variables ¶
var OutputFormats = clioutput.Formats
Temporary forwarding value for the generated runtime bridge.
Functions ¶
func ConfigureCommand ¶ added in v1.39.1
ConfigureCommand installs SDK-owned behavior after the generated command tree is complete.
func ConfigureCommandErrors ¶ added in v1.39.1
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.39.1
ConfigureHelp decorates help without changing API commands or their defaults.
func FlagOptions ¶ added in v1.39.1
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 ¶ added in v1.39.1
func GetDefaultRequestOptions(cmd *cli.Command) []option.RequestOption
GetDefaultRequestOptions keeps feature middleware composition with its current owner.
func ImageModelOptions ¶ added in v1.39.1
func ImageModelOptions() images.ModelOptions
ImageModelOptions binds discovery to application policy.
func ImagePreviewOptions ¶ added in v1.39.1
func ImagePreviewOptions() images.PreviewOptions
ImagePreviewOptions binds local previews to application receipt and error policy.
func ImageSavingOptions ¶ added in v1.39.1
func ImageSavingOptions() images.SavingOptions
ImageSavingOptions binds image preparation to application request and diagnostic policy.
func InteractiveListOutput ¶ added in v1.39.1
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 IsLocalUtilityCommand ¶ added in v1.39.1
IsLocalUtilityCommand identifies a registered utility after root flag parsing. Request values and unregistered command names never select the local path.
func NewRequestHeaderFlag ¶ added in v1.39.1
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.1
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 Run ¶
Run executes one CLI process invocation and returns its exit status. The caller supplies the process-scoped command tree; Run is called once per process.
func RunWithOutputPolicy ¶ added in v1.39.1
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.39.1
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.39.1
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.1
ShowCommandErrorFallback keeps secondary cancellation diagnostics bounded too. Its result retains the original presentation failure and any fallback failure.
func ShowJSON ¶ added in v1.39.1
func ShowJSON(res gjson.Result, opts ShowJSONOpts) error
ShowJSON displays a single JSON result to the user.
func ShowJSONIterator ¶ added in v1.39.1
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.1
func ShowJSONPages[P JSONListPage[P]](first func(context.Context) (P, error), maximum int64, opts ShowJSONOpts, cursorField string) error
ShowJSONPages retains the lazy-page entrypoint with assembly presentation policy.
func ValidateBaseURL ¶ added in v1.39.1
ValidateBaseURL forwards scheme validation for the generated runtime bridge.
func WriteBinaryResponse ¶ added in v1.39.1
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 ¶ added in v1.39.1
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.1
type JSONListPage[P any] = listview.JSONListPage[P]
JSONListPage is implemented by SDK explicit API page types.
type OutputKind ¶ added in v1.39.1
type OutputKind = transformers.OutputKind
type ShowJSONOpts ¶ added in v1.39.1
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_policy.go
- agents_explorer.go
- agents_request_options.go
- agents_session_creation.go
- agents_stream.go
- api_auth_guidance.go
- api_permission_errors.go
- audio_policy.go
- batch_browser_details.go
- batch_help.go
- batch_input_detail.go
- batch_policy.go
- batch_records_readable.go
- batch_request_failure.go
- batch_result_detail.go
- certificate_compatibility.go
- cmdutil.go
- command.go
- command_error.go
- debug_capture_options.go
- describe_agents_commands.go
- finite_json_list.go
- flagoptions.go
- help.go
- image_picker_first_run.go
- images_policy.go
- input_file_errors.go
- list_commands.go
- list_navigation.go
- local_errors.go
- local_utilities.go
- models_policy.go
- output_policy.go
- output_transform.go
- project_api_key_update.go
- project_lifecycle_results.go
- readable_errors.go
- readable_output.go
- report_save_receipt.go
- requestheaders.go
- run.go
- shell_suggestions.go
- unavailable_option.go
- update_notice.go
- vector_store_search_output.go
- vector_store_workspace.go
- version.go
- webhooks_policy.go