Documentation ¶
Overview ¶
Package inputs handles the user interactions
Index ¶
- Constants
- func FromFlagsForPasswordEntry(cmd *cobra.Command, uN, password, mPassword, desc *string, labels *[]string) error
- func FromPromptForPasswordEntry(uN, password, mPassword, desc *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 PromptForDescWithDefault(defaultVal string) (string, error)
- func PromptForDescription() (string, error)
- 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 []PromptSelectInfo) (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)
- type PromptSelectInfo
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" // FlagDescription is the flag name for description. FlagDescription = "description" // 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 prompt name for masterPassword. PromptMasterPassword = "Master password" // PromptDescription is the prompt name for description. PromptDescription = "Description" // 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 ¶ added in v0.7.0
func FromFlagsForPasswordEntry(cmd *cobra.Command, uN, password, mPassword, desc *string, labels *[]string) error
FromFlagsForPasswordEntry functions gets the input values required for Password entry from flags.
func FromPromptForPasswordEntry ¶ added in v0.7.0
FromPromptForPasswordEntry functions gets the input values required for Password entry by prompting.
func GetFlagBoolVal ¶
GetFlagBoolVal method returns the Boolean flag value.
func GetFlagIntVal ¶ added in v0.5.0
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 ¶ added in v0.7.0
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 PromptForDescWithDefault ¶ added in v0.9.1
PromptForDescWithDefault prompt for description with a default value and returns the chosen value.
func PromptForDescription ¶ added in v0.9.1
PromptForDescription function prompts for description and returns the input.
func PromptForLabels ¶ added in v0.5.0
PromptForLabels prompts for labels and returns the given labels.
func PromptForMPassword ¶ added in v0.5.0
PromptForMPassword prompts for the master password and returns master password.
func PromptForMPasswordSecondTime ¶ added in v0.6.0
PromptForMPasswordSecondTime function prompts for master password for second time to validate and returns the input.
func PromptForNewMPassword ¶ added in v0.5.0
PromptForNewMPassword prompts for a new master password and returns master password.
func PromptForPassword ¶
PromptForPassword function prompts for password and returns the input.
func PromptForPasswordSecondTime ¶ added in v0.6.0
PromptForPasswordSecondTime function prompts for password for second time to validate and returns the input.
func PromptForPasswordWithDefault ¶ added in v0.5.0
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 []PromptSelectInfo) (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 ¶ added in v0.5.0
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 ¶ added in v0.5.0
PromptForUserPasswordWithDefault function prompts for a user password with a choice of default value and returns the chosen value.
func PromptForUsername ¶ added in v0.5.0
PromptForUsername prompt for username and returns the value.
func PromptForUsernameWithDefault ¶ added in v0.5.0
PromptForUsernameWithDefault prompt for username with a default value and returns the chosen value.
Types ¶
type PromptSelectInfo ¶ added in v0.9.1
PromptSelectInfo represents the information for prompt select.