apple / apple/swift-argument-parser
Provide public method for getting an array of string arguments for a `ParsableArguments` type
- Dominant language
- Swift
- Stars
- 3.8k
- Forks
- 411
- Avg merge
- 7d 13h
- Merged PRs (30d)
- 17
Description
I'd like to be able to get an array of `String` arguments from an already-initialized `ParsableArguments` type. This is useful for Driver applications that need to create some `ParsableArguments` type, then get the raw string arguments to pass into a child `Process`, which might not even be the same tool and/or cannot be run directly.
```swift
struct MyInvocation: Decodable, ParsableArguments {
@Flag var myOption = false
}
var invocation = MyInvocation.parse([])
invocation.myOption = true
runChildProcess("myOtherTool \(invocation.rawArguments.joined(separator: " "))")
```
Contributor guide
Research direction
Start with the ParsableArguments protocol and the existing parse entry point to understand how argument values are represented. Define the expected raw argument behavior for the mutated MyInvocation example, then add focused tests showing that the returned String array can be passed to another process.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- swift
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100