From eccfd6baf3a57448c3ed81569e71a01629efa280 Mon Sep 17 00:00:00 2001 From: Fintan Halpenny Date: Tue, 3 Feb 2026 08:56:49 +0000 Subject: [PATCH] cli: optional message for issue comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The `From for Message` implementation has an interesting interaction between `clap` and how `Message` can be used from the command line. Note that `FromStr` is not implemented for `Message` – which usually what is to be expected for use with `clap`, but in fact, `clap` also allows `From`. This would make `Message` be a required option when using `rad issue comment`. It is not possible to use `default_value_t` because that required an implementation of `Display`, which in this case we do not want to implement. Trying to use `default_value = "Message::Edit"` also would not work – it uses that as the text. So, the solution is to mark it as optional, and default to `Message::Edit` when it is not specified. --- crates/radicle-cli/src/commands/issue/args.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/radicle-cli/src/commands/issue/args.rs b/crates/radicle-cli/src/commands/issue/args.rs index e89023f3..b49e56a8 100644 --- a/crates/radicle-cli/src/commands/issue/args.rs +++ b/crates/radicle-cli/src/commands/issue/args.rs @@ -310,7 +310,7 @@ pub(crate) struct CommentArgs { /// The body of the comment #[arg(long, short)] #[arg(value_name = "MESSAGE")] - message: Message, + message: Option, /// Optionally, the comment to reply to. If not specified, the comment /// will be in reply to the issue itself @@ -441,6 +441,7 @@ impl From for CommentAction { edit, }: CommentArgs, ) -> Self { + let message = message.unwrap_or(Message::Edit); match (reply_to, edit) { (Some(_), Some(_)) => { unreachable!("the argument '--reply-to' cannot be used with '--edit'")