tree

package
v0.5.8 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: MIT Imports: 9 Imported by: 30

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
	Description 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

func (Args) Validate added in v0.4.0

func (a Args) Validate(args readline.Args) error

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.FlagSets) error
	Description string
	Nodes       []*Node
	Execute     func(ctx context.Context, r *readline.Readline) error
}

type Nodes

type Nodes []*Node

type Root

type Root interface {
	Node() *Node
	Complete(ctx context.Context, r *readline.Readline) []goprompt.Suggest
	Execute(ctx context.Context, r *readline.Readline) error
	Help(ctx context.Context, r *readline.Readline) string
}

func New added in v0.4.0

func New(node *Node) Root

Jump to

Keyboard shortcuts

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