command

package
v0.0.0-...-a838feb Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package command implements functions for responding to user input and dispatching to appropriate backend commands.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommandFunc

func CommandFunc(fn func() error) cmdfunc

Types

type Commands

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

func DebugCommands

func DebugCommands() *Commands

Returns a Commands struct with default commands defined.

func (*Commands) Find

func (c *Commands) Find(cmdstr string) cmdfunc

Find will look up the command function for the given command input. If it cannot find the command it will defualt to noCmdAvailable(). If the command is an empty string it will replay the last command.

func (*Commands) Register

func (c *Commands) Register(cmdstr string, cf cmdfunc)

Register custom commands. Expects cf to be a func of type cmdfunc, returning only an error.

Jump to

Keyboard shortcuts

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