Back to Chezmoi

`promptMultichoice` *prompt* *choices* [*default*]

assets/chezmoi.io/docs/reference/templates/init-functions/promptMultichoice.md

2.70.2573 B
Original Source

promptMultichoice prompt choices [default]

promptMultichoice prompts the user with prompt and choices and returns the user's response. choices must be a list of strings. If a default list is passed and the user's response is empty then it returns default.

!!! example

```
{{- $choices := list "chocolate" "strawberry" "vanilla" "pistachio" -}}
{{- $icecream := promptMultichoice "What type of ice cream do you like"
    $choices (list "pistachio" "chocolate")
-}}
[data]
    icecream = {{- $icecream | toToml -}}
```