nuno bu gisti düzenledi 1 month ago. Düzenlemeye git
1 file changed, 15 insertions
gistfile1.txt(dosya oluşturuldu)
| @@ -0,0 +1,15 @@ | |||
| 1 | + | function peers::format_status() { | |
| 2 | + | local name="${1:-}" public_key="${2:-}" is_blocked="${3:-false}" | |
| 3 | + | local is_restricted="${4:-false}" handshake_ts="${5:-0}" last_ts="${6:-}" | |
| 4 | + | ||
| 5 | + | local state | |
| 6 | + | state=$(peers::connection_state "$is_blocked" "$is_restricted" \ | |
| 7 | + | "$handshake_ts" "$last_ts") | |
| 8 | + | ||
| 9 | + | local conn_str modifier color | |
| 10 | + | IFS="|" read -r conn_str modifier color <<< "$state" | |
| 11 | + | ||
| 12 | + | local display="$conn_str" | |
| 13 | + | [[ -n "$modifier" ]] && display="${conn_str} (${modifier})" | |
| 14 | + | echo -e "${color}${display}\033[0m" | |
| 15 | + | } | |
Daha yeni
Daha eski