Closed pawamoy closed 3 weeks ago
Oh and https://cappa.readthedocs.io/en/latest/arg.html#arg-group-groups-and-mutual-exclusion mentions this Group
object but it doesn't cross-ref to its documentation, and I can't find it in the API reference.
cappa.Subcommands[Foo]
is just Annotated[Foo, cappa.Subcommand()]
, to which you can supply group=...
whatever you want.
I would expect groups to show up in the order they're encountered/defined, assuming the same index.
but yes, perhaps subcommands/help should be a large number, or or some extra Group attribute that indicates they should always go after normal group items.
Thanks! Annotated[Foo, cappa.Subcommand(group=(100, "Subcommands"))]
is working well! I might even prefer this syntax to cappa.Subcommands
: less nesting, and makes https://github.com/DanCardin/cappa/discussions/164 a non-issue!
I had to play a bit with different values to find out that the "Subcommands" group has index 3 or 4. I'm still not sure because I don't know what happens if two groups have the same index :slightly_smiling_face: EDIT: ah, seems to be 3: https://cappa.readthedocs.io/en/latest/api.html#cappa.Subcommand.group
Is there a way to change the "Subcommands" group index by the way? 3 or 4 seems too low, if I add this many groups some will end up after the "Subcommands" one :thinking: