OptionGroup array

I am trying to parse following command
--platform ios --arch arm64 --platform iossimulator --arch arm64 x86_64
User can write platform as much as he wants. But after the platform user needs to specify arch option.

Implementation looks like this:

struct TrimOption: ParsableArguments {
    @Option var platform: String
    @Option(parsing: ArrayParsingStrategy.upToNextOption) 
    var archs: [String]

extension Array: ParsableArguments where Element == TrimOption { }

Since user can specify as many platforms I declared it as array.

struct XCTrim: ParsableCommand {
    @OptionGroup var platforms: [TrimOption]
    func run() throws {

This gives following error:

Error: No value set for non-argument var InputKey(rawValue: "platforms"). Replace with a static variable, or let constant.
Usage: xctrim
  See 'xctrim --help' for more information.
Program ended with exit code: 64

So how can I declare multiple OptionGroup?

Terms of Service

Privacy Policy

Cookie Policy