Skip to content

Commit

Permalink
feat(requirements): Add an option to toggle listing plugins and commands
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Nov 27, 2023
1 parent b675cc5 commit fc7f8ce
Showing 1 changed file with 13 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
package org.ossreviewtoolkit.plugins.commands.requirements

import com.github.ajalt.clikt.core.ProgramResult
import com.github.ajalt.clikt.parameters.options.default
import com.github.ajalt.clikt.parameters.options.option
import com.github.ajalt.clikt.parameters.options.split
import com.github.ajalt.clikt.parameters.types.enum
import com.github.ajalt.mordant.rendering.Theme

import java.io.File
Expand Down Expand Up @@ -53,12 +57,19 @@ class RequirementsCommand : OrtCommand(
name = "requirements",
help = "Check for the command line tools required by ORT."
) {
private enum class RequirementsType { PLUGINS, COMMANDS }

private val list by option(
"--list", "-l",
help = "A comma-separated list of requirements to list."
).enum<RequirementsType>().split(",").default(RequirementsType.entries)

override fun run() {
val reflections = Reflections("org.ossreviewtoolkit", Scanners.SubTypes)

listPlugins(reflections)
if (RequirementsType.PLUGINS in list) listPlugins(reflections)

val statusCode = checkToolVersions(reflections)
val statusCode = if (RequirementsType.COMMANDS in list) checkToolVersions(reflections) else 0

echo("Prefix legend:")
echo("${DANGER_PREFIX}The tool was not found in the PATH environment.")
Expand Down

0 comments on commit fc7f8ce

Please sign in to comment.