Documentation
¶
Index ¶
- func CommandWithResult(ctx context.Context, logger *log.Logger, command *Command) (output string, err error)
- func FilterArgs(args []string, filter []string, ignore bool) (filtered []string)
- func FilterArgsKeep(args []string, filter []string) (filtered []string)
- func FilterArgsRemove(args []string, filter []string) (filtered []string)
- func Flags(cmd any) (args []string)
- func FormatToGoObject(object any) string
- func Pretty(object any) string
- func PrettyPrint(object any)
- func Set[T comparable](s []T) map[T]bool
- func UniqueDirectory(path string) (uniquePath string, err error)
- func UniqueName(name string, existsFunction func(candidate string) (bool, error)) (uniqueName string, err error)
- type Command
- type Parallel
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandWithResult ¶
func CommandWithResult(ctx context.Context, logger *log.Logger, command *Command) (output string, err error)
CommandWithResult executes a command and returns its output, while printing the same output to the given logger.
func FilterArgs ¶ added in v0.6.0
FilterArgs filters the arguments by either ignoring/allowing them in the result.
func FilterArgsKeep ¶ added in v0.6.0
FilterArgsKeep filters the given argument list and only returns arguments defined present in "filter".
func FilterArgsRemove ¶ added in v0.6.0
FilterArgsRemove filters the given argument list and returns arguments where "filter" entries are removed.
func FormatToGoObject ¶ added in v0.6.0
FormatToGoObject formats the given object to equivalent Go code.
func PrettyPrint ¶ added in v0.6.0
func PrettyPrint(object any)
PrettyPrint pretty prints the given object to STDOUT.
func UniqueDirectory ¶ added in v0.6.0
UniqueDirectory creates a unique directory from the given path.
Types ¶
type Command ¶
type Command struct {
// Command holds the command with its optional arguments.
Command []string
// Stdin holds a string which is passed on as STDIN.
Stdin string
// Directory defines the directory the execution should run in, without changing the working directory of the caller.
Directory string
// Env overwrites the environment variables of the executed command.
Env map[string]string
}
Command defines a command that should be executed.
type Parallel ¶ added in v0.6.0
type Parallel struct {
// contains filtered or unexported fields
}
Parallel holds a buffered channel for limiting parallel executions.
func NewParallel ¶ added in v0.6.0
NewParallel returns a Parallel execution helper.