command

package
v0.3.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeExamples

func NormalizeExamples(examples string) string

NormalizeExamples removes leading and trailing empty lines from the command's Example string and normalizes the indentation so that all examples across all commands are indented consistently.

func PreRunE

func PreRunE(cmd Command) func(*cobra.Command, []string) error

PreRunE validates os args, and then saves them on the svcat command.

func RunE

func RunE(cmd Command) func(*cobra.Command, []string) error

RunE executes a validated svcat command.

Types

type ClassFiltered

type ClassFiltered struct {
	ClassFilter string
}

ClassFiltered adds support to a command for the --class flag.

func NewClassFiltered

func NewClassFiltered() *ClassFiltered

NewClassFiltered initializes a new class specified command.

func (*ClassFiltered) AddClassFlag

func (c *ClassFiltered) AddClassFlag(cmd *cobra.Command)

AddClassFlag adds the class related flag.

--class

func (*ClassFiltered) ApplyClassFlag

func (c *ClassFiltered) ApplyClassFlag(cmd *cobra.Command) error

ApplyClassFlag persists the class related flag.

--class

type Command

type Command interface {
	// Validate and load the arguments passed to the svcat command.
	Validate(args []string) error

	// Run a validated svcat command.
	Run() error
}

Command represents an svcat command.

type Context

type Context struct {
	// Output should be used instead of directly writing to stdout/stderr, to enable unit testing.
	Output io.Writer

	// svcat application, the library behind the cli
	App *svcat.App

	// Viper configuration
	Viper *viper.Viper
}

Context is ambient data necessary to run any svcat command.

type Formatted

type Formatted struct {
	OutputFormat string
}

Formatted is the base command of all svcat commands that support customizable output formats.

func NewFormatted

func NewFormatted() *Formatted

NewFormatted command.

func (*Formatted) AddOutputFlags

func (c *Formatted) AddOutputFlags(flags *pflag.FlagSet)

AddOutputFlags adds common output flags to a command that can have variable output formats.

func (*Formatted) ApplyFormatFlags

func (c *Formatted) ApplyFormatFlags(flags *pflag.FlagSet) error

ApplyFormatFlags persists the format-related flags: * --output

type HasClassFlag

type HasClassFlag interface {
	// ApplyClassFlag validates and persists the class related flag.
	//   --class
	ApplyClassFlag(*cobra.Command) error
}

HasClassFlag represents a command that supports --class.

type HasFormatFlags

type HasFormatFlags interface {
	// ApplyFormatFlags persists the format-related flags:
	// * --output
	ApplyFormatFlags(lags *pflag.FlagSet) error
}

HasFormatFlags represents a command that can have its output formatted.

type HasNamespaceFlags

type HasNamespaceFlags interface {
	Command

	// ApplyNamespaceFlags persists the namespace-related flags:
	// * --namespace
	// * --all-namespaces
	ApplyNamespaceFlags(flags *pflag.FlagSet)
}

HasNamespaceFlags represents a command that can be scoped to a namespace.

type HasPlanFlag

type HasPlanFlag interface {
	// ApplyPlanFlag validates and persists the plan related flag.
	//   --plan
	ApplyPlanFlag(*cobra.Command) error
}

HasPlanFlag represents a command that supports --plan.

type HasScopedFlags

type HasScopedFlags interface {
	// ApplyScopedFlags persists the scope related flags:
	// * --cluster
	ApplyScopedFlags(flags *pflag.FlagSet) error
}

HasScopedFlags represents a command that can be scoped to either namespace level or cluster level resources.

type HasWaitFlags

type HasWaitFlags interface {
	// ApplyWaitFlags validates and persists the wait related flags.
	//   --wait
	//   --timeout
	//   --interval
	ApplyWaitFlags() error
}

HasWaitFlags represents a command that supports --wait.

type Namespaced

type Namespaced struct {
	*Context
	Namespace string
}

Namespaced is the base command of all svcat commands that are namespace scoped.

func NewNamespaced

func NewNamespaced(cxt *Context) *Namespaced

NewNamespaced from context.

func (*Namespaced) AddNamespaceFlags

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

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

func (*Namespaced) ApplyNamespaceFlags

func (c *Namespaced) ApplyNamespaceFlags(flags *pflag.FlagSet)

ApplyNamespaceFlags persists the namespace-related flags: * --namespace * --all-namespaces

type PlanFiltered

type PlanFiltered struct {
	PlanFilter string
}

PlanFiltered adds support to a command for the --plan flag.

func NewPlanFiltered

func NewPlanFiltered() *PlanFiltered

NewPlanFiltered initializes a new plan specified command.

func (*PlanFiltered) AddPlanFlag

func (c *PlanFiltered) AddPlanFlag(cmd *cobra.Command)

AddPlanFlag adds the plan related flag.

--plan

func (*PlanFiltered) ApplyPlanFlag

func (c *PlanFiltered) ApplyPlanFlag(cmd *cobra.Command) error

ApplyPlanFlag persists the plan related flag.

--plan

type Scoped

type Scoped struct {
	Scope servicecatalog.Scope
	// contains filtered or unexported fields
}

Scoped is the base command of all svcat commands that can be scoped to either namespace level or cluster level resources.

func NewScoped

func NewScoped() *Scoped

NewScoped creates a new Scoped command.

func (*Scoped) AddScopedFlags

func (c *Scoped) AddScopedFlags(flags *pflag.FlagSet, allowAll bool)

AddScopedFlags adds the scope-related flags. * --scope

func (*Scoped) ApplyScopedFlags

func (c *Scoped) ApplyScopedFlags(flags *pflag.FlagSet) error

ApplyScopedFlags persists the scope-related flags: * --scope

type Waitable

type Waitable struct {
	Wait bool

	Timeout *time.Duration

	Interval time.Duration
	// contains filtered or unexported fields
}

Waitable adds support to a command for the --wait flags.

func NewWaitable

func NewWaitable() *Waitable

NewWaitable initializes a new waitable command.

func (*Waitable) AddWaitFlags

func (c *Waitable) AddWaitFlags(cmd *cobra.Command)

AddWaitFlags adds the wait related flags.

--wait
--timeout
--interval

func (*Waitable) ApplyWaitFlags

func (c *Waitable) ApplyWaitFlags() error

ApplyWaitFlags validates and persists the wait related flags.

--wait
--timeout
--interval

Jump to

Keyboard shortcuts

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