Code optimise

main
Michal 2 years ago
parent 9fc6931583
commit a68d201bba
No known key found for this signature in database
GPG Key ID: A6A1A4DCB22279B9

@ -1,5 +1,5 @@
pub use exit_codes::*;
mod exit_codes; mod exit_codes;
pub mod strings; pub mod strings;
pub mod structs; pub mod structs;
pub use exit_codes::*;

@ -1,7 +1,8 @@
use crate::internal::AppExitCode;
use colored::*; use colored::*;
use std::process::exit; use std::process::exit;
use crate::internal::AppExitCode;
const LOGO_SYMBOL: &str = "μ"; const LOGO_SYMBOL: &str = "μ";
const ERR_SYMBOL: &str = "❌"; const ERR_SYMBOL: &str = "❌";

@ -1,3 +1,4 @@
use clap::Parser;
use std::env; use std::env;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
@ -5,8 +6,6 @@ use std::process::Command;
use crate::args::{Args, Operation}; use crate::args::{Args, Operation};
use crate::internal::AppExitCode; use crate::internal::AppExitCode;
use crate::repository::create_config; use crate::repository::create_config;
use clap::Parser;
use crate::workspace::read_cfg; use crate::workspace::read_cfg;
#[global_allocator] #[global_allocator]

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

@ -1,6 +1,7 @@
use std::process::Command;
use crate::internal::AppExitCode; use crate::internal::AppExitCode;
use crate::{crash, info, workspace}; use crate::{crash, info, workspace};
use std::process::Command;
pub fn init() { pub fn init() {
let config = workspace::read_cfg(); let config = workspace::read_cfg();

@ -1,11 +1,11 @@
mod build;
mod config;
mod init;
mod prune;
mod pull;
pub use build::*; pub use build::*;
pub use config::*; pub use config::*;
pub use init::*; pub use init::*;
pub use prune::*; pub use prune::*;
pub use pull::*; pub use pull::*;
mod build;
mod config;
mod init;
mod prune;
mod pull;

@ -1,7 +1,8 @@
use crate::{info, read_cfg};
use std::fs; use std::fs;
use std::process::Command; use std::process::Command;
use crate::{info, read_cfg};
pub fn prune() { pub fn prune() {
let config = read_cfg(); let config = read_cfg();
let mut packages = vec![]; let mut packages = vec![];

@ -1,7 +1,8 @@
use crate::info;
use std::env; use std::env;
use std::process::Command; use std::process::Command;
use crate::info;
fn do_the_pulling(packages: Vec<String>) { fn do_the_pulling(packages: Vec<String>) {
for dir in packages { for dir in packages {
let current_dir = env::current_dir().unwrap(); let current_dir = env::current_dir().unwrap();

@ -1,10 +1,11 @@
use crate::crash;
use crate::internal::AppExitCode;
use std::env; use std::env;
use std::fs::File; use std::fs::File;
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use crate::crash;
use crate::internal::AppExitCode;
const DEFAULT_CONFIG: &str = r#"# either "repository" or "workspace" const DEFAULT_CONFIG: &str = r#"# either "repository" or "workspace"
mode = "" mode = ""

@ -1,7 +1,7 @@
mod config;
mod package;
mod repo;
pub use config::*; pub use config::*;
pub use package::*; pub use package::*;
pub use repo::*; pub use repo::*;
mod config;
mod package;
mod repo;

@ -1,9 +1,10 @@
use crate::crash;
use crate::internal::AppExitCode;
use std::path::Path; use std::path::Path;
use std::process::Command; use std::process::Command;
use std::{env, fs}; use std::{env, fs};
use crate::crash;
use crate::internal::AppExitCode;
pub fn build(pkg: &str) -> i32 { pub fn build(pkg: &str) -> i32 {
let dir = env::current_dir().unwrap(); let dir = env::current_dir().unwrap();
if !Path::exists("out".as_ref()) { if !Path::exists("out".as_ref()) {

@ -1,3 +1,3 @@
mod read;
pub use read::*; pub use read::*;
mod read;

@ -1,9 +1,9 @@
use crate::crash;
use crate::internal::AppExitCode;
use std::fs; use std::fs;
use std::path::Path; use std::path::Path;
use crate::crash;
use crate::internal::structs::{Config, SplitRepo, UnexpandedConfig}; use crate::internal::structs::{Config, SplitRepo, UnexpandedConfig};
use crate::internal::AppExitCode;
pub fn read_cfg() -> Config { pub fn read_cfg() -> Config {
if !Path::exists("mlc.toml".as_ref()) { if !Path::exists("mlc.toml".as_ref()) {

Loading…
Cancel
Save