command

package
v0.0.0-...-5a71971 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgOption

type ArgOption struct {
	Value string
	Label string
}

type ArgType

type ArgType int
const (
	StringArg ArgType = iota
	BoolArg
	SelectArg
)

type Argument

type Argument struct {
	Name            string
	IsConstant      bool
	AutoComplete    func(currentText string, currentArgs *[]string) []string
	OnAutoCompleted func(text string, index int, field *tview.InputField) bool
	Type            ArgType
	Options         []ArgOption
}

func (*Argument) AutoCompleteWithArgs

func (a *Argument) AutoCompleteWithArgs(currentArgs *[]string) func(currentText string) []string

func (*Argument) OnAutoCompletedWithField

func (a *Argument) OnAutoCompletedWithField(field *tview.InputField) func(text string, index int, source int) bool

type Command

type Command struct {
	Name         string
	Short        string
	Long         string
	SubCommands  []*Command
	ExpectedArgs []Argument
	Run          func(args []string) ([]Output, error)
	ShowLogs     bool
	PrefillForm  bool
}

func (*Command) ToCobra

func (c *Command) ToCobra() *cobra.Command

type Output

type Output struct {
	String    string
	Options   []OutputOption
	IsMessage bool
}

type OutputOption

type OutputOption struct {
	Name   string
	Select *Command
	Args   []string
}

Jump to

Keyboard shortcuts

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