I am looking at using `groupSwitch` to help select...
# clikt
p
I am looking at using
groupSwitch
to help select a security toggle and then provides each toggles associated required parameters. My app will be a Hadoop client if it helps any, so my security selection under a Kerberos enabled cluster would be from the following 3 presents choices 1: A default mechanism, in which all that is delegated to the hadoop libraries (it will have options, but they are not relevant or hampering me right now) 2: User supplies a Kerberos principal & keytab as options 3: User supplies a Kerberos principal & associated password as options As we can see, options 2 & 3 share a common parameter
principal
, whilst option 1 does not require it as input. Principal would be a required parameter were the switch for 2/3 is used. So the principal is not generic to the application, so I don't want to ask for it outside of the
groupSwitch
However, if I request
principal
in both
OptionGroup
classes, we get an error that the option is duplicated From my reading of how it works, a
ChoiceGroup
is inherently
single
when they are a required option, unlike with Mutually Exclusive Options, were they are optional. However, i can't use
single
with a
ChoiceGroup
to enforce that characteristic. I can't use either Mutually Exclusive Options or Co-Occurring exclusively that I can see, given the desire to have a switch act as the driver to collect additional options or not. Is there a pattern that would support this? i.e. allowing a
--principal
parameter to exist in both option groups, yet it be considered unique as it would only be possible for one of the duplicates to be exposed? Side node.
groupSwitch
help formatting is very very odd. When used with
groupSwitch
the
name
parameter of the
OptionGroup
is used in the help formatter, but not the
help
parameter. The option groups are documented above the
Options:
and the switches below it. So putting the help text for each option in the
name
parameter feels very odd. The switches in the
Options:
section are not really conveyed that they are switches either. Almost all other self-documenting elements in Clikt feel intuitive, but those for
groupSwitch
feel quite out of place