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 ¶
- type Command
- type Commands
- func (c *Commands) Combined() Command
- func (c *Commands) Exe() error
- func (c *Commands) Get(_ string) string
- func (c *Commands) Initialize(command string) error
- func (c *Commands) Install(d common.InstallData) (output string, found file.File, err error)
- func (c *Commands) Path(path string, patterns []string, _ string, _ match.Requirements) error
- func (c *Commands) Version(version string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command string
Command represents a shell command as a string.
type Commands ¶
type Commands []Command
Commands represents a slice of shell commands.
func (*Commands) Combined ¶
Combined returns all commands in the Commands slice as a single Command, with each command joined by semicolons.
func (*Commands) Initialize ¶
Initialize prepares the Commands based on the given string.
func (*Commands) Install ¶
Install runs the combined commands for installation using the provided InstallData, captures the output, and returns it alongside any errors or found file information.