swift-argument-parser icon indicating copy to clipboard operation
swift-argument-parser copied to clipboard

Way to specify an array argument as "additional" or "pass through" arguments

Open ian-twilightcoder opened this issue 2 years ago • 0 comments

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.

ian-twilightcoder avatar Sep 01 '22 05:09 ian-twilightcoder