env

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package env provides the environment for the commands to run.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Env

type Env struct {
	// contains filtered or unexported fields
}

Env defines the environment to run the commands.

func Default

func Default() *Env

Default returns the default environment, for real world use.

func Testing

func Testing(ctx context.Context) *Env

Testing sets up an environment for testing commands.

func (*Env) InjectReader

func (e *Env) InjectReader(r io.Reader)

InjectReader sets the alternative reader to use in the env.

func (*Env) InjectStoreError

func (e *Env) InjectStoreError(err error)

InjectStoreError forces the in memory store to return an error.

func (*Env) ProvideStore

func (e *Env) ProvideStore(ctx context.Context, databaseURL string) (store.Store, error)

ProvideStore returns the Store to use.

func (*Env) ReadFile

func (e *Env) ReadFile(file string) ([]byte, error)

ReadFile reads the named file. If the filename is "-", it will read the content from the alternate reader in the environment.

func (*Env) TestCommand

func (e *Env) TestCommand(f func(*Env) *cobra.Command, args []string) (string, error)

TestCommand executes the given command with the supplied arguments and returns the standard output as a string.

Jump to

Keyboard shortcuts

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