Documentation
¶
Overview ¶
Package command provides utilities to manage and execute shell commands. It supports executing individual commands, combining multiple commands into one, and running those commands within a specified environment. Additionally, the package offers methods for initializing, executing, and handling installation of commands, often in conjunction with external tools like mvdan/sh for shell script parsing and execution.
The Commands type represents a collection of shell commands that can be processed together. The Command type encapsulates a single shell command, with methods to manipulate, format, and execute it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrRun = errors.New("running shell command")
ErrRun indicates a failure while executing a shell command.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command string
Command represents a shell command that can be executed.
type Commands ¶
type Commands struct {
Data install.Metadata `yaml:"-"`
Commands unmarshal.SingleOrSliceType[Command] `yaml:"commands"`
AllowFailure bool `yaml:"allow-failure"`
ExitOnError bool `yaml:"exit-on-error"`
}
Commands represents a collection of shell commands that can be executed together.
func (*Commands) Combined ¶
Combined joins all commands into a single Command with proper shell options. Prepends shell error handling options based on ExitOnError setting and joins commands with semicolons.