From fe5addc2a61022824e83c3523a83fce7690ca8e8 Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Tue, 17 Feb 2026 10:42:33 +0000 Subject: feat: add push-options for title and description to git-remote-nostr Allows setting PR title and description via git push options: git push --push-option=title="My PR" \ --push-option=description="Details" origin pr/branch --- src/bin/git_remote_nostr/main.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'src/bin/git_remote_nostr/main.rs') diff --git a/src/bin/git_remote_nostr/main.rs b/src/bin/git_remote_nostr/main.rs index d7151d8..e57dff7 100644 --- a/src/bin/git_remote_nostr/main.rs +++ b/src/bin/git_remote_nostr/main.rs @@ -24,6 +24,12 @@ use nostr::nips::nip19::Nip19Coordinate; use crate::{client::Client, git::Repo}; +#[derive(Default, Clone)] +struct PushOptions { + title: Option, + description: Option, +} + mod fetch; mod list; mod push; @@ -71,6 +77,7 @@ async fn main() -> Result<()> { let mut line = String::new(); let mut list_outputs = None; + let mut push_options: PushOptions = PushOptions::default(); loop { let tokens = read_line(&stdin, &mut line)?; @@ -79,11 +86,23 @@ async fn main() -> Result<()> { println!("option"); println!("push"); println!("fetch"); + println!("push-options"); println!(); } ["option", "verbosity"] => { println!("ok"); } + ["option", "push-option", rest @ ..] => { + let option = rest.join(" "); + if let Some((key, value)) = option.split_once('=') { + match key { + "title" => push_options.title = Some(value.to_string()), + "description" => push_options.description = Some(value.to_string()), + _ => {} + } + } + println!("ok"); + } ["option", ..] => { println!("unsupported"); } @@ -98,8 +117,10 @@ async fn main() -> Result<()> { refspec, &client, list_outputs.clone(), + push_options.title.as_ref().zip(push_options.description.as_ref()).map(|(t, d)| (t.clone(), d.clone())), ) .await?; + push_options = PushOptions::default(); } ["list"] => { list_outputs = Some(list::run_list(&git_repo, &repo_ref, false).await?); -- cgit v1.2.3