Última atividade 1 month ago

nuno revisou este gist 1 month ago. Ir para a revisão

1 file changed, 55 insertions

gistfile1.txt(arquivo criado)

@@ -0,0 +1,55 @@
1 + #!/usr/bin/env bash
2 + # ui/identity.module.sh — rendering for identity data
3 + # All functions pure rendering — no writes, no state changes.
4 +
5 + function ui::identity::header() {
6 + printf " %-20s %-7s %s\n" "IDENTITY" "PEERS" "DEVICE TYPES"
7 + ui::divider 54
8 + }
9 +
10 + function ui::identity::row() {
11 + local name="${1:-}" peer_count="${2:-}" types="${3:-}"
12 + local types_display="${types//,/, }"
13 + [[ -z "$types_display" ]] && types_display="—"
14 + printf " %-20s %-7s %s\n" "$name" "$peer_count" "$types_display"
15 + }
16 +
17 + function ui::identity::detail_name() {
18 + local name="${1:-}" peer_count="${2:-}"
19 + echo ""
20 + ui::row "Identity" "$name"
21 + ui::row "Peers" "$peer_count"
22 + echo ""
23 + }
24 +
25 + function ui::identity::device_row() {
26 + local peer_name="${1:-}" dev_type="${2:-}" \
27 + dev_index="${3:-1}" status="${4:-}"
28 + local suffix=""
29 + [[ "$dev_index" -gt 1 ]] && suffix=" (#${dev_index})"
30 + printf " · %-24s %-10s%s%s\n" \
31 + "$peer_name" "$dev_type" "$suffix" "$status"
32 + }
33 +
34 + function ui::identity::migrate_create() {
35 + local peer_name="${1:-}" identity_name="${2:-}" \
36 + peer_type="${3:-}" index="${4:-}"
37 + printf " %s %-22s → identity %-14s %-10s #%s\n" \
38 + "$(color::green "+")" "$peer_name" "$identity_name" "$peer_type" "$index"
39 + }
40 +
41 + function ui::identity::migrate_skip() {
42 + local peer_name="${1:-}"
43 + printf " %s %-22s (no convention match)\n" \
44 + "$(color::dim "·")" "$peer_name"
45 + }
46 +
47 + function ui::identity::migrate_summary() {
48 + local created="${1:-0}" skipped="${2:-0}" dry_run="${3:-false}"
49 + echo ""
50 + if [[ "$dry_run" == "true" ]]; then
51 + log::info "Would create entries for ${created} peers (${skipped} skipped)"
52 + else
53 + log::ok "Created identity entries for ${created} peers (${skipped} skipped)"
54 + fi
55 + }
Próximo Anterior