bootique
bootique copied to clipboard
Consider using picocli
Unsure if this has been considered before, but it may be interesting to replace joptsimple with picocli.
There could be several benefits, depending on whether this is limited to an internal change or whether you want to go further.
End user benefits:
- usage help with ANSI colors and styles. This doesn’t just look good, it also reduces the cognitive load on end users: the contrast make important information like commands, options, and parameters stand out from the surrounding text.
- @-files to load arguments from files
Maintenance benefits:
- built-in support for subcommands: less code to maintain
- built-in support for Dependency Injection
- built-in support for interactive password options
- actively maintained and extensive documentation
Depending on how much you like this idea, you could consider allowing users to create custom bootique-based CLI applications using the picocli API directly, similar to Micronaut's approach.
Thoughts?
Thanks for the pointer. In fact we considered replacing jopt with our own CLI parser as a part of the general effort to remove 3rd party dependencies. Will certainly take a look at Picocli. We do need something more advanced.
Ok, interesting. You may like the fact that picocli is in a single source file so applications also have the option to include it as source to avoid the external dependency.
But take a look at whether picocli's functionality is attractive or whether you would rather develop this in-house. Are you mainly interested in using this internally in Bootique or are you considering offering/expanding an external API for applications to create Bootique-based CLI applications?
Let me know if I can help. -Remko
Update: picocli 4.0 adds some features that may be of interest:
- repeatable nested argument groups
- negatable options ("no-")
- execute API improves exit code support and reduces boilerplate code
- improved support for GraalVM native images
... and more. See the 4.0 release notes for more detail.
I'd be happy to help if there is interest.
We still haven't got around to reworking options handling (that's probably Bootique 4.0). But the consensus is that we are not going to add any new third-party dependencies to the Bootique core, and will be working towards getting rid of most of the current ones.