Fixed Malachite parsing git info even if git_info = false

main
Michal 2 years ago
parent 5703777d68
commit 87e0115aca

@ -115,6 +115,7 @@ pub fn info(verbose: bool) {
let mut repos = vec![];
let mut repos_git = vec![];
if git_info {
// Start the spinner
let sp = Spinner::new(
Spinners::Line,
@ -132,7 +133,7 @@ pub fn info(verbose: bool) {
\n\
# This script will run `git remote update` in all repositories\n\
pull() { cd $1; git remote update; cd -; }\n\
\n",
\n"
);
for repo in &repos_unparsed {
writeln!(bash_script, "pull {} &", repo.name).unwrap();
@ -148,6 +149,17 @@ pub fn info(verbose: bool) {
.output()
.unwrap();
// Because spinoff requires &'static str, we need to Box these in the heap and then leak them to be able to format the spinner
let symbol = Box::new(format!("{}", "✔".bold().green()));
let done = Box::new(format!("{}", "Done!".bold()));
let symbol: &'static str = Box::leak(symbol);
let done: &'static str = Box::leak(done);
sp.stop_and_persist(symbol, done);
log!(verbose, "Repos: {:?}", repos);
}
// Iterate over all repositories
for repo in repos_unparsed {
// Get name with branch, '/' serving as the delimiter
@ -187,16 +199,6 @@ pub fn info(verbose: bool) {
}
}
// Because spinoff requires &'static str, we need to Box these in the heap and then leak them to be able to format the spinner
let symbol = Box::new(format!("{}", "✔".bold().green()));
let done = Box::new(format!("{}", "Done!".bold()));
let symbol: &'static str = Box::leak(symbol);
let done: &'static str = Box::leak(done);
sp.stop_and_persist(symbol, done);
log!(verbose, "Repos: {:?}", repos);
// Sort by priority
repos.sort_by(|a, b| b.priority.cmp(&a.priority));
repos_git.sort_by(|a, b| b.priority.cmp(&a.priority));

Loading…
Cancel
Save