Skip to main content

Module display

Module display 

Source
Expand description

Terminal rendering for DIDs and their display names.

The naming logic itself lives in vta_sdk::display_name — this module is the thin CLI layer on top: ANSI colour, ratatui cells, and the decision about whether a table gets a NAME column at all.

§Usage

A command builds a NameBook from the response it already has, then renders through it:

let mut book = NameBook::new();
book_from_acl(&mut book, &resp.entries);   // one pass, no extra requests
let show_names = book.names_any(resp.entries.iter().map(|e| e.did.as_str()));

The book_from_* helpers are the payoff: filling the book from an ACL listing also names the Created By column, because a granting admin is very often another entry’s subject. No lookup, no round trip.

Structs§

DisplayName
A name for a DID, and the provenance of that name.
NameBook
A DID → name map, populated by the caller from data it already holds.

Enums§

NameSource
Where a display name came from.

Constants§

NAME_HEADER
Column heading for the name column. One constant so every table agrees.
UNNAMED
Placeholder for a row with no name, used only when some other row in the same table has one.

Functions§

book_from_acl
Fill book from an ACL listing.
book_from_contexts
Fill book from a context listing: each context’s name names its DID.
book_from_vta
Best-effort book from the two listings that name DIDs on a VTA: the ACL (subject labels) and the contexts (each context’s name, for its own DID).
book_from_webvh_servers
Fill book from a webvh hosting-server listing.
did_cell
A DID rendered for a fixed-width table cell: shortened, dimmed.
full_display_pairs
Key-value pairs for a --full-display block: a Name line above the DID line, and the DID in full — abbreviating it is the one thing full display exists to avoid.
inline
One-line rendering for prose, confirmations and progress messages: mediator-prod (did:webvh:QmXk…9f2:example.com).
name_cell
A name cell for did.
name_or_did
Plain-text name-or-DID for a fixed-width column.
named_did_cell
A cell for a DID that may carry a name — used where a column holds a reference to some other principal (Created By, Actor, a sender) rather than the row’s own subject, so there is no room for a paired name column. Falls back to the shortened DID.
resolve_agent_names
Whether agent-name resolution was requested.
resolve_agent_names_into
Without the agent-names feature there is nothing to resolve.
set_resolve_agent_names
Register the operator’s --resolve-agent-names choice. Called once at CLI startup.
shorten_did
Shorten a DID for a fixed-width cell while keeping the part that identifies it.