remkop / picocli

Picocli is a modern framework for building powerful, user-friendly, GraalVM-enabled command line apps with ease. It supports colors, autocompletion, subcommands, and more. In 1 source file so apps can include as source & avoid adding a dependency. Written in Java, usable from Groovy, Kotlin, Scala, etc.
https://picocli.info
Apache License 2.0
4.79k stars 414 forks source link

Variable interpolation does not work for ArgGroup.heading attribute #2281

Open marcphilipp opened 1 month ago

marcphilipp commented 1 month ago

I tried abusing an @ArgGroup heading to include a link for the previous group and wanted to use variable interpolation to generate a version-specific documentation link:

@ArgGroup(validate = false, order = 3, heading = "%n  For more information on selectors including syntax examples, see"
        + "%n  @|underline https://junit.org/junit5/docs/${junit.docs.version}/user-guide/#running-tests-discovery-selectors|@"
        + "%n%n@|bold FILTERS|@%n%n")
FilterOptions filterOptions;

junit.docs.version is defined as a system property. I also tried with java.version to rule out a problem setting the custom system property.

Admittedly, my use case is a bit weird (please let me know if there's a better way to do this), but the Picocli docs make it sound as if variable interpolation should work in all annotation attributes, includine ArgGroup.heading.

remkop commented 1 month ago

Thank you for raising this. That sounds like a bug. I’ll look into it.