EliziumNet / Loopz

PowerShell iteration utilities with additional tools like the Parameter Set Tools
https://eliziumnet.github.io/Loopz/
MIT License
3 stars 0 forks source link

Add Update-CustomSignals #99

Closed plastikfan closed 3 years ago

plastikfan commented 3 years ago
function Update-CustomSignals {
  param(
    [Parameter(Mandatory)]
    [hashtable]$Signals
  )

  if ($Signals -and ($Signals.Count -gt 0)) {
    if ($Loopz) {
      if (-not($Loopz.CustomSignals)) {
        $Loopz.CustomSignals = @{}
      }

      $Signals.GetEnumerator() | ForEach-Object {
        if ($_.Value -is [couplet]) {
          $Loopz.CustomSignals[$_.Key] = $_.Value;
        }
        else {
          Write-Warning "Skipping custom signal('$($_.Key)'); not a valid couplet/pair: $($_.Value)";
        }
      }
    }
  }
}

Somehow, I lost rrack of this function, thinking that it was already commited, turns out forgot to commit it. It was simply lying around in old test version Loopz and was nearly lost by accident.