manifoldco / promptui

Interactive prompt for command-line applications
https://www.manifold.co
BSD 3-Clause "New" or "Revised" License
6.07k stars 336 forks source link

No space in confirmation text? #116

Open danawoodman opened 5 years ago

danawoodman commented 5 years ago

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.

aschrijver commented 3 years ago

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),
        }