|
|
|
@ -1,4 +1,4 @@
|
|
|
|
|
use crate::{info, workspace};
|
|
|
|
|
use crate::info;
|
|
|
|
|
use clap::ArgMatches;
|
|
|
|
|
use std::env;
|
|
|
|
|
use std::process::Command;
|
|
|
|
@ -9,41 +9,39 @@ pub fn pull(matches: &ArgMatches) {
|
|
|
|
|
.unwrap()
|
|
|
|
|
.values_of_lossy("package(s)")
|
|
|
|
|
.unwrap_or_default();
|
|
|
|
|
let config = workspace::read_cfg();
|
|
|
|
|
let cdir = env::current_dir().unwrap();
|
|
|
|
|
|
|
|
|
|
if packages.is_empty() {
|
|
|
|
|
for r in config.repo {
|
|
|
|
|
info(format!("Entering working directory: {}", r));
|
|
|
|
|
let dir = format!(
|
|
|
|
|
"{}/{}",
|
|
|
|
|
env::current_dir().unwrap().display(),
|
|
|
|
|
r.split('/').collect::<Vec<&str>>().last().unwrap()
|
|
|
|
|
);
|
|
|
|
|
let stdout = Command::new("ls").arg("-1").output().unwrap().stdout;
|
|
|
|
|
let dirs_string = String::from_utf8_lossy(&stdout);
|
|
|
|
|
|
|
|
|
|
let mut dirs = dirs_string.lines().collect::<Vec<&str>>();
|
|
|
|
|
|
|
|
|
|
dirs.retain(|x| *x != "mlc.toml");
|
|
|
|
|
|
|
|
|
|
for dir in dirs {
|
|
|
|
|
let cdir = env::current_dir().unwrap();
|
|
|
|
|
info(format!("Entering working directory: {}", dir));
|
|
|
|
|
env::set_current_dir(dir).unwrap();
|
|
|
|
|
Command::new("git")
|
|
|
|
|
.args(&["pull", &r])
|
|
|
|
|
.arg("pull")
|
|
|
|
|
.spawn()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.wait()
|
|
|
|
|
.unwrap();
|
|
|
|
|
env::set_current_dir(&cdir).unwrap();
|
|
|
|
|
env::set_current_dir(cdir).unwrap();
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
for r in packages {
|
|
|
|
|
info(format!("Entering working directory: {}", r));
|
|
|
|
|
let dir = format!(
|
|
|
|
|
"{}/{}",
|
|
|
|
|
env::current_dir().unwrap().display(),
|
|
|
|
|
r.split('/').collect::<Vec<&str>>().last().unwrap()
|
|
|
|
|
);
|
|
|
|
|
for dir in packages {
|
|
|
|
|
let cdir = env::current_dir().unwrap();
|
|
|
|
|
info(format!("Entering working directory: {}", dir));
|
|
|
|
|
env::set_current_dir(dir).unwrap();
|
|
|
|
|
Command::new("git")
|
|
|
|
|
.args(&["pull", &r])
|
|
|
|
|
.arg("pull")
|
|
|
|
|
.spawn()
|
|
|
|
|
.unwrap()
|
|
|
|
|
.wait()
|
|
|
|
|
.unwrap();
|
|
|
|
|
env::set_current_dir(&cdir).unwrap();
|
|
|
|
|
env::set_current_dir(cdir).unwrap();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|