Version: v0.9.0 Latest Latest

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

Go to latest
Published: Mar 19, 2016 License: Apache-2.0, Apache-2.0 Imports: 7 Imported by: 0




This section is empty.


This section is empty.


func Alias

func Alias(name string, alias string)

func Commands

func Commands() map[string]Command

func ProcessCommand

func ProcessCommand(h HasFlags) error

func Register

func Register(name string, c Command)

func RegisterCommand

func RegisterCommand(h HasFlags, f *flag.FlagSet)

func Run

func Run(args []string) int

func Walk

func Walk(c interface{}, ifaceType reflect.Type, fn WalkFn) error

Walk recursively walks struct types that implement the specified interface. Fields that implement the specified interface are expected to be pointer values. This allows the function to cache pointer values on a per-type basis. If, during a recursive walk, the same type is encountered twice, the function creates a new value of that type the first time, and reuses that same value the second time.

This function is used to make sure that a hierarchy of flags where multiple structs refer to the `Client` flag will not end up with more than one instance of the actual client. Rather, every struct referring to the `Client` flag will have a pointer to the same underlying `Client` struct.


type Command

type Command interface {

	Run(f *flag.FlagSet) error

type HasFlags

type HasFlags interface {
	// Register may be called more than once and should be idempotent.
	Register(f *flag.FlagSet)

	// Process may be called more than once and should be idempotent.
	Process() error

type WalkFn

type WalkFn func(c interface{}) error

Jump to

Keyboard shortcuts

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