diff options
| author | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-04 15:09:54 +0000 |
|---|---|---|
| committer | DanConwayDev <DanConwayDev@protonmail.com> | 2026-03-04 15:09:54 +0000 |
| commit | 7f7827e445029799400aacf69838e26299b6dc10 (patch) | |
| tree | 058871707600f821a45103049d48ad2a31bf19c0 /src/bin/ngit/main.rs | |
| parent | 7dcbdc7841e932570359ccef3b82459b89e6f2bc (diff) | |
fix NIP-22 compliance and add --reply-to flag for issue/PR comments
- Add missing P and p tags (root and parent author pubkeys)
- Fix E tag 4th element to be root pubkey (was empty string)
- Fix e tag 4th element to be parent pubkey (was "reply", a NIP-10 convention)
- Add --reply-to <ID|nevent> flag to both issue and PR comment commands
- When --reply-to is set, look up the parent comment from cache and use it
as the parent scope (e/k/p); root scope (E/K/P) always stays the issue/PR
- When --reply-to is omitted, parent == root (existing top-level behaviour)
Diffstat (limited to 'src/bin/ngit/main.rs')
| -rw-r--r-- | src/bin/ngit/main.rs | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/bin/ngit/main.rs b/src/bin/ngit/main.rs index 2982b61..03a5ce9 100644 --- a/src/bin/ngit/main.rs +++ b/src/bin/ngit/main.rs | |||
| @@ -90,8 +90,19 @@ async fn main() { | |||
| 90 | PrCommands::Ready { id, offline } => { | 90 | PrCommands::Ready { id, offline } => { |
| 91 | sub_commands::pr_status::launch_ready(id, *offline).await | 91 | sub_commands::pr_status::launch_ready(id, *offline).await |
| 92 | } | 92 | } |
| 93 | PrCommands::Comment { id, body, offline } => { | 93 | PrCommands::Comment { |
| 94 | sub_commands::comment::launch_pr_comment(id, body, *offline).await | 94 | id, |
| 95 | body, | ||
| 96 | reply_to, | ||
| 97 | offline, | ||
| 98 | } => { | ||
| 99 | sub_commands::comment::launch_pr_comment( | ||
| 100 | id, | ||
| 101 | body, | ||
| 102 | reply_to.as_deref(), | ||
| 103 | *offline, | ||
| 104 | ) | ||
| 105 | .await | ||
| 95 | } | 106 | } |
| 96 | PrCommands::Merge { | 107 | PrCommands::Merge { |
| 97 | id, | 108 | id, |
| @@ -140,8 +151,19 @@ async fn main() { | |||
| 140 | IssueCommands::Reopen { id, offline } => { | 151 | IssueCommands::Reopen { id, offline } => { |
| 141 | sub_commands::issue_status::launch_reopen(id, *offline).await | 152 | sub_commands::issue_status::launch_reopen(id, *offline).await |
| 142 | } | 153 | } |
| 143 | IssueCommands::Comment { id, body, offline } => { | 154 | IssueCommands::Comment { |
| 144 | sub_commands::comment::launch_issue_comment(id, body, *offline).await | 155 | id, |
| 156 | body, | ||
| 157 | reply_to, | ||
| 158 | offline, | ||
| 159 | } => { | ||
| 160 | sub_commands::comment::launch_issue_comment( | ||
| 161 | id, | ||
| 162 | body, | ||
| 163 | reply_to.as_deref(), | ||
| 164 | *offline, | ||
| 165 | ) | ||
| 166 | .await | ||
| 145 | } | 167 | } |
| 146 | }, | 168 | }, |
| 147 | Commands::Sync(args) => sub_commands::sync::launch(args).await, | 169 | Commands::Sync(args) => sub_commands::sync::launch(args).await, |