Остання активність 1 month ago

nuno ревизій цього gist 1 month ago. До ревизії

1 file changed, 21 insertions

gistfile1.txt(файл створено)

@@ -0,0 +1,21 @@
1 + function ui::watch::fw_row() {
2 + local ts="${1:-}" client="${2:-}" dest_display="${3:-}" \
3 + w_client="${4:-20}" w_dest="${5:-18}"
4 +
5 + # "fw" is always 2 visible chars — no padding needed
6 + local src="${_UI_WATCH_FW_COLOR}fw\033[0m"
7 +
8 + local ts_pad client_pad dest_pad_n
9 + ts_pad=$(printf "%-11s" "$ts")
10 + client_pad=$(printf "%-${w_client}s" "$client")
11 + dest_pad_n=$(( w_dest - ${#dest_display} ))
12 + [[ $dest_pad_n -lt 0 ]] && dest_pad_n=0
13 +
14 + printf " %s %b %s \033[1;31m→\033[0m %s%*s \033[1;31mdrop\033[0m\n" \
15 + "$ts_pad" "$src" "$client_pad" "$dest_display" "$dest_pad_n" ""
16 + }
17 + function ui::watch::fw_row_table() {
18 + local ts="${1:-}" client="${2:-}" dest="${3:-}" event="${4:-}" status="${5:-}"
19 + printf " %-20s %-8s %-22s %-28s \033[1;31m%-14s\033[0m %s\n" \
20 + "$ts" "firewall" "$client" "$dest" "$event" "$status"
21 + }
Новіше Пізніше