This will generate a comment to put into code files
read -p 'Title: ' text
read -p 'Number of characters on each side [default 10]: ' sideCharacters
read -p 'Prefix [enter for none]: ' prefix
echo This is the generated comment for \""${text}"\":
echo
sideCharacters=${sideCharacters:-10}
chr=$(((2 * ${sideCharacters}) + ${#text}))
printf_new() {
num=$1
printf "%${num}s\n" "" | sed -e 's/ /*/g'
}
printf_title() {
sides=$1
title=$2
num=$((${sides} - 1))
printf "%${num}s\n" "" | sed -e 's/ /*/g' | tr -d '\n'
printf " " | tr -d '\n'
printf "${title}" | tr -d '\n'
printf " " | tr -d '\n'
printf "%${num}s\n" "" | sed -e 's/ /*/g'
}
printf "${prefix} ";
printf_new ${chr}
printf "${prefix} ";
printf_title ${sideCharacters} "${text}"
printf "${prefix} ";
printf_new ${chr}