From cd0eee8b2078d8dd2d77d7241d18639ae2f84309 Mon Sep 17 00:00:00 2001 From: lol Date: Tue, 20 Feb 2024 15:47:51 +0100 Subject: [PATCH] refactor(clone): set remote in config --- src/commands/clone.rs | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/commands/clone.rs b/src/commands/clone.rs index b384948..e2bb303 100644 --- a/src/commands/clone.rs +++ b/src/commands/clone.rs @@ -59,11 +59,15 @@ pub fn clone(args: CloneArgs) { std::process::exit(1); } else { init::init(); - let mut remote_config = api_props.username.clone(); - remote_config.push_str("@"); - remote_config.push_str(api_props.host.strip_prefix("https://").unwrap()); - remote_config.push_str(&api_props.root); - if config::set("remote", &remote_config).is_err() { + + // set remote origin in config file + let mut remote_url = api_props.username.clone(); + remote_url.push_str("@"); + remote_url.push_str(api_props.host.strip_prefix("https://").unwrap()); + remote_url.push_str(&api_props.root); + + if config::add_remote("origin", &remote_url).is_err() + { eprintln!("err: not able to save remote"); } }