Documentation
¶
Index ¶
Constants ¶
const CurrentEnvironmentFilename = "current-environment"
Variables ¶
var ErrNoEnvironmentSpecified = fmt.Errorf("no environment specified")
ErrNoEnvironmentSpecified is returned by commands that operate on an environment if there is no current environment, no environment has been explicitly specified, and there is no default environment.
Functions ¶
func ReadCurrentEnvironment ¶
func ReadCurrentEnvironment() string
Read the file $JUJU_HOME/current-environment and return the value stored there. If the file doesn't exist, or there is a problem reading the file, an empty string is returned.
func Wrap ¶
func Wrap(c EnvironCommand) cmd.Command
Wrap wraps the specified EnvironCommand, returning a Command that proxies to each of the EnvironCommand methods.
func WriteCurrentEnvironment ¶
Write the envName to the file $JUJU_HOME/current-environment file.
Types ¶
type EnvCommandBase ¶
type EnvCommandBase struct { cmd.CommandBase EnvName string }
EnvCommandBase is a convenience type for embedding in commands that wish to implement EnvironCommand.
func (*EnvCommandBase) SetEnvName ¶
func (c *EnvCommandBase) SetEnvName(envName string)
type EnvironCommand ¶
type EnvironCommand interface { cmd.Command // SetEnvName is called prior to the wrapped command's Init method // with the active environment name. The environment name is guaranteed // to be non-empty at entry of Init. SetEnvName(envName string) }
EnvironCommand extends cmd.Command with a SetEnvName method.