main
Michal 2 years ago
parent 21b80478bb
commit 98a4bf55cf
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -47,6 +47,7 @@ pub fn clone(verbose: bool) {
info!("Cloning ({} mode): {}", config.base.mode, r.name); info!("Cloning ({} mode): {}", config.base.mode, r.name);
Command::new("git") Command::new("git")
.args(&["clone", &r.url, &r.name]) .args(&["clone", &r.url, &r.name])
// If a branch is specified, clone that specific branch
.args(if r.branch.is_some() { .args(if r.branch.is_some() {
vec!["-b", r.branch.as_ref().unwrap()] vec!["-b", r.branch.as_ref().unwrap()]
} else { } else {

@ -52,23 +52,30 @@ pub fn read_cfg(verbose: bool) -> Config {
// Parses all necessary values for expanding the repo to a Repo struct // Parses all necessary values for expanding the repo to a Repo struct
let index = split_struct.indx; let index = split_struct.indx;
// If a branch is defined, parse it
let branch = if split_struct.name.contains('@') { let branch = if split_struct.name.contains('@') {
log!(verbose, "Branch defined: {}", split_struct.name);
Some( Some(
split_struct.name.split('@').collect::<Vec<&str>>()[1] split_struct.name.split('@').collect::<Vec<&str>>()[1]
.to_string() .to_string()
.replace('!', ""), .replace('!', ""),
) )
} else { } else {
log!(verbose, "No branch defined");
None None
}; };
// Strip branch and priority info from the name, if present
let name = if split_struct.name.contains('@') { let name = if split_struct.name.contains('@') {
split_struct.name.split('@').collect::<Vec<&str>>()[0].to_string() split_struct.name.split('@').collect::<Vec<&str>>()[0].to_string()
} else { } else {
split_struct.name.to_string().replace('!', "") split_struct.name.to_string().replace('!', "")
}; };
// Substitutes the name into the url
let url = config.repositories.urls[index - 1].replace("%repo%", &name); let url = config.repositories.urls[index - 1].replace("%repo%", &name);
// Counts instances of ! in the name, and totals a priority accordingly
let priority = &split_struct.name.matches('!').count(); let priority = &split_struct.name.matches('!').count();
// Creates and pushes Repo struct to expanded_repos // Creates and pushes Repo struct to expanded_repos

Loading…
Cancel
Save