util

package
v0.0.0-...-b8e83fa Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PhaseListFormat is used to print tables with phase list
	PhaseListFormat = "NAMESPACE:metadata.namespace,NAME:metadata.name,CLUSTER NAME:metadata.clusterName," +
		"EXECUTOR:config.executorRef.kind,DOC ENTRYPOINT:config.documentEntryPoint"
	// PlanListFormat is used to print tables with plan list
	PlanListFormat = "NAMESPACE:metadata.namespace,NAME:metadata.name,DESCRIPTION:description"
	// HostListFormat is used to print tables with host list
	HostListFormat = "NodeName:nodename,NodeID:nodeid"
)

Variables

This section is empty.

Functions

func ExpandTilde

func ExpandTilde(path string) string

ExpandTilde expands the path to include the home directory if the path is prefixed with `~`. If it isn't prefixed with `~` or has no slash after tilde, the path is returned as-is.

func GetNewTabWriter

func GetNewTabWriter(output io.Writer) *tabwriter.Writer

GetNewTabWriter returns a tabwriter that translates tabbed columns in input into properly aligned text.

func GitDirNameFromURL

func GitDirNameFromURL(urlString string) string

GitDirNameFromURL extract directory name of the repository from URL

func PrintObjects

func PrintObjects(objects interface{}, template string, w io.Writer, noHeaders bool) error

PrintObjects prints suitable

func Setenv

func Setenv(envVars ...EnvVar)

Setenv is used to set variable number of env variables, if an error occurs it will be printed to logger

func Unsetenv

func Unsetenv(envVars ...EnvVar)

Unsetenv is used to unset variable number of env variables, if an error occurs it will be printed to logger

func UserHomeDir

func UserHomeDir() string

UserHomeDir is a utility function that wraps os.UserHomeDir and returns no errors. If the user has no home directory, the returned value will be the empty string

func WriteFiles

func WriteFiles(fls map[string][]byte, mode os.FileMode) error

WriteFiles write multiple files described in a map

Types

type EnvVar

type EnvVar struct {
	Key   string
	Value string
}

EnvVar is an object to store key:value pairs to set/unset environment variables

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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