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.
We have some picocli commands that can process instructions defined in an 'action' YAML file, with the YAML file defining acceptable CLI options (i.e., somewhat similar to picocli @Option). To have picocli accept and pass these options to our command, we use the following in our command implementation:
@Unmatched private String[] actionArgs;
As we want the synopsis to show a generic placeholder for these unmatched arguments, we add a dummy picocli option like the below:
However, the special characters in the option name cause syntax errors in the command completion script generated by picocli:
-bash: ./fcli_completion: line 6357: syntax error near unexpected token `<'
-bash: ./fcli_completion: line 6357: ` --<action-parameter>)'
Of course, as an easy work-around, we could just rename this option to --action-parameter, but users may interpret this as a literal option name rather than generic placeholder. Also, ideally this dummy option shouldn't even be present in the completion script.
Can you think of any quick fixes/work-arounds to have something like --<action-parameter> listed in synopsis (and manual pages), but not included in the completion script?
We have some picocli commands that can process instructions defined in an 'action' YAML file, with the YAML file defining acceptable CLI options (i.e., somewhat similar to picocli
@Option
). To have picocli accept and pass these options to our command, we use the following in our command implementation:As we want the synopsis to show a generic placeholder for these unmatched arguments, we add a dummy picocli option like the below:
However, the special characters in the option name cause syntax errors in the command completion script generated by picocli:
Of course, as an easy work-around, we could just rename this option to
--action-parameter
, but users may interpret this as a literal option name rather than generic placeholder. Also, ideally this dummy option shouldn't even be present in the completion script.Can you think of any quick fixes/work-arounds to have something like
--<action-parameter>
listed in synopsis (and manual pages), but not included in the completion script?