clienv

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2020 License: Apache-2.0 Imports: 6 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 {
	// 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
	// Getenv is the equivalent of os.Getenv.
	Getenv(key string) string
	// 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,
	variables 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.

Jump to

Keyboard shortcuts

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