cmd

package
v1.4.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetApplicationsForCompletion

func GetApplicationsForCompletion(ctx context.Context, f Factory, namespace string, toComplete string) ([]string, cobra.ShellCompDirective)

GetApplicationsForCompletion auto-complete application

func GetNamespace

func GetNamespace(f Factory, cmd *cobra.Command) string

GetNamespace get namespace from command flags and env

func GetNamespacesForCompletion

func GetNamespacesForCompletion(ctx context.Context, f Factory, toComplete string) ([]string, cobra.ShellCompDirective)

GetNamespacesForCompletion auto-complete the namespace

func GetRevisionForCompletion

func GetRevisionForCompletion(ctx context.Context, f Factory, appName string, namespace string, toComplete string) ([]string, cobra.ShellCompDirective)

GetRevisionForCompletion auto-complete the revision according to the application

Types

type Builder

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

Builder build command with factory

func NewCommandBuilder

func NewCommandBuilder(f Factory, cmd *cobra.Command) *Builder

NewCommandBuilder builder for command

func (*Builder) Build

func (builder *Builder) Build() *cobra.Command

Build construct the command

func (*Builder) WithEnvFlag

func (builder *Builder) WithEnvFlag() *Builder

WithEnvFlag add env flag to the command

func (*Builder) WithNamespaceFlag

func (builder *Builder) WithNamespaceFlag(options ...NamespaceFlagOption) *Builder

WithNamespaceFlag add namespace flag to the command, by default, it will also add env flag to the command

func (*Builder) WithResponsiveWriter

func (builder *Builder) WithResponsiveWriter() *Builder

WithResponsiveWriter format the command outputs

type ClientGetter

type ClientGetter func() (client.Client, error)

ClientGetter function for getting client

type Factory

type Factory interface {
	Client() client.Client
}

Factory client factory for running command

func NewDefaultFactory

func NewDefaultFactory(clientGetter ClientGetter) Factory

NewDefaultFactory create a factory based on client getter function

type NamespaceFlagConfig

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

NamespaceFlagConfig config for namespace flag in cmd

type NamespaceFlagDisableEnvOption

type NamespaceFlagDisableEnvOption struct{}

NamespaceFlagDisableEnvOption disable loading namespace from env

func (NamespaceFlagDisableEnvOption) ApplyToNamespaceFlagOptions

func (option NamespaceFlagDisableEnvOption) ApplyToNamespaceFlagOptions(cfg *NamespaceFlagConfig)

ApplyToNamespaceFlagOptions .

type NamespaceFlagNoCompletionOption

type NamespaceFlagNoCompletionOption struct{}

NamespaceFlagNoCompletionOption disable auto-completion for namespace flag

func (NamespaceFlagNoCompletionOption) ApplyToNamespaceFlagOptions

func (option NamespaceFlagNoCompletionOption) ApplyToNamespaceFlagOptions(cfg *NamespaceFlagConfig)

ApplyToNamespaceFlagOptions .

type NamespaceFlagOption

type NamespaceFlagOption interface {
	ApplyToNamespaceFlagOptions(*NamespaceFlagConfig)
}

NamespaceFlagOption the option for configuring namespace flag in cmd

type NamespaceFlagUsageOption

type NamespaceFlagUsageOption string

NamespaceFlagUsageOption the usage description for namespace flag

func (NamespaceFlagUsageOption) ApplyToNamespaceFlagOptions

func (option NamespaceFlagUsageOption) ApplyToNamespaceFlagOptions(cfg *NamespaceFlagConfig)

ApplyToNamespaceFlagOptions .

Jump to

Keyboard shortcuts

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