cli: Give hint on how to start node, when stopped

Also enable some tests that were disabled.
This commit is contained in:
Alexis Sellier 2023-07-15 14:43:28 +02:00
parent b827c6bc54
commit edd70b701e
No known key found for this signature in database
2 changed files with 23 additions and 17 deletions

View File

@ -2,22 +2,20 @@ The radicle node is our daemon friend that is running as a background
process. It allows us to interact with the network as well as storing
some key data that we may be interested in.
<details>
<summary>🚧 `rad node start` is under construction 🚧</summary>
If the node is not running we can start it by using the `rad node
start` command:
<!-- ``` -->
<!-- $ rad node start -->
<!-- ``` -->
</details>
```
$ rad node start
✓ Node is already running.
```
We can confirm the status of the node at any time by using the `rad
node status` command (or just `rad node` for short):
```
$ rad node status
✓ Node is running
✓ Node is running.
```
The node also allows us to connect with other nodes in the
@ -79,13 +77,17 @@ $ rad node routing
╰─────────────────────────────────────────────────────╯
```
<details>
<summary>🚧 `rad node stop` is under construction 🚧</summary>
Finally, if we want to stop the daemon process from running we can
issue the `rad node stop` command:
<!-- ``` -->
<!-- $ rad node stop -->
<!-- Stopping the node... -->
<!-- ``` -->
</details>
```
$ rad node stop
✓ Stopping node...
```
Running the command again gives us an error:
```
$ rad node stop
✗ Stopping node... error: node is not running
```

View File

@ -21,7 +21,7 @@ pub fn start(
profile: &Profile,
) -> anyhow::Result<()> {
if node.is_running() {
term::success!("Node is already running");
term::success!("Node is already running.");
return Ok(());
}
let envs = if profile.keystore.is_encrypted()? {
@ -142,9 +142,13 @@ pub fn connect(node: &mut Node, nid: NodeId, addr: Address) -> anyhow::Result<()
pub fn status(node: &Node, profile: &Profile) -> anyhow::Result<()> {
if node.is_running() {
term::success!("Node is {}", term::format::positive("running"));
term::success!("Node is {}.", term::format::positive("running"));
} else {
term::info!("Node is {}", term::format::negative("stopped"));
term::info!("Node is {}.", term::format::negative("stopped"));
term::info!(
"To start it, run {}.",
term::format::command("rad node start")
);
return Ok(());
}