changed set-boxtype to accept args, iterated minor version (2.0.2)

This commit is contained in:
alanweinstock 2025-02-26 08:42:59 -08:00
parent 6ddb1539f3
commit e38b44c542

View file

@ -2,7 +2,7 @@
# pyr0ball script functions library # pyr0ball script functions library
# Initial Vars # Initial Vars
functionsrev=2.0.1 functionsrev=2.0.2
#scriptname="${BASH_SOURCE[0]##*/}" #scriptname="${BASH_SOURCE[0]##*/}"
#rundir="${BASH_SOURCE[0]%/*}" #rundir="${BASH_SOURCE[0]%/*}"
#runuser="$(whoami)" #runuser="$(whoami)"
@ -245,13 +245,30 @@ box-light(){
} }
set-boxtype() { set-boxtype() {
case $boxtype in # Accept a parameter if provided, otherwise use the global variable
local style="${1:-$boxtype}"
# Update the global variable to match what we're using
boxtype="$style"
# Ensure characters are defined
set_box_chars
update_terminal_width
# Set the box style
case $style in
norm) box-norm ;; norm) box-norm ;;
double) box-double ;; double) box-double ;;
heavy) box-heavy ;; heavy) box-heavy ;;
light) box-light ;; light) box-light ;;
rounded) box-rounded ;; rounded) box-rounded ;;
char) box-singlechar ;; char) box-singlechar ;;
*)
# Handle unknown box types by falling back to normal
echo "Warning: Unknown box type '$style', falling back to 'norm'" >&2
boxtype="norm"
box-norm
;;
esac esac
} }