Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli/issue: Fix list state filtering
Erik Kundt committed 7 months ago
commit 1314f926ce77d162dd71a442736fd9c5a4d76195
parent bb2f5b6ff2f999c5c0191ba1395c75f2b46b2684
2 files changed +20 -12
modified crates/radicle-cli/examples/rad-issue-list.md
@@ -38,3 +38,14 @@ It will not show up in the list of open issues anymore.
```
$ rad issue list
```
+

+
Instead, it will now show up in the list of solved issues.
+

+
```
+
$ rad issue list --solved
+
╭────────────────────────────────────────────────────────────────────────────────────────────────────╮
+
│ ●   ID        Title                         Author           Labels             Assignees   Opened │
+
├────────────────────────────────────────────────────────────────────────────────────────────────────┤
+
│ ●   d87dcfe   flux capacitor underpowered   alice    (you)   good-first-issue   alice       now    │
+
╰────────────────────────────────────────────────────────────────────────────────────────────────────╯
+
```
modified crates/radicle-cli/src/commands/issue/args.rs
@@ -226,7 +226,6 @@ pub(crate) struct ListArgs {

    /// List only open issues (default)
    #[arg(long, group = "state")]
-
    #[arg(default_value = "true")]
    open: bool,

    /// List only closed issues
@@ -239,19 +238,17 @@ pub(crate) struct ListArgs {
}

impl From<ListArgs> for Option<State> {
-
    fn from(value: ListArgs) -> Self {
-
        if value.open {
-
            Some(State::Open)
-
        } else if value.closed {
-
            Some(State::Closed {
+
    fn from(args: ListArgs) -> Self {
+
        match (args.all, args.open, args.closed, args.solved) {
+
            (true, _, _, _) => None,
+
            (_, true, _, _) => Some(State::Open),
+
            (_, _, true, _) => Some(State::Closed {
                reason: CloseReason::Other,
-
            })
-
        } else if value.solved {
-
            Some(State::Closed {
+
            }),
+
            (_, _, _, true) => Some(State::Closed {
                reason: CloseReason::Solved,
-
            })
-
        } else {
-
            None
+
            }),
+
            _ => Some(State::Open),
        }
    }
}