commands

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2022 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCommands

func GetCommands() []*cli.Command

GetCommands returns the registered commands

func RegisterCommand

func RegisterCommand(name CommandName, command Command, opts *CommandOpts) error

RegisterCommand registers a command

Types

type Command

type Command interface {
	Name() CommandName
	Aliases() []string
	Usage() string
	Subcommands() []*cli.Command
	Flags() []cli.Flag
	Action(c *cli.Context) error
}

Command is the interface that all commands must implement

type CommandName

type CommandName string

CommandName is the name of the command

type CommandOpts

type CommandOpts struct {
	// Treat all flags as normal arguments if true
	SkipFlagParsing bool
}

CommandOpts is the options for a command

Jump to

Keyboard shortcuts

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