Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Give hint on how to start node, when stopped
Alexis Sellier committed 2 years ago
commit edd70b701eee72cb63dac3ed1919ede2c64c0b20
parent b827c6bc54d2b47b7ff26c1cbe05e78168798c63
2 files changed +23 -17
modified radicle-cli/examples/rad-node.md
@@ -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
+
```
modified radicle-cli/src/commands/node/control.rs
@@ -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(());
    }