cli: Improve `rad sync status` output
To make it less confusing, clearly mark the local node and don't show sync status for it.
This commit is contained in:
parent
5e3990d411
commit
67c950954d
|
|
@ -7,18 +7,16 @@ For instance let's create an issue and sync it with the network:
|
|||
$ rad issue open --title "Test `rad sync`" --description "Check that the command works" -q --no-announce
|
||||
```
|
||||
|
||||
If we check the sync status, we see that our peers are out of sync:
|
||||
Our own node is also out of sync, since we used `--no-announce`.
|
||||
It isn't aware of the updates to the repo.
|
||||
If we check the sync status, we see that our peers are out of sync.
|
||||
|
||||
```
|
||||
$ rad sync status --sort-by alias
|
||||
╭──────────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ● NID Alias Address Status At Timestamp │
|
||||
│ ● Node Address Status Tip Timestamp │
|
||||
├──────────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● z6MknSL…StBU8Vi alice alice.radicle.xyz:8776 out-of-sync f209c9f [ ... ] │
|
||||
│ ● z6Mkt67…v4N1tRk bob bob.radicle.xyz:8776 out-of-sync f209c9f [ ... ] │
|
||||
│ ● z6Mkux1…nVhib7Z eve eve.radicle.xyz:8776 out-of-sync f209c9f [ ... ] │
|
||||
│ ● alice (you) alice.radicle.xyz:8776 f209c9f [ ... ] │
|
||||
│ ● bob z6Mkt67…v4N1tRk bob.radicle.xyz:8776 out-of-sync f209c9f [ ... ] │
|
||||
│ ● eve z6Mkux1…nVhib7Z eve.radicle.xyz:8776 out-of-sync f209c9f [ ... ] │
|
||||
╰──────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
|
|
@ -78,10 +76,10 @@ We can check the sync status again to make sure everything's in sync:
|
|||
```
|
||||
$ rad sync status --sort-by alias
|
||||
╭─────────────────────────────────────────────────────────────────────────────────────╮
|
||||
│ ● NID Alias Address Status At Timestamp │
|
||||
│ ● Node Address Status Tip Timestamp │
|
||||
├─────────────────────────────────────────────────────────────────────────────────────┤
|
||||
│ ● z6MknSL…StBU8Vi alice alice.radicle.xyz:8776 synced 9f615f9 [ ... ] │
|
||||
│ ● z6Mkt67…v4N1tRk bob bob.radicle.xyz:8776 synced 9f615f9 [ ... ] │
|
||||
│ ● z6Mkux1…nVhib7Z eve eve.radicle.xyz:8776 synced 9f615f9 [ ... ] │
|
||||
│ ● alice (you) alice.radicle.xyz:8776 9f615f9 [ ... ] │
|
||||
│ ● bob z6Mkt67…v4N1tRk bob.radicle.xyz:8776 synced 9f615f9 [ ... ] │
|
||||
│ ● eve z6Mkux1…nVhib7Z eve.radicle.xyz:8776 synced 9f615f9 [ ... ] │
|
||||
╰─────────────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ $ rad ls
|
|||
╰───────────────────────────────────────────────────────────────────────────────────────────────────────────╯
|
||||
```
|
||||
|
||||
We could stop seeding it if didn't want other nodes to fetch it from us:
|
||||
We could stop seeding it if we didn't want other nodes to fetch it from us:
|
||||
|
||||
```
|
||||
$ rad seed --delete rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ use radicle_term::Element;
|
|||
|
||||
use crate::terminal as term;
|
||||
use crate::terminal::args::{Args, Error, Help};
|
||||
use crate::terminal::format::Author;
|
||||
use crate::terminal::{Table, TableOptions};
|
||||
|
||||
pub const HELP: Help = Help {
|
||||
|
|
@ -316,11 +317,11 @@ fn sync_status(
|
|||
|
||||
table.push([
|
||||
term::format::dim(String::from("●")).into(),
|
||||
term::format::bold(String::from("NID")).into(),
|
||||
term::format::bold(String::from("Alias")).into(),
|
||||
term::format::bold(String::from("Node")).into(),
|
||||
term::Label::blank(),
|
||||
term::format::bold(String::from("Address")).into(),
|
||||
term::format::bold(String::from("Status")).into(),
|
||||
term::format::bold(String::from("At")).into(),
|
||||
term::format::bold(String::from("Tip")).into(),
|
||||
term::format::bold(String::from("Timestamp")).into(),
|
||||
]);
|
||||
table.divider();
|
||||
|
|
@ -331,13 +332,13 @@ fn sync_status(
|
|||
let (icon, status, head, time) = match seed.sync {
|
||||
Some(SyncStatus::Synced { at }) => (
|
||||
term::format::positive("●"),
|
||||
term::format::positive("synced"),
|
||||
term::format::positive(if seed.nid != local { "synced" } else { "" }),
|
||||
term::format::oid(at.oid),
|
||||
term::format::timestamp(at.timestamp),
|
||||
),
|
||||
Some(SyncStatus::OutOfSync { remote, .. }) => (
|
||||
term::format::negative("●"),
|
||||
term::format::negative("out-of-sync"),
|
||||
term::format::negative(if seed.nid != local { "out-of-sync" } else { "" }),
|
||||
term::format::oid(remote.oid),
|
||||
term::format::timestamp(remote.timestamp),
|
||||
),
|
||||
|
|
@ -355,15 +356,12 @@ fn sync_status(
|
|||
.map(|a| a.addr.to_string())
|
||||
.unwrap_or_default()
|
||||
.into();
|
||||
let alias = aliases
|
||||
.alias(&seed.nid)
|
||||
.map(|a| a.to_string())
|
||||
.unwrap_or_default();
|
||||
let (alias, nid) = Author::new(&seed.nid, profile).labels();
|
||||
|
||||
table.push([
|
||||
icon.into(),
|
||||
term::format::primary(term::format::node(&seed.nid)).into(),
|
||||
term::format::primary(alias).dim().into(),
|
||||
alias,
|
||||
nid,
|
||||
addr,
|
||||
status.into(),
|
||||
term::format::secondary(head).into(),
|
||||
|
|
|
|||
Loading…
Reference in New Issue