cli: fix issue where negate removes too many packages

This commit is contained in:
Thomas Hobson 2021-06-13 19:17:04 +12:00
parent 5a82e0308b
commit 7d40abfb3f
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
1 changed files with 4 additions and 5 deletions

View File

@ -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)
)
}