cmdcore

package
v0.2.16 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddCommands

func AddCommands(rootCmd *cobra.Command, cmdFuncs map[string]CommandEntry)

Types

type CommandContext

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

func NewCommandContext

func NewCommandContext(adminClient service.AdminServiceClient, out io.Writer) CommandContext

func NewCommandContextWithExt added in v0.1.7

func NewCommandContextWithExt(
	adminClient service.AdminServiceClient,
	fetcher ext.AdminFetcherExtInterface,
	updater ext.AdminUpdaterExtInterface,
	deleter ext.AdminDeleterExtInterface,
	out io.Writer) CommandContext

NewCommandContextWithExt construct command context with injected extensions. Helps in injecting mocked ones for testing.

func (CommandContext) AdminClient

func (c CommandContext) AdminClient() service.AdminServiceClient

func (CommandContext) AdminDeleterExt added in v0.1.7

func (c CommandContext) AdminDeleterExt() ext.AdminDeleterExtInterface

func (CommandContext) AdminFetcherExt added in v0.1.7

func (c CommandContext) AdminFetcherExt() ext.AdminFetcherExtInterface

func (CommandContext) AdminUpdaterExt added in v0.1.7

func (c CommandContext) AdminUpdaterExt() ext.AdminUpdaterExtInterface

func (CommandContext) InputPipe

func (c CommandContext) InputPipe() io.Reader

func (CommandContext) OutputPipe

func (c CommandContext) OutputPipe() io.Writer

type CommandEntry

type CommandEntry struct {
	ProjectDomainNotRequired bool
	CmdFunc                  CommandFunc
	Aliases                  []string
	Short                    string
	Long                     string
	PFlagProvider            PFlagProvider
}

type CommandFunc

type CommandFunc func(ctx context.Context, args []string, cmdCtx CommandContext) error

type PFlagProvider

type PFlagProvider interface {
	GetPFlagSet(prefix string) *pflag.FlagSet
}

Jump to

Keyboard shortcuts

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