fmt + fixed #4

main
michal 3 years ago
parent 90011992c1
commit 8eeb2aa841

@ -12,9 +12,9 @@ use crate::workspace::read_cfg;
static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
mod internal; mod internal;
mod operations;
mod repository; mod repository;
mod workspace; mod workspace;
mod operations;
fn main() { fn main() {
extern "C" { extern "C" {
@ -137,11 +137,11 @@ fn main() {
} }
if let true = matches.is_present("reinit") { if let true = matches.is_present("reinit") {
operations::reinit(); operations::reinit();
} }
if let true = matches.is_present("build") { if let true = matches.is_present("build") {
operations::build(&matches); operations::build(&matches);
} }
if let true = matches.is_present("pull") { if let true = matches.is_present("pull") {
@ -211,4 +211,4 @@ fn main() {
if let true = matches.is_present("config") { if let true = matches.is_present("config") {
operations::config(); operations::config();
} }
} }

@ -1,5 +1,6 @@
use clap::ArgMatches; use crate::repository::generate;
use crate::{crash, repository, workspace}; use crate::{crash, repository, workspace};
use clap::ArgMatches;
pub fn build(matches: &ArgMatches) { pub fn build(matches: &ArgMatches) {
let config = workspace::read_cfg(); let config = workspace::read_cfg();
@ -15,7 +16,6 @@ pub fn build(matches: &ArgMatches) {
.values_of_lossy("exclude") .values_of_lossy("exclude")
.unwrap_or_default(); .unwrap_or_default();
for pkg in &exclude { for pkg in &exclude {
packages.retain(|x| &*x != pkg); packages.retain(|x| &*x != pkg);
} }
@ -57,6 +57,7 @@ pub fn build(matches: &ArgMatches) {
for pkg in repos { for pkg in repos {
repository::build(pkg); repository::build(pkg);
} }
generate();
} }
if matches if matches
@ -66,4 +67,4 @@ pub fn build(matches: &ArgMatches) {
{ {
repository::generate(); repository::generate();
} }
} }

@ -1,3 +1,8 @@
use crate::create_config;
use std::env;
use std::path::Path;
use std::process::Command;
pub fn config() { pub fn config() {
if !Path::exists("mlc.toml".as_ref()) { if !Path::exists("mlc.toml".as_ref()) {
create_config(); create_config();
@ -9,4 +14,4 @@ pub fn config() {
.unwrap() .unwrap()
.wait() .wait()
.unwrap(); .unwrap();
} }

@ -1,5 +1,5 @@
use std::process::Command;
use crate::{crash, info, workspace}; use crate::{crash, info, workspace};
use std::process::Command;
pub fn reinit() { pub fn reinit() {
let config = workspace::read_cfg(); let config = workspace::read_cfg();
@ -79,4 +79,4 @@ pub fn init() {
} else { } else {
crash("Invalid mode in mlc.toml".to_string(), 1); crash("Invalid mode in mlc.toml".to_string(), 1);
} }
} }

@ -1,9 +1,9 @@
use clap::ArgMatches; use clap::ArgMatches;
mod init;
mod build; mod build;
mod pull;
mod config; mod config;
mod init;
mod pull;
pub fn reinit() { pub fn reinit() {
init::reinit(); init::reinit();
@ -23,4 +23,4 @@ pub fn pull(matches: &ArgMatches) {
pub fn config() { pub fn config() {
config::config(); config::config();
} }

@ -1,7 +1,7 @@
use crate::{info, workspace};
use clap::ArgMatches;
use std::env; use std::env;
use std::process::Command; use std::process::Command;
use clap::ArgMatches;
use crate::{info, workspace};
pub fn pull(matches: &ArgMatches) { pub fn pull(matches: &ArgMatches) {
let packages: Vec<String> = matches let packages: Vec<String> = matches
@ -46,4 +46,4 @@ pub fn pull(matches: &ArgMatches) {
env::set_current_dir(&cdir).unwrap(); env::set_current_dir(&cdir).unwrap();
} }
} }
} }

Loading…
Cancel
Save