Documentation ¶
Index ¶
- Constants
- Variables
- func BehaviorOnFatal(f func(string, int))
- func CheckErr(err error)
- func ConfigDir() (string, error)
- func DefaultBehaviorOnFatal()
- func HomeDir() string
- func StandardErrorMessage(err error) (string, bool)
- func UsageError(cmd *cobra.Command, format string, args ...interface{}) error
- type Factory
Constants ¶
const ( DefaultErrorExitCode = 1 DefaultWritePermissions = 0760 )
Variables ¶
var ErrExit = fmt.Errorf("exit")
ErrExit may be passed to CheckError to instruct it to output nothing but exit with status code 1.
Functions ¶
func BehaviorOnFatal ¶
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 ¶
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 ¶
func DefaultBehaviorOnFatal()
DefaultBehaviorOnFatal allows you to undo any previous override. Useful in tests.
func StandardErrorMessage ¶
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.
Types ¶
type Factory ¶
type Factory interface { GetJenkinsClient() (*gojenkins.Jenkins, error) CreateJenkinsConfigService() (jenkins.JenkinsConfigService, error) CreateClient() (*kubernetes.Clientset, string, error) CreateTable(out io.Writer) table.Table }
func NewFactory ¶
func NewFactory() Factory
NewFactory creates a factory with the default Kubernetes resources defined if optionalClientConfig is nil, then flags will be bound to a new clientcmd.ClientConfig. if optionalClientConfig is not nil, then this factory will make use of it.