8 lines
397 B
Bash
8 lines
397 B
Bash
#!/usr/bin/env bash
|
|
|
|
output="$(progress -q)"
|
|
text="$(printf "%s" "$output" | sed 's/\[[^]]*\] //g' | awk 'BEGIN { ORS=" " } NR%3==1 { op=$1 } NR%3==2 { pct=($1+0); if (op != "gpg" && op != "coreutils" && pct > 0 && pct < 100) { print op, $1 } }')"
|
|
tooltip="$(printf "%s" "$output" | perl -pe 's/\n/\\n/g' | perl -pe 's/(?:\\n)+$//')"
|
|
|
|
printf '{"text": "%s", "tooltip": "%s"}\n' "$text" "$tooltip"
|