Replies: 1 comment 2 replies
-
|
Hi @jrivard nice to hear you like the library! First, about Second, one idea (you may not like it) is to let go of having a single base-command. If you split them up into multiple top-level commands, the user experience may be much nicer... |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building a CLI tool using the excellent picocli library. My tool has about a dozen subcommands, many of which share a complex set of options with validations and mutual exclusivity. I handle these shared options using a mixin across most subcommands, which works technically but leads to awkward UX for users.
My structure looks like this:
The problem:
All option names are globally unique. Most
mixin1options are required and frequently used, but because they're defined on the subcommands, users must place them after the subcommand. This is unintuitive since users tend to provide these options first and only change the subcommand (and a few other options) using shell history.A related issue is with
@filesupport: it also must appear after the subcommand, which further complicates the user experience.I understand why this behavior exists given picocli's design, but I'd like to make the option order more flexible for users.
What I've tried:
mixin1has required options.mixin1tobase-command: This forces irrelevant options on subcommands that don't usemixin1(e.g.,sub3).[ArgGroupMixinDemo2.java](https://github.com/remkop/picocli/blob/main/picocli-examples/src/main/java/picocli/examples/arggroup/ArgGroupMixinDemo2.java)example, but it doesn't seem to fit because of required options.Potential workaround:
I could duplicate
mixin1—one version required on subcommands and another optional onbase-command—and manually sync the values. This feels cumbersome and error-prone.My questions:
mixin1to be accepted both before and after subcommands?@filework regardless of its position?Any insights or alternative approaches would be greatly appreciated!
Beta Was this translation helpful? Give feedback.
All reactions