inputs

package
v0.0.0-...-787f100 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package inputs handles the user interactions

Index

Constants

View Source
const (
	// FlagUsername is the flag name for username.
	FlagUsername = "username"
	// FlagPassword is the flag name for password.
	FlagPassword = "password"
	// FlagLabels is the flag name for labels.
	FlagLabels = "labels"
	// FlagMasterPassword is the flag name for masterPassword.
	FlagMasterPassword = "masterPassword"
	// FlagNewMasterPassword is the flag name for new masterPassword.
	FlagNewMasterPassword = "newMasterPassword"
	// FlagShowPassword flag
	FlagShowPassword = "show-pass"
)
View Source
const (
	// PromptUsername is the prompt name for username
	PromptUsername = "Username"
	// PromptPassword is the prompt name for password
	PromptPassword = "Password"
	// PromptLabels is the flag name for labels.
	PromptLabels = "Labels"
	// PromptMasterPassword is the flag name for masterPassword.
	PromptMasterPassword = "Master password"
	// ErrMSGCannotPrompt is an error message
	ErrMSGCannotPrompt = "cannot prompt for %s"
	// ErrMsgCannotGetInput is an error message
	ErrMsgCannotGetInput = "cannot get input"
	// ErrMsgCannotGetFlag is an error message
	ErrMsgCannotGetFlag = "cannot get value of %s flag"
	// ErrMsgMasterPasswordMissMatch is an error message
	ErrMsgMasterPasswordMissMatch = "master password doesn't match"
	// ErrMsgPasswordMissMatch is an error message
	ErrMsgPasswordMissMatch = "password doesn't match"
	// MinPasswordCharacters is the allowed minimum number of characters for a password.
	MinPasswordCharacters = 6
	// MinUsernameCharacters is the allowed minimum number of characters for a username.
	MinUsernameCharacters = 6
)

Variables

This section is empty.

Functions

func FromFlagsForPasswordEntry

func FromFlagsForPasswordEntry(cmd *cobra.Command, uN, password, mPassword *string, labels *[]string) error

FromFlagsForPasswordEntry functions gets the input values required for Password entry from flags.

func FromPromptForPasswordEntry

func FromPromptForPasswordEntry(uN, password, mPassword *string, labels *[]string) error

FromPromptForPasswordEntry functions gets the input values required for Password entry by prompting.

func GetFlagBoolVal

func GetFlagBoolVal(cmd *cobra.Command, flag string) (bool, error)

GetFlagBoolVal method returns the Boolean flag value.

func GetFlagIntVal

func GetFlagIntVal(cmd *cobra.Command, flag string) (int, error)

GetFlagIntVal method returns the int flag value.

func GetFlagStringArrayVal

func GetFlagStringArrayVal(cmd *cobra.Command, flag string) ([]string, error)

GetFlagStringArrayVal method returns the String array flag value.

func GetFlagStringVal

func GetFlagStringVal(cmd *cobra.Command, flag string) (string, error)

GetFlagStringVal method returns the String flag value.

func HasProvidedValidID

func HasProvidedValidID() func(cmd *cobra.Command, args []string) error

HasProvidedValidID returns a function which validates the ID input.

func HasProvidedValidIDLabel

func HasProvidedValidIDLabel() func(cmd *cobra.Command, args []string) error

HasProvidedValidIDLabel returns a function which validates the Label input.

func IsArgValid

func IsArgValid(arg string) bool

IsArgValid method check whether the CMD arg are valid or not.

func IsPasswordValid

func IsPasswordValid(passphrase string) bool

IsPasswordValid method check whether the FlagPassword is valid or not.

func IsValidSingleArg

func IsValidSingleArg(args []string) bool

IsValidSingleArg method check whether the CMD args are valid or not.

func PromptForLabels

func PromptForLabels() ([]string, error)

PromptForLabels prompts for labels and returns the given labels.

func PromptForMPassword

func PromptForMPassword() (string, error)

PromptForMPassword prompts for the master password and returns master password.

func PromptForMPasswordSecondTime

func PromptForMPasswordSecondTime(currentPassword string) (string, error)

PromptForMPasswordSecondTime function prompts for master password for second time to validate and returns the input.

func PromptForNewMPassword

func PromptForNewMPassword() (string, error)

PromptForNewMPassword prompts for a new master password and returns master password.

func PromptForPassword

func PromptForPassword() (string, error)

PromptForPassword function prompts for password and returns the input.

func PromptForPasswordSecondTime

func PromptForPasswordSecondTime(currentPassword string) (string, error)

PromptForPasswordSecondTime function prompts for password for second time to validate and returns the input.

func PromptForPasswordWithDefault

func PromptForPasswordWithDefault(label, defaultVal string, validate promptui.ValidateFunc) (string, error)

PromptForPasswordWithDefault function prompts for a password with a choice of default value and returns the chosen value.

func PromptForSelect

func PromptForSelect(l string, size int, items []string) (string, error)

PromptForSelect start selection and return the selected value.

func PromptForString

func PromptForString(label string, validate promptui.ValidateFunc) (string, error)

PromptForString function prompt for string and returns the input.

func PromptForStringWithDefault

func PromptForStringWithDefault(label, defaultVal string, validate promptui.ValidateFunc) (string, error)

PromptForStringWithDefault function prompts for a string with a choice of default value and returns the chosen value.

func PromptForUserPasswordWithDefault

func PromptForUserPasswordWithDefault(defaultVal string) (string, error)

PromptForUserPasswordWithDefault function prompts for a user password with a choice of default value and returns the chosen value.

func PromptForUsername

func PromptForUsername() (string, error)

PromptForUsername prompt for username and returns the value.

func PromptForUsernameWithDefault

func PromptForUsernameWithDefault(defaultVal string) (string, error)

PromptForUsernameWithDefault prompt for username with a default value and returns the chosen value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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