Documentation ¶
Index ¶
- func ClearDirectory(ctx context.Context, executor Executor, path string) error
- func Command(name string, arg ...string) *exec.Cmd
- func CreateDirectory(ctx context.Context, executor Executor, path string) error
- func DirectoryExists(ctx context.Context, executor Executor, path string) bool
- func EnsureDirectoryIsEmpty(ctx context.Context, executor Executor, path string) error
- func ExecutableFileExists(ctx context.Context, executor Executor, file string) error
- func RemoveDirectory(ctx context.Context, executor Executor, path string) error
- type Executor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearDirectory ¶
func Command ¶
Command creates a shell command, almost like a standard `exec.Command()`, except it doesn't try to resolve an absolute path of `name`. This allows to work with local commands as well as with SSH.
func CreateDirectory ¶
func DirectoryExists ¶
DirectoryExists checks if a directory exists
func EnsureDirectoryIsEmpty ¶
EnsureDirectoryIsEmpty checks if the directory exists and is empty. Removes directory contents, if it exists. Creates a directory, if it doesn't exist.
func ExecutableFileExists ¶
ExecutableFileExists checks if an executable file exists
Types ¶
type Executor ¶
type Executor interface { Execute(ctx context.Context, cmd *exec.Cmd) ([]byte, error) Run(ctx context.Context, cmd *exec.Cmd) error ReadFile(ctx context.Context, path string) ([]byte, error) WriteFile(ctx context.Context, path string, data []byte) error }
Executor is a shell command executor interface
Click to show internal directories.
Click to hide internal directories.