subflags

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeCommandFlagSet

func MakeCommandFlagSet(cmd *Command) *flag.FlagSet

MakeCommandFlagSet creates flag set for given command.

func MakeUsage

func MakeUsage(cmds ...*Command) func()

MakeUsage creates usage description function for given set of commands.

Types

type Command

type Command struct {
	// Name is command name and command line identifier.
	Name string
	// Desc is a description of the command.
	Desc string
	// Parser gets rest of command line arguments and returns a function which
	// executes the command.
	Parser func(args []string) (CommandFunc, error)
}

Command defines CLI command.

type CommandFunc

type CommandFunc func(*global.Config) error

CommandFunc is a prototype of a function which executes command.

func Parse

func Parse(cmds ...*Command) CommandFunc

Parse dispatches and run parser for a command from given set.

Jump to

Keyboard shortcuts

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