Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Add `--seeds` option to `ls`
cloudhead committed 2 years ago
commit 0a3da17fadadda149035fcf1e715dc575f340ce8
parent 71bba29c9a164e23c102dda5cc19834e79fa840a
3 files changed +16 -4
modified radicle-cli/examples/rad-clone.md
@@ -65,7 +65,7 @@ Date: Mon Jan 1 14:39:16 2018 +0000

Cloned repositories show up in `rad ls`:
```
-
$ rad ls --all
+
$ rad ls --seeds
╭───────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Name        RID                                 Visibility   Head      Description                        │
├───────────────────────────────────────────────────────────────────────────────────────────────────────────┤
modified radicle-cli/examples/rad-unseed.md
@@ -21,6 +21,8 @@ Now, if we run `rad ls`, we see it's gone:
```
$ rad ls
Nothing to show.
+
$ rad ls --seeds
+
Nothing to show.
```

However, with the `--all` flag, we can see it still, but as local-only:
modified radicle-cli/src/commands/ls.rs
@@ -23,7 +23,8 @@ Options

    --private       Show only private repositories
    --public        Show only public repositories
-
    --all           Show all repositories in storage
+
    --seeds, -s     Show all seeded repositories
+
    --all, -a       Show all repositories in storage
    --verbose, -v   Verbose output
    --help          Print help
"#,
@@ -35,6 +36,7 @@ pub struct Options {
    public: bool,
    private: bool,
    all: bool,
+
    seeds: bool,
}

impl Args for Options {
@@ -46,15 +48,19 @@ impl Args for Options {
        let mut private = false;
        let mut public = false;
        let mut all = false;
+
        let mut seeds = false;

        while let Some(arg) = parser.next()? {
            match arg {
                Long("help") | Short('h') => {
                    return Err(Error::Help.into());
                }
-
                Long("all") => {
+
                Long("all") | Short('a') => {
                    all = true;
                }
+
                Long("seeds") | Short('s') => {
+
                    seeds = true;
+
                }
                Long("private") => {
                    private = true;
                }
@@ -72,6 +78,7 @@ impl Args for Options {
                private,
                public,
                all,
+
                seeds,
            },
            vec![],
        ))
@@ -103,7 +110,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
        if !doc.visibility.is_public() && !options.private && options.public {
            continue;
        }
-
        if refs.is_none() && !options.all {
+
        if refs.is_none() && !options.all && !options.seeds {
            continue;
        }
        let seeded = policy.is_seeding(&rid)?;
@@ -111,6 +118,9 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
        if !seeded && !options.all {
            continue;
        }
+
        if !seeded && options.seeds {
+
            continue;
+
        }
        let proj = doc.project()?;
        let head = term::format::oid(head).into();