๐ interactive
โก interactive::askForConfirmation
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::askForConfirmation "Press enter to continue."
โก interactive::askForConfirmationRaw
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::askForConfirmationRaw
โก 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?"
โก interactive::promptYesNo
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::promptYesNo "Do you want to continue?"; then echo "Yes."; else echo "No."; fi
โก interactive::promptYesNoRaw
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::promptYesNoRaw "Do you want to continue?" && local answer="${REPLY}"
Important
Documentation generated for the version 0.33.0 (2025-08-31).