Documentation
¶
Overview ¶
Package models owns model-list selection and interactive presentation.
Index ¶
- func Configure(root *cli.Command, policy Options)
- func Interrupt(err error) error
- func IsListSource[T any](source jsonview.Iterator[T]) bool
- func RenderTable(ctx context.Context, items []gjson.Result, width int, diagnostics bool, ...) (string, bool, error)
- func Select[T any](ctx context.Context, source jsonview.Iterator[T], maximum int64) (context.Context, jsonview.Iterator[clioutput.JSON], bool, error)
- func ShowPages(opts listview.Options, client openai.Client, options []option.RequestOption, ...) error
- func StopLoading(ctx context.Context)
- func WriteList[T any](iter *clioutput.Iterator[T], opts listview.Options, width, height int, ...) error
- type ListError
- type LoadingInterrupt
- type Options
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsListSource ¶
IsListSource admits only the SDK single-response pager or selected records. Cursor pagers must remain lazy even if operation metadata says models.
func RenderTable ¶
func RenderTable(ctx context.Context, items []gjson.Result, width int, diagnostics bool, style listview.Style) (string, bool, error)
RenderTable lists IDs and owners. Explicit machine formats retain complete records through their existing presentation paths.
func Select ¶
func Select[T any](ctx context.Context, source jsonview.Iterator[T], maximum int64) (context.Context, jsonview.Iterator[clioutput.JSON], bool, error)
Select uses only the SDK's already-loaded models response. Cursor pagers must never enter a path that collects all their pages before displaying data.
func ShowPages ¶ added in v1.45.0
func ShowPages(opts listview.Options, client openai.Client, options []option.RequestOption, diagnostics bool) error
ShowPages opens the terminal before requesting page one. The pager owns and joins the request worker, including when the user quits during a body read.
func StopLoading ¶
StopLoading joins loading feedback before results write to the terminal.
Types ¶
type ListError ¶
type ListError struct {
// contains filtered or unexported fields
}
ListError contains only fixed guidance, never filter values or response data.
type LoadingInterrupt ¶
type LoadingInterrupt struct {
// contains filtered or unexported fields
}
LoadingInterrupt retains cancellation and the command interrupt exit status.
func (*LoadingInterrupt) ExitCode ¶
func (e *LoadingInterrupt) ExitCode() int
func (*LoadingInterrupt) Unwrap ¶
func (e *LoadingInterrupt) Unwrap() error
type Options ¶
type Options struct {
ShowPages func(context.Context, *cli.Command) (bool, error)
LoadingAllowed func(*cli.Command) bool
// StartFeedback returns a non-nil, idempotent stop function that joins its worker.
StartFeedback func(context.Context, *cli.Command) func()
}
Options supplies application policy without coupling model behavior to assembly.