command

package
v0.0.0-...-21d6f6e Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContinueOnError = ErrorHandling(flag.ContinueOnError)
	PanicOnError    = ErrorHandling(flag.PanicOnError)
	ExitOnError     = ErrorHandling(flag.ExitOnError)
)

Variables

This section is empty.

Functions

func ListModules

func ListModules() []string

func Register

func Register(module string, commandFunc func() (Module, ErrorHandling))

func RegisterFunc

func RegisterFunc(module string, obj interface{}, run func([]string, io.Writer) error, help ...func(io.Writer))

func ReparseFlags

func ReparseFlags(module Module)

Re-apply the flag settings to the module that was bound earlier. This is done by matching the type of the module and use the bound flagSet and reparse it again.

func RunModule

func RunModule(key string, module Module, args []string, w io.Writer)

func VisitModules

func VisitModules(f func(string, Module))

Types

type ErrorHandling

type ErrorHandling flag.ErrorHandling

type Module

type Module interface {
	io.Closer

	Help(io.Writer)
	Run([]string, io.Writer) error
}

Module helps with building command-line applications of the form <command> <module> <flags...>

func GetModule

func GetModule(key string) (Module, bool)

Jump to

Keyboard shortcuts

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