nuno zrewidował ten Gist 1 month ago. Przejdź do rewizji
1 file changed, 37 insertions
gistfile1.txt(stworzono plik)
| @@ -0,0 +1,37 @@ | |||
| 1 | + | function ui::activity::peer_row() { | |
| 2 | + | local name_pad="${1:-}" rx_pad="${2:-}" tx_pad="${3:-}" \ | |
| 3 | + | drops="${4:-0}" drop_word="${5:-drops}" w_drops="${6:-1}" | |
| 4 | + | ||
| 5 | + | printf " \033[1m%s\033[0m \033[2m↓\033[0m%s \033[2m↑\033[0m%s %${w_drops}s %s\n" \ | |
| 6 | + | "$name_pad" "$rx_pad" "$tx_pad" "$drops" "$drop_word" | |
| 7 | + | } | |
| 8 | + | ||
| 9 | + | function ui::activity::peer_row_table() { | |
| 10 | + | local name="${1:-}" rx_fmt="${2:-}" tx_fmt="${3:-}" \ | |
| 11 | + | drops="${4:-0}" drop_word="${5:-drops}" | |
| 12 | + | printf " %-24s %-14s %-14s %s %s\n" \ | |
| 13 | + | "$name" "↓$rx_fmt" "↑$tx_fmt" "$drops" "$drop_word" | |
| 14 | + | } | |
| 15 | + | function ui::activity::accept_row() { | |
| 16 | + | local name_pad="${1:-}" bytes_in="${2:-}" bytes_out="${3:-}" \ | |
| 17 | + | conns="${4:-0}" w_drops="${5:-4}" | |
| 18 | + | ||
| 19 | + | local conn_word="conns" | |
| 20 | + | [[ "$conns" -eq 1 ]] && conn_word="conn" | |
| 21 | + | ||
| 22 | + | local w=${#name_pad} | |
| 23 | + | printf " \033[0;32m%-${w}s\033[0m \033[0;32m↓\033[0m%-10s \033[0;32m↑\033[0m%-10s \033[0;32m%${w_drops}s %s\033[0m\n" \ | |
| 24 | + | "ACCEPT" "$bytes_in" "$bytes_out" "$conns" "$conn_word" | |
| 25 | + | } | |
| 26 | + | ||
| 27 | + | function ui::activity::accept_dest_row() { | |
| 28 | + | local dest="${1:-}" bytes_raw="${2:-0}" bytes_fmt="${3:-}" \ | |
| 29 | + | count="${4:-0}" drops_col="${5:-40}" w_drops="${6:-4}" | |
| 30 | + | ||
| 31 | + | local conn_word="conns" | |
| 32 | + | [[ "$count" -eq 1 ]] && conn_word="conn" | |
| 33 | + | ||
| 34 | + | local arrow_prefix=" → " | |
| 35 | + | printf "%b\033[0;32m%-28s %${w_drops}s %s %s\033[0m\n" \ | |
| 36 | + | "$arrow_prefix" "$dest" "$count" "$conn_word" "$bytes_fmt" | |
| 37 | + | } | |
Nowsze
Starsze