Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli: List issues consistent
Slack Coder committed 3 years ago
commit e0241050f8fb77a1623cb76f8913fc6b031c3a93
parent 3e2cf83f9b3cc5753e75c44fc58d293d011e1d59
1 file changed +23 -13
modified radicle-cli/src/commands/issue.rs
@@ -338,6 +338,24 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
                None => None,
            };

+
            let mut all = Vec::new();
+
            for result in issues.all()? {
+
                let (id, issue, _) = result?;
+

+
                if Some(true) == assignee.map(|a| !issue.assigned().any(|v| v == Did::from(a))) {
+
                    continue;
+
                }
+

+
                all.push((id, issue))
+
            }
+

+
            all.sort_by(|(id1, i1), (id2, i2)| {
+
                let by_timestamp = i2.timestamp().cmp(&i1.timestamp());
+
                let by_id = id1.cmp(id2);
+

+
                by_timestamp.then(by_id)
+
            });
+

            let mut t = term::Table::new(term::table::TableOptions::bordered());
            t.push([
                term::format::dim(String::from("●")),
@@ -350,18 +368,10 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
            ]);
            t.divider();

-
            for result in issues.all()? {
-
                let (id, issue, _) = result?;
-
                let assigned: Vec<_> = issue.assigned().collect();
-
                let state = issue.state();
-

-
                if Some(true) == assignee.map(|a| !assigned.contains(&Did::from(a))) {
-
                    continue;
-
                }
-

-
                let assigned: String = assigned
-
                    .iter()
-
                    .map(|p| term::format::did(p).to_string())
+
            for (id, issue) in all {
+
                let assigned: String = issue
+
                    .assigned()
+
                    .map(|p| term::format::did(&p).to_string())
                    .collect::<Vec<_>>()
                    .join(", ");

@@ -369,7 +379,7 @@ pub fn run(options: Options, ctx: impl term::Context) -> anyhow::Result<()> {
                tags.sort();

                t.push([
-
                    match state {
+
                    match issue.state() {
                        State::Open => term::format::positive("●").into(),
                        State::Closed { .. } => term::format::negative("●").into(),
                    },