...

Package commonflags

Overview ▾

Constants

const (
    // PlatformFlagName is the name of the flag allowing user to specify target platform
    PlatformFlagName = "platform"
    PlatformCluster  = "cluster"
    PlatformPodman   = "podman"
    PlatformDefault  = PlatformCluster
)
const (
    VarFileFlagName = "var-file"
    VarFlagName     = "var"
)
const (
    // OutputFlagName is the name of the flag allowing user to specify output format
    OutputFlagName = "o"
)

func AddOutputFlag

func AddOutputFlag()

AddOutputFlag adds the machine readable output flag to all commands We use "flag" in order to make this accessible throughtout ALL of odo, rather than the above traditional "persistentflags" usage that does not make it a pointer within the 'pflag' package

func AddPlatformFlag

func AddPlatformFlag(ctx context.Context)

AddPlatformFlag adds the --platform output flag to all commands We use "flag" in order to make this accessible throughtout ALL of odo, rather than the above traditional "persistentflags" usage that does not make it a pointer within the 'pflag' package

func AddVariablesFlags

func AddVariablesFlags()

AddVariablesFlags adds the --var-file and --var flags to all commands We use "flag" in order to make this accessible throughtout ALL of odo, rather than the above traditional "persistentflags" usage that does not make it a pointer within the 'pflag' package

func CheckMachineReadableOutputCommand

func CheckMachineReadableOutputCommand(envconfig *config.Configuration, cmd *cobra.Command) error

CheckMachineReadableOutputCommand performs machine-readable output functions required to have it work correctly

func CheckPlatformCommand

func CheckPlatformCommand(cmd *cobra.Command) error

CheckPlatformCommand checks if commands enabling platform flag are used correctly

func CheckVariablesCommand

func CheckVariablesCommand(cmd *cobra.Command) error

CheckVariablesCommand checks if commands enabling --var-file and --var flags are used correctly

func GetJsonOutputValue

func GetJsonOutputValue(cmd cmdline.Cmdline) bool

GetJsonOutputValue returns true if -o flag is used and value is "json"

func GetPlatformValue

func GetPlatformValue(cmd cmdline.Cmdline) string

GetPlatformValue returns value of --platform flag or default value

func GetVariablesValues

func GetVariablesValues(cmd cmdline.Cmdline) (map[string]string, error)

GetVariablesValues returns variables computed from --var-file and --var values

func UseOutputFlag

func UseOutputFlag(cmd *cobra.Command)

UseOutputFlag indicates that a command accepts the -o flag

func UsePlatformFlag

func UsePlatformFlag(cmd *cobra.Command)

UsePlatformFlag indicates that a command accepts the --platform flag

func UseVariablesFlags

func UseVariablesFlags(cmd *cobra.Command)

UseVariablesFlags indicates that a command accepts the --var-file and --var flags

Subdirectories

Name Synopsis
..
context