Skip to content

Commit 5f14f10

Browse files
N3WK1Dtwpayne
N3WK1D
authored andcommittedSep 26, 2023
docs: Added an example for promptChoiceOnce
1 parent 4a52e5c commit 5f14f10

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed
 

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

+9
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,12 @@
33
`promptChoiceOnce` returns the value of *map* at *path* if it exists and is a
44
string, otherwise it prompts the user for one of *choices* with *prompt* and an
55
optional *default* using `promptChoice`.
6+
7+
!!! example
8+
9+
```
10+
{{- $choices := list "desktop" "laptop" "server" "termux" -}}
11+
{{- $hosttype := promptChoiceOnce . "hosttype" "What type of host are you on" $choices -}}
12+
[data]
13+
hosttype = {{- $hosttype | quote -}}
14+
```

0 commit comments

Comments
 (0)
Please sign in to comment.