Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli/self: Stop printing information about the node
◌ CI pending Lorenz Leutgeb committed 8 months ago
commit f00d1d67432882bef11fc940601f071efe55c88d
parent e1af550a0907304c2c520d6a49fc8c6185996948
3 passed 1 pending (4 total) View logs
6 files changed +36 -57
modified build/upload
@@ -7,7 +7,7 @@ SSH_KEY="$(rad path)/keys/radicle"

main() {
  version="$(build/version)"
-
  nid="$(rad self --nid)"
+
  nid="$(rad self --did | cut -d: -f3-)"
  rad_url="$(rad . | sed s/rad:/rad:\\/\\//)"
  rad_remote="$rad_url/$nid"

modified crates/radicle-cli/examples/rad-self.md
@@ -3,17 +3,17 @@ device and node.

```
$ rad self
-
Alias           alice
-
DID             did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
-
└╴Node ID (NID) z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
-
SSH             not running
-
├╴Key (hash)    SHA256:UIedaL6Cxm6OUErh9GQUzzglSk7VpQlVTI1TAFB/HWA
-
└╴Key (full)    ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHahWSBEpuT1ESZbynOmBNkLBSnR32Ar4woZqSV2YNH1
-
Home            [..]/home/alice/.radicle
-
├╴Config        [..]/home/alice/.radicle/config.json
-
├╴Storage       [..]/home/alice/.radicle/storage
-
├╴Keys          [..]/home/alice/.radicle/keys
-
└╴Node          [..]/home/alice/.radicle/node
+
Alias        alice
+
DID          did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
+
Node         not running
+
SSH          not running
+
├╴Key (hash) SHA256:UIedaL6Cxm6OUErh9GQUzzglSk7VpQlVTI1TAFB/HWA
+
└╴Key (full) ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIHahWSBEpuT1ESZbynOmBNkLBSnR32Ar4woZqSV2YNH1
+
Home         [..]/home/alice/.radicle
+
├╴Config     [..]/home/alice/.radicle/config.json
+
├╴Storage    [..]/home/alice/.radicle/storage
+
├╴Keys       [..]/home/alice/.radicle/keys
+
└╴Node       [..]/home/alice/.radicle/node
```

If you need to display only your DID, Node ID, or SSH Public Key, you can use
@@ -26,6 +26,7 @@ did:key:z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi

```
$ rad self --nid
+
! Warning: The option `--nid` is deprecated, please use `rad node status` instead.
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
```

modified crates/radicle-cli/src/commands/self.rs
@@ -1,7 +1,8 @@
use std::ffi::OsString;

use radicle::crypto::ssh;
-
use radicle::Profile;
+
use radicle::node::Handle as _;
+
use radicle::{Node, Profile};

use crate::terminal as term;
use crate::terminal::args::{Args, Error, Help};
@@ -20,7 +21,6 @@ Options

    --did                Show your DID
    --alias              Show your Node alias
-
    --nid                Show your Node ID (NID)
    --home               Show your Radicle home
    --config             Show the location of your configuration file
    --ssh-key            Show your public key in OpenSSH format
@@ -100,7 +100,15 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
            term::print(profile.config.alias());
        }
        Show::NodeId => {
-
            term::print(profile.id());
+
            term::warning(
+
                "The option `--nid` is deprecated, please use `rad node status` instead.",
+
            );
+
            term::print(
+
                Node::new(profile.socket())
+
                    .nid()
+
                    .ok()
+
                    .unwrap_or_else(|| *profile.id()),
+
            );
        }
        Show::Did => {
            term::print(profile.did());
@@ -137,11 +145,13 @@ fn all(profile: &Profile) -> anyhow::Result<()> {
        term::format::tertiary(did).into(),
    ]);

-
    let node_id = profile.id();
-
    table.push([
-
        term::format::style("└╴Node ID (NID)").into(),
-
        term::format::tertiary(node_id).into(),
-
    ]);
+
    let socket = profile.socket();
+
    let node = if Node::new(&socket).is_running() {
+
        term::format::positive(format!("running ({})", socket.display()))
+
    } else {
+
        term::format::negative("not running".to_string())
+
    };
+
    table.push([term::format::style("Node").into(), node.to_string().into()]);

    let ssh_agent = match ssh::agent::Agent::connect() {
        Ok(c) => term::format::positive(format!(
@@ -158,13 +168,14 @@ fn all(profile: &Profile) -> anyhow::Result<()> {
        ssh_agent.to_string().into(),
    ]);

-
    let ssh_short = ssh::fmt::fingerprint(node_id);
+
    let id = profile.id();
+
    let ssh_short = ssh::fmt::fingerprint(id);
    table.push([
        term::format::style("├╴Key (hash)").into(),
        term::format::tertiary(ssh_short).into(),
    ]);

-
    let ssh_long = ssh::fmt::key(node_id);
+
    let ssh_long = ssh::fmt::key(id);
    table.push([
        term::format::style("└╴Key (full)").into(),
        term::format::tertiary(ssh_long).into(),
modified crates/radicle-cli/src/commands/watch.rs
@@ -26,7 +26,7 @@ Options

        --repo      <rid>       The repository to watch (default: `rad .`)
        --node      <nid>       The namespace under which this reference exists
-
                                (default: `rad self --nid`)
+
                                (default: NID of the profile)
    -r, --ref       <ref>       The fully-qualified Git reference (branch, tag, etc.) to watch,
                                eg. 'refs/heads/master'
    -t, --target    <oid>       The target OID (commit hash) that when reached,
modified rad.1.adoc
@@ -115,7 +115,7 @@ For example, to connect to a community node, you can run:

The argument given to *connect* is called a node _address_. It is composed of
a Node ID (NID), followed by an *@* symbol, and the _host_ name and _port_.
-
You can display your NID with *rad self --nid*.
+
You can display your NID with *rad node status*.

To make these connections permanent, such that they are always tried on
startup, add the addresses to your configuration file at
deleted scripts/delete-remote-refs.sh
@@ -1,33 +0,0 @@
-
#!/bin/sh
-

-
set -e
-

-
if [ "$#" -lt 2 ]; then
-
  printf "usage: %s <rid> <nid>\n" "$(basename "$0")"
-
  exit 1
-
fi
-

-
RAD_HOME=${RAD_HOME:-"$HOME/.radicle"}
-
REPO=$(echo "$1" | sed 's/rad://')
-
REMOTE=$2
-

-
if [ "$REMOTE" = "$(rad self --nid)" ]; then
-
  echo "Error: refusing to delete your own remote"
-
  exit 1
-
fi
-

-
cd "$RAD_HOME/storage/$REPO"
-

-
refs=$(git for-each-ref --format="%(refname)")
-
pattern="refs/namespaces/$2/refs/*"
-

-
for ref in $refs; do
-
  case "$ref" in
-
    "$pattern" )
-
      git update-ref -d "$ref"
-
      printf 'Deleted %s\n' "$ref"
-
      ;;
-
  esac
-
done
-

-
git gc