refactor(clone): set remote in config

This commit is contained in:
grimhilt 2024-02-20 15:47:51 +01:00
parent c6534cfd40
commit 1c60560c6e

View File

@ -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");
}
}