cmd

package
v0.0.0-...-e560ebb Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2021 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package cmd provides support for running commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandRunner

type CommandRunner interface {
	RunCommand(ctx context.Context, stdoutBuf, stderrBuf *bytes.Buffer, dir, name string, args ...string) error
}

CommandRunner is the common interface for this module.

type FakeCommandRunner

type FakeCommandRunner struct {
	Stdout string
	Stderr string
	// Only one of ExpectedCmd and ExpectedCmdPartial can be set.
	ExpectedCmd        []string
	ExpectedCmdPartial []string
	ExpectedDir        string
	FailCommand        bool
	FailError          string
}

FakeCommandRunner does not actually run commands. It is used for testing.

func (FakeCommandRunner) RunCommand

func (c FakeCommandRunner) RunCommand(ctx context.Context, stdoutBuf, stderrBuf *bytes.Buffer, dir, name string, args ...string) error

RunCommand runs a command (not actually).

type FakeCommandRunnerMulti

type FakeCommandRunnerMulti struct {
	CommandRunners []FakeCommandRunner
	// contains filtered or unexported fields
}

FakeCommandRunnerMulti provides multiple command runners.

func (*FakeCommandRunnerMulti) RunCommand

func (c *FakeCommandRunnerMulti) RunCommand(ctx context.Context, stdoutBuf, stderrBuf *bytes.Buffer, dir, name string, args ...string) error

RunCommand runs a command (not actually).

type RealCommandRunner

type RealCommandRunner struct{}

RealCommandRunner actually runs commands.

func (RealCommandRunner) RunCommand

func (c RealCommandRunner) RunCommand(ctx context.Context, stdoutBuf, stderrBuf *bytes.Buffer, dir, name string, args ...string) error

RunCommand runs a command.

Jump to

Keyboard shortcuts

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