Skip to content

Mixin-with-prefix capability? #1808

Answered by remkop
rcauble asked this question in Q&A
Sep 11, 2022 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

You may be able to use variable interpolation and resource bundles to give options in one command a different name than in another command.
The options need to be defined something like this:

    @Option(names = "${lookupkey.foo:---foo") // yes 3 dashes, that is not a typo, the ":-" means "what follows is the default"
    private String foo;
    @Option(names = "${lookupkey.bar:---bar")
    private String bar;

Then, in your diff application, you add a resource bundle that provides the option name.
See this example: https://picocli.info/#_shared_resource_bundles

In the resource bundle, you prefix the lookupkey.foo with the command name so you can have separate values for each command.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@remkop
Comment options

@rcauble
Comment options

Answer selected by remkop
Comment options

You must be logged in to vote
1 reply
@remkop
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants