From d3bf05365ff2d360d53abe2324f42d98f0c1779c Mon Sep 17 00:00:00 2001 From: DanConwayDev Date: Fri, 23 Feb 2024 14:23:26 +0000 Subject: feat(init): improve copy order move instruction to commit and push maintainers.yaml to end of file --- src/sub_commands/init.rs | 47 +++++++++++++++++++++++------------------------ 1 file changed, 23 insertions(+), 24 deletions(-) (limited to 'src') 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<()> { } }; - // if yaml file doesnt exist or needs updating - if match &repo_config_result { - Ok(config) => { - !(extract_pks(config.maintainers.clone())?.eq(&maintainers) - && config.relays.eq(&relays)) - } - Err(_) => true, - } { - save_repo_config_to_yaml(&git_repo, maintainers.clone(), relays.clone())?; - println!( - "maintainers.yaml {}. commit and push.", - if repo_config_result.is_err() { - "created" - } else { - "updated" - } - ); - println!( - "this enables existing contributors to automatically fetch your repo event (instead of one from a pubkey pretending to be the maintainer)" - ); - } - println!("publishing repostory reference..."); let repo_event = RepoRef { @@ -311,7 +289,7 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { git_server, web, relays: relays.clone(), - maintainers, + maintainers: maintainers.clone(), } .to_event(&keys)?; @@ -319,10 +297,31 @@ pub async fn launch(cli_args: &Cli, args: &SubCommandArgs) -> Result<()> { &client, vec![repo_event], user_ref.relays.write(), - relays, + relays.clone(), !cli_args.disable_cli_spinners, ) .await?; + // if yaml file doesnt exist or needs updating + if match &repo_config_result { + Ok(config) => { + !(extract_pks(config.maintainers.clone())?.eq(&maintainers) + && config.relays.eq(&relays)) + } + Err(_) => true, + } { + save_repo_config_to_yaml(&git_repo, maintainers.clone(), relays.clone())?; + println!( + "maintainers.yaml {}. commit and push.", + if repo_config_result.is_err() { + "created" + } else { + "updated" + } + ); + println!( + "this optional file enables existing contributors to automatically fetch your repo event (instead of one from a pubkey pretending to be the maintainer)" + ); + } Ok(()) } -- cgit v1.2.3