formatted

package
v0.13.1 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: Apache-2.0 Imports: 12 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 CheckParamDefaultValue added in v0.10.0

func CheckParamDefaultValue(param string, paramSpec []v1beta1.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 v1beta1.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 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 Param added in v0.10.0

func Param(params []v1beta1.Param, paramSpec []v1beta1.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 Result added in v0.12.0

func Result(value string) string

Result will format a given result value

func TaskConditions added in v0.10.0

func TaskConditions(conditions []v1beta1.PipelineTaskCondition) string

TaskConditions formats a list of conditions

func Timeout added in v0.10.0

func Timeout(t *metav1.Duration) string

func Workspace added in v0.12.0

func Workspace(ws v1beta1.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