cli: `rad seed` output improvement
Better colors, and re-order fields to have policy before scope.
This commit is contained in:
parent
0908c65f50
commit
e06dd208f4
|
|
@ -36,8 +36,8 @@ And a 'block' policy was added:
|
||||||
```
|
```
|
||||||
$ rad seed
|
$ rad seed
|
||||||
╭───────────────────────────────────────────────────────╮
|
╭───────────────────────────────────────────────────────╮
|
||||||
│ RID Scope Policy │
|
│ Repository Policy Scope │
|
||||||
├───────────────────────────────────────────────────────┤
|
├───────────────────────────────────────────────────────┤
|
||||||
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji followed block │
|
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji block followed │
|
||||||
╰───────────────────────────────────────────────────────╯
|
╰───────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -35,9 +35,9 @@ repository that was already created:
|
||||||
```
|
```
|
||||||
$ rad seed
|
$ rad seed
|
||||||
╭───────────────────────────────────────────────────────╮
|
╭───────────────────────────────────────────────────────╮
|
||||||
│ RID Scope Policy │
|
│ Repository Policy Scope │
|
||||||
├───────────────────────────────────────────────────────┤
|
├───────────────────────────────────────────────────────┤
|
||||||
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji followed allow │
|
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji allow followed │
|
||||||
╰───────────────────────────────────────────────────────╯
|
╰───────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,8 @@ We can list the repositories we are seeding by omitting the RID:
|
||||||
```
|
```
|
||||||
$ rad seed
|
$ rad seed
|
||||||
╭───────────────────────────────────────────────────────╮
|
╭───────────────────────────────────────────────────────╮
|
||||||
│ RID Scope Policy │
|
│ Repository Policy Scope │
|
||||||
├───────────────────────────────────────────────────────┤
|
├───────────────────────────────────────────────────────┤
|
||||||
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji followed allow │
|
│ rad:z42hL2jL4XNk6K8oHQaSWfMgCL7ji allow followed │
|
||||||
╰───────────────────────────────────────────────────────╯
|
╰───────────────────────────────────────────────────────╯
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -177,9 +177,9 @@ pub fn seeding(profile: &Profile) -> anyhow::Result<()> {
|
||||||
let store = profile.policies()?;
|
let store = profile.policies()?;
|
||||||
let mut t = term::Table::new(term::table::TableOptions::bordered());
|
let mut t = term::Table::new(term::table::TableOptions::bordered());
|
||||||
t.header([
|
t.header([
|
||||||
term::format::default(String::from("RID")),
|
term::format::default(String::from("Repository")),
|
||||||
term::format::default(String::from("Scope")),
|
|
||||||
term::format::default(String::from("Policy")),
|
term::format::default(String::from("Policy")),
|
||||||
|
term::format::default(String::from("Scope")),
|
||||||
]);
|
]);
|
||||||
t.divider();
|
t.divider();
|
||||||
|
|
||||||
|
|
@ -191,13 +191,9 @@ pub fn seeding(profile: &Profile) -> anyhow::Result<()> {
|
||||||
{
|
{
|
||||||
let id = id.to_string();
|
let id = id.to_string();
|
||||||
let scope = scope.to_string();
|
let scope = scope.to_string();
|
||||||
let policy = policy.to_string();
|
let policy = term::format::policy(&policy);
|
||||||
|
|
||||||
t.push([
|
t.push([term::format::tertiary(id), policy, term::format::dim(scope)])
|
||||||
term::format::highlight(id),
|
|
||||||
term::format::secondary(scope),
|
|
||||||
term::format::secondary(policy),
|
|
||||||
])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if t.is_empty() {
|
if t.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ pub use radicle_term::{style, Paint};
|
||||||
|
|
||||||
use radicle::cob::{ObjectId, Timestamp};
|
use radicle::cob::{ObjectId, Timestamp};
|
||||||
use radicle::identity::Visibility;
|
use radicle::identity::Visibility;
|
||||||
|
use radicle::node::policy::Policy;
|
||||||
use radicle::node::{Alias, AliasStore, NodeId};
|
use radicle::node::{Alias, AliasStore, NodeId};
|
||||||
use radicle::prelude::Did;
|
use radicle::prelude::Did;
|
||||||
use radicle::profile::Profile;
|
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.
|
/// Format a timestamp.
|
||||||
pub fn timestamp(time: impl Into<LocalTime>) -> Paint<String> {
|
pub fn timestamp(time: impl Into<LocalTime>) -> Paint<String> {
|
||||||
let time: LocalTime = time.into();
|
let time: LocalTime = time.into();
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ pub struct Limits {
|
||||||
/// How long to keep a gossip message entry before pruning it.
|
/// How long to keep a gossip message entry before pruning it.
|
||||||
#[serde(with = "crate::serde_ext::localtime::duration")]
|
#[serde(with = "crate::serde_ext::localtime::duration")]
|
||||||
pub gossip_max_age: LocalDuration,
|
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,
|
pub fetch_concurrency: usize,
|
||||||
/// Maximum number of open files.
|
/// Maximum number of open files.
|
||||||
pub max_open_files: usize,
|
pub max_open_files: usize,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue