api

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrEmptyCommand = fmt.Errorf("empty command")

Functions

func ErrUnknownCommand

func ErrUnknownCommand(input string) error

func ParseInput

func ParseInput(input string) (registry.Command, args.Args, error)

ParseInput takes a full input string like: "docker node inspect node-1 --verbose --limit=10" It returns the matching Command and parsed Args.

Types

type Context

type Context struct {
	App             any
	context.Context // embedded, so it implements context.Context
	DockerClient    *client.Client
}

Context is the shared command execution context. It wraps a standard context.Context and provides additional handles like the Docker client.

func New

func New(cli *client.Client) Context

New creates a new API context with a background context.

func WithCancel

func WithCancel(cli *client.Client) (Context, context.CancelFunc)

WithCancel returns a cancellable derived context and a cancel func.

func WithContext

func WithContext(ctx context.Context, cli *client.Client) Context

WithContext creates a derived API context from an existing context.Context.

type ErrHelpRequested

type ErrHelpRequested struct {
	Cmd registry.Command
}

ErrHelpRequested is a sentinel returned by ParseInput when the user asked for a command's help (`:cmd --help` / `-h`). It is not a parse failure: the dispatcher recovers it via errors.As and renders the per-command help screen instead of an inline error.

func (ErrHelpRequested) Error

func (ErrHelpRequested) Error() string

Jump to

Keyboard shortcuts

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