Skip to content

Commit 3b2feb4

Browse files
authored
Replace some if-statements with if-expressions (#168)
1 parent 0405db8 commit 3b2feb4

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

Diff for: pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt

+4-6
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
7676
/** The Project used by this command. */
7777
protected val project: Project? by lazy {
7878
if (cliOptions.noProject) {
79-
return@lazy null
79+
null
80+
} else {
81+
cliOptions.normalizedProjectFile?.let { loadProject(it) }
8082
}
81-
cliOptions.normalizedProjectFile?.let { loadProject(it) }
8283
}
8384

8485
protected fun loadProject(projectFile: Path): Project {
@@ -103,10 +104,7 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
103104
}
104105

105106
private val projectSettings: Project.EvaluatorSettings? by lazy {
106-
if (cliOptions.omitProjectSettings) {
107-
return@lazy null
108-
}
109-
project?.settings
107+
if (cliOptions.omitProjectSettings) null else project?.settings
110108
}
111109

112110
protected val allowedModules: List<Pattern> by lazy {

0 commit comments

Comments
 (0)