test

package
v1.18.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0, BSD-2-Clause, MIT, + 1 more Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithVar

func WithVar(dst interface{}, src interface{}) func()

WithVar sets the given var to the src value and returns a function to revert to the original state. The type of `dst` has to be a settable pointer. The value of `src` has to be assignable to the type of `dst`.

Example usage: ``` v := "foo" defer WithVar(&v, "bar")() ```

Types

type Command

type Command struct {
	Name  string
	Flags []Flag
	Args  []string
}

Command is a command that has a name, a list of flags, and a list of arguments.

func (*Command) Slice

func (c *Command) Slice() []string

Slice returns a representation of this Command as a slice of strings.

func (*Command) String

func (c *Command) String() string

String returns a representation of this Command as a string.

type CommandBuilder

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

CommandBuilder is a builder for Command objects.

func NewCommandBuilder

func NewCommandBuilder(name string) *CommandBuilder

NewCommandBuilder creates and returns a new CommandBuilder with the given name.

func (*CommandBuilder) Args

func (c *CommandBuilder) Args(args ...string) *CommandBuilder

Args appends the given arguments to this CommandBuilder.

func (*CommandBuilder) Command

func (c *CommandBuilder) Command() *Command

Command returns the Command that has been built by this CommandBuilder.

func (*CommandBuilder) Flags

func (c *CommandBuilder) Flags(flags ...Flag) *CommandBuilder

Flags appends the given flags to this CommandBuilder.

type Flag

type Flag interface {
	Slice() []string
}

func BoolFlag

func BoolFlag(key string, value bool) Flag

func IntFlag

func IntFlag(key string, value int) Flag

func StringFlag

func StringFlag(key, value string) Flag

func StringSliceFlag

func StringSliceFlag(key string, value ...string) Flag

Jump to

Keyboard shortcuts

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