Documentation ¶
Overview ¶
Package flagutil is a helper package for processing and interactive command line flags
Index ¶
- Variables
- func EnableOutputFlagCompletion(cmd *cobra.Command)
- func EnableStaticFlagCompletion(cmd *cobra.Command, flagName string, validValues []string)
- func FlagDescription(localizer localize.Localizer, messageID string, validOptions ...string) string
- func IsValidInput(input string, validValues ...string) bool
- func RegisterServiceAccountCompletionFunc(cmd *cobra.Command, flagName string, connFunc factory.ConnectionFunc) error
- func RegisterUserCompletionFunc(cmd *cobra.Command, flagName string, connFunc factory.ConnectionFunc) error
- type FlagOptions
- type FlagSet
Constants ¶
This section is empty.
Variables ¶
var ( ValidOutputFormats = []string{dump.JSONFormat, dump.YAMLFormat, dump.YMLFormat} CredentialsOutputFormats = []string{credentials.EnvFormat, credentials.JSONFormat, credentials.PropertiesFormat} )
Functions ¶
func EnableOutputFlagCompletion ¶
EnableOutputFlagCompletion enables autocompletion for output flag
func EnableStaticFlagCompletion ¶
EnableStaticFlagCompletion enables autocompletion for flags with predefined valid values
func FlagDescription ¶
FlagDescription creates a flag description and adds a list of valid options (if any)
func IsValidInput ¶
IsValidInput checks if the input value is in the range of valid values
func RegisterServiceAccountCompletionFunc ¶
func RegisterServiceAccountCompletionFunc(cmd *cobra.Command, flagName string, connFunc factory.ConnectionFunc) error
RegisterNameFlagCompletionFunc adds the user list to flag dynamic completion
func RegisterUserCompletionFunc ¶
func RegisterUserCompletionFunc(cmd *cobra.Command, flagName string, connFunc factory.ConnectionFunc) error
RegisterUserCompletionFunc adds the user list to flag dynamic completion
Types ¶
type FlagOptions ¶
type FlagOptions struct {
Required func() error
}
FlagOptions defines additional flag options
func WithFlagOptions ¶
func WithFlagOptions(cmd *cobra.Command, flagName string) *FlagOptions
WithFlagOptions returns additional functions to custom the default flag settings