refactor(clone): set remote in config

This commit is contained in:
lol 2024-02-20 15:47:51 +01:00
parent ef986305c0
commit cd0eee8b20

View File

@ -59,11 +59,15 @@ pub fn clone(args: CloneArgs) {
std::process::exit(1); std::process::exit(1);
} else { } else {
init::init(); init::init();
let mut remote_config = api_props.username.clone();
remote_config.push_str("@"); // set remote origin in config file
remote_config.push_str(api_props.host.strip_prefix("https://").unwrap()); let mut remote_url = api_props.username.clone();
remote_config.push_str(&api_props.root); remote_url.push_str("@");
if config::set("remote", &remote_config).is_err() { 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"); eprintln!("err: not able to save remote");
} }
} }