pretty.cli.prompt
confirm
(confirm question default-value)
(confirm question)
Prompt a question
and wait for user to reply yes or no.
Accepted inputs are:
- y | Y | yes | YES
- n | N | no | NO
default-value
is a boolean and can set the default selected option, true for Yes and false for No.
input
(input question validate-fn)
(input question)
Prompt a question
and wait for user to insert a free input string.
Input can be validated if validate-fn
is passed as function that returns:
- nil if input is valid.
- String error if input is not valid. Returned String is displayed with an error style.
list-checkbox
(list-checkbox question choices)
Prompt a question
with a list of choices
and wait for user to check and select some of them.
Choices can be:
; List of strings. Same label and value, none is checked by default.
[ "One" "Two" "Three" ]
; List of maps.
[
{:label "One" :value "1" :checked true}
{:label "Two" :value "2" :checked false}
{:label "Three" :value "3" :checked false}
]
list-select
(list-select question choices)
Prompt a question
with a list of choices
and wait for user to select one of them
Choices can be:
; List of strings. Same label and value.
[ "One" "Two" "Three" ]
; List of maps.
[
{:label "One" :value "1"}
{:label "Two" :value "2"}
{:label "Three" :value "3"}
]