diff --git a/src/main.rs b/src/main.rs index f9ae3c2..976ff32 100644 --- a/src/main.rs +++ b/src/main.rs @@ -121,6 +121,9 @@ pub struct Cook { /// Build all members in the workspace. #[arg(long)] workspace: bool, + /// Exclude packages from the build + #[arg(long, requires = "workspace")] + exclude: Option>, /// Build offline. #[arg(long)] offline: bool, @@ -185,6 +188,7 @@ fn _main() -> Result<(), anyhow::Error> { manifest_path, package, workspace, + exclude, offline, frozen, locked, @@ -286,6 +290,7 @@ fn _main() -> Result<(), anyhow::Error> { manifest_path, package, workspace, + exclude, offline, timings, no_std, diff --git a/src/recipe.rs b/src/recipe.rs index 1f26f76..bf38983 100644 --- a/src/recipe.rs +++ b/src/recipe.rs @@ -38,6 +38,7 @@ pub struct CookArgs { pub manifest_path: Option, pub package: Option>, pub workspace: bool, + pub exclude: Option>, pub offline: bool, pub locked: bool, pub frozen: bool, @@ -108,6 +109,7 @@ fn build_dependencies(args: &CookArgs) { manifest_path, package, workspace, + exclude, offline, frozen, locked, @@ -183,6 +185,17 @@ fn build_dependencies(args: &CookArgs) { if *workspace { command_with_args.arg("--workspace"); } + match (*workspace, exclude) { + (true, Some(exclude_list)) if !exclude_list.is_empty() => { + for exclude_item in exclude_list { + command_with_args.arg("--exclude").arg(exclude_item); + } + } + (false, Some(_)) => { + panic!("`--exclude` can only be used with `--workspace`"); + } + _ => {} + } if *offline { command_with_args.arg("--offline"); }