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 <[email protected]>
  • Loading branch information
fviernau committed Jul 10, 2024
1 parent 72d9291 commit b6761fd
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 ->

Check warning on line 94 in helper-cli/src/main/kotlin/commands/ListPackagesCommand.kt

View check run for this annotation

Codecov / codecov/patch

helper-cli/src/main/kotlin/commands/ListPackagesCommand.kt#L94

Added line #L94 was not covered by tests
(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 b6761fd

Please sign in to comment.