Repository: apple/pkl
File: pkl-cli/src/main/kotlin/org/pkl/cli/commands/EvalCommand.kt (Kotlin)

Code before:
    option(
        names = arrayOf("-x", "--expression"),
        metavar = "expression",
        help = "Expression to be evaluated within the module.",
      )
      .single()

  private val multipleFileOutputPath: String? by
    option(
        names = arrayOf("-m", "--multiple-file-output-path"),
        metavar = "path",
        help = "Directory where a module's multiple file output is placed.",
        completionCandidates = CompletionCandidates.Path,
      )
      .single()
      .validate {
        if (outputPath != null || expression != null) {
          fail("Option is mutually exclusive with -o, --output-path and -x, --expression.")
        }
      }

  // hidden option used by the native tests
  private val testMode: Boolean by
    option(names = arrayOf("--test-mode"), help = "Internal test mode", hidden = true).flag()

  private val powerAssertions: Boolean by
    option(
        names = arrayOf("--power-assertions"),
        help = "Enable power assertions for detailed assertion failure messages.",
      )
      .flag("--no-power-assertions", default = true, defaultForHelp = "enabled")

  override fun run() {
    val options =
      CliEvaluatorOptions(
        base =
          baseOptions.baseOptions(
            modules,
            projectOptions,
            testMode = testMode,
            powerAssertions = powerAssertions,
          ),
        outputPath = outputPath,
        outputFormat = baseOptions.format,
        moduleOutputSeparator = moduleOutputSeparator,
        multipleFileOutputPath = multipleFileOutputPath,
        expression = expression ?: CliEvaluatorOptions.defaults.expression,
      )
    CliEvaluator(options).run()
  }
}

Review comment (suggestion):
Thoughts on keeping the var name consistent through the stack?

```suggestion
  private val powerAssertionsEnabled: Boolean by
```


Code after:
    option(
        names = arrayOf("-x", "--expression"),
        metavar = "expression",
        help = "Expression to be evaluated within the module.",
      )
      .single()

  private val multipleFileOutputPath: String? by
    option(
        names = arrayOf("-m", "--multiple-file-output-path"),
        metavar = "path",
        help = "Directory where a module's multiple file output is placed.",
        completionCandidates = CompletionCandidates.Path,
      )
      .single()
      .validate {
        if (outputPath != null || expression != null) {
          fail("Option is mutually exclusive with -o, --output-path and -x, --expression.")
        }
      }

  // hidden option used by the native tests
  private val testMode: Boolean by
    option(names = arrayOf("--test-mode"), help = "Internal test mode", hidden = true).flag()

  private val powerAssertionsEnabled: Boolean by
    option(
        names = arrayOf("--power-assertions"),
        help = "Enable power assertions for detailed assertion failure messages.",
      )
      .flag("--no-power-assertions", default = true, defaultForHelp = "enabled")

  override fun run() {
    val options =
      CliEvaluatorOptions(
        base =
          baseOptions.baseOptions(
            modules,
            projectOptions,
            testMode = testMode,
            powerAssertionsEnabled = powerAssertionsEnabled,
          ),
        outputPath = outputPath,
        outputFormat = baseOptions.format,
        moduleOutputSeparator = moduleOutputSeparator,
        multipleFileOutputPath = multipleFileOutputPath,
        expression = expression ?: CliEvaluatorOptions.defaults.expression,
      )
    CliEvaluator(options).run()
  }
}