xcli

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildCobraCommand

func BuildCobraCommand(icmd ICommand) *cobra.Command

func ConvFlag2Pflag

func ConvFlag2Pflag(src *pflag.FlagSet, dst *pflag.FlagSet)

Types

type ICommand

type ICommand interface {
	Use() string
	Short() string
	Long() string
	Run(ctx context.Context, args []string) error
	Flags() *pflag.FlagSet
}

type ICommandList

type ICommandList []ICommand

type XCli added in v1.2.7

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

func NewXCli added in v1.2.7

func NewXCli(name string, opts ...XCliOption) *XCli

func (*XCli) Run added in v1.2.7

func (x *XCli) Run(ctx context.Context) error

type XCliOption added in v1.2.7

type XCliOption interface {
	// contains filtered or unexported methods
}

func WithCommandList added in v1.2.7

func WithCommandList(cmdList ICommandList) XCliOption

func WithHandleUnknownCommand added in v1.2.8

func WithHandleUnknownCommand(handleUnknownCommand func(ctx context.Context, args []string) error) XCliOption

func WithLong added in v1.2.7

func WithLong(long string) XCliOption

func WithShort added in v1.2.7

func WithShort(short string) XCliOption

type XCliOptionFunc added in v1.2.7

type XCliOptionFunc func(opt *XCliOptions)

type XCliOptions added in v1.2.7

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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