Created
March 5, 2026 19:59
-
-
Save reeslo/4fcc02fb5d7014638a980bf9002509ec to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| rtk gain -f json 2>/dev/null | awk -F'[:,}]' ' | |
| /"total_input"/ { input=$2+0 } | |
| /"total_saved"/ { saved=$2+0 } | |
| /"avg_savings_pct"/ { pct=$2+0 } | |
| END { | |
| if (input > 0) { | |
| fmt_input = (input >= 1000) ? sprintf("%.1fK", input/1000) : input | |
| fmt_saved = (saved >= 1000) ? sprintf("%.1fK", saved/1000) : saved | |
| printf "RTK: %s/%s saved (%.0f%%)\n", fmt_saved, fmt_input, pct | |
| } else { | |
| print "RTK: no data" | |
| } | |
| }' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment