promptui icon indicating copy to clipboard operation
promptui copied to clipboard

No space in confirmation text?

Open danawoodman opened this issue 5 years ago • 1 comments

I am seeing a lack of a space in the confirmation message of the prompt:

I would assume a space should be appended between the label and the value?

Also, how can one turn off the confirmation message in the first place?

I am using iTerm on a Mac.

danawoodman avatar Nov 04 '19 20:11 danawoodman

Yep, can confirm. Space needs to be added after Label.

Update: You can add the space by fiddling with the templates:

	p := promptui.Prompt{
		Label:     display,
		Default:   def,
		AllowEdit: false,
		Templates: &promptui.PromptTemplates{
			Prompt:          fmt.Sprintf(`{{ "%s" | bold }} {{ . | bold }}{{ ": " | bold}}`, promptui.IconInitial),
			Valid:           fmt.Sprintf(`{{ "%s" | bold }} {{ . | bold }}{{ ": " | bold}}`, promptui.IconGood),
			Invalid:         fmt.Sprintf(`{{ "%s" | bold }} {{ . | bold }}{{ ": " | bold}}`, promptui.IconBad),
			ValidationError: fmt.Sprintf(`{{ ">>" | red }} {{ . | red }}{{ ": " | bold}}`),
			Success:         fmt.Sprintf(`{{ "%s" | bold }} {{ . | faint }}{{ ": " | bold}}`, promptui.IconGood),
		}

aschrijver avatar Jan 11 '21 20:01 aschrijver