commands

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2019 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const FakeNamespace = "current"

Variables

View Source
var BuildDate string
View Source
var CfgFile string

CfgFile is Kn's config file is the path for the Kubernetes config

View Source
var GitRevision string
View Source
var ServingVersion string
View Source
var Version string

Functions

func AddNamespaceFlags

func AddNamespaceFlags(flags *pflag.FlagSet, allowAll bool)

AddNamespaceFlags adds the namespace-related flags: * --namespace * --all-namespaces

func CaptureStdout added in v0.2.0

func CaptureStdout(t *testing.T)

CaptureStdout collects the current content of os.Stdout

func ConditionsValue added in v0.2.0

func ConditionsValue(conditions duckv1beta1.Conditions) string

conditionsValue returns the True conditions count among total conditions

func CreateTestKnCommand added in v0.2.0

func CreateTestKnCommand(cmd *cobra.Command, knParams *KnParams) (*cobra.Command, *fake.FakeServingV1alpha1, *bytes.Buffer)

CreateTestKnCommand helper for creating test commands

func NewCompletionCommand

func NewCompletionCommand(p *KnParams) *cobra.Command

func NewVersionCommand

func NewVersionCommand(p *KnParams) *cobra.Command

func NonReadyConditionReason added in v0.2.0

func NonReadyConditionReason(conditions duckv1beta1.Conditions) string

func ReadStdout added in v0.2.0

func ReadStdout(t *testing.T) string

ReadStdout returns the collected os.Stdout content

func ReadyCondition added in v0.2.0

func ReadyCondition(conditions duckv1beta1.Conditions) string

readyCondition returns status of resource's Ready type condition

func ReleaseStdout added in v0.2.0

func ReleaseStdout(t *testing.T)

ReleaseStdout releases the os.Stdout and restores to original

func TranslateTimestampSince added in v0.2.0

func TranslateTimestampSince(timestamp metav1.Time) string

translateTimestampSince returns the elapsed time since timestamp in human-readable approximation.

Types

type CompletionFlags added in v0.2.0

type CompletionFlags struct {
	Zsh bool
}

type HumanPrintFlags

type HumanPrintFlags struct {
}

HumanPrintFlags provides default flags necessary for printing. Given the following flag values, a printer can be requested that knows how to handle printing based on these values.

func NewHumanPrintFlags

func NewHumanPrintFlags() *HumanPrintFlags

NewHumanPrintFlags returns flags associated with human-readable printing, with default values set.

func (*HumanPrintFlags) AddFlags

func (f *HumanPrintFlags) AddFlags(c *cobra.Command)

AddFlags receives a *cobra.Command reference and binds flags related to human-readable printing to it

func (*HumanPrintFlags) AllowedFormats

func (f *HumanPrintFlags) AllowedFormats() []string

AllowedFormats returns more customized formating options

func (*HumanPrintFlags) ToPrinter

func (f *HumanPrintFlags) ToPrinter(getHandlerFunc func(h hprinters.PrintHandler)) (hprinters.ResourcePrinter, error)

ToPrinter receives returns a printer capable of handling human-readable output.

type KnParams

type KnParams struct {
	Output       io.Writer
	KubeCfgPath  string
	ClientConfig clientcmd.ClientConfig
	NewClient    func(namespace string) (serving_kn_v1alpha1.KnClient, error)
	// contains filtered or unexported fields
}

Parameters for creating commands. Useful for inserting mocks for testing.

func (*KnParams) CurrentNamespace added in v0.2.0

func (params *KnParams) CurrentNamespace() (string, error)

func (*KnParams) GetClientConfig added in v0.2.0

func (params *KnParams) GetClientConfig() clientcmd.ClientConfig

func (*KnParams) GetConfig added in v0.2.0

func (*KnParams) GetNamespace added in v0.2.0

func (params *KnParams) GetNamespace(cmd *cobra.Command) (string, error)

GetNamespace returns namespace from command specified by flag

func (*KnParams) Initialize

func (params *KnParams) Initialize()

type WaitFlags added in v0.2.0

type WaitFlags struct {
	// Timeout in seconds for how long to wait for a command to return
	TimeoutInSeconds int

	// If set then just apply resources and don't wait
	Async bool
}

Flags for tuning wait behaviour

func (*WaitFlags) AddConditionWaitFlags added in v0.2.0

func (p *WaitFlags) AddConditionWaitFlags(command *cobra.Command, waitTimeoutDefault int, what string)

Add flags which influence the sync/async behaviour when creating or updating resources. Set `waitDefault` argument if the default behaviour is synchronous. Use `what` for describing what is waited for.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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