tree

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: MIT Imports: 8 Imported by: 43

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoop            = errors.New("noop")
	ErrInvalidCommand  = errors.New("invalid command")
	ErrMissingCommand  = errors.New("missing command")
	ErrMissingArgument = errors.New("missing argument")
)

Functions

This section is empty.

Types

type Arg

type Arg struct {
	Name     string
	Repeat   bool
	Optional bool
	Suggest  func(ctx context.Context, t *Root, r *readline.Readline) []goprompt.Suggest
}

type Args

type Args []*Arg

func (Args) Last

func (a Args) Last() *Arg

type Flag

type Flag struct {
	Name     string
	Required bool
	Value    interface{}
}

type Node

type Node struct {
	Name             string
	Values           func(ctx context.Context, r *readline.Readline) []goprompt.Suggest
	Args             Args
	Flags            func(ctx context.Context, r *readline.Readline, fs *readline.FlagSet) error
	PassThroughArgs  Args
	PassThroughFlags func(ctx context.Context, r *readline.Readline, fs *readline.FlagSet) error
	Description      string
	Nodes            []*Node
	Execute          func(ctx context.Context, r *readline.Readline) error
}

type Nodes

type Nodes []*Node

type Root

type Root struct {
	Name        string
	Description string
	Node        *Node
	Nodes       Nodes
}

func (*Root) Complete

func (t *Root) Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest

func (*Root) Execute

func (t *Root) Execute(ctx context.Context, r *readline.Readline) error

func (*Root) Help added in v0.3.0

func (t *Root) Help(ctx context.Context, r *readline.Readline) string

Jump to

Keyboard shortcuts

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