mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-14 16:35:01 +01:00
add tracing
This commit is contained in:
parent
1cb5114557
commit
e1fd83b4d9
8 changed files with 264 additions and 33 deletions
30
src/lib.rs
30
src/lib.rs
|
|
@ -1,4 +1,7 @@
|
|||
use std::path::PathBuf;
|
||||
#[macro_use]
|
||||
extern crate tracing;
|
||||
|
||||
use std::{path::PathBuf, str::FromStr};
|
||||
|
||||
mod build;
|
||||
mod everybody_loops;
|
||||
|
|
@ -31,10 +34,35 @@ pub struct Options {
|
|||
#[arg(long)]
|
||||
no_verify: bool,
|
||||
|
||||
#[arg(long)]
|
||||
env: Vec<EnvVar>,
|
||||
|
||||
#[arg(default_value = "src")]
|
||||
path: PathBuf,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
struct EnvVar {
|
||||
key: String,
|
||||
value: String,
|
||||
}
|
||||
|
||||
impl FromStr for EnvVar {
|
||||
type Err = &'static str;
|
||||
fn from_str(s: &str) -> Result<Self, Self::Err> {
|
||||
let mut split = s.split("=");
|
||||
let key = split
|
||||
.next()
|
||||
.ok_or("env var must have KEY=VALUE format")?
|
||||
.to_string();
|
||||
let value = split
|
||||
.next()
|
||||
.ok_or("env var must have KEY=VALUE format")?
|
||||
.to_string();
|
||||
Ok(Self { key, value })
|
||||
}
|
||||
}
|
||||
|
||||
pub fn minimize() -> Result<()> {
|
||||
let Cargo::Minimize(options) = Cargo::parse();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue