Split-pipeline

Topics: Developer Forum, User Forum
Dec 5, 2007 at 4:37 AM
Anyone think this is a good idea as a function for the PSCX.. I think it fills a particular gap in my soul. There may be problems if one of the pipelines modifies the data as it flows through the pipe.... ;->

param( $PipeOne = $(Throw "Need to specify First block") , $PipeTwo = $( throw "Need to specify Second script block" ) )

begin {

}

process {

$_ | % { &$PipeOne }
$_ | % { &$PipeTwo }
}

gci | split-pipeline { write-host $_ -fore red } { $_ | %{ $_.Name } }



ps: It would be way cooler if I'd used $args to have multiple pipelines...

Dec 6, 2007 at 1:34 AM
Edited Dec 6, 2007 at 1:37 AM
A better example of the functionality would be

>> ls -r -i * | split-pipeline { $_ | where { $_ -like "*.c" } } { $_ | where { $_ -like "*.h" } }

and splice-pipeline would be a better name? as the action is splicing multiple pipelines to the output of the first.. there is no split operation happening...