flagutil

package
v0.0.0-...-5d524a5 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ValidOutputFormats stores a default set of possible valid output formats
	ValidOutputFormats = []string{"json", "yml", "yaml", "toml"}

	// CredentialsOutputFormats stores a default set of possible valid credential output formats
	CredentialsOutputFormats = []string{"env", "json", "properties"}
)

Functions

func CastValueError

func CastValueError(v interface{}, t string) error

CastValueError returns an error when a value cannot be casted to the given type

func EnableStaticFlagCompletion

func EnableStaticFlagCompletion(cmd *cobra.Command, flagName string, validValues []string)

EnableStaticFlagCompletion enables autocompletion for flags with predefined valid values

func InvalidValueError

func InvalidValueError(flag string, val interface{}, validOptions ...string) error

InvalidValueError returns an error when an invalid flag value is provided

func IsValidInput

func IsValidInput(input string, validValues ...string) bool

IsValidInput checks if the input value is in the range of valid values

func RequiredValueError

func RequiredValueError(arg string) error

RequiredValueError returns an error when a required value is not provided

func ValidateName

func ValidateName(val interface{}, validRegexpString string, minLength, maxLength int) error

ValidateName validates the proposed name of an instance

Types

This section is empty.

Jump to

Keyboard shortcuts

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