cmdx

package
v0.0.94 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2020 License: Apache-2.0 Imports: 8 Imported by: 59

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNilDependency = errors.New("a dependency was expected to be defined but is nil. Please open an issue with the stack trace")

ErrNilDependency is returned if a dependency is missing.

Functions

func CheckResponse

func CheckResponse(err error, expectedStatusCode int, response *http.Response)

CheckResponse fatals if err is nil or the response.StatusCode does not match the expectedStatusCode

func EnvVarExamplesHelpMessage

func EnvVarExamplesHelpMessage(name string) string

EnvVarExamplesHelpMessage returns a string containing documentation on how to use environment variables.

func ExactArgs added in v0.0.6

func ExactArgs(cmd *cobra.Command, args []string, l int)

ExactArgs fatals if args does not equal l.

func ExpectDependency added in v0.0.37

func ExpectDependency(logger logrus.FieldLogger, dependencies ...interface{})

ExpectDependency expects every dependency to be not nil or it fatals.

func Fatalf

func Fatalf(message string, args ...interface{})

Fatalf prints to os.Stderr and exists with code 1.

func FormatResponse

func FormatResponse(o interface{}) string

FormatResponse takes an object and prints a json.MarshalIdent version of it or fatals.

func MinArgs

func MinArgs(cmd *cobra.Command, args []string, min int)

MinArgs fatals if args does not satisfy min.

func Must

func Must(err error, message string, args ...interface{})

Must fatals with the optional message if err is not nil.

func RangeArgs added in v0.0.6

func RangeArgs(cmd *cobra.Command, args []string, r []int)

RangeArgs fatals if args does not satisfy any of the lengths set in r.

func Version

func Version(gitTag, gitHash, buildTime *string) *cobra.Command

Version returns a *cobra.Command that handles the `version` command.

Types

This section is empty.

Jump to

Keyboard shortcuts

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