command

package
v1.30.3 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2026 License: GPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand(ctx context.Context, step core.Step) (executor.Executor, error)

NewCommand creates an executor that will run the provided step. It returns an executor configured from the step, or an error if creating the command configuration fails. If the step has multiple commands, it returns a multiCommandExecutor that runs them sequentially.

func NewCommandConfig

func NewCommandConfig(ctx context.Context, step core.Step) (*commandConfig, error)

NewCommandConfig creates a commandConfig populated from the given context and step. The returned config uses the environment from runtime.GetEnv(ctx) for Dir and Shell, extracts Command/Args from the first command entry, and sets UserSpecifiedShell to true when the step explicitly provided a Shell. It returns the constructed *commandConfig and a nil error.

Types

type Shell added in v1.25.0

type Shell interface {
	// Match returns true if this shell handles the given executable name.
	// The name is lowercase and without path (e.g., "bash", "powershell.exe").
	Match(name string) bool

	// Build constructs an exec.Cmd for executing the command in this shell.
	Build(ctx context.Context, b *shellCommandBuilder) (*exec.Cmd, error)
}

Shell defines the interface for shell-specific command building. Each shell type (bash, PowerShell, cmd, nix-shell) implements this interface to handle its unique argument syntax and behaviors.

Jump to

Keyboard shortcuts

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