Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Add `rad inspect --sigrefs` command
cloudhead committed 2 years ago
commit 79644941bdfd595456e3b66a7d6630fcac9c7699
parent d3b0483f426f60a36f0c2bd0f8745953429e15d6
2 files changed +25 -0
modified radicle-cli/examples/rad-inspect.md
@@ -29,6 +29,13 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
        └── sigrefs
```

+
And sigrefs:
+

+
```
+
$ rad inspect --sigrefs
+
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi f209c9f68aa689af24220a20462e13ee9dfb2a95
+
```
+

Or display the repository identity's payload and delegates:

```
modified radicle-cli/src/commands/inspect.rs
@@ -12,6 +12,7 @@ use radicle::identity::Id;
use radicle::identity::Identity;
use radicle::node::tracking::Policy;
use radicle::node::AliasStore as _;
+
use radicle::storage::refs::RefsAt;
use radicle::storage::{ReadRepository, ReadStorage};

use crate::terminal as term;
@@ -36,6 +37,7 @@ Options
    --rid        Return the repository identifier (RID)
    --payload    Inspect the repository's identity payload
    --refs       Inspect the repository's refs on the local device
+
    --sigrefs    Inspect the values of `rad/sigrefs` for all remotes of this repository
    --identity   Inspect the identity document
    --visibility Inspect the repository's visibility
    --delegates  Inspect the repository's delegates
@@ -52,6 +54,7 @@ pub enum Target {
    Delegates,
    Identity,
    Visibility,
+
    Sigrefs,
    Policy,
    History,
    #[default]
@@ -95,6 +98,9 @@ impl Args for Options {
                Long("identity") => {
                    target = Target::Identity;
                }
+
                Long("sigrefs") => {
+
                    target = Target::Sigrefs;
+
                }
                Long("rid") => {
                    target = Target::RepoId;
                }
@@ -159,6 +165,18 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
                colorizer().colorize_json_str(&serde_json::to_string_pretty(&project.doc)?)?
            );
        }
+
        Target::Sigrefs => {
+
            for remote in repo.remote_ids()? {
+
                let remote = remote?;
+
                let refs = RefsAt::new(&repo, remote)?;
+

+
                println!(
+
                    "{:<48} {}",
+
                    term::format::tertiary(remote.to_human()),
+
                    term::format::secondary(refs.at)
+
                );
+
            }
+
        }
        Target::Policy => {
            let tracking = profile.tracking()?;
            if let Some(repo) = tracking.repo_policy(&rid)? {