Skip to content

Commit

Permalink
ListLicensesCommand: Allow overriding the repository config
Browse files Browse the repository at this point in the history
As the output of this command can be affected by the entries of the
repository configuration it can be useful to override those entries.

Signed-off-by: Frank Viernau <frank.viernau@here.com>
  • Loading branch information
fviernau committed Oct 8, 2019
1 parent 7d97def commit c1a2029
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion helper-cli/src/main/kotlin/commands/ListLicensesCommand.kt
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,20 @@ internal class ListLicensesCommand : CommandWithHelp() {
)
private var applyLicenseFindingCurations: Boolean = false

@Parameter(
names = ["--repository-configuration-file"],
required = false,
order = PARAMETER_ORDER_OPTIONAL,
description = "Override the repository configuration contained in the ORT result."
)
private var repositoryConfigurationFile: File? = null

override fun runCommand(jc: JCommander): Int {
val ortResult = ortResultFile.readValue<OrtResult>()
var ortResult = ortResultFile.readValue<OrtResult>()
repositoryConfigurationFile?.let {
ortResult = ortResult.replaceConfig(it.readValue())
}

val sourcesDir = sourceCodeDir ?: ortResult.fetchScannedSources(packageId)
val violatedRulesByLicense = ortResult.getViolatedRulesByLicense(packageId, Severity.ERROR)

Expand Down

0 comments on commit c1a2029

Please sign in to comment.