diff --git a/crates/radicle-cli/examples/rad-node.md b/crates/radicle-cli/examples/rad-node.md index f6a5406d..3be1ef59 100644 --- a/crates/radicle-cli/examples/rad-node.md +++ b/crates/radicle-cli/examples/rad-node.md @@ -15,7 +15,7 @@ node status` command (or just `rad node` for short): ``` $ rad node status -✓ Node is running and listening on [..]. +✓ Node is running with Node ID z6MknSL[..]Vi and listening for inbound connections on [..]. ``` ``` diff --git a/crates/radicle-cli/src/commands/node/control.rs b/crates/radicle-cli/src/commands/node/control.rs index fb4628a4..8876aba6 100644 --- a/crates/radicle-cli/src/commands/node/control.rs +++ b/crates/radicle-cli/src/commands/node/control.rs @@ -263,23 +263,7 @@ pub fn status(node: &Node, profile: &Profile) -> anyhow::Result<()> { term::warning(warning); } - if node.is_running() { - let listen = node - .listen_addrs()? - .into_iter() - .map(|addr| addr.to_string()) - .collect::>(); - - if listen.is_empty() { - term::success!("Node is {}.", term::format::positive("running")); - } else { - term::success!( - "Node is {} and listening on {}.", - term::format::positive("running"), - listen.join(", ") - ); - } - } else { + if !node.is_running() { term::info!("Node is {}.", term::format::negative("stopped")); term::info!( "To start it, run {}.", @@ -288,6 +272,35 @@ pub fn status(node: &Node, profile: &Profile) -> anyhow::Result<()> { return Ok(()); } + let listen = node + .listen_addrs()? + .into_iter() + .map(|addr| addr.to_string()) + .collect::>(); + + let nid = node.nid()?; + let nid = if &nid == profile.id() { + term::format::tertiary(term::format::node_id_human(&nid)) + } else { + term::format::yellow(term::format::node_id_human(&nid)).bold() + }; + + if listen.is_empty() { + term::success!( + "Node is {} with Node ID {} and {} configured to listen for inbound connections.", + term::format::positive("running"), + nid, + term::Paint::new("not").italic() + ); + } else { + term::success!( + "Node is {} with Node ID {} and listening for inbound connections on {}.", + term::format::positive("running"), + nid, + listen.join(", ") + ); + } + let sessions = sessions(node)?; if let Some(table) = sessions { term::blank();