package cli import "github.com/erikgeiser/promptkit/textinput" func WithPretty(inp *textinput.TextInput) { const template = ` {{- Foreground "2" (Bold "?") }} {{ .Prompt }} {{- Foreground "8" ">" }} {{ .Input }} ` inp.Template = template } type InputOption func(*textinput.TextInput) func WithDefault(defaultValue string) InputOption { return func(inp *textinput.TextInput) { inp.Placeholder = defaultValue } } func WithValidate(validate func(string) error) InputOption { return func(inp *textinput.TextInput) { inp.Validate = validate } } func Ask(prompt string, opts ...InputOption) (string, error) { inp := textinput.New(prompt) for _, opt := range opts { opt(inp) } return inp.RunPrompt() }