Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
REVIEW: Move state arguments for `rad issue` to own arg group
Lorenz Leutgeb committed 7 months ago
commit b2918a34c4813be6f755d83882c6da491a055166
parent 7a6cd1220ddbc771e59c17ab07cc671f6d6d38d7
1 file changed +18 -9
modified crates/radicle-cli/src/commands/issue/args.rs
@@ -218,6 +218,14 @@ pub(crate) struct EmptyArgs {
    #[arg(num_args = 0..=1)]
    pub(crate) assigned: Option<Assigned>,

+
    #[clap(flatten)]
+
    pub(crate) state: Option<EmptyStateArgs>,
+
}
+

+
/// Counterpart to [`ListStateArgs`] for the empty subcommand.
+
#[derive(Parser, Debug)]
+
#[group(id = "state", required = false, multiple = false)]
+
pub(crate) struct EmptyStateArgs {
    /// List all issues
    #[arg(long, group = "state", hide = true)]
    all: bool,
@@ -285,9 +293,9 @@ impl From<ListStateArgs> for Option<State> {
    }
}

-
impl Default for ListStateArgs {
-
    fn default() -> Self {
-
        Self { all: false, open: true, closed: false, solved: false }
+
impl From<EmptyStateArgs> for ListStateArgs {
+
    fn from(args: EmptyStateArgs) -> Self {
+
        Self { all: args.all, open: args.open, closed: args.closed, solved: args.solved }
    }
}

@@ -295,16 +303,17 @@ impl From<EmptyArgs> for ListArgs {
    fn from(args: EmptyArgs) -> Self {
        Self {
            assigned: args.assigned,
-
            state: Some(ListStateArgs {
-
                all: args.all,
-
                open: args.open,
-
                solved: args.solved,
-
                closed: args.closed,
-
            }),
+
            state: args.state.map(Into::into),
        }
    }
}

+
impl Default for ListStateArgs {
+
    fn default() -> Self {
+
        Self { all: false, open: true, closed: false, solved: false }
+
    }
+
}
+

/// Arguments for the [`Command::Comment`] subcommand.
#[derive(Parser, Debug)]
pub(crate) struct CommentArgs {