swift-argument-parser
swift-argument-parser copied to clipboard
Optional arrays
It's the solution for issue #307 The author closed the issue, but I still need this one.
Checklist
- [x] I've added at least one test that validates that my change is working, if appropriate
- [x] I've followed the code style of the rest of the project
- [x] I've read the Contribution Guidelines
- [x] I've updated the documentation if necessary
Didn't find any documentation about using arrays in Option properties.
@natecook1000 Hey, could you validate this draft? It suits my command-line tool and now I can use it like this:
struct Rugby: ParsableCommand {
@Option(parsing: .upToNextOption) var focus: [String]?
func run() throws { print(focus) }
}
Command | Output
---------------------------------------------------------------------------------
rugby | nil
rugby --focus | []
rugby --focus Alamofire SnapKit | ["Alamofire", "SnapKit"]
@swift-ci please test
Thanks for this, @swiftyfinch — I'm not totally convinced that this is the right design to solve this issue, but it does seem sensible. Can you make sure the behavior makes sense / add tests for using this with the other parsing strategies? We'll also want an initializer that works with non-ExpressibleByArgument
types.
@natecook1000 Okey, I will try) How can I run checks with @swift-ci?
@swiftyfinch I think only committers can kick off CI… Just let me know when you're ready for review!
- [x] Finalize handling all parsing strategies
- [x] Add non-ExpressibleByArgument init
- [x] Add more tests for the most part of cases
@natecook1000 Ready for review
@swift-ci Please test
@natecook1000 I fixed compile error. Please, run tests again.
@swift-ci please test
@natecook1000 @kylemacomber Hey, any updates here?
Any updates?
@natecook1000 @kylemacomber Hey, do I need to resolve conflicts or this solution doesn't have a chance to be merged? Just let me know if you are waiting for me. There weren't any updates last three months.
Bumping this, as this feature would be nice.
Bumping this.