Documentation ¶
Index ¶
- func ForLines(reader io.Reader, fn func(string) error) error
- func ForLinesInCommandOutput(ctx context.Context, cmd []string, fn func(string) error) error
- func ForLinesInFile(filePath string, fn func(string) error) error
- func GenerateServiceCommand(ctx context.Context, serviceName, command string) ([]string, error)
- func GetTarExtension(tarPath string) string
- func IsNewerVersion(a, b string) bool
- func IsNewerVersionOrEqual(a, b string) bool
- func IsSupportedTarExtension(tarPath string) bool
- func ListDirectory(dirPath string) ([]string, error)
- func NewCommand(ctx context.Context, cmd []string) *exec.Cmd
- func ParseCommandLine(command string) ([]string, error)
- func ParseEnvFile(filePath string) (map[string]string, error)
- func RebootCommand() ([]string, error)
- func RunCommand(ctx context.Context, cmd []string) ([]byte, error)
- func UnpackTar(tarPath string, destPath string) error
- func WriteFileSync(name string, data []byte, perm os.FileMode) error
- type SemanticVersion
- type TailBuffer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ForLinesInCommandOutput ¶
ForLinesInCommandOutput executes a command and runs fn for each line of the stdout.
func ForLinesInFile ¶
ForLinesInFile runs fn for every line in the provided filePath.
func GenerateServiceCommand ¶
GenerateServiceCommand generates a service command based on the service name and command
func GetTarExtension ¶
GetTarExtension returns the extension of a tar file.
func IsNewerVersion ¶
IsNewerVersion returns true if "a" is newer than "b". Only semantic version is accepted (major[.minor[.patch]])
func IsNewerVersionOrEqual ¶
IsNewerVersionOrEqual returns true if "a" is newer or equal to "b".
func IsSupportedTarExtension ¶
IsSupportedTarExtension returns true if the tarPath has a supported extension.
func ListDirectory ¶
ListDirectory returns a list of files and directories under the provided dirPath.
func NewCommand ¶
NewCommand creates a new exec.Cmd with the given context and command.
func ParseCommandLine ¶
ParseCommandLine parses a string into an array of commandline arguments
func ParseEnvFile ¶
ParseEnvFile parses env file into a map of strings.
func RebootCommand ¶
RebootCommand returns the command to reboot the system
func RunCommand ¶
RunCommand runs a command and returns its output.
Types ¶
type SemanticVersion ¶
type SemanticVersion [3]uint64
SemanticVersion represents a semantic version (major[.minor[.patch]])
type TailBuffer ¶
type TailBuffer struct {
// contains filtered or unexported fields
}
TailBuffer keeps a size-limited tail of lines.
func NewTailBuffer ¶
func NewTailBuffer(maxLines int) *TailBuffer
NewTailBuffer returns an initialized TailBuffer for maxLines.
func (*TailBuffer) Close ¶
func (tf *TailBuffer) Close() [][]byte
Close the buffer and return all recorded lines. After calling this method, any writes will result in a panic.
func (*TailBuffer) Push ¶
func (tf *TailBuffer) Push(line []byte)
Push adds a line to the end of the buffer. If buffer is full, the first line of the buffer gets dropped.