diff --git a/fip.sh b/fip.sh index 3b2dc83..83f98e3 100755 --- a/fip.sh +++ b/fip.sh @@ -26,8 +26,11 @@ function print_data() { slug="\033[1;${color_code}m$slug\033[0m" slug=$(printf "%-32s" "$slug") - artiste=$(printf "%-40s" "$artiste") - titre=$(printf "%-40s" "$titre") + terminal_width=$(tput cols) + width=$((((terminal_width - 32) / 2) - 4)) + artiste=$(printf "%-${width}s" "${artiste:0:${width}}") + titre=$(printf "%-${width}s" "${titre:0:${width}}") + output+="\033[1$slug\033[0m | \033[1mArtiste:\033[0m $artiste | \033[1mTitre:\033[0m $titre |\n" color_index=$(get_next_color "$color_index") done