Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
cli/issue: Allow list argsuments for empty subcommand
◌ CI pending Erik Kundt committed 7 months ago
commit 9af55b6e4dea49e83a213deec455c9846993a6e5
parent 1314f926ce77d162dd71a442736fd9c5a4d76195
1 pending (1 total) View logs
3 files changed +21 -1
modified crates/radicle-cli/examples/rad-issue-list.md
@@ -49,3 +49,14 @@ $ rad issue list --solved
│ ●   d87dcfe   flux capacitor underpowered   alice    (you)   good-first-issue   alice       now    │
╰────────────────────────────────────────────────────────────────────────────────────────────────────╯
```
+

+
Note: You can achieve the same by omitting the `list` subcommand, since that's the fallback when no subcommand is specified.
+

+
```
+
$ rad issue --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.rs
@@ -41,7 +41,11 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
    };
    let repo = profile.storage.repository_mut(rid)?;

-
    let command = args.command.unwrap_or_default();
+
    // Fallback to [`Command::List`] if no subcommand is provided. Construct it
+
    // with the [`ListArgs`] provided, if any.
+
    let command = args
+
        .command
+
        .unwrap_or(Command::List(args.list.unwrap_or_default()));
    let announce = !args.no_announce && command.should_announce_for();
    let mut issues = term::cob::issues_mut(&profile, &repo)?;

modified crates/radicle-cli/src/commands/issue/args.rs
@@ -58,6 +58,11 @@ pub struct Args {
    #[arg(long, short)]
    #[clap(global = true)]
    pub(crate) verbose: bool,
+

+
    /// Arguments for the `rad issue list` subcommand, which is the fallback
+
    /// when no subcommand is provided.
+
    #[clap(flatten)]
+
    pub(crate) list: Option<ListArgs>,
}

/// Commands to create, view, and edit Radicle issues