uber / mockolo

Efficient Mock Generator for Swift
Apache License 2.0
805 stars 85 forks source link

Bug: Specifying multiple mock file paths is broken #172

Closed ffittschen closed 2 years ago

ffittschen commented 2 years ago

Prior to 1.5.0, it was possible to specify multiple mock file paths with the -mocks argument separated by a space, e.g.

mockolo -s Foo/Sources -mocks Bar/Sources/Mocks.generated.swift Baz/Sources/Mocks.generated.swift -d Foo/Sources/Mocks.generated.swift

With the switch to the Swift Argument Parser in 1.5.0, this doesn't seem to be possible anymore. When running mockolo directly in Xcode and adding a breakpoint in Executor.swift#L173, the mockFilePaths will be an array with 1 value of Bar/Sources/Mocks.generated.swift Baz/Sources/Mocks.generated.swift instead of an array with 2 values Bar/Sources/Mocks.generated.swift and Baz/Sources/Mocks.generated.swift. This bug not only applies to the -mocks option, but all options that have "[...] (separated by a comma or a space) [...]" in their help text.

To restore the previous behavior, we could make use of the .upToNextOption parsing strategy in the @Option.

I'd be happy to create a PR for this, but as there are also other [String] options, I thought I'd clarify it with you first to have a consistent usage for all array options.

EspressoCup commented 2 years ago

Nice catch! Yes please make a PR for all [String] options with that parsing strategy. Thanks.