The user launchs a script called wrapper.ps1 It has
param(
[string]$command,
[string]$item=''
etc
)
I then evaluate this with
switch -wildcard ($command) {
"command1" {function1 $item;}
"command2" {function2 $item;}
etc.
}
Then I have a function1 like:
function function1 {
param([string] $itemname =''}
#etc...then:
$summary = @{blah1 = $blah1; blah2= $blah2; blah3= $blah3; }
return $summary
$blah# are simple strings. The question is how can I pipeline into function1 via wrapper.ps1? I'd like to call this script like this:
wrapper.ps1 command1 filename |ft blah1,blah3
You choose to return a hashtable so you can exploit it from the pipeline
wrapper.ps1 "command1" "item" | select -ExpandProperty values
or
wrapper.ps1 "command1" "item" | % {foreach ($hash in $_.keys){write-host "the key is $hash the value is $($_[$hash])"}}