upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/src/sub_commands/init.rs
diff options
context:
space:
mode:
authorDanConwayDev <DanConwayDev@protonmail.com>2024-02-23 14:23:26 +0000
committerDanConwayDev <DanConwayDev@protonmail.com>2024-02-23 14:23:26 +0000
commitd3bf05365ff2d360d53abe2324f42d98f0c1779c (patch)
treec409f9d98e0cc6deb49489a98d3a55c4fc20722b /src/sub_commands/init.rs
parentd5284b758661c491e6a206570763f2982424b70a (diff)
feat(init): improve copy order
move instruction to commit and push maintainers.yaml to end of file
Diffstat (limited to 'src/sub_commands/init.rs')
-rw-r--r--src/sub_commands/init.rs47
1 files changed, 23 insertions, 24 deletions
diff --git a/src/sub_commands/init.rs b/src/sub_commands/init.rs
index 54b6156..4f098c0 100644
--- a/src/sub_commands/init.rs
+++ b/src/sub_commands/init.rs
@@ -279,28 +279,6 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
279 } 279 }
280 }; 280 };
281 281
282 // if yaml file doesnt exist or needs updating
283 if match &repo_config_result {
284 Ok(config) => {
285 !(extract_pks(config.maintainers.clone())?.eq(&maintainers)
286 && config.relays.eq(&relays))
287 }
288 Err(_) => true,
289 } {
290 save_repo_config_to_yaml(&git_repo, maintainers.clone(), relays.clone())?;
291 println!(
292 "maintainers.yaml {}. commit and push.",
293 if repo_config_result.is_err() {
294 "created"
295 } else {
296 "updated"
297 }
298 );
299 println!(
300 "this enables existing contributors to automatically fetch your repo event (instead of one from a pubkey pretending to be the maintainer)"
301 );
302 }
303
304 println!("publishing repostory reference..."); 282 println!("publishing repostory reference...");
305 283
306 let repo_event = RepoRef { 284 let repo_event = RepoRef {
@@ -311,7 +289,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
311 git_server, 289 git_server,
312 web, 290 web,
313 relays: relays.clone(), 291 relays: relays.clone(),
314 maintainers, 292 maintainers: maintainers.clone(),
315 } 293 }
316 .to_event(&keys)?; 294 .to_event(&keys)?;
317 295
@@ -319,10 +297,31 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> {
319 &client, 297 &client,
320 vec![repo_event], 298 vec![repo_event],
321 user_ref.relays.write(), 299 user_ref.relays.write(),
322 relays, 300 relays.clone(),
323 !cli_args.disable_cli_spinners, 301 !cli_args.disable_cli_spinners,
324 ) 302 )
325 .await?; 303 .await?;
326 304
305 // if yaml file doesnt exist or needs updating
306 if match &repo_config_result {
307 Ok(config) => {
308 !(extract_pks(config.maintainers.clone())?.eq(&maintainers)
309 && config.relays.eq(&relays))
310 }
311 Err(_) => true,
312 } {
313 save_repo_config_to_yaml(&git_repo, maintainers.clone(), relays.clone())?;
314 println!(
315 "maintainers.yaml {}. commit and push.",
316 if repo_config_result.is_err() {
317 "created"
318 } else {
319 "updated"
320 }
321 );
322 println!(
323 "this optional file enables existing contributors to automatically fetch your repo event (instead of one from a pubkey pretending to be the maintainer)"
324 );
325 }
327 Ok(()) 326 Ok(())
328} 327}