mirror of
https://github.com/Noratrieb/cargo-minimize.git
synced 2026-01-16 09:15:02 +01:00
make subcommand configurable
This commit is contained in:
parent
a866667545
commit
c0289c65f7
6 changed files with 97 additions and 39 deletions
19
src/lib.rs
19
src/lib.rs
|
|
@ -31,9 +31,18 @@ pub enum Cargo {
|
|||
|
||||
#[derive(clap::Args, Debug)]
|
||||
pub struct Options {
|
||||
/// Additional arguments to pass to cargo, separated by whitespace.
|
||||
/// Additional arguments to pass to cargo/rustc, separated by whitespace.
|
||||
#[arg(long)]
|
||||
pub cargo_args: Option<String>,
|
||||
pub extra_args: Option<String>,
|
||||
|
||||
/// The cargo subcommand used to find the reproduction, seperated by whitespace (for example `miri run`).
|
||||
#[arg(long, default_value = "build")]
|
||||
pub cargo_subcmd: String,
|
||||
|
||||
/// The cargo subcommand used to get diagnostics like the dead_code lint from the compiler, seperated by whitespace.
|
||||
/// Defaults to the value of `--cargo-subcmd`.
|
||||
#[arg(long)]
|
||||
pub diagnostics_cargo_subcmd: Option<String>,
|
||||
|
||||
/// To disable colored output.
|
||||
#[arg(long)]
|
||||
|
|
@ -96,7 +105,7 @@ impl FromStr for EnvVar {
|
|||
}
|
||||
|
||||
pub fn minimize(options: Options) -> Result<()> {
|
||||
let build = build::Build::new(&options);
|
||||
let build = build::Build::new(&options)?;
|
||||
|
||||
let mut minimizer = Minimizer::new_glob_dir(options, build)?;
|
||||
|
||||
|
|
@ -129,7 +138,9 @@ impl Default for Options {
|
|||
fn default() -> Self {
|
||||
Self {
|
||||
script_path: None,
|
||||
cargo_args: None,
|
||||
extra_args: None,
|
||||
cargo_subcmd: "build".into(),
|
||||
diagnostics_cargo_subcmd: None,
|
||||
no_color: false,
|
||||
rustc: false,
|
||||
no_verify: false,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue