Namespace src/UI

src/UI

Overview

Directory src/UI

file source src/UI/askToContinue.sh

UI::askToContinue

ask the user if he wishes to continue a process

Input: user input y or Y characters Output: displays message

Are you sure, you want to continue (y or n)?
Exit: with error code 1 if y or Y, other keys do nothing

src/UI/askToIgnoreOverwriteAbort.sh

file source src/UI/askToIgnoreOverwriteAbort.sh

UI::askToIgnoreOverwriteAbort

ask the user to ignore(i), overwrite(o) or abort(a)

Input: user input any characters

Output:

  • displays message
    do you want to ignore(i), overwrite(o), abort(a) ?
  • if characters entered different than [iIoOaA] displays “Invalid answer” and continue to ask

Returns:

  • 0 if i or I
  • 1 if o or O Exit:
  • 1 if a or A

src/UI/askYesNo.sh

file source src/UI/askYesNo.sh

UI::askYesNo

Ask user to enter y or n, retry until answer is correct

Arguments
  • $1 (message:String): message to display before asking
Exit codes
  • 0: if yes
  • 1: else
Output on stdout
  • displays message
    [msg arg $1] (y or n)?
  • if characters entered different than [yYnN] displays “Invalid answer” and continue to ask

src/UI/drawLine.sh

file source src/UI/drawLine.sh

UI::drawLine

draw a line with the character passed in parameter repeated depending on terminal width

Arguments
  • $1 (character:String): character to use as separator (default value #)

src/UI/drawLineWithMsg.sh

file source src/UI/drawLineWithMsg.sh

UI::drawLineWithMsg

draw a line with the character passed in parameter repeated depending on terminal width including message in the middle of the screen

Arguments
  • $1 (character:String): character to use as separator (default value #)
  • $2 (msg:String): msg to display on the middle
Environment variables
  • COLUMNS (number): of columns, if not provided compute the screen width

src/UI/requireTheme.sh

file source src/UI/requireTheme.sh

UI::requireTheme

load color theme

Function has no arguments.

Environment variables
  • BASH_FRAMEWORK_THEME (String): theme to use
  • LOAD_THEME (int): 0 to avoid loading theme
Exit codes
  • 0: always successful

src/UI/talkToUser.sh

file source src/UI/talkToUser.sh

UI::talkToUser

display info message And wall Text to speech to tell the message if wsl and powershell available Else try to use bip

Arguments
  • $1 (msg:String): message to tell
  • $2 (talkScript:String): filepath to powershell talk script
Environment variables
  • CAN_TALK_DURING_INSTALLATION (if): not 1 skip talking or beeping

src/UI/textLine.sh

file source src/UI/textLine.sh

UI::textLine

Display given text and complete the rest of the line with given character

Arguments
  • $1 (text:String): text to display
  • $2 (character:String): (default:#) character to use to complete the line

src/UI/theme.sh

file source src/UI/theme.sh

UI::theme

1 Warning(s)

load colors theme constants

Arguments
  • $1 (theme:String): the theme to use (default, noColor)
  • $@ args:String[]
Variables set
  • __ERROR_COLOR (String): indicate error status
  • __INFO_COLOR (String): indicate info status
  • __SUCCESS_COLOR (String): indicate success status
  • __WARNING_COLOR (String): indicate warning status
  • __SKIPPED_COLOR (String): indicate skipped status
  • __DEBUG_COLOR (String): indicate debug status
  • __HELP_COLOR (String): indicate help status
  • __TEST_COLOR (String): not used
  • __TEST_ERROR_COLOR (String): not used
  • __HELP_TITLE_COLOR (String): used to display help title in help strings
  • __HELP_OPTION_COLOR (String): used to display highlight options in help strings
  • __RESET_COLOR (String): reset default color
  • __HELP_EXAMPLE (String): to remove
  • __HELP_TITLE (String): to remove
  • __HELP_NORMAL (String): to remove
Warnings
  • if tty not opened, noColor theme will be chosen
Or, if you want, you can alternatively use the GitHub discussion Q&A for feedback and questions.