Add speed
speedtest and the result with image in terminal with chafa by running speed
This commit is contained in:
parent
9575e5d3b7
commit
dc3bbcff0f
1 changed files with 15 additions and 0 deletions
15
after.sh
15
after.sh
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue