๐ interactive
โก interactive::confirm
Ask the user to yes or no.
- The user can switch between the two options with the arrow keys or space.
- The user can validate the choice with the enter key.
- The user can also validate immediately with the y or n key.
Dialog boxes are displayed for the question and answer.
Inputs:
$1: prompt as string:the prompt to display
${default}as bool:(optional) the default value to select
(defaults to true)
Returns:
$?:- 0 if the user answered yes
- 1 otherwise
${REPLY}: true or false.
Example usage:
if interactive::confirm "Do you want to continue?"; then echo "Yes."; else echo "No."; fiโก interactive::confirmRaw
Ask the user to yes or no.
- The user can switch between the two options with the arrow keys or space.
- The user can validate the choice with the enter key.
- The user can also validate immediately with the y or n key.
This raw version does not display the prompt or the answer.
Inputs:
${default}as bool:(optional) the default value to select
(defaults to true)
Returns:
$?:- 0 if the user answered yes
- 1 otherwise
${REPLY}: true or false.
Example usage:
interactive::confirmRaw "Do you want to continue?" && local answer="${REPLY}"โก interactive::continue
Ask the user to press the button to continue.
Inputs:
$1: prompt as string:the prompt to display
Returns:
$?:- 0 if the user pressed enter
- 1 otherwise
Example usage:
interactive::continue "Press enter to continue."โก interactive::continueRaw
Ask the user to press the button to continue.
This raw version does not display the prompt or the answer.
Returns:
$?:- 0 if the user pressed enter
- 1 otherwise
Example usage:
interactive::continueRawโก interactive::displayAnswer
Displays an answer to a previous question.
The text is wrapped and put inside a box like so:
โญโโโโโโฎ
โ No. โโโโ
โฐโโโโโโฏInputs:
$1: answer as string:the answer to display
${width}as int:(optional) the maximum width of the text in the dialog box
(defaults to “${GLOBAL_COLUMNS}”)
Example usage:
interactive::displayAnswer "My answer."โก interactive::displayQuestion
Displays a question to the user.
The text is wrapped and put inside a box like so:
โญโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โโโโค Is this an important question? โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏInputs:
$1: prompt as string:the prompt to display
${width}as int:(optional) the maximum width of the text in the dialog box
(defaults to “${GLOBAL_COLUMNS}”)
Example usage:
interactive::displayPrompt "Do you want to continue?"Important
Documentation generated for the version 0.36.26 (2025-10-10).