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

containers

package
v2.16.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: BSD-3-Clause Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContainerRef = cmdutil.ResourceRef[container.Details, container.Summary]{
	EnvironmentScoped: true,
	Singular:          "container",
	Plural:            "containers",
	IDHint:            "the container ID",
	ListCmd:           "arcane containers list",
	GetPath:           types.Container,
	ListPath:          types.Containers,
	Matches: func(item container.Summary, identifierLower, original string) bool {
		return strings.Contains(strings.ToLower(item.ID), identifierLower) ||
			strings.Contains(strings.ToLower(item.Image), identifierLower) ||
			slices.ContainsFunc(item.Names, func(name string) bool {
				trimmedName := strings.TrimPrefix(name, "/")
				return strings.Contains(strings.ToLower(trimmedName), identifierLower) || strings.EqualFold(trimmedName, original) || strings.EqualFold(name, original)
			})
	},
	Label: func(item container.Summary) string {
		name := cmp.Or(docker.ContainerNameFromNames(item.Names), item.ID[:min(len(item.ID), 12)])
		image := cmp.Or(item.Image, "<unknown>")
		state := cmp.Or(item.State, "unknown")
		return fmt.Sprintf("%s (%s, %s)", name, item.ID[:min(len(item.ID), 12)], image+" / "+state)
	},
	Promote: func(summary container.Summary) *container.Details {
		return &container.Details{ID: summary.ID, Name: docker.ContainerNameFromNames(summary.Names)}
	},
	IDOf:         func(item container.Summary) string { return item.ID },
	IdentifierOf: func(details container.Details) string { return details.ID },
}

Functions

func Command added in v2.16.0

func Command() *cobra.Command

Command builds the containers command tree.

Types

This section is empty.

Jump to

Keyboard shortcuts

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