From 3b2feb45cf47ef97c6db38b2cb5af4ecc713f447 Mon Sep 17 00:00:00 2001 From: translatenix <119817707+translatenix@users.noreply.github.com> Date: Fri, 16 Feb 2024 05:41:41 -0800 Subject: [PATCH] Replace some if-statements with if-expressions (#168) --- .../src/main/kotlin/org/pkl/commons/cli/CliCommand.kt | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt index df07952f0..948c4453a 100644 --- a/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt +++ b/pkl-commons-cli/src/main/kotlin/org/pkl/commons/cli/CliCommand.kt @@ -76,9 +76,10 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) { /** The Project used by this command. */ protected val project: Project? by lazy { if (cliOptions.noProject) { - return@lazy null + null + } else { + cliOptions.normalizedProjectFile?.let { loadProject(it) } } - cliOptions.normalizedProjectFile?.let { loadProject(it) } } protected fun loadProject(projectFile: Path): Project { @@ -103,10 +104,7 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) { } private val projectSettings: Project.EvaluatorSettings? by lazy { - if (cliOptions.omitProjectSettings) { - return@lazy null - } - project?.settings + if (cliOptions.omitProjectSettings) null else project?.settings } protected val allowedModules: List by lazy {