cmdbox

package
v0.6.9-alpha.11 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CmdBoxWidget

type CmdBoxWidget struct {
	*tview.InputField

	sync.Mutex
	// contains filtered or unexported fields
}

func New

func New(getLastCmd func() string, setLastCmd func(string)) *CmdBoxWidget

func (*CmdBoxWidget) AddCommand

func (CB *CmdBoxWidget) AddCommand(command Command)

func (*CmdBoxWidget) AddCommandCallback

func (CB *CmdBoxWidget) AddCommandCallback(command string, callback func(map[string]interface{})) Command

func (*CmdBoxWidget) Id

func (CB *CmdBoxWidget) Id() string

func (*CmdBoxWidget) InputHandler

func (CB *CmdBoxWidget) InputHandler() func(*tcell.EventKey, func(tview.Primitive))

InputHandler returns the handler for this primitive.

func (*CmdBoxWidget) Mount

func (CB *CmdBoxWidget) Mount(context map[string]interface{}) error

func (*CmdBoxWidget) RemoveCommand

func (CB *CmdBoxWidget) RemoveCommand(command Command)

func (*CmdBoxWidget) Submit

func (CB *CmdBoxWidget) Submit(command string, args []string)

func (*CmdBoxWidget) Unmount

func (CB *CmdBoxWidget) Unmount() error

type Command

type Command interface {
	CommandName() string
	CommandUsage() string
	CommandHelp() string

	CommandCallback(context map[string]any)
}

type DefaultCommand

type DefaultCommand struct {
	Name  string
	Usage string
	Help  string

	Callback func(context map[string]interface{})
}

func (*DefaultCommand) CommandCallback

func (DC *DefaultCommand) CommandCallback(context map[string]interface{})

func (*DefaultCommand) CommandHelp

func (DC *DefaultCommand) CommandHelp() string

func (*DefaultCommand) CommandName

func (DC *DefaultCommand) CommandName() string

func (*DefaultCommand) CommandUsage

func (DC *DefaultCommand) CommandUsage() string

Jump to

Keyboard shortcuts

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