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

models

package
v1.42.4 Latest Latest
Warning

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

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

Documentation

Overview

Package models owns model-list selection and interactive presentation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Configure

func Configure(root *cli.Command, policy Options)

Configure installs model-list flags and the loading/selection lifecycle.

func Interrupt

func Interrupt(err error) error

Interrupt preserves the models command's process status after viewer cancellation.

func IsListSource

func IsListSource[T any](source jsonview.Iterator[T]) bool

IsListSource admits only the SDK single-response pager or selected records. Cursor pagers must remain lazy even if operation metadata says models.

func NeedsViewport

func NeedsViewport(content string, width, height int) bool

NeedsViewport preserves display-cell widths and space for the shell prompt.

func PrintHint

func PrintHint(count, width int) string

PrintHint describes printing every selected record from the single response. Keep counts whole when the terminal cannot fit the complete hint.

func RenderTable

func RenderTable(ctx context.Context, items []gjson.Result, width int, diagnostics bool) (string, bool, error)

RenderTable lists IDs and owners. Explicit formats and printing retain the 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 StopLoading

func StopLoading(ctx context.Context)

StopLoading joins loading feedback before results write to the terminal.

func WriteList

func WriteList[T any](iter *clioutput.Iterator[T], opts listview.Options, width, height int) error

WriteList renders the already loaded response or opens navigation when it overflows.

Types

type ListError

type ListError struct {
	// contains filtered or unexported fields
}

ListError contains only fixed guidance, never filter values or response data.

func (*ListError) Error

func (e *ListError) Error() string

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 {
	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.

Jump to

Keyboard shortcuts

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