commands

package module
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2022 License: BSD-3-Clause Imports: 3 Imported by: 8 modules, 8 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

Commands interface and helpers for zetools 

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

func SetVersion added in v1.0.2

func SetVersion(version string)

SetVersion sets the version of the application

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
⌂ 换网址