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