mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-16 09:15:02 +01:00
just works
This commit is contained in:
parent
dcd163aeda
commit
436546eaf5
7 changed files with 23 additions and 14 deletions
16
src/lib.rs
16
src/lib.rs
|
|
@ -1,5 +1,3 @@
|
|||
#![allow(dead_code)]
|
||||
|
||||
use std::path::PathBuf;
|
||||
|
||||
mod build;
|
||||
|
|
@ -15,25 +13,31 @@ use processor::Minimizer;
|
|||
use crate::{everybody_loops::EverybodyLoops, privatize::Privatize, processor::Processor};
|
||||
|
||||
#[derive(clap::Parser)]
|
||||
#[command(version, about, name = "cargo", bin_name = "cargo")]
|
||||
enum Cargo {
|
||||
Minimize(Options),
|
||||
}
|
||||
|
||||
#[derive(clap::Args, Debug)]
|
||||
pub struct Options {
|
||||
#[arg(short, long)]
|
||||
verify_error_path: Option<PathBuf>,
|
||||
#[arg(long)]
|
||||
cargo: bool,
|
||||
rustc: bool,
|
||||
#[arg(long)]
|
||||
no_verify: bool,
|
||||
|
||||
#[arg(default_value = "src")]
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
pub fn minimize() -> Result<()> {
|
||||
let options = Options::parse();
|
||||
let Cargo::Minimize(options) = Cargo::parse();
|
||||
|
||||
let build = build::Build::new(&options);
|
||||
|
||||
let mut minimizer = Minimizer::new_glob_dir(&options.path, build);
|
||||
|
||||
println!("{minimizer:?}");
|
||||
|
||||
minimizer.delete_dead_code().context("deleting dead code")?;
|
||||
|
||||
minimizer.run_passes([
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue