clienv

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package clienv contains types to work with the host environment.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env interface {
	Environ

	// Args are the arguments, not including the application name or command.
	//
	// Do not modify.
	Args() []string
	// Stdin is the stdin.
	//
	// If no value was passed when the Env was created, this will return io.EOF on any call.
	Stdin() io.Reader
	// Stdout is the stdout.
	//
	// If no value was passed when the Env was created, this will return io.EOF on any call.
	Stdout() io.Writer
	// Stderr is the stderr.
	//
	// If no value was passed when the Env was created, this will return io.EOF on any call.
	Stderr() io.Writer
	// WithArgs returns a copy of Env with the replacement args.
	WithArgs(args []string) Env
}

Env is an execution environment for the CLI. This is what is passed to commands.

func NewEnv

func NewEnv(
	args []string,
	stdin io.Reader,
	stdout io.Writer,
	stderr io.Writer,
	environMap map[string]string,
) Env

NewEnv creates a new environment.

Default values will be set if any values are nil.

func NewOSEnv

func NewOSEnv() (Env, error)

NewOSEnv returns a new OS environment.

type Environ added in v0.11.0

type Environ interface {
	// Environ is the equivalent of os.Environ.
	//
	// Do not modify.
	Environ() []string
	// Getenv is the equivalent of os.Getenv.
	Getenv(key string) string
}

Environ wraps environment variables.

Jump to

Keyboard shortcuts

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