From 7d40abfb3fd182402d02f592bbe9c9c205ec235e Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Sun, 13 Jun 2021 19:17:04 +1200 Subject: [PATCH] cli: fix issue where negate removes too many packages --- cli/commands/ppman_commands/spec.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/cli/commands/ppman_commands/spec.js b/cli/commands/ppman_commands/spec.js index 8f54779..d558810 100644 --- a/cli/commands/ppman_commands/spec.js +++ b/cli/commands/ppman_commands/spec.js @@ -51,7 +51,7 @@ exports.handler = async ({axios, specfile}) => { const installed = packages.filter(pkg => pkg.installed); - const ensure_packages = []; + let ensure_packages = []; for(const rule of rules){ if(rule.comment) continue; @@ -78,10 +78,9 @@ exports.handler = async ({axios, specfile}) => { ensure_packages.push(match) } }else{ - for(const package of ensure_packages){ - if(does_match(package, rule)) - ensure_packages.splice(ensure_packages.indexOf(package)) - } + ensure_packages = ensure_packages.filter( + pkg => !does_match(pkg, rule) + ) }