OptionGroup
A wrapper that transparently includes a parsable type.
@propertyWrapper struct OptionGroup<Value> where Value : ParsableArguments
Use an option group to include a group of options, flags, or arguments declared in a parsable type.
struct GlobalOptions: ParsableArguments {
@Flag(name: .shortAndLong)
var verbose: Bool
@Argument var values: [Int]
}
struct Options: ParsableArguments {
@Option var name: String
@OptionGroup var globals: GlobalOptions
}
The flag and positional arguments declared as part of GlobalOptions
are included when parsing Options
.
Creating an Option Group
init(title: String, visibility: ArgumentVisibility
) Creates a property that represents another parsable type, using the specified title and visibility.
Option Group Properties
var title: String
The title to use in the help screen for this option group.
Infrequently Used APIs
init(
) Creates a property that represents another parsable type.
var wrappedValue: Value
The value presented by this property wrapper.
var description: String