Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var DefaultPrompter = New()
DefaultPrompter is the default prompter for the package
var Out = os.Stdout
Out is the default out
var TitleUnderliner = "="
TitleUnderliner is the underline character for the title
Functions ¶
func PromptHiddenString ¶
PromptHiddenString uses the default prompter to prompt the user for input and hides the input when the string is missing. It is used for capturing sensitive data (passwords). Will not prompt when no interactive is true
Types ¶
type Component ¶
type Component interface {
Bytes() []byte
}
Component in the interface that UI components need to implement
type Printer ¶
type Printer struct {
// contains filtered or unexported fields
}
Printer represents a buffered container for components that can be flushed
func NewPrinter ¶
NewPrinter returns a pointer to a new printer object
type Prompter ¶
type Prompter struct {
// Reader is the input reader to read user input from
Reader io.Reader
// Writer is the output writer to present the prompt
Writer io.Writer
// NoInteractive when enabled disables prompting user
NoInteractive bool
}
Prompter represent an interactive prompter that captures inputs from the user
func (*Prompter) PromptHiddenString ¶
PromptHiddenString prompts the user for input and hides the input capture. It used for capturing sensitive data (passwords). Will not prompt when no interactive is true
Example ¶
package main
import (
"fmt"
"github.com/gosuri/uiutil"
)
func main() {
var pass string
uiutil.PromptHiddenString(&pass, "Password: ")
fmt.Println("Password is", pass)
}
