Documentation ¶
Index ¶
- Variables
- func AskForBool(ctx context.Context, text string, def bool) (bool, error)
- func AskForConfirmation(ctx context.Context, text string) bool
- func AskForInt(ctx context.Context, text string, def int) (int, error)
- func AskForKeyImport(ctx context.Context, key string, names []string) bool
- func AskForPassword(ctx context.Context, name string) (string, error)
- func AskForString(ctx context.Context, text, def string) (string, error)
- func HasPassPromptFunc(ctx context.Context) bool
- func WithPassPromptFunc(ctx context.Context, ppf PassPromptFunc) context.Context
- type LineReader
- type PassPromptFunc
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func AskForBool ¶
AskForBool ask for a bool (yes or no) exactly once. The empty answer uses the specified default, any other answer is an error.
func AskForConfirmation ¶
AskForConfirmation asks a yes/no question until the user replies yes or no
func AskForInt ¶
AskForInt asks for an valid interger once. If the input can not be converted to an int it returns an error
func AskForKeyImport ¶
AskForKeyImport asks for permissions to import the named key
func AskForPassword ¶
AskForPassword prompts for a password twice until both match
func AskForString ¶
AskForString asks for a string once, using the default if the anser is empty. Errors are only returned on I/O errors
func HasPassPromptFunc ¶
HasPassPromptFunc returns true if a value for the pass prompt func has been set in this context
func WithPassPromptFunc ¶
func WithPassPromptFunc(ctx context.Context, ppf PassPromptFunc) context.Context
WithPassPromptFunc returns a context with the password prompt function set
Types ¶
type LineReader ¶
type LineReader struct {
// contains filtered or unexported fields
}
LineReader is an unbuffered line reader
func (LineReader) ReadLine ¶
func (lr LineReader) ReadLine() (string, error)
ReadLine reads one line w/o buffering
type PassPromptFunc ¶
PassPromptFunc is a password prompt function
func GetPassPromptFunc ¶
func GetPassPromptFunc(ctx context.Context) PassPromptFunc
GetPassPromptFunc will return the password prompt func or a default one Note: will never return nil