cli: Add `rad inspect --sigrefs` command
This commit is contained in:
parent
d3b0483f42
commit
79644941bd
|
|
@ -29,6 +29,13 @@ z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi
|
||||||
└── sigrefs
|
└── sigrefs
|
||||||
```
|
```
|
||||||
|
|
||||||
|
And sigrefs:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ rad inspect --sigrefs
|
||||||
|
z6MknSLrJoTcukLrE435hVNQT4JUhbvWLX4kUzqkEStBU8Vi f209c9f68aa689af24220a20462e13ee9dfb2a95
|
||||||
|
```
|
||||||
|
|
||||||
Or display the repository identity's payload and delegates:
|
Or display the repository identity's payload and delegates:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ use radicle::identity::Id;
|
||||||
use radicle::identity::Identity;
|
use radicle::identity::Identity;
|
||||||
use radicle::node::tracking::Policy;
|
use radicle::node::tracking::Policy;
|
||||||
use radicle::node::AliasStore as _;
|
use radicle::node::AliasStore as _;
|
||||||
|
use radicle::storage::refs::RefsAt;
|
||||||
use radicle::storage::{ReadRepository, ReadStorage};
|
use radicle::storage::{ReadRepository, ReadStorage};
|
||||||
|
|
||||||
use crate::terminal as term;
|
use crate::terminal as term;
|
||||||
|
|
@ -36,6 +37,7 @@ Options
|
||||||
--rid Return the repository identifier (RID)
|
--rid Return the repository identifier (RID)
|
||||||
--payload Inspect the repository's identity payload
|
--payload Inspect the repository's identity payload
|
||||||
--refs Inspect the repository's refs on the local device
|
--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
|
--identity Inspect the identity document
|
||||||
--visibility Inspect the repository's visibility
|
--visibility Inspect the repository's visibility
|
||||||
--delegates Inspect the repository's delegates
|
--delegates Inspect the repository's delegates
|
||||||
|
|
@ -52,6 +54,7 @@ pub enum Target {
|
||||||
Delegates,
|
Delegates,
|
||||||
Identity,
|
Identity,
|
||||||
Visibility,
|
Visibility,
|
||||||
|
Sigrefs,
|
||||||
Policy,
|
Policy,
|
||||||
History,
|
History,
|
||||||
#[default]
|
#[default]
|
||||||
|
|
@ -95,6 +98,9 @@ impl Args for Options {
|
||||||
Long("identity") => {
|
Long("identity") => {
|
||||||
target = Target::Identity;
|
target = Target::Identity;
|
||||||
}
|
}
|
||||||
|
Long("sigrefs") => {
|
||||||
|
target = Target::Sigrefs;
|
||||||
|
}
|
||||||
Long("rid") => {
|
Long("rid") => {
|
||||||
target = Target::RepoId;
|
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)?)?
|
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 => {
|
Target::Policy => {
|
||||||
let tracking = profile.tracking()?;
|
let tracking = profile.tracking()?;
|
||||||
if let Some(repo) = tracking.repo_policy(&rid)? {
|
if let Some(repo) = tracking.repo_policy(&rid)? {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue