mirror of
https://github.com/apple/pkl.git
synced 2026-04-19 23:11:29 +02:00
Replace some if-statements with if-expressions (#168)
This commit is contained in:
@@ -76,9 +76,10 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
|
|||||||
/** The Project used by this command. */
|
/** The Project used by this command. */
|
||||||
protected val project: Project? by lazy {
|
protected val project: Project? by lazy {
|
||||||
if (cliOptions.noProject) {
|
if (cliOptions.noProject) {
|
||||||
return@lazy null
|
null
|
||||||
|
} else {
|
||||||
|
cliOptions.normalizedProjectFile?.let { loadProject(it) }
|
||||||
}
|
}
|
||||||
cliOptions.normalizedProjectFile?.let { loadProject(it) }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun loadProject(projectFile: Path): Project {
|
protected fun loadProject(projectFile: Path): Project {
|
||||||
@@ -103,10 +104,7 @@ abstract class CliCommand(protected val cliOptions: CliBaseOptions) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private val projectSettings: Project.EvaluatorSettings? by lazy {
|
private val projectSettings: Project.EvaluatorSettings? by lazy {
|
||||||
if (cliOptions.omitProjectSettings) {
|
if (cliOptions.omitProjectSettings) null else project?.settings
|
||||||
return@lazy null
|
|
||||||
}
|
|
||||||
project?.settings
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected val allowedModules: List<Pattern> by lazy {
|
protected val allowedModules: List<Pattern> by lazy {
|
||||||
|
|||||||
Reference in New Issue
Block a user