genericclioptions

package
v0.0.15 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2018 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Client

func Client(command *cobra.Command) *occlient.Client

Client returns an oc client configured for this command's options

func ClientWithConnectionCheck

func ClientWithConnectionCheck(command *cobra.Command, skipConnectionCheck bool) *occlient.Client

ClientWithConnectionCheck returns an oc client configured for this command's options but forcing the connection check status to the value of the provided bool, skipping it if true, checking the connection otherwise

func FlagValueIfSet

func FlagValueIfSet(cmd *cobra.Command, flagName string) string

FlagValueIfSet retrieves the value of the specified flag if it is set for the given command

Types

type Context

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

Context holds contextual information useful to commands such as correctly configured client, target project and application (based on specified flag values) and provides for a way to retrieve a given component given this context

func NewContext

func NewContext(command *cobra.Command) *Context

NewContext creates a new Context struct populated with the current state based on flags specified for the provided command

func NewContextCreatingAppIfNeeded

func NewContextCreatingAppIfNeeded(command *cobra.Command) *Context

NewContextCreatingAppIfNeeded creates a new Context struct populated with the current state based on flags specified for the provided command, creating the application if none already exists

func NewFakeContext

func NewFakeContext(project, application, component string, client *occlient.Client) *Context

func (*Context) Component

func (o *Context) Component(optionalComponent ...string) string

Component retrieves the optionally specified component or the current one if it is set. If no component is set, exit with an error

func (*Context) ComponentAllowingEmpty

func (o *Context) ComponentAllowingEmpty(allowEmpty bool, optionalComponent ...string) string

ComponentAllowingEmpty retrieves the optionally specified component or the current one if it is set, allowing empty components (instead of exiting with an error) if so specified

Jump to

Keyboard shortcuts

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