Documentation
¶
Index ¶
- Variables
- func BackendConfig(ctx context.Context, name string)
- func BackendListUnmarshal(out interface{}) error
- func ChangePassword(name string) string
- func Choose(what string, defaults, help []string, newOk bool) string
- func ChooseBackend() string
- func ChooseNumber(what string, min, max int) int
- func ChooseOption(o place.Option, name string) string
- func Command(commands []string) byte
- func CommandDefault(commands []string, defaultIndex int) byte
- func Confirm(isDefault bool) bool
- func CreateBackend(ctx context.Context, name string, provider string, keyValues rc.Params, ...) error
- func EditBackend(ctx context.Context, ri *place.RegInfo, name string)
- func EditConfig(ctx context.Context)
- func FileGet(section, key string, defaultVal ...string) string
- func FileGetFlag(section, key string) (string, bool)
- func FileSet(section, key, value string)
- func GetConfigPath() string
- func GetPassword(prompt string) string
- func LoadConfig()
- func MustFindByName(name string) *place.RegInfo
- func NewBackend(ctx context.Context, name string)
- func NewBackendName() (name string)
- func OkBackend(name string) bool
- func ReadPassword() string
- func SetConfigPath(path string) (err error)
- func SetValueAndSave(name, key, value string) (err error)
- func ShowBackend(name string)
- func ShowBackends()
- func UpdateBackend(ctx context.Context, name string, keyValues rc.Params, ...) error
Constants ¶
This section is empty.
Variables ¶
var ( // ConfigPath points to the config file ConfigPath = makeConfigPath() // output of prompt for password PasswordPromptOutput = os.Stderr // Password can be used to configure the random password generator Password = random.Password )
var ReadLine = func() string { buf := bufio.NewReader(os.Stdin) line, err := buf.ReadString('\n') if err != nil { log.Fatalf("Failed to read line: %v", err) } return strings.TrimSpace(line) }
ReadLine reads some input
Functions ¶
func BackendConfig ¶
BackendConfig runs the config helper for the backend if needed
func BackendListUnmarshal ¶ added in v0.1.9
func BackendListUnmarshal(out interface{}) error
func ChangePassword ¶
ChangePassword will query the user twice for the named password. If the same password is entered it is returned.
func ChooseNumber ¶
ChooseNumber asks the user to enter a number between min and max inclusive prompting them with what.
func ChooseOption ¶
ChooseOption asks the user to choose an option
func CommandDefault ¶
CommandDefault - choose one. If return is pressed then it will chose the defaultIndex if it is >= 0
func Confirm ¶
Confirm asks the user for Yes or No and returns true or false
If the user presses enter then the isDefault will be used
func CreateBackend ¶
func CreateBackend(ctx context.Context, name string, provider string, keyValues rc.Params, doObscure, noObscure bool) error
CreateBackend create a new backend
func EditBackend ¶
EditBackend gets the user to edit a backend
func EditConfig ¶
EditConfig edits the config file interactively
func FileGet ¶
FileGet gets the config key under section returning the default or empty string if not set.
It looks up defaults in the environment if they are present
func FileGetFlag ¶
FileGetFlag gets the config key under section returning the the value and true if found and or ("", false) otherwise
func FileSet ¶
func FileSet(section, key, value string)
FileSet sets the key in section to value. It doesn't save the config file.
func GetPassword ¶
GetPassword asks the user for a password with the prompt given.
func MustFindByName ¶
MustFindByName finds the RegInfo for the backend name passed in or exits with a fatal error.
func NewBackend ¶
NewBackend make a new backend from its name
func NewBackendName ¶
func NewBackendName() (name string)
NewBackendName asks the user for a name for a new backend
func ReadPassword ¶
func ReadPassword() string
ReadPassword reads a password without echoing it to the terminal.
func SetConfigPath ¶ added in v0.1.14
SetConfigPath sets new config file path
Checks for empty string, os null device, or special path, all of which indicates in-memory config.
func SetValueAndSave ¶
SetValueAndSave sets the key to the value and saves just that value in the config file. It loads the old config file in from disk first and overwrites the given value only.
Types ¶
This section is empty.
Directories
¶
Path | Synopsis |
---|---|
Package flags contains enhanced versions of spf13/pflag flag routines which will read from the environment also.
|
Package flags contains enhanced versions of spf13/pflag flag routines which will read from the environment also. |