Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: Stabilize sort order of inbox repos
cloudhead committed 2 years ago
commit b477864b83b2c33f211c827ead7026b129031dbd
parent 9576a6496b5a2557c2f7522e42ae5a38c3aa4d31
2 files changed +13 -10
modified radicle-cli/examples/rad-inbox.md
@@ -28,17 +28,17 @@ $ rad inbox --sort-by id

``` ~alice
$ rad inbox --all --sort-by id
+
╭──────────────────────────────────────────────────────────╮
+
│ radicle-git                                              │
+
├──────────────────────────────────────────────────────────┤
+
│ 3   ●   patch   Copyright fixes   [ ... ]   opened   now │
+
╰──────────────────────────────────────────────────────────╯
╭──────────────────────────────────────────────────────────────╮
│ heartwood                                                    │
├──────────────────────────────────────────────────────────────┤
│ 1   ●   issue    No license file    [  ..  ]   opened    now │
│ 2   ●   branch   Change copyright   bob/copy   created   now │
╰──────────────────────────────────────────────────────────────╯
-
╭──────────────────────────────────────────────────────────╮
-
│ radicle-git                                              │
-
├──────────────────────────────────────────────────────────┤
-
│ 3   ●   patch   Copyright fixes   [ ... ]   opened   now │
-
╰──────────────────────────────────────────────────────────╯
```

``` ~alice
modified radicle-cli/src/commands/inbox.rs
@@ -201,12 +201,15 @@ fn list_all<'a>(
    notifs: &notifications::StoreReader,
    storage: &Storage,
) -> anyhow::Result<Vec<term::VStack<'a>>> {
-
    let mut repos = Vec::new();
-
    for repo in storage.repositories()? {
-
        let repo = list_repo(repo.rid, sort_by, notifs, storage)?;
-
        repos.extend(repo.into_iter());
+
    let mut repos = storage.repositories()?;
+
    repos.sort_by_key(|r| r.rid);
+

+
    let mut vstacks = Vec::new();
+
    for repo in repos {
+
        let vstack = list_repo(repo.rid, sort_by, notifs, storage)?;
+
        vstacks.extend(vstack.into_iter());
    }
-
    Ok(repos)
+
    Ok(vstacks)
}

fn list_repo<'a, R: ReadStorage>(