I have two PowerShell functions, the first of which calls the second. They both take N arguments, and one of them is determined simply by adding a flag and calling the other. The following are examples:
function inner { foreach( $arg in $args ) {
Usage will look something like this:
inner foo bar baz
or
outer wibble wobble wubble
The goal is for the last example to be equivalent
inner --flag wibble wobble wubble
Problem: As defined here, the latter actually leads to two arguments passed to inner : the first is "-flag" and the second is an array containing "wibble", "wobble" and "wubble". I want inner get four arguments: a flag and three source arguments.
So I'm wondering how to convince powershell to expand the $ args array before passing it to inner , passing it as N elements, not just one array. I believe that you can do this in Ruby using the splatting operator (* character), and I'm sure PowerShell can do this, but I donβt remember how.
arrays powershell
Charlie
source share