cmd

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2024 License: MIT-0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgumentAndFlagCantBeUsedTogetherError added in v0.10.0

type ArgumentAndFlagCantBeUsedTogetherError struct {
	Arg  string
	Flag string
}

func (*ArgumentAndFlagCantBeUsedTogetherError) Error added in v0.10.0

type BoolFlag

type BoolFlag struct {
	CommandFlag
	Option *bool
}

func (*BoolFlag) AddFlagToCommand

func (f *BoolFlag) AddFlagToCommand(cmd *cobra.Command)

Boolean flag methods

func (*BoolFlag) ValidateFlag

func (f *BoolFlag) ValidateFlag(cmd *cobra.Command, args []string) error

type Command

type Command struct {
	Parent      string
	Name        string
	Description string
	Aliases     []string
	Args        []string
	Hidden      bool
}

type CommandFlag

type CommandFlag struct {
	Name        string
	Description string
	Shorthand   string
	Required    bool
	Validate    func(cmd *cobra.Command, args []string) error
}

func (*CommandFlag) GetName

func (f *CommandFlag) GetName() string

Command flag methods

type DurationFlag

type DurationFlag struct {
	CommandFlag
	Option *time.Duration
}

func (*DurationFlag) AddFlagToCommand

func (f *DurationFlag) AddFlagToCommand(cmd *cobra.Command)

Duration flag methods

func (*DurationFlag) ValidateFlag

func (f *DurationFlag) ValidateFlag(cmd *cobra.Command, args []string) error

type Flag

type Flag interface {
	AddFlagToCommand(*cobra.Command)
	ValidateFlag(cmd *cobra.Command, args []string) error
	GetName() string
}

type Flags

type Flags []Flag

func (Flags) Remove

func (f Flags) Remove(name string) Flags

func (Flags) ValidateFlags

func (f Flags) ValidateFlags(cmd *cobra.Command, args []string) error

Flags (list of flags) methods

type IntFlag

type IntFlag struct {
	CommandFlag
	Option *int
}

func (*IntFlag) AddFlagToCommand

func (f *IntFlag) AddFlagToCommand(cmd *cobra.Command)

Int flag methods

func (*IntFlag) ValidateFlag

func (f *IntFlag) ValidateFlag(cmd *cobra.Command, args []string) error

type OutputFlag

type OutputFlag printer.Output

func NewOutputFlag

func NewOutputFlag(o *printer.Output) *OutputFlag

func (*OutputFlag) Set

func (o *OutputFlag) Set(outputType string) error

func (*OutputFlag) String

func (o *OutputFlag) String() string

func (*OutputFlag) Type

func (o *OutputFlag) Type() string

type StringFlag

type StringFlag struct {
	CommandFlag
	Choices []string
	Option  *string
}

func (*StringFlag) AddFlagToCommand

func (f *StringFlag) AddFlagToCommand(cmd *cobra.Command)

String flag methods

func (*StringFlag) ValidateFlag

func (f *StringFlag) ValidateFlag(cmd *cobra.Command, args []string) error

type StringSliceFlag

type StringSliceFlag struct {
	CommandFlag
	Choices []string
	Option  *[]string
}

func (*StringSliceFlag) AddFlagToCommand

func (f *StringSliceFlag) AddFlagToCommand(cmd *cobra.Command)

StringSlice flag methods

func (*StringSliceFlag) ValidateFlag

func (f *StringSliceFlag) ValidateFlag(cmd *cobra.Command, args []string) error

Jump to

Keyboard shortcuts

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