pkgcobra

package
v0.0.0-...-15a92f0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2016 License: MIT Imports: 4 Imported by: 29

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Check

func Check(err error)

Check checks the error.

func CheckBoundedArgs

func CheckBoundedArgs(argBounds Bounds, args []string) error

CheckBoundedArgs checks that the number of arguments is within the given Bounds.

func CheckFixedArgs

func CheckFixedArgs(numArgs int, args []string) error

CheckFixedArgs checks that the number of arguments equals numArgs.

func ErrorAndExit

func ErrorAndExit(format string, args ...interface{})

ErrorAndExit errors with the given format and args, and then exits.

func Run

func Run(run func(args []string) error) func(*cobra.Command, []string)

Run makes a new cobra run function that wraps the given function.

func RunBoundedArgs

func RunBoundedArgs(argBounds Bounds, run func(args []string) error) func(*cobra.Command, []string)

RunBoundedArgs makes a new cobra run function that checks that the number of args is within argBounds.

func RunFixedArgs

func RunFixedArgs(numArgs int, run func(args []string) error) func(*cobra.Command, []string)

RunFixedArgs makes a new cobra run function that checks that the number of args is equal to numArgs.

Types

type Bounds

type Bounds struct {
	Min int
	Max int
}

Bounds represent min and max bounds.

Jump to

Keyboard shortcuts

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