utils

package
v0.0.0-...-bed3165 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package utils provides a number of function for input validation and io

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasOneArgument

func HasOneArgument(args []string) (string, error)

HasOneArgument checks that the provided string slice has one (and only one) value that is not empty, and returns it.

func ReadPassword

func ReadPassword() (string, error)

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

func ValidEncryptionContext(raw []string) (map[string]*string, error)

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

func ValidFormatter(format string) (formatter.Formatter, error)

ValidFormatter parses the formatter string argument into a formatter method. Supported values are "bash", "dotenv", "json" and "yaml".

func ValidName

func ValidName(name string) error

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

func ValidNewSecretsPath(path string) error

ValidNewSecretsPath checks for a valid path that does not exist.

func ValidSecretsPath

func ValidSecretsPath(path string) error

ValidSecretsPath checks for an existing path that is not a directory.

Types

This section is empty.

Jump to

Keyboard shortcuts

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