ActionContainers (docker/container.go)

carapace-bin · pkg/actions/tools/docker/container.go · go · MIT
infra

Module exposing: ActionContainers, ActionContainerIds, ActionContainerPath, ActionContainerLabels

// Source: https://github.com/carapace-sh/carapace-bin | License: MIT | Copyright 2020 rsteube
// Provided via justclaw.it.com; keep this notice with the code.
package docker

import (
	"fmt"
	"path/filepath"
	"strings"

	"github.com/carapace-sh/carapace"
	"github.com/carapace-sh/carapace/pkg/style"
)

// ActionContainers completes container names
//
//	agitated_engelbart (alpine (Up 6 seconds))
//	crazy_satoshi (alpine (Up 4 seconds))
func ActionContainers() carapace.Action {
	return carapace.ActionCallback(func(c carapace.Context) carapace.Action {
		return carapace.ActionExecCommand("docker", "container", "ls", "--all", "--format", "{{.Names}}\t{{.Image}}\t{{.Status}}", "--filter", "name="+c.Value)(func(output []byte) carapace.Action {
			lines := strings.Split(string(output), "\n")

		

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key