Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewTestRootCommand ¶
func NewTestRootCommand(t testing.TB, opts ...*TestOption) *cobra.Command
NewTestRootCommand sets `fyt` root command for testing needs.
Types ¶
type TestOption ¶
type TestOption struct {
// ConfigLocation keeps where config is located.
ConfigLocation string
// Envs supplies environment overrides as NAME=value entries.
// MergeTestOptions accumulates entries from all options in their supplied order.
Envs []string
StdOut io.Writer
StdErr io.Writer
}
TestOption keeps different options for testing commands.
func MergeTestOptions ¶
func MergeTestOptions(_ testing.TB, opts ...*TestOption) *TestOption
MergeTestOptions merges testing options into single TestOption object.
func TOptConfigLocation ¶
func TOptConfigLocation(location string) *TestOption
TOptConfigLocation sets config location as TestOption object
func TOptEnv ¶
func TOptEnv(name, value string) *TestOption
TOptEnv supplies an environment variable as a TestOption object.
func TOptEnvs ¶
func TOptEnvs(envs []string) *TestOption
TOptEnvs supplies environment variable overrides for TestOption.
func TOptStdErr ¶
func TOptStdErr(stderr io.Writer) *TestOption
TOptStdErr sets stderr for TestOption object
func TOptStdOut ¶
func TOptStdOut(stdout io.Writer) *TestOption
TOptStdOut sets stdout for TestOption object
func (*TestOption) Env ¶
func (o *TestOption) Env(name string) (val string)
Env returns the first matching value from TestOption.Envs, or an empty string.