formatted

package
v0.36.0 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ConditionColor = map[string]color.Attribute{
	"Failed":    color.FgHiRed,
	"Succeeded": color.FgHiGreen,
	"Running":   color.FgHiBlue,
	"Cancelled": color.FgHiYellow,
	"Completed": color.FgHiMagenta,
	"Pending":   color.FgHiBlue,
	"Started":   color.FgHiCyan,
}

Functions

func Age

func Age(t *metav1.Time, c clockwork.Clock) string

func AutoStepName added in v0.7.0

func AutoStepName(stepName string) string

AutoStepName when our stepName is empty return a generated name as generated on pipeLine

func BaseCompletion added in v0.16.0

func BaseCompletion(target string, args []string) ([]string, cobra.ShellCompDirective)

BaseCompletion return a completion for a kubernetes object using Kubectl

func CheckParamDefaultValue added in v0.10.0

func CheckParamDefaultValue(param string, paramSpec []v1.ParamSpec) string

CheckParamDefaultValue returns param's value if defined, if not then checks for default value If default value is not defined then returns param's type

func ColorStatus added in v0.7.0

func ColorStatus(status string) string

ColorStatus Get a status coloured

func Condition

func Condition(c v1.Conditions) string

Condition returns a human readable text based on the status of the Condition

func DecorateAttr added in v0.7.0

func DecorateAttr(attrString, message string) string

DecorateAttr decorate strings with a color or an emoji, respecting the user preference if no colour needed.

func Duration

func Duration(t1, t2 *metav1.Time) string

func FindVersion added in v0.18.0

func FindVersion(version map[string]string) string

func FormatAddress added in v0.13.0

func FormatAddress(addressURL string) string

func FormatDesc added in v0.9.0

func FormatDesc(desc string) string

If description is longer than 20 char then it will return initial 20 chars suffixed by ...

func GetObjectsWithKubectl added in v0.16.0

func GetObjectsWithKubectl(obj string) []string

GetObjectsWithKubectl return completions with kubectl, we are doing this with kubectl since we have caching and without it completion is way too slow

func GetTaskRefName added in v0.17.0

func GetTaskRefName(task *v1.PipelineTask) string

func Param added in v0.10.0

func Param(params []v1.Param, paramSpec []v1.ParamSpec) string

Param returns params with their values. If user value is not defined then returns default value, if default value is not defined then returns param's type

func ParentCompletion added in v0.16.0

func ParentCompletion(cmd *cobra.Command, args []string, _ string) ([]string, cobra.ShellCompDirective)

ParentCompletion do completion of command to the Parent

func PipelineRefExists added in v0.30.0

func PipelineRefExists(spec v1.PipelineRunSpec) string

Check if PipelineRef exists on a PipelineRunSpec. Returns empty string if not present.

func RemoveLastAppliedConfig added in v0.25.0

func RemoveLastAppliedConfig(annotations map[string]string) map[string]string

func Result added in v0.12.0

func Result(value v1.ParamValue) string

Result will format a given result value

func TaskRefExists added in v0.30.0

func TaskRefExists(spec v1.TaskRunSpec) string

Check if TaskRef exists on a TaskRunSpec. Returns empty string if not present.

func Timeout added in v0.10.0

func Timeout(t *metav1.Duration) string

func Workspace added in v0.12.0

func Workspace(ws v1.WorkspaceBinding) string

Types

type Color

type Color struct {
	Rainbow *rainbow
	// contains filtered or unexported fields
}

Color formatter to print the colored output on streams

func NewColor

func NewColor() *Color

NewColor returns a new instance color formatter

func (*Color) Error

func (c *Color) Error(w io.Writer, format string, args ...interface{})

Error prints the formatted content to given destination in red color

func (*Color) PrintRed

func (c *Color) PrintRed(w io.Writer, format string, args ...interface{})

PrintRed prints the formatted content to given destination in red color

Jump to

Keyboard shortcuts

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