Radish alpha
h
Radicle Heartwood Protocol & Stack
Radicle
Git (anonymous pull)
Log in to clone via SSH
fixup! Add patch CLI parsing with clap
✗ CI failure Matthias Beyer committed 8 months ago
commit cb34d688533c6e42d0df840f86e823d5b9b3b03b
parent 3e53b8f78a0d1070b665138c065b43d3d9263c85
3 failed 1 pending (4 total) View logs
2 files changed +26 -30
modified crates/radicle-cli/src/commands/patch.rs
@@ -307,20 +307,6 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
            )?;
        }

-
        Some(Command::Comment {
-
            revision_id,
-
            message,
-
            reply_to,
-
        }) => {
-
            comment::run(
-
                revision_id,
-
                message,
-
                reply_to,
-
                options.quiet,
-
                &repository,
-
                &profile,
-
            )?;
-
        }
        Some(Command::Review {
            patch_id,
            revision_id,
@@ -333,6 +319,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
                .map(patch::RevisionId::from);
            review::run(patch_id, revision_id, opts, &profile, &repository)?;
        }
+

        Some(Command::Resolve {
            ref patch_id,
            ref review_id,
@@ -376,7 +363,7 @@ pub fn run(args: Args, ctx: impl term::Context) -> anyhow::Result<()> {
        }
        Some(Command::Label {
            patch_id,
-
            opts: self::args::LabelArgs { add, delete },
+
            opts: self::args::LabelArg { add, delete },
        }) => {
            let patch_id = patch_id.resolve(&repository.backend)?;
            label::run(&patch_id, add, delete, &profile, &repository)?;
modified crates/radicle-cli/src/commands/patch/args.rs
@@ -60,19 +60,6 @@ pub struct ListOptions {
    pub authored: bool,
}

-
#[derive(Debug, clap::Args)]
-
#[group(required = false, multiple = false)]
-
pub struct ResolveOptions {
-
    #[arg(long, group = "cmd-resolve")]
-
    pub review: Option<String>,
-

-
    #[arg(long, group = "cmd-resolve")]
-
    pub comment: Option<String>,
-

-
    #[arg(long, group = "cmd-resolve")]
-
    pub unresolve: bool,
-
}
-

#[derive(Debug, Parser)]
pub struct ReviewOptions {
    #[clap(long, group = "cmd-review")]
@@ -88,6 +75,19 @@ pub struct ReviewOptions {
    pub delete: bool,
}

+
impl From<ReviewOptions> for crate::commands::rad_patch::review::Options {
+
    fn from(value: ReviewOptions) -> Self {
+
        Self {
+
            message: value.message.into(),
+
            op: if value.delete {
+
                crate::commands::rad_patch::review::Operation::Delete
+
            } else {
+
                todo!()
+
            }
+
        }
+
    }
+
}
+

#[derive(Debug, clap::Args)]
#[group(required = false, multiple = false)]
pub struct UpdateMessageArg {
@@ -208,6 +208,9 @@ pub enum Command {
        #[arg(value_name = "PATCH_ID", add = ArgValueCompleter::new(crate::commands::hints::patch_ids_completer))]
        patch_id: Rev,

+
        #[clap(long)]
+
        revision_id: Option<Rev>,
+

        #[clap(flatten)]
        options: ReviewOptions,
    },
@@ -216,8 +219,14 @@ pub enum Command {
        #[arg(value_name = "PATCH_ID", add = ArgValueCompleter::new(crate::commands::hints::patch_ids_completer))]
        patch_id: Rev,

-
        #[clap(flatten)]
-
        options: ResolveOptions,
+
        #[clap(long)]
+
        review_id: Option<Rev>,
+

+
        #[clap(long)]
+
        comment_id: Option<Rev>,
+

+
        #[clap(long)]
+
        undo: bool,
    },

    Delete {