envcmd

package
v0.0.0-...-6337964 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2014 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const CurrentEnvironmentFilename = "current-environment"

Variables

View Source
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

func WriteCurrentEnvironment(envName string) error

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.

Jump to

Keyboard shortcuts

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