Open MaxDesiatov opened 1 year ago
Great spot, @MaxDesiatov — it would be great if these could preserve their titles when nested. What do you think the behavior should be if the "parent" option group also includes a title? That is, what should the help look like in this case?
struct A: ParsableArguments {
@Flag var one = false
@Flag var two = false
}
struct B: ParsableArguments {
@Flag var three = false
@Flag var four = false
}
struct Options: ParsableArguments {
@OptionGroup(title: "Group A")
var groupA: A
@OptionGroup(title: "Group B")
var groupB: B
}
struct Command: ParsableCommand {
@OptionGroup(title: "All Options")
var options: Options
}
@OptionGroup
behaves in an unexpected way with nested groups whentitle:
argument value is specified.ArgumentParser version: 1.2.2 Swift version: swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51) Target: arm64-apple-macosx13.0
Checklist
main
branch of this packageSteps to Reproduce
Create a type that has properties using
@OptionGroup
property wrapper withtitle:
argument passed. Uses this type then as@OptionGroup
itself. This top level may specify or not specify its owntitle:
argument, this doesn't make a difference on the observed outcome.Expected behavior
Nested
@OptionGroup
s have theirtitle:
values displayed and options grouped by these titles in help output.Actual behavior
Nested
@OptionGroup
s don't have theirtitle:
values displayed and options grouped by these titles in help output. All of the options are displayed within the top-level group,title:
values on nested groups have no effect whatsoever.