click-contrib/click-option-group

Option group of Option groups

Wyko opened this issue · 2 comments

Wyko commented

I want to have a user supply either one option or a group of two options. So I need to make a group, consisting of one option and one group of options. I'm not sure it's possible to do this by reading the docs.

Hi @Wyko,

Yes, currently, it is not possible. We cannot create nested option groups. See "Limitations" section in the docs.

Without decorators (like argparse works) I created nested groups using click-option-group. I don't see a user-friendly way for the default usage with decorators as the option validator code (the handle_parse_result in various OptionGroups) must know the whole nested group hierarchy somehow.