Documentation ¶
Overview ¶
package commands contains Cobra commands that implement the CLI behavior. The commands are responsible for arguments and flags manipulation/validation, printing of success and error, etc. Commands delegate to a high level client for actual interaction with the kubernetes environment.
Index ¶
- func ArgValidationConjunction(validators ...cobra.PositionalArgs) cobra.PositionalArgs
- func AtPosition(i int, validator PositionalArg) cobra.PositionalArgs
- func Channel() *cobra.Command
- func ChannelCreate(fcTool *core.Client) *cobra.Command
- func ChannelDelete(riffClient *core.Client) *cobra.Command
- func ChannelList(fcTool *core.Client) *cobra.Command
- func Completion(rootCmd *cobra.Command) *cobra.Command
- func CreateAndWireRootCommand(manifests map[string]*core.Manifest) *cobra.Command
- func Display(out io.Writer, items []interface{}, extractors []NamedExtractor)
- func Docs(rootCmd *cobra.Command, fs Filesystem) *cobra.Command
- func FindSubcommand(command *cobra.Command, names ...string) *cobra.Command
- func Function() *cobra.Command
- func FunctionBuild(buildpackBuilder core.Builder, fcTool *core.Client) *cobra.Command
- func FunctionCreate(buildpackBuilder core.Builder, fcTool *core.Client) *cobra.Command
- func FunctionUpdate(buildpackBuilder core.Builder, fcTool *core.Client) *cobra.Command
- func GenerateDocs(rootCommand *cobra.Command, directory string, fs Filesystem) error
- func LabelArgs(cmd *cobra.Command, labels ...string)
- func Namespace() *cobra.Command
- func NamespaceCleanup(c *core.Client) *cobra.Command
- func NamespaceInit(manifests map[string]*core.Manifest, c *core.Client) *cobra.Command
- func OptionalAtPosition(i int, validator PositionalArg) cobra.PositionalArgs
- func PrintCurlHttpErrors(curlErrOutput string, w io.Writer)
- func PrintInterruptedCompletion(cmd *cobra.Command)
- func PrintSuccessfulCompletion(cmd *cobra.Command)
- func Service() *cobra.Command
- func ServiceCreate(fcTool *core.Client) *cobra.Command
- func ServiceDelete(riffClient *core.Client) *cobra.Command
- func ServiceInvoke(fcClient *core.Client) *cobra.Command
- func ServiceList(fcClient *core.Client) *cobra.Command
- func ServiceStatus(fcClient *core.Client) *cobra.Command
- func ServiceUpdate(client *core.Client) *cobra.Command
- func StartingAtPosition(position int, validator PositionalArg) cobra.PositionalArgs
- func Subscription() *Command
- func SubscriptionCreate(client *core.Client) *Command
- func SubscriptionDelete(riffClient *core.Client) *Command
- func SubscriptionList(client *core.Client) *Command
- func System() *cobra.Command
- func SystemInstall(manifests map[string]*core.Manifest, c *core.Client) *cobra.Command
- func SystemUninstall(c *core.Client) *cobra.Command
- func UpToDashDash(delegate cobra.PositionalArgs) cobra.PositionalArgs
- func Version() *cobra.Command
- func Visit(cmd *cobra.Command, f func(c *cobra.Command) error) error
- type CobraEFunction
- type DeleteChannelsCliOptions
- type DeleteServicesCliOptions
- type DeleteSubscriptionsCliOptions
- type Filesystem
- type FlagsMatcher
- type FlagsValidator
- func AtLeastOneOf(flagNames ...string) FlagsValidator
- func AtMostOneOf(flagNames ...string) FlagsValidator
- func ExactlyOneOf(flagNames ...string) FlagsValidator
- func FlagsDependency(matcher FlagsMatcher, delegates ...FlagsValidator) FlagsValidator
- func FlagsValidationConjunction(validators ...FlagsValidator) FlagsValidator
- func NotBlank(flagName string) FlagsValidator
- func ValueDoesNotStartWith(flagName string, prefixes ...string) FlagsValidator
- func ValueOneOf(flagName string, values ...string) FlagsValidator
- type LocalFs
- type Marshaller
- type NamedExtractor
- type PositionalArg
- type StringExtractor
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ArgValidationConjunction ¶
func ArgValidationConjunction(validators ...cobra.PositionalArgs) cobra.PositionalArgs
ArgValidationConjunction returns a PositionalArgs validator that checks all provided validators in turn (all must pass).
func AtPosition ¶
func AtPosition(i int, validator PositionalArg) cobra.PositionalArgs
AtPosition returns a PositionalArgs that applies the single valued validator to the i-th argument. The actual number of arguments is not checked by this function (use cobra's MinimumNArgs, ExactArgs, etc)
func Display ¶
func Display(out io.Writer, items []interface{}, extractors []NamedExtractor)
func FunctionBuild ¶
func FunctionCreate ¶
func FunctionUpdate ¶
func GenerateDocs ¶
func GenerateDocs(rootCommand *cobra.Command, directory string, fs Filesystem) error
func NamespaceInit ¶
func OptionalAtPosition ¶
func OptionalAtPosition(i int, validator PositionalArg) cobra.PositionalArgs
func PrintCurlHttpErrors ¶
Print any HTTP errors in the given string to the given writer
func StartingAtPosition ¶
func StartingAtPosition(position int, validator PositionalArg) cobra.PositionalArgs
StartingAtPosition returns a PositionalArgs that applies the single valued validator start at the i-th argument till the last one.
func Subscription ¶
func Subscription() *Command
func SubscriptionCreate ¶
func SubscriptionDelete ¶
func SubscriptionList ¶
func SystemInstall ¶
func UpToDashDash ¶
func UpToDashDash(delegate cobra.PositionalArgs) cobra.PositionalArgs
UpToDashDash returns a validator that will invoke the `delegate` validator, but only with args before the splitting `--`, if any
Types ¶
type CobraEFunction ¶
CobraEFunction is the type of functions cobra expects for Run, PreRun, etc that can return an error.
func FlagsValidatorAsCobraRunE ¶
func FlagsValidatorAsCobraRunE(validator FlagsValidator) CobraEFunction
FlagsValidatorAsCobraRunE allows a FlagsValidator to be used as a CobraEFunction (typically PreRunE())
type DeleteChannelsCliOptions ¶
type DeleteChannelsCliOptions struct {
Namespace string
}
type DeleteServicesCliOptions ¶
type DeleteServicesCliOptions struct {
Namespace string
}
type DeleteSubscriptionsCliOptions ¶
type DeleteSubscriptionsCliOptions struct {
Namespace string
}
type FlagsMatcher ¶
func Set ¶
func Set(name string) FlagsMatcher
type FlagsValidator ¶
func AtLeastOneOf ¶
func AtLeastOneOf(flagNames ...string) FlagsValidator
AtLeastOneOf returns a FlagsValidator that asserts that at least one of the passed in flags is set.
func AtMostOneOf ¶
func AtMostOneOf(flagNames ...string) FlagsValidator
AtMostOneOf returns a FlagsValidator that asserts that at most one of the passed in flags is set.
func ExactlyOneOf ¶
func ExactlyOneOf(flagNames ...string) FlagsValidator
ExactlyOneOf returns a FlagsValidator that asserts that one and only one of the passed in flags is set.
func FlagsDependency ¶
func FlagsDependency(matcher FlagsMatcher, delegates ...FlagsValidator) FlagsValidator
FlagsDependency returns a validator that will evaluate the given delegates if the provided flag matcher returns true. Use to enforce scenarios such as "if --foo is set, then --bar must be set as well".
func FlagsValidationConjunction ¶
func FlagsValidationConjunction(validators ...FlagsValidator) FlagsValidator
FlagsValidationConjunction returns a FlagsValidator validator that checks all provided validators in turn (all must pass).
func NotBlank ¶
func NotBlank(flagName string) FlagsValidator
NotBlank returns a FlagsValidator that asserts that the given flag is not made entirely of space characters.
func ValueDoesNotStartWith ¶
func ValueDoesNotStartWith(flagName string, prefixes ...string) FlagsValidator
ValueDoesNotStartWith returns a FlagsValidator that asserts that the given flag value does not start with any of the subsequently given prefixes.
func ValueOneOf ¶
func ValueOneOf(flagName string, values ...string) FlagsValidator
ValueOneOf returns a FlagsValidator that asserts that the given flag value matches one of the subsequently given values.
type Marshaller ¶
type Marshaller interface {
Marshal(o interface{}) error
}
func NewMarshaller ¶
func NewMarshaller(w io.Writer) Marshaller
type NamedExtractor ¶
type NamedExtractor struct {
// contains filtered or unexported fields
}
type PositionalArg ¶
PositionalArg is a function for validating a single argument
func KubernetesValidation ¶
func KubernetesValidation(k8s func(string) []string) PositionalArg
KubernetesValidation turns a kubernetes-style validation function into a PositionalArg
func ValidName ¶
func ValidName() PositionalArg
type StringExtractor ¶
type StringExtractor func(interface{}) string