osutil

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Feb 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Checksum

func Checksum(path, checksum string) bool

Checksum checks if the checksum of a file matches the specified checksum

Types

type CommandRunner added in v0.3.0

type CommandRunner struct{}

CommandRunner is the implementation of the Runner interface that runs OS commands.

func (CommandRunner) RunCommand added in v0.3.0

func (c CommandRunner) RunCommand(command string, args []string, options ...Option) (string, error)

RunCommand runs the given OS command with the specified options, and returns the output as a string, along with any error that occurred.

type Option added in v0.3.0

type Option func(*commandOptions)

func WithStderr added in v0.3.0

func WithStderr(stderr io.Writer) Option

WithStderr sets the stderr for the command.

func WithStdin added in v0.3.0

func WithStdin(stdin io.Reader) Option

WithStdin sets the stdin for the command.

func WithStdout added in v0.3.0

func WithStdout(stdout io.Writer) Option

WithStdout sets the stdout for the command.

type Runner added in v0.3.0

type Runner interface {
	RunCommand(command string, args []string, options ...Option) (string, error)
}

Jump to

Keyboard shortcuts

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