fixed my janky ass code

main
jan Michal 3 years ago
parent ef6a0bc483
commit 744125fd95
No known key found for this signature in database
GPG Key ID: CB521D73AA05EBF2

@ -160,12 +160,32 @@ fn main() {
if let true = matches.is_present("reinit") {
let config = workspace::read_cfg();
Command::new("bash")
.args(&["-c", "rm -rf */"])
let out = Command::new("bash")
.args(&["-c", "ls -A"])
.output()
.unwrap()
.stdout;
let dirs_to_s = String::from_utf8_lossy(&*out);
let mut dirs = dirs_to_s.lines().collect::<Vec<&str>>();
let name = config.name.unwrap();
dirs.retain(|x| *x != "mlc.toml");
dirs.retain(|x| *x != ".git");
if config.mode == "repository" {
dirs.retain(|x| *x != "out");
dirs.retain(|x| *x != name);
}
info("Removing all repo directories to reinitialise".to_string());
Command::new("rm")
.args(&["-rf", &dirs.join(" ")])
.spawn()
.unwrap()
.wait()
.unwrap();
if config.mode == "workspace" {
for r in config.repo {
info(format!("Cloning (workspace mode): {}", r));

Loading…
Cancel
Save