Documentation ¶
Overview ¶
Package utils provides a number of function for input validation and io
Index ¶
- func HasOneArgument(args []string) (string, error)
- func ReadPassword() (string, error)
- func ValidEncryptionContext(raw []string) (map[string]*string, error)
- func ValidFormatter(format string) (formatter.Formatter, error)
- func ValidName(name string) error
- func ValidNewSecretsPath(path string) error
- func ValidSecretsPath(path string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HasOneArgument ¶
HasOneArgument checks that the provided string slice has one (and only one) value that is not empty, and returns it.
func ReadPassword ¶
ReadPassword reads the contents of the given file, and returns the contents with trimmed spaces
If file is a terminal (such as when running with os.Stdin), it prints instructions to the user on how to close the input by sending an EOF.
func ValidEncryptionContext ¶
ValidEncryptionContext parses the CLI form of key-value pairs used for encryption contexts. The format must be key1=value1. Keys and values are not checked for a specific format
func ValidFormatter ¶
ValidFormatter parses the formatter string argument into a formatter method. Supported values are "bash", "dotenv", "json" and "yaml".
func ValidName ¶
ValidName checks if the provided string is valid as a secret name.
It must be only lowercase letters, digits or underscores. It cannot start with a letter.
func ValidNewSecretsPath ¶
ValidNewSecretsPath checks for a valid path that does not exist.
func ValidSecretsPath ¶
ValidSecretsPath checks for an existing path that is not a directory.
Types ¶
This section is empty.