PoshCode Archive  Artifact Content

Artifact 257825d88f513e937375b25cd0f0b624fa9d2747106f32b164d815d5ff2a7e9c:

  • File accelerators-for-posh-2.ps1 — part of check-in [0bf8c72619] at 2018-06-10 13:43:08 on branch trunk — As you know PowerShell v3 has [accelerators] type but PowerShell v2 has not this feature. So why do I have to endure this omission in PowerShell v2? (user: greg zakharov size: 638)

# encoding: ascii
# api: powershell
# title: accelerators for posh 2
# description: As you know PowerShell v3 has [accelerators] type but PowerShell v2 has not this feature. So why do I have to endure this omission in PowerShell v2?
# version: 0.1
# author: greg zakharov
# license: CC0
# x-poshcode-id: 4567
# x-archived: 2013-11-01T01:52:03
# x-published: 2013-10-28T07:34:00
#
#
$ta = [Type]::GetType("System.Management.Automation.TypeAccelerators")
$ta::Get.Keys.GetEnumerator() | % {$arr = @()}{
  $arr += $($_ -ne 'accelerators')
}{
  if (-not ($arr -contains 'False')) {
    $ta::Add('accelerators', $ta)
  }
}