console

package
v0.0.0-...-89dfdfc Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(commands map[string]*Command)

Types

type Command

type Command struct {
	Definition  string
	Description string
	Execution   func(c *ParsedCommand)
}

func (*Command) GetCommand

func (cmd *Command) GetCommand() string

func (*Command) GetDescription

func (cmd *Command) GetDescription() string

func (*Command) GetName

func (cmd *Command) GetName() string

func (*Command) Run

func (cmd *Command) Run(c *ParsedCommand)

type CommandGroup

type CommandGroup struct {
	Name        string
	Description string
	Prefix      string
	Commands    []*Command
}

type Console

type Console struct {
	Commands map[string]*Command
}

func New

func New() *Console

func (*Console) Add

func (c *Console) Add(command *Command)

func (*Console) AddCommand

func (c *Console) AddCommand(name string, description string, execution func(c *ParsedCommand)) *Command

func (*Console) Run

func (c *Console) Run()

type ParsedCommand

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

func Parse

func Parse(definition string, command string) *ParsedCommand

func (*ParsedCommand) GetArgument

func (p *ParsedCommand) GetArgument(name string) *Value

func (*ParsedCommand) GetArgumentWithDefault

func (p *ParsedCommand) GetArgumentWithDefault(name string, defaultValue any) *Value

func (*ParsedCommand) GetName

func (p *ParsedCommand) GetName() string

func (*ParsedCommand) GetOption

func (p *ParsedCommand) GetOption(name string) *Value

func (*ParsedCommand) GetOptionWithDefault

func (p *ParsedCommand) GetOptionWithDefault(name string, defaultValue any) *Value

func (*ParsedCommand) GetPrefix

func (p *ParsedCommand) GetPrefix() string

func (*ParsedCommand) GetSubCommand

func (p *ParsedCommand) GetSubCommand() string

type Value

type Value struct {
	fmt.Stringer
	Value any
}

func (*Value) Bool

func (o *Value) Bool() bool

func (*Value) Integer

func (o *Value) Integer() int

func (*Value) String

func (o *Value) String() string

Directories

Path Synopsis
Package filenotify provides a mechanism for watching file(s) for changes.
Package filenotify provides a mechanism for watching file(s) for changes.
web

Jump to

Keyboard shortcuts

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