swift-argument-parser
swift-argument-parser copied to clipboard
Way to specify an array argument as "additional" or "pass through" arguments
I have a command line tool that invokes another tool, and I'd like to allow the user to pass arguments for the underlying tool. In other words:
my-tool my-argument --my-flag -- --argument-for-underlying-tool
That would look like this in code.
@Argument
var myArgument: String?
@Flag
var myFlag = false
@Argument
var passThroughArguments: [String] = []
The problem is that I need my-tool -- --argument-for-underlying-tool
to assign "--argument-for-underlying-tool" to passThroughArguments
, but it assigns it to myArgument
instead. I don't see any existing argument parsing strategies that can achieve this behavior.