mirror of
https://seed.radicle.dev/rad:z3gqcJUoA1n9HaHKufZs5FCSGazv5.git
synced 2026-11-29 14:00:31 +08:00
term: Add border support for tables
This commit is contained in:
@@ -4,15 +4,13 @@ use crate::terminal as term;
|
||||
use crate::terminal::Element;
|
||||
|
||||
pub fn run<S: node::routing::Store>(routing: &S) -> anyhow::Result<()> {
|
||||
let mut t = term::Table::new(term::table::TableOptions::default());
|
||||
let mut t = term::Table::new(term::table::TableOptions::bordered());
|
||||
t.push([
|
||||
term::format::default(String::from("RID")),
|
||||
term::format::default(String::from("NID")),
|
||||
]);
|
||||
t.push([
|
||||
term::format::default(String::from("---")),
|
||||
term::format::default(String::from("---")),
|
||||
]);
|
||||
t.divider();
|
||||
|
||||
for (id, node) in routing.entries()? {
|
||||
t.push([
|
||||
term::format::highlight(id.to_string()),
|
||||
|
||||
@@ -15,17 +15,14 @@ pub fn run(store: &tracking::store::Config, mode: TrackingMode) -> anyhow::Resul
|
||||
}
|
||||
|
||||
fn print_repos(store: &tracking::store::Config) -> anyhow::Result<()> {
|
||||
let mut t = term::Table::new(term::table::TableOptions::default());
|
||||
let mut t = term::Table::new(term::table::TableOptions::bordered());
|
||||
t.push([
|
||||
term::format::default(String::from("RID")),
|
||||
term::format::default(String::from("Scope")),
|
||||
term::format::default(String::from("Policy")),
|
||||
]);
|
||||
t.push([
|
||||
term::format::default(String::from("---")),
|
||||
term::format::default(String::from("-----")),
|
||||
term::format::default(String::from("------")),
|
||||
]);
|
||||
t.divider();
|
||||
|
||||
for tracking::Repo { id, scope, policy } in store.repo_policies()? {
|
||||
let id = id.to_string();
|
||||
let scope = scope.to_string();
|
||||
@@ -43,17 +40,14 @@ fn print_repos(store: &tracking::store::Config) -> anyhow::Result<()> {
|
||||
}
|
||||
|
||||
fn print_nodes(store: &tracking::store::Config) -> anyhow::Result<()> {
|
||||
let mut t = term::Table::new(term::table::TableOptions::default());
|
||||
let mut t = term::Table::new(term::table::TableOptions::bordered());
|
||||
t.push([
|
||||
term::format::default(String::from("DID")),
|
||||
term::format::default(String::from("Alias")),
|
||||
term::format::default(String::from("Policy")),
|
||||
]);
|
||||
t.push([
|
||||
term::format::default(String::from("---")),
|
||||
term::format::default(String::from("-----")),
|
||||
term::format::default(String::from("------")),
|
||||
]);
|
||||
t.divider();
|
||||
|
||||
for tracking::Node { id, alias, policy } in store.node_policies()? {
|
||||
t.push([
|
||||
term::format::highlight(Did::from(id).to_string()),
|
||||
|
||||
Reference in New Issue
Block a user