You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Update documentation and examples to use natural property wrapper syntax (#210)
Since #207, property
wrapper usage with no arguments can now use the more natural syntax
without the `()`. Updates documentation and example code accordingly.
It's time to define our first two subcommands: `Add` and `Multiply`. Both of these subcommands include the arguments defined in the `Options` type by denoting that property with the `@OptionGroup()` property wrapper. `@OptionGroup` doesn't define any new arguments for a command; instead, it splats in the arguments defined by another `ParsableArguments` type.
66
+
It's time to define our first two subcommands: `Add` and `Multiply`. Both of these subcommands include the arguments defined in the `Options` type by denoting that property with the `@OptionGroup` property wrapper. `@OptionGroup` doesn't define any new arguments for a command; instead, it splats in the arguments defined by another `ParsableArguments` type.
67
67
68
68
```swift
69
69
extensionMath {
70
70
structAdd: ParsableCommand {
71
71
staticvar configuration
72
72
=CommandConfiguration(abstract: "Print the sum of the values.")
73
73
74
-
@OptionGroup()
75
-
var options: Math.Options
74
+
@OptionGroupvar options: Math.Options
76
75
77
76
mutatingfuncrun() {
78
77
let result = options.values.reduce(0, +)
@@ -84,8 +83,7 @@ extension Math {
84
83
staticvar configuration
85
84
=CommandConfiguration(abstract: "Print the product of the values.")
0 commit comments