Последняя активность 1 month ago

nuno ревизий этого фрагмента 1 month ago. К ревизии

1 file changed, 21 insertions

gistfile1.txt(файл создан)

@@ -0,0 +1,21 @@
1 + function cmd::list::_iter_confs() {
2 + # Usage: cmd::list::_iter_confs <filter_type> <callback>
3 + local filter_type="$1"
4 + local callback="$2"
5 + local dir
6 + dir="$(ctx::clients)"
7 +
8 + for conf in "${dir}"/*.conf; do
9 + [[ -f "$conf" ]] || continue
10 + local client_name
11 + client_name=$(basename "$conf" .conf)
12 + local ip="${p_ips[$client_name]:-}"
13 + if [[ -z "$ip" ]]; then
14 + ip=$(grep "^Address" "$conf" | awk '{print $3}' | cut -d'/' -f1)
15 + fi
16 + local type
17 + type=$(peers::get_type_from_ip "$ip")
18 + [[ -n "$filter_type" && "$type" != "$filter_type" ]] && continue
19 + "$callback" "$client_name" "$ip" "$type"
20 + done
21 + }
Новее Позже