formatter

package
v0.0.0-...-c5ab296 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MPL-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

View Source
const (
	ApprovalIdentifierHeader = "Identifier"
	ApprovalDeltaHeader      = "Delta"
	ApprovalVotesHeader      = "Votes"
	ApprovalRejectedHeader   = "Rejected"
	ApprovalProviderHeader   = "Provider"
	ApprovalCreatedHeader    = "Created"
)

Formatter headers

View Source
const (
	DeploymentNamespaceHeader = "NAMESPACE"
	DeploymentNameHeader      = "NAME"
	DeploymentReadyHeader     = "READY"
	DeploymentImagesHeader    = "IMAGES"
)

Formatter headers

View Source
const (
	TableFormatKey  = "table"
	RawFormatKey    = "raw"
	PrettyFormatKey = "pretty"
)

Format keys used to specify certain kinds of output formats

Variables

This section is empty.

Functions

func ApprovalWrite

func ApprovalWrite(ctx Context, approvals []*types.Approval) error

ApprovalWrite writes formatted approvals using the Context

func DeploymentWrite

func DeploymentWrite(ctx Context, Deployments []Deployment) error

DeploymentWrite writes formatted deployments using the Context

Types

type ApprovalContext

type ApprovalContext struct {
	HeaderContext
	// contains filtered or unexported fields
}

ApprovalContext - approval context is a container for each line

func (*ApprovalContext) Created

func (c *ApprovalContext) Created() string

func (*ApprovalContext) Delta

func (c *ApprovalContext) Delta() string

func (*ApprovalContext) Identifier

func (c *ApprovalContext) Identifier() string

func (*ApprovalContext) MarshalJSON

func (c *ApprovalContext) MarshalJSON() ([]byte, error)

MarshalJSON - marshal to json (inspect)

func (*ApprovalContext) Provider

func (c *ApprovalContext) Provider() string

func (*ApprovalContext) Rejected

func (c *ApprovalContext) Rejected() string

func (*ApprovalContext) Votes

func (c *ApprovalContext) Votes() string

type Context

type Context struct {
	// Output is the output stream to which the formatted string is written.
	Output io.Writer
	// Format is used to choose raw, table or custom format for the output.
	Format Format
	// Trunc when set to true will truncate the output of certain fields such as Container ID.
	Trunc bool
	// contains filtered or unexported fields
}

Context contains information required by the formatter to print the output as desired.

func (*Context) Write

func (c *Context) Write(sub subContext, f SubFormat) error

Write the template to the buffer using this Context

type Deployment

type Deployment struct {
	Namespace         string `json:"namespace,omitempty"`
	Name              string `json:"name,omitempty"`
	CreatedAt         time.Time
	Replicas          int32
	AvailableReplicas int32
	Images            []string `json:"images,omitempty"` // image:tag list
}

Deployment - internal deployment, used to better represent bow related info

type DeploymentContext

type DeploymentContext struct {
	HeaderContext
	// contains filtered or unexported fields
}

DeploymentContext - deployment context is a container for each line

func (*DeploymentContext) Images

func (c *DeploymentContext) Images() string

Images - print used images

func (*DeploymentContext) MarshalJSON

func (c *DeploymentContext) MarshalJSON() ([]byte, error)

MarshalJSON - marshal to json (inspect)

func (*DeploymentContext) Name

func (c *DeploymentContext) Name() string

Name - print name

func (*DeploymentContext) Namespace

func (c *DeploymentContext) Namespace() string

Namespace - print namespace

func (*DeploymentContext) Ready

func (c *DeploymentContext) Ready() string

Ready - print readiness

type Format

type Format string

Format is the format string rendered using the Context

func NewApprovalsFormat

func NewApprovalsFormat(source string, quiet bool) Format

NewApprovalsFormat returns a format for use with a approval Context

func NewDeploymentsFormat

func NewDeploymentsFormat(source string, quiet bool) Format

NewDeploymentsFormat returns a format for use with a deployment Context

func (Format) Contains

func (f Format) Contains(sub string) bool

Contains returns true if the format contains the substring

func (Format) IsTable

func (f Format) IsTable() bool

IsTable returns true if the format is a table-type format

type HeaderContext

type HeaderContext struct {
	// contains filtered or unexported fields
}

HeaderContext provides the subContext interface for managing headers

func (*HeaderContext) AddHeader

func (c *HeaderContext) AddHeader(header string)

AddHeader adds another column to the header

func (*HeaderContext) FullHeader

func (c *HeaderContext) FullHeader() string

FullHeader returns the header as a string

type SubFormat

type SubFormat func(func(subContext) error) error

SubFormat is a function type accepted by Write()

Jump to

Keyboard shortcuts

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