Skip to content

Commit

Permalink
feat(helper-cli): Allow listing only non-excluded packages
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Viernau <frank_viernau@epam.com>
  • Loading branch information
fviernau committed Jul 10, 2024
1 parent 72d9291 commit 799acd1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion helper-cli/src/main/kotlin/commands/ListPackagesCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@ internal class ListPackagesCommand : CliktCommand(
"comma-separated values."
).enum<Severity>().split(",").default(Severity.entries)

private val omitExcluded by option(
"--omit-excluded",
help = "Only list non-excluded packages."
).flag()

override fun run() {
val ortResult = readOrtResult(ortFile)

Expand All @@ -86,7 +91,7 @@ internal class ListPackagesCommand : CliktCommand(
it.severity in offendingSeverities
}.mapNotNullTo(mutableSetOf()) { it.pkg }

val packages = ortResult.getProjectsAndPackages().filter { id ->
val packages = ortResult.getProjectsAndPackages(omitExcluded = omitExcluded).filter { id ->
(ortResult.isPackage(id) && PACKAGE in type) || (ortResult.isProject(id) && PROJECT in type)
}.filter { id ->
matchDetectedLicenses.isEmpty() || (matchDetectedLicenses - getDetectedLicenses(id)).isEmpty()
Expand Down

0 comments on commit 799acd1

Please sign in to comment.