util

package
v0.2.22 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2021 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithCancelOnSignals

func ContextWithCancelOnSignals(ctx context.Context, sigs ...os.Signal) context.Context

ContextWithCancelOnSignals returns a context that is canceled when one of the specified signals are received

func Die

func Die(err error, cause ...string)

Die panics it the error is not nil. If a cause string is provided it will be displayed in the error message.

func Doc

func Doc(doc string) string

Doc returns a string where all the '<BIN>' are replaced with the binary name and all the '\t' are replaced with a uniformed indentation using space.

func JoinManifests

func JoinManifests(manifests ...[]byte) []byte

JoinManifests concats all of the provided yaml manifests with a yaml separator.

func KubeContextToServer

func KubeContextToServer(contextName string) (string, error)

KubeContextToServer returns the cluster server address for the provided kubernetes context

func MustParseDuration

func MustParseDuration(dur string) time.Duration

MustParseDuration parses the given string as "time.Duration", or panic.

func ParseGitUrl

func ParseGitUrl(n string) (
	host string, orgRepo string, path string, gitRef string, gitSubmodules bool, gitSuff string, gitTimeout time.Duration)

From strings like git@github.com:someOrg/someRepo.git or https://github.com/someOrg/someRepo?ref=someHash, extract the parts.

func SplitManifests

func SplitManifests(manifests []byte) [][]byte

func StealFlags

func StealFlags(cmd *cobra.Command, exceptFor []string) (*pflag.FlagSet, error)

func WithSpinner

func WithSpinner(ctx context.Context, msg ...string) func()

WithSpinner create a spinner that prints a message and canceled if the given context is canceled or the returned stop function is called.

Types

This section is empty.

Jump to

Keyboard shortcuts

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