common

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CommandName is the expected entrypoint of the root command.
	CommandName = "furiko"
)
View Source
const (
	DefaultErrorExitCode = 1
)

Variables

This section is empty.

Functions

func Fatal

func Fatal(err error, code int)

Fatal terminates the command immediately and writes to stderr.

func GetClientConfig

func GetClientConfig(cmd *cobra.Command) (clientcmd.ClientConfig, error)

GetClientConfig loads the ClientConfig after parsing relevant flags.

func GetCronDynamicConfig

func GetCronDynamicConfig(cmd *cobra.Command) *configv1alpha1.CronExecutionConfig

GetCronDynamicConfig returns the cron dynamic config.

func GetCtrlContext

func GetCtrlContext() controllercontext.Context

GetCtrlContext retrieves the common context.

func GetDynamicConfig

func GetDynamicConfig(ctx context.Context, cmd *cobra.Command, name configv1alpha1.ConfigName, out interface{}) error

GetDynamicConfig loads the dynamic config by name and unmarshals to out. TODO(irvinlim): If the current user does not have permissions to read the ConfigMap, or the ConfigMap uses a different name/namespace, we should gracefully handle this case.

func GetFlagBool

func GetFlagBool(cmd *cobra.Command, flag string) bool

GetFlagBool gets the boolean value of a flag.

func GetFlagBoolIfExists

func GetFlagBoolIfExists(cmd *cobra.Command, flag string) (val bool, ok bool)

GetFlagBoolIfExists gets the boolean value of a flag if it exists.

func GetFlagInt64

func GetFlagInt64(cmd *cobra.Command, flag string) int64

GetFlagInt64 gets the int64 value of a flag.

func GetFlagString

func GetFlagString(cmd *cobra.Command, flag string) string

GetFlagString gets the string value of a flag.

func GetKubeConfig

func GetKubeConfig(cmd *cobra.Command) (*rest.Config, error)

GetKubeConfig returns the desired kubeconfig.

func GetNamespace

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

GetNamespace returns the namespace to use depending on what was defined in the flags.

func GetOutputFormat

func GetOutputFormat(cmd *cobra.Command) printer.OutputFormat

GetOutputFormat returns the output format as parsed by the flag.

func NewContext

func NewContext(cmd *cobra.Command) (controllercontext.Context, error)

NewContext returns a common context from the cobra command.

func PrepareExample

func PrepareExample(example string) string

PrepareExample replaces the root command name and indents all lines.

func PrerunWithKubeconfig

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

PrerunWithKubeconfig is a pre-run function that will set up the common context when kubeconfig is needed.

func SetCtrlContext

func SetCtrlContext(cc controllercontext.Context)

SetCtrlContext explicitly sets the common context.

func SetupCtrlContext

func SetupCtrlContext(cmd *cobra.Command) error

SetupCtrlContext sets up the common context. TODO(irvinlim): We currently reuse controllercontext, but most of it is unusable for CLI interfaces. We should create a new common context as needed.

Types

type RunEFunc

type RunEFunc func(cmd *cobra.Command, args []string) error

func RunAllE

func RunAllE(funcs ...RunEFunc) RunEFunc

RunAllE composes multiple RunEFunc together.

Jump to

Keyboard shortcuts

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