diff options
Diffstat (limited to 'src/bin/ngit/sub_commands')
| -rw-r--r-- | src/bin/ngit/sub_commands/init.rs | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/bin/ngit/sub_commands/init.rs b/src/bin/ngit/sub_commands/init.rs index 021a33e..0554f32 100644 --- a/src/bin/ngit/sub_commands/init.rs +++ b/src/bin/ngit/sub_commands/init.rs | |||
| @@ -430,6 +430,10 @@ pub struct SubCommandArgs { | |||
| 430 | #[clap(long)] | 430 | #[clap(long)] |
| 431 | /// usually root commit but will be more recent commit for forks | 431 | /// usually root commit but will be more recent commit for forks |
| 432 | earliest_unique_commit: Option<String>, | 432 | earliest_unique_commit: Option<String>, |
| 433 | #[clap(long)] | ||
| 434 | /// only publish nostr events to repo relays, not to user or default relays | ||
| 435 | /// (sets nostr.repo-relay-only in local git config) | ||
| 436 | repo_relay_only: bool, | ||
| 433 | } | 437 | } |
| 434 | 438 | ||
| 435 | impl SubCommandArgs { | 439 | impl SubCommandArgs { |
| @@ -444,6 +448,7 @@ impl SubCommandArgs { | |||
| 444 | || !self.other_maintainers.is_empty() | 448 | || !self.other_maintainers.is_empty() |
| 445 | || !self.hashtag.is_empty() | 449 | || !self.hashtag.is_empty() |
| 446 | || self.earliest_unique_commit.is_some() | 450 | || self.earliest_unique_commit.is_some() |
| 451 | || self.repo_relay_only | ||
| 447 | } | 452 | } |
| 448 | } | 453 | } |
| 449 | 454 | ||
| @@ -1266,11 +1271,21 @@ async fn publish_and_finalize( | |||
| 1266 | // Step 5: Publish events | 1271 | // Step 5: Publish events |
| 1267 | client.set_signer(signer).await; | 1272 | client.set_signer(signer).await; |
| 1268 | 1273 | ||
| 1274 | let repo_relay_only = git_repo | ||
| 1275 | .get_git_config_item("nostr.repo-relay-only", None) | ||
| 1276 | .ok() | ||
| 1277 | .flatten() | ||
| 1278 | .is_some_and(|s| s == "true"); | ||
| 1279 | |||
| 1269 | let _ = send_events( | 1280 | let _ = send_events( |
| 1270 | client, | 1281 | client, |
| 1271 | Some(git_repo_path), | 1282 | Some(git_repo_path), |
| 1272 | events, | 1283 | events, |
| 1273 | user_ref.relays.write(), | 1284 | if repo_relay_only { |
| 1285 | vec![] | ||
| 1286 | } else { | ||
| 1287 | user_ref.relays.write() | ||
| 1288 | }, | ||
| 1274 | fields.relays.clone(), | 1289 | fields.relays.clone(), |
| 1275 | !cli.disable_cli_spinners, | 1290 | !cli.disable_cli_spinners, |
| 1276 | false, | 1291 | false, |
| @@ -1522,7 +1537,12 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { | |||
| 1522 | cli_args.interactive, | 1537 | cli_args.interactive, |
| 1523 | )?; | 1538 | )?; |
| 1524 | 1539 | ||
| 1525 | // Phase 6: Build and publish | 1540 | // Phase 6: Persist --repo-relay-only flag to local git config if supplied |
| 1541 | if args.repo_relay_only { | ||
| 1542 | git_repo.save_git_config_item("nostr.repo-relay-only", "true", false)?; | ||
| 1543 | } | ||
| 1544 | |||
| 1545 | // Phase 7: Build and publish | ||
| 1526 | publish_and_finalize( | 1546 | publish_and_finalize( |
| 1527 | fields, | 1547 | fields, |
| 1528 | signer, | 1548 | signer, |