Add speed

speedtest and the result with image in terminal with chafa by running speed
This commit is contained in:
Baltrust 2026-10-28 22:59:51 +02:00
parent 9575e5d3b7
commit dc3bbcff0f

View file

@ -174,6 +174,21 @@ manual() {
rm -f "$pdf"
}
speed() {
local output url exit_code
output=$(mktemp) || return # Create temporary file
script -q -c 'speedtest -A' /dev/null | tee "$output" # Run speedtest and save output
exit_code=$? # Save exit status
url=$(awk '/Result URL:/ {print $NF ".png"; exit}' "$output" | tr -d '\r') # Extract result image URL
rm -f "$output" # Remove temporary file
[[ $exit_code -eq 0 && -n $url ]] && curl -sL --compressed "$url" | chafa - # Display result image
return "$exit_code" # Return exit status
}
EOF
# Make everything we created belong to the user