-
Notifications
You must be signed in to change notification settings - Fork 199
[Option] Support MultiArg options #1609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Option] Support MultiArg options #1609
Conversation
needed to support: swiftlang/swift#73601 |
@swift-ci please test |
143899e
to
8e42d4c
Compare
@swift-ci please test |
@swift-ci please test windows platform |
} | ||
let endIdx = index + Int(option.numArgs) | ||
parsedOptions.addOption(option, argument: .multiple(Array())) | ||
arguments[index..<endIdx].map { String($0) }.forEach { parsedOptions.addInput($0) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will this index off the end of the array if the user doesn't provide enough args?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Added a testcase for that too.
Teach SwiftOption to handle MultiArg options, including generating Options from Options.td, etc. Even the only MultiArg option in swift is a NoDriver option, still teach the OptionTable to parse such options to future proof the implementation.
8e42d4c
to
62c300b
Compare
@swift-ci please test |
Teach SwiftOption to handle MultiArg options, including generating Options from Options.td, etc. Even the only MultiArg option in swift is a NoDriver option, still teach the OptionTable to parse such options to future proof the implementation.