Skip to content

Commit

Permalink
feat(GenerateScopeExcludesCommand): Do not require the repo config to…
Browse files Browse the repository at this point in the history
… exist

Signed-off-by: Sebastian Schuberth <[email protected]>
  • Loading branch information
sschuberth committed Apr 15, 2024
1 parent 6c84bba commit e942b66
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,21 @@ internal class GenerateScopeExcludesCommand : CliktCommand(
"--repository-configuration-file",
help = "The repository configuration file to write the generated scope excludes to."
).convert { it.expandTilde() }
.file(mustExist = true, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false)
.file(mustExist = false, canBeFile = true, canBeDir = false, mustBeWritable = false, mustBeReadable = false)
.convert { it.absoluteFile.normalize() }
.required()

override fun run() {
val ortResult = readOrtResult(ortFile)
val scopeExcludes = ortResult.generateScopeExcludes()

repositoryConfigurationFile
.readValue<RepositoryConfiguration>()
val repositoryConfiguration = if (repositoryConfigurationFile.isFile) {
repositoryConfigurationFile.readValue<RepositoryConfiguration>()
} else {
RepositoryConfiguration()
}

repositoryConfiguration
.replaceScopeExcludes(scopeExcludes)
.sortScopeExcludes()
.write(repositoryConfigurationFile)
Expand Down

0 comments on commit e942b66

Please sign in to comment.