aldrichtr / PSOrgMode

A module for reading and writing the org-mode markup format
0 stars 0 forks source link

Ensure all Get- functions are returning objects when created vice storing in an array #41

Closed aldrichtr closed 2 years ago

aldrichtr commented 2 years ago

in PowerShell advanced functions, the begin, process, end sections are available for use. The begin and end blocks only execute once, while the process block executes once per item passed in on the pipeline. Functions that collect several items and return them (particularly "Get" commands) should return objects as they are created rather than waiting until the end block.

Change any of these:

begin {
    $things = @()
}

process {
    $things += makeNewThing()
}

end {
   $things
}

to

process {
    Write-Output makeNewThing()