Documentation ¶
Overview ¶
Package inputs handles the user interactions
Index ¶
- Constants
- func FromFlagsForPasswordEntry(cmd *cobra.Command, uN, password, mPassword *string, labels *[]string) error
- func FromPromptForPasswordEntry(uN, password, mPassword *string, labels *[]string) error
- func GetFlagBoolVal(cmd *cobra.Command, flag string) (bool, error)
- func GetFlagIntVal(cmd *cobra.Command, flag string) (int, error)
- func GetFlagStringArrayVal(cmd *cobra.Command, flag string) ([]string, error)
- func GetFlagStringVal(cmd *cobra.Command, flag string) (string, error)
- func HasProvidedValidID() func(cmd *cobra.Command, args []string) error
- func HasProvidedValidIDLabel() func(cmd *cobra.Command, args []string) error
- func IsArgValid(arg string) bool
- func IsPasswordValid(passphrase string) bool
- func IsValidSingleArg(args []string) bool
- func PromptForLabels() ([]string, error)
- func PromptForMPassword() (string, error)
- func PromptForMPasswordSecondTime(currentPassword string) (string, error)
- func PromptForNewMPassword() (string, error)
- func PromptForPassword() (string, error)
- func PromptForPasswordSecondTime(currentPassword string) (string, error)
- func PromptForPasswordWithDefault(label, defaultVal string, validate promptui.ValidateFunc) (string, error)
- func PromptForSelect(l string, size int, items []string) (string, error)
- func PromptForString(label string, validate promptui.ValidateFunc) (string, error)
- func PromptForStringWithDefault(label, defaultVal string, validate promptui.ValidateFunc) (string, error)
- func PromptForUserPasswordWithDefault(defaultVal string) (string, error)
- func PromptForUsername() (string, error)
- func PromptForUsernameWithDefault(defaultVal string) (string, error)
Constants ¶
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" )
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 ¶
FromPromptForPasswordEntry functions gets the input values required for Password entry by prompting.
func GetFlagBoolVal ¶
GetFlagBoolVal method returns the Boolean flag value.
func GetFlagIntVal ¶
GetFlagIntVal method returns the int flag value.
func GetFlagStringArrayVal ¶
GetFlagStringArrayVal method returns the String array flag value.
func GetFlagStringVal ¶
GetFlagStringVal method returns the String flag value.
func HasProvidedValidID ¶
HasProvidedValidID returns a function which validates the ID input.
func HasProvidedValidIDLabel ¶
HasProvidedValidIDLabel returns a function which validates the Label input.
func IsArgValid ¶
IsArgValid method check whether the CMD arg are valid or not.
func IsPasswordValid ¶
IsPasswordValid method check whether the FlagPassword is valid or not.
func IsValidSingleArg ¶
IsValidSingleArg method check whether the CMD args are valid or not.
func PromptForLabels ¶
PromptForLabels prompts for labels and returns the given labels.
func PromptForMPassword ¶
PromptForMPassword prompts for the master password and returns master password.
func PromptForMPasswordSecondTime ¶
PromptForMPasswordSecondTime function prompts for master password for second time to validate and returns the input.
func PromptForNewMPassword ¶
PromptForNewMPassword prompts for a new master password and returns master password.
func PromptForPassword ¶
PromptForPassword function prompts for password and returns the input.
func PromptForPasswordSecondTime ¶
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 ¶
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 ¶
PromptForUserPasswordWithDefault function prompts for a user password with a choice of default value and returns the chosen value.
func PromptForUsername ¶
PromptForUsername prompt for username and returns the value.
func PromptForUsernameWithDefault ¶
PromptForUsernameWithDefault prompt for username with a default value and returns the chosen value.
Types ¶
This section is empty.