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.94k stars 424 forks source link

Customizing default option names provided with AutoHelpMixin #1745

Open lpellegr opened 2 years ago

lpellegr commented 2 years ago

I a using mixinStandardHelpOptions with a command and subcommands. This is really convenient. The issue I have is that this mixin adds a version option with default names defined as -V, --version whereas I would like to get -v, --version.

Looking at Picoli implementation, I see there is a placeholder defined in CommandLine.AutoHelpMixin:

@Option(names = {"${picocli.version.name.0:--V}", "${picocli.version.name.1:---version}"}, versionHelp = true, descriptionKey = "mixinStandardHelpOptions.version", description = "Print version information and exit.")
private boolean versionRequested;

Setting System.setProperty("picocli.version.name.0", "-v"); in my app main is working but there seems to be no mention about Picocli placeholders in the docs. Is this the recommended way to proceed?

remkop commented 2 years ago

Yes, well-spotted. if you feel like helping improve the docs that’d be great.