command

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 23 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestConfigFn added in v0.2.1

func NewTestConfigFn(cfgFile string, logFile string) func() *TestConfig

Types

type Command

type Command[T config.Config] struct {
	// contains filtered or unexported fields
}

func New

func New[T config.Config](cli string, short string, long string, noargs bool, version *version.Version[T], newConfig config.New[T], setupCommands []SetupCommand[T]) *Command[T]

func (*Command[T]) Execute

func (c *Command[T]) Execute(ctx context.Context, commandType Type) int

type SetupCommand

type SetupCommand[T config.Config] func(cmd *cobra.Command, ch *cmdutils.Helper[T])

type TestCommandHarness added in v0.2.1

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

func NewTestCommandHarness added in v0.2.1

func NewTestCommandHarness(t *testing.T, fn testCommandFn) *TestCommandHarness

func (*TestCommandHarness) Execute added in v0.2.1

func (h *TestCommandHarness) Execute(ctx context.Context, args []string) int

func (*TestCommandHarness) Stderr added in v0.2.1

func (h *TestCommandHarness) Stderr() string

func (*TestCommandHarness) Stdout added in v0.2.1

func (h *TestCommandHarness) Stdout() string

type TestConfig added in v0.2.1

type TestConfig struct {

	// Common configuration values.
	Format  string
	Debug   bool
	NoColor bool `mapstructure:"no-color"`
	// contains filtered or unexported fields
}

func (*TestConfig) DefaultConfigDir added in v0.2.1

func (c *TestConfig) DefaultConfigDir() (string, error)

func (*TestConfig) DefaultConfigFile added in v0.2.1

func (c *TestConfig) DefaultConfigFile() string

func (*TestConfig) DefaultLogDir added in v0.2.1

func (c *TestConfig) DefaultLogDir() (string, error)

func (*TestConfig) DefaultLogFile added in v0.2.1

func (c *TestConfig) DefaultLogFile() string

func (*TestConfig) GetConfigFile added in v0.2.1

func (c *TestConfig) GetConfigFile() string

func (*TestConfig) GetLogFile added in v0.2.1

func (c *TestConfig) GetLogFile() string

func (*TestConfig) GlobalRequiredFlags added in v0.2.1

func (_ *TestConfig) GlobalRequiredFlags(cmd *cobra.Command) error

func (*TestConfig) RootPersistentFlags added in v0.2.1

func (_ *TestConfig) RootPersistentFlags(flags *pflag.FlagSet)

func (*TestConfig) SetConfigFile added in v0.2.1

func (c *TestConfig) SetConfigFile(cfg string)

func (*TestConfig) SetLogFile added in v0.2.1

func (c *TestConfig) SetLogFile(l string)

func (*TestConfig) Validate added in v0.2.1

func (_ *TestConfig) Validate() error

type Type added in v0.1.7

type Type int
const (
	Interactive Type = iota
	Noninteractive
)

Jump to

Keyboard shortcuts

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