#!/usr/bin/env bash # ui/identity.module.sh — rendering for identity data # All functions pure rendering — no writes, no state changes. function ui::identity::header() { printf " %-20s %-7s %s\n" "IDENTITY" "PEERS" "DEVICE TYPES" ui::divider 54 } function ui::identity::row() { local name="${1:-}" peer_count="${2:-}" types="${3:-}" local types_display="${types//,/, }" [[ -z "$types_display" ]] && types_display="—" printf " %-20s %-7s %s\n" "$name" "$peer_count" "$types_display" } function ui::identity::detail_name() { local name="${1:-}" peer_count="${2:-}" echo "" ui::row "Identity" "$name" ui::row "Peers" "$peer_count" echo "" } function ui::identity::device_row() { local peer_name="${1:-}" dev_type="${2:-}" \ dev_index="${3:-1}" status="${4:-}" local suffix="" [[ "$dev_index" -gt 1 ]] && suffix=" (#${dev_index})" printf " · %-24s %-10s%s%s\n" \ "$peer_name" "$dev_type" "$suffix" "$status" } function ui::identity::migrate_create() { local peer_name="${1:-}" identity_name="${2:-}" \ peer_type="${3:-}" index="${4:-}" printf " %s %-22s → identity %-14s %-10s #%s\n" \ "$(color::green "+")" "$peer_name" "$identity_name" "$peer_type" "$index" } function ui::identity::migrate_skip() { local peer_name="${1:-}" printf " %s %-22s (no convention match)\n" \ "$(color::dim "·")" "$peer_name" } function ui::identity::migrate_summary() { local created="${1:-0}" skipped="${2:-0}" dry_run="${3:-false}" echo "" if [[ "$dry_run" == "true" ]]; then log::info "Would create entries for ${created} peers (${skipped} skipped)" else log::ok "Created identity entries for ${created} peers (${skipped} skipped)" fi }