You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.2 KiB
49 lines
1.2 KiB
#!/usr/bin/env bash |
|
|
|
|
|
RED='\033[0;31m' |
|
LRED='\033[1;31m' |
|
YELLOW='\033[1;33m' |
|
GREEN='\033[0;32m' |
|
LGREEN='\033[1;32m' |
|
LBLUE='\033[1;34m' |
|
CYAN='\033[0;36m' |
|
LCYAN='\033[1;36m' |
|
ORANGE='\033[0;33m' |
|
LGREY='\033[0;37m' |
|
WHITE='\033[1;37m' |
|
NC='\033[0m' # No Color |
|
|
|
stripAnsi(){ |
|
sed -r "s/\x1B\[([0-9]{1,3}(;[0-9]{1,2})?)?[mGK]//g" |
|
} |
|
|
|
drawInBox(){ |
|
innerWidth="45" |
|
echo -en "${LBLUE}╭" |
|
head -c $innerWidth /dev/zero | tr '\0' '-' |
|
echo -e "╮${NC}" |
|
while IFS= read -r line; do |
|
# The ansi characters mess up the string length so we need to strip them to calculate the width |
|
stripped="$(echo -n "$line" | stripAnsi)" |
|
leftPad=$(( ( innerWidth - ${#stripped} ) / 2)) |
|
rightPad=$(( ( innerWidth - leftPad ) - ${#stripped} )) |
|
echo -en "${LBLUE}|${NC}" |
|
head -c $leftPad /dev/zero | tr '\0' ' ' |
|
echo -n "$line" |
|
head -c $rightPad /dev/zero | tr '\0' ' ' |
|
echo -e "${LBLUE}|${NC}" |
|
done |
|
echo -en "${LBLUE}╰" |
|
head -c $innerWidth /dev/zero | tr '\0' '-' |
|
echo -e "╯${NC}" |
|
} |
|
|
|
echo -e " |
|
${RED}Jonathan Hodgson${NC} |
|
|
|
${ORANGE}Email: ${GREEN}jonathan@jonathanh.co.uk${NC} |
|
${ORANGE}Website: ${GREEN}https://jonathanh.co.uk${NC} |
|
${ORANGE}GitRepos: ${GREEN}https://git.jonathanh.co.uk${NC} |
|
" | drawInBox |
|
|
|
|