jx: github.com/jenkins-x/jx/pkg/cmd/helper Index | Files

package helper

import "github.com/jenkins-x/jx/pkg/cmd/helper"


Package Files

error.go seealso.go


var ErrExit = fmt.Errorf("exit")

ErrExit may be passed to CheckError to instruct it to output nothing but exit with status code 1.

func BehaviorOnFatal Uses

func BehaviorOnFatal(f func(string, int))

BehaviorOnFatal allows you to override the default behavior when a fatal error occurs, which is to call os.Exit(code). You can pass 'panic' as a function here if you prefer the panic() over os.Exit(1).

func CheckErr Uses

func CheckErr(err error)

CheckErr prints a user friendly error to STDERR and exits with a non-zero exit code. Unrecognized errors will be printed with an "error: " prefix.

This method is generic to the command in use and may be used by non-Kubectl commands.

func DefaultBehaviorOnFatal Uses

func DefaultBehaviorOnFatal()

DefaultBehaviorOnFatal allows you to undo any previous override. Useful in tests.

func Fatal Uses

func Fatal(msg string, code int)

Fatal prints the message (if provided) and then exits. If V(2) or greater, glog.Logger().Fatal is invoked for extended information.

func SeeAlsoText Uses

func SeeAlsoText(commands ...string) string

SeeAlsoText returns text to describe which other commands to look at which are related to the current command

func StandardErrorMessage Uses

func StandardErrorMessage(err error) (string, bool)

StandardErrorMessage translates common errors into a human readable message, or returns false if the error is not one of the recognized types. It may also log extended information to glog.

This method is generic to the command in use and may be used by non-Kubectl commands.

func UsageError Uses

func UsageError(cmd *cobra.Command, format string, args ...interface{}) error

UsageError prints an error with how to run the help for the specified command.

Package helper imports 6 packages (graph) and is imported by 49 packages. Updated 2019-09-12. Refresh now. Tools for package owners.