Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: `rad seed` output improvement
cloudhead committed 2 years ago
commit e06dd208f4b5728c25ebe1b97b9fe7d034d4be7a
parent 0908c65f504ec56bcb368b3a020ddee5f251eb56
6 files changed +20 -15
modified radicle-cli/examples/rad-block.md
@@ -36,8 +36,8 @@ And a 'block' policy was added:
```
$ rad seed
╭───────────────────────────────────────────────────────╮
-
│ RID                                 Scope      Policy │
+
│ Repository                          Policy   Scope    │
├───────────────────────────────────────────────────────┤
-
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji   followed   block  │
+
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji   block    followed │
╰───────────────────────────────────────────────────────╯
```
modified radicle-cli/examples/rad-node.md
@@ -35,9 +35,9 @@ repository that was already created:
```
$ rad seed
╭───────────────────────────────────────────────────────╮
-
│ RID                                 Scope      Policy │
+
│ Repository                          Policy   Scope    │
├───────────────────────────────────────────────────────┤
-
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji   followed   allow  │
+
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji   allow    followed │
╰───────────────────────────────────────────────────────╯
```

modified radicle-cli/examples/rad-seed-and-follow.md
@@ -30,8 +30,8 @@ We can list the repositories we are seeding by omitting the RID:
```
$ rad seed
╭───────────────────────────────────────────────────────╮
-
│ RID                                 Scope      Policy │
+
│ Repository                          Policy   Scope    │
├───────────────────────────────────────────────────────┤
-
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji   followed   allow  │
+
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji   allow    followed │
╰───────────────────────────────────────────────────────╯
```
modified radicle-cli/src/commands/seed.rs
@@ -177,9 +177,9 @@ pub fn seeding(profile: &Profile) -> anyhow::Result<()> {
    let store = profile.policies()?;
    let mut t = term::Table::new(term::table::TableOptions::bordered());
    t.header([
-
        term::format::default(String::from("RID")),
-
        term::format::default(String::from("Scope")),
+
        term::format::default(String::from("Repository")),
        term::format::default(String::from("Policy")),
+
        term::format::default(String::from("Scope")),
    ]);
    t.divider();

@@ -191,13 +191,9 @@ pub fn seeding(profile: &Profile) -> anyhow::Result<()> {
    {
        let id = id.to_string();
        let scope = scope.to_string();
-
        let policy = policy.to_string();
+
        let policy = term::format::policy(&policy);

-
        t.push([
-
            term::format::highlight(id),
-
            term::format::secondary(scope),
-
            term::format::secondary(policy),
-
        ])
+
        t.push([term::format::tertiary(id), policy, term::format::dim(scope)])
    }

    if t.is_empty() {
modified radicle-cli/src/terminal/format.rs
@@ -7,6 +7,7 @@ pub use radicle_term::{style, Paint};

use radicle::cob::{ObjectId, Timestamp};
use radicle::identity::Visibility;
+
use radicle::node::policy::Policy;
use radicle::node::{Alias, AliasStore, NodeId};
use radicle::prelude::Did;
use radicle::profile::Profile;
@@ -63,6 +64,14 @@ pub fn visibility(v: &Visibility) -> Paint<&str> {
    }
}

+
/// Format a policy.
+
pub fn policy(p: &Policy) -> Paint<String> {
+
    match p {
+
        Policy::Allow => term::format::positive(p.to_string()),
+
        Policy::Block => term::format::negative(p.to_string()),
+
    }
+
}
+

/// Format a timestamp.
pub fn timestamp(time: impl Into<LocalTime>) -> Paint<String> {
    let time: LocalTime = time.into();
modified radicle/src/node/config.rs
@@ -86,7 +86,7 @@ pub struct Limits {
    /// How long to keep a gossip message entry before pruning it.
    #[serde(with = "crate::serde_ext::localtime::duration")]
    pub gossip_max_age: LocalDuration,
-
    /// Maximum number of concurrent fetches per per connection.
+
    /// Maximum number of concurrent fetches per peer connection.
    pub fetch_concurrency: usize,
    /// Maximum number of open files.
    pub max_open_files: usize,