Repository: apple/pkl
File: pkl-codegen-java/src/main/kotlin/org/pkl/codegen/java/Main.kt (Kotlin)

Code before:
  cliMain { PklJavaCodegenCommand().main(args) }
}

internal val helpLink = "${Release.current().documentation.homepage}java-binding/codegen.html#cli"

class PklJavaCodegenCommand : ModulesCommand(name = "pkl-codegen-java", helpLink) {
  private val defaults = CliJavaCodeGeneratorOptions(CliBaseOptions(), "".toPath())

  private val outputDir: Path by
    option(
        names = arrayOf("-o", "--output-dir"),
        metavar = "path",
        help = "The directory where generated source code is placed.",
      )
      .path()
      .default(defaults.outputDir)

  private val indent: String by
    option(
        names = arrayOf("--indent"),
        metavar = "chars",
        help = "The characters to use for indenting generated source code.",
      )
      .default(defaults.indent)

  private val generatedAnnotation: Boolean by
    option(
        names = arrayOf("--add-generated-annotation"),
        help = "Whether to add a @Generated annotation to the types to be generated.",
      )
      .flag()

  private val generateGetters: Boolean by
    option(
        names = arrayOf("--generate-getters"),
        help =
          "Whether to generate public getter methods and " +
            "private final fields instead of public final fields.",
      )
      .flag()

  private val generateJavadoc: Boolean by
    option(
        names = arrayOf("--generate-javadoc"),
        help = "Whether to preserve Pkl doc comments by generating corresponding Javadoc comments.",
      )
      .flag()

  private val generateSpringBoot: Boolean by
    option(
        names = arrayOf("--generate-spring-boot"),

Review comment (suggestion):
```suggestion
  private val addGeneratedAnnotation: Boolean by
```

Code after:
  cliMain { PklJavaCodegenCommand().main(args) }
}

internal val helpLink = "${Release.current().documentation.homepage}java-binding/codegen.html#cli"

class PklJavaCodegenCommand : ModulesCommand(name = "pkl-codegen-java", helpLink) {
  private val defaults = CliJavaCodeGeneratorOptions(CliBaseOptions(), "".toPath())

  private val outputDir: Path by
    option(
        names = arrayOf("-o", "--output-dir"),
        metavar = "path",
        help = "The directory where generated source code is placed.",
      )
      .path()
      .default(defaults.outputDir)

  private val indent: String by
    option(
        names = arrayOf("--indent"),
        metavar = "chars",
        help = "The characters to use for indenting generated source code.",
      )
      .default(defaults.indent)

  private val addGeneratedAnnotation: Boolean by
    option(
        names = arrayOf("--add-generated-annotation"),
        help = "Whether to add a @Generated annotation to the types to be generated.",
      )
      .flag()

  private val generateGetters: Boolean by
    option(
        names = arrayOf("--generate-getters"),
        help =
          "Whether to generate public getter methods and " +
            "private final fields instead of public final fields.",
      )
      .flag()

  private val generateJavadoc: Boolean by
    option(
        names = arrayOf("--generate-javadoc"),
        help = "Whether to preserve Pkl doc comments by generating corresponding Javadoc comments.",
      )
      .flag()

  private val generateSpringBoot: Boolean by
    option(
        names = arrayOf("--generate-spring-boot"),