diff options
Diffstat (limited to 'crates/mozart/src/commands.rs')
| -rw-r--r-- | crates/mozart/src/commands.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/crates/mozart/src/commands.rs b/crates/mozart/src/commands.rs index 1717437..f9b8880 100644 --- a/crates/mozart/src/commands.rs +++ b/crates/mozart/src/commands.rs @@ -312,3 +312,25 @@ pub async fn execute(cli: &Cli) -> anyhow::Result<()> { Commands::Validate(args) => validate::execute(args, cli, &console).await, } } + +/// Creates PlatformRequirementFilter from CLI options. Priority: +/// +/// 1. `--ignore-platform-reqs` → ignore every platform requirement +/// 2. `--ignore-platform-req <name>...` (non-empty) → ignore the listed names +/// 3. neither → ignore nothing +/// +/// ref: \Composer\Command\BaseCommand::getPlatformRequirementFilter() +pub(crate) fn get_platform_requirement_filter( + ignore_platform_reqs: bool, + ignore_platform_req: &[String], +) -> anyhow::Result<mozart_core::composer::PlatformRequirementFilter> { + use mozart_core::composer::PlatformRequirementFilter; + + if ignore_platform_reqs { + return Ok(PlatformRequirementFilter::ignore_all()); + } + if !ignore_platform_req.is_empty() { + return PlatformRequirementFilter::from_list(ignore_platform_req); + } + Ok(PlatformRequirementFilter::ignore_nothing()) +} |
