command

package
v0.0.0-...-171ac31 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandList = []CommandItem{}

Functions

This section is empty.

Types

type CliCommand

type CliCommand[T any] struct {
	Name        string
	Description string
	Handler     func(args T)
}

func (CliCommand[T]) Load

func (c CliCommand[T]) Load(group string, parser *Parser)

Load loads the command into the specified command group

type Command

type Command[T any] struct {
	// contains filtered or unexported fields
}

func (Command[T]) Execute

func (c Command[T]) Execute()

type CommandItem

type CommandItem struct {
	Cmd      *argparse.Command
	Executor Executor
}

type CommandTable

type CommandTable = map[string][]Loader

type Executor

type Executor interface {
	Execute()
}

type Handler

type Handler[T any] func(args T)

type Loader

type Loader interface {
	Load(string, *Parser)
}

type Parser

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

func NewParser

func NewParser(name, description string) *Parser

func (*Parser) Parse

func (p *Parser) Parse(args []string) error

func (*Parser) Usage

func (p *Parser) Usage(err error) string

Jump to

Keyboard shortcuts

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