fmt, clippy & fixed #1

main
jan Michal 3 years ago
parent 70708f8782
commit b3913e9120
No known key found for this signature in database
GPG Key ID: CB521D73AA05EBF2

@ -95,6 +95,32 @@ fn main() {
let matches = build_app().get_matches(); let matches = build_app().get_matches();
if Path::exists("mlc.toml".as_ref()) && Path::exists(".git".as_ref()) {
info(
"In a git repository, pulling latest mlc.toml. It is advised you run mlc pull/update"
.to_string(),
);
Command::new("git")
.arg("pull")
.spawn()
.unwrap()
.wait()
.unwrap();
}
if Path::exists("../.git".as_ref()) {
info("Parent directory is a git directory, pulling latest mlc.toml. It is advised you run mlc pull/update in all malachite directories".to_string());
let dir = env::current_dir().unwrap();
env::set_current_dir("../").unwrap();
Command::new("git")
.arg("pull")
.spawn()
.unwrap()
.wait()
.unwrap();
env::set_current_dir(dir).unwrap();
}
if let true = matches.is_present("init") { if let true = matches.is_present("init") {
let config = workspace::read_cfg(); let config = workspace::read_cfg();
if config.mode == "workspace" { if config.mode == "workspace" {
@ -127,12 +153,14 @@ fn main() {
let mut packages: Vec<String> = matches let mut packages: Vec<String> = matches
.subcommand_matches("build") .subcommand_matches("build")
.unwrap() .unwrap()
.values_of_lossy("package(s)").unwrap_or_default(); .values_of_lossy("package(s)")
.unwrap_or_default();
let exclude: Vec<String> = matches let exclude: Vec<String> = matches
.subcommand_matches("build") .subcommand_matches("build")
.unwrap() .unwrap()
.values_of_lossy("exclude").unwrap_or_default(); .values_of_lossy("exclude")
.unwrap_or_default();
for pkg in &exclude { for pkg in &exclude {
packages.retain(|x| &*x != pkg); packages.retain(|x| &*x != pkg);

@ -29,4 +29,4 @@ pub fn build(pkg: String) {
.unwrap(); .unwrap();
env::set_current_dir(dir).unwrap(); env::set_current_dir(dir).unwrap();
} }

@ -27,7 +27,13 @@ pub fn generate() {
let files = format!("{}.files", &name); let files = format!("{}.files", &name);
Command::new("bash") Command::new("bash")
.args(&["-c", &format!("repo-add {}.tar.gz *.pkg.tar.zst; repo-add {}.tar.gz *.pkg.tar.xz", db, db)]) .args(&[
"-c",
&format!(
"repo-add {}.tar.gz *.pkg.tar.zst; repo-add {}.tar.gz *.pkg.tar.xz",
db, db
),
])
.spawn() .spawn()
.unwrap() .unwrap()
.wait() .wait()

@ -38,4 +38,4 @@ pub fn read_cfg() -> Config {
name: config.name, name: config.name,
repo: expanded_repos, repo: expanded_repos,
} }
} }

Loading…
Cancel
Save