| Library file | Function | Sections | Content | help file |
|---|---|---|---|---|
| bmtDraw | bmtDrawFunc | 901-907 | Draw related | bmtDraw.md |
- 901 Create a multi-line box with text inside it
- 902 Create a single line box with variable box character.
- 903 Centered text with variable banner character
- 904 Display gauge
- 905 Table
- 906 Menu
- 907 Columns
- Param $2 color of box , tput setaf , 1 = red
- Param $3 color of text , tput setaf , 2 = green
- The Rest of Params are the lines of text
bmtDrawFunc drawbox 1 2 'first line' 'second line' 'third line'- Param $2 color of box, tput setaf 2=green
- Param $3 color of text , tput setaf 6=cyan
- Param $4 symbol to make the box lines out of.
- Param $5 text
bmtDrawFunc title 2 6 '#' 'hello'- Param $2 Text to center
- Param $3 Banner symbol
bmtDrawFunc centertext "Hello World" =- Param $2 Text label
- Param $3 Value to display
- Param $4 Minimum value of gauge
- Param $5 Maximum value of gauge
- Param $6 Gauge full symbol
- Param $7 Gauge empty symbol
bmtDrawFunc gauge "Volts" 25 1 50 "#" "."- Param $2 colour for the border/keys (tput colour number).
- Param $3 colour for the values (tput colour number).
- Param $4 onwards as flat alternating key-value pairs e.g. "OS" "Linux" "Uptime" "3 days"
bmtDrawFunc table 2 6 "OS" "Linux" "Uptime"- Param $2 colour for the menu border and numbers (tput colour number).
- Param $3 colour for the menu item text (tput colour number).
- Param $4 prompt string shown to user below the list.
- Param $5 onwards as menu item strings, one per argument.
- Three distinct return codes: the chosen number 1–N on valid input, 253 for non-integer input, 254 for out-of-range.
bmtDrawFunc menu 3 2 "Choose an option:" "Start" "Stop" "Restart"
choice=$?
if [ "$choice" -eq 253 ]; then
echo "Invalid input: not a number"
elif [ "$choice" -eq 254 ]; then
echo "Invalid input: number out of range"
else
echo "You chose option $choice"
fiPrints a list of items across a specified number of evenly spaced columns, with column width calculated from the longest item and fitted to terminal width.
- Param $2 number of columns.
- Param $3 colour for the items (tput colour number).
- Param $4+ onwards as items to display.
- Returns 1 if column count is missing or not a positive integer.
bmtDrawFunc cols 3 4 "alpha" "beta" "gamma" "delta" "epsilon" "zeta" "eta"
# This will display the 7 items across 3 columns with color 4 (blue)
# alpha beta gamma
# delta epsilon zeta
# eta