Documentation ¶
Overview ¶
Helper functions for running interactive CLI sessions from Go
Helper functions for running interactive CLI sessions from Go
Index ¶
- type Command
- type Docker
- func (d *Docker) AddEnv(e Env)
- func (d *Docker) AddMount(typeStr, source, target string, optAdditionalArgs ...string)
- func (d *Docker) AddRWOverlay(externalDirectory, internalDirectory string) func()
- func (d *Docker) CopyAndAddMount(typeStr, parentDir, source, target string, optAdditionalArgs ...string) func()
- type Env
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Command ¶
type Command struct { Name string Args []string // If LogFile is set, anything send to stdout and stderr is tee'd to the file named in LogFile when .Run() is called. LogFile string // contains filtered or unexported fields }
Command represents running an executable, to make it easy to write interactive "shell scripts" in Go. This routes standard in, out, and error from and to the calling program, intended usually to be a login shell run by a person.
func NewCommand ¶
NewCommand creates an Command, breaking out .Name and .Args for you
type Docker ¶
type Docker struct {
Command
}
Docker is mostly an Command preloaded with arguments which setup Docker for running an image interactively.
func NewDocker ¶
func NewDocker() Docker
NewDocker creates a Docker with default Docker command arguments for running interactively
func (*Docker) AddEnv ¶
AddEnv adds arguments so all the environment variables present in e become part of the docker run's environment
func (*Docker) AddRWOverlay ¶
AddRWOverlay mounts a directory into the image at the desired location, but with an overlay
so internal changes do not modify the external directory.
externalDirectory probably needs to be an absolute path Returns a function to clean up the mount (but does not delete the directory). Uses sudo and probably only works on Linux
func (*Docker) CopyAndAddMount ¶
func (d *Docker) CopyAndAddMount(typeStr, parentDir, source, target string, optAdditionalArgs ...string) func()
CopyAndAddMount copies the source files into a temp directory, and then mounts them as the target. It also returns a function to remove the temp directory for cleaning up.
type Env ¶
Env represents a collection of environment variables and their values
func (Env) PromoteFromEnv ¶
PromoteFromEnv pulls the named environment variables from the environment and puts them in the Env. It does not stop on error and returns an error listing all the failed values