command

package
v0.1.62 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2025 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EmptyCondition = func(iapi.Api, *client.Client) bool { return true }
	EmptyFunction  = func(iapi.Api, *client.Client, []string) {}
	EmptyDepend    = []func(iapi.Api, *client.Client, []string){EmptyFunction}
	EmptyFlag      = func(cmd *cobra.Command) {}
)

Functions

func New

func New() *cobra.Command

Types

type Builder

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

func NewBuilder

func NewBuilder() *Builder

func (*Builder) Args

func (cb *Builder) Args(args func(*cobra.Command, []string) error) *Builder

func (*Builder) Build

func (cb *Builder) Build() icommand.Command

func (*Builder) BuildWithValidation

func (cb *Builder) BuildWithValidation() icommand.Command

func (*Builder) Condition

func (cb *Builder) Condition(fn func(iapi.Api, *client.Client) bool) *Builder

func (*Builder) DependsOn

func (cb *Builder) DependsOn(fns ...func(iapi.Api, *client.Client, []string)) *Builder

func (*Builder) Flags

func (cb *Builder) Flags(flags func(cmd *cobra.Command)) *Builder

func (*Builder) Function

func (cb *Builder) Function(fn func(iapi.Api, *client.Client, []string)) *Builder

func (*Builder) Name

func (cb *Builder) Name(name string) *Builder

func (*Builder) Parent

func (cb *Builder) Parent(parent string) *Builder

func (*Builder) Validate

func (cb *Builder) Validate() error

type Command

type Command struct {
	Parent    string
	Name      string
	Flag      string
	Args      func(*cobra.Command, []string) error
	Condition func(iapi.Api, *client.Client) bool
	Command   func(iapi.Api, *client.Client, []string)
	DependsOn []func(iapi.Api, *client.Client, []string)
	Flags     func(command *cobra.Command)
}

func (Command) GetArgs

func (command Command) GetArgs() func(*cobra.Command, []string) error

func (Command) GetCommand

func (command Command) GetCommand() func(iapi.Api, *client.Client, []string)

func (Command) GetCondition

func (command Command) GetCondition(api iapi.Api, cli *client.Client) bool

func (Command) GetDependsOn

func (command Command) GetDependsOn() []func(iapi.Api, *client.Client, []string)

func (Command) GetFlags

func (command Command) GetFlags() func(command *cobra.Command)

func (Command) GetName

func (command Command) GetName() string

func (Command) GetParent

func (command Command) GetParent() string

func (Command) SetFlags

func (command Command) SetFlags(cmd *cobra.Command)

Jump to

Keyboard shortcuts

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