PoshCode Archive  Artifact Content

Artifact 58051386eb0f01613f9de3bf26cd1dc1fa15c6b04f1d71362b537455ca000ced:

  • File powertab-patch.ps1 — part of check-in [63a31b1722] at 2018-06-10 12:58:44 on branch trunk — Patch To TabExpansion.ps1 (user: idvorkin size: 1141)

# encoding: ascii
# api: powershell
# title: powertab patch
# description: Patch To TabExpansion.ps1
# version: 0.1
# type: function
# author: idvorkin
# license: CC0
# x-poshcode-id: 1586
# x-archived: 2010-01-22T07:23:43
#
# ( after line 569 – commented out line #if ((@$....)
#
# Stick this anywhere
    filter convertTypeToTabCompletionName()
    {

        $typeToTabCompletion=@{
        [Microsoft.Powershell.Commands.X509StoreLocation]={$_.Location};
        [System.Security.Cryptography.X509Certificates.X509Store]={$_.Name};
        [Microsoft.Win32.RegistryKey]={ $_.Name.Split("\")[-1] };
        }

        $convertToTabCompletionFunction =$typeToTabCompletion[$_.GetType()]
        if (-not $convertToTabCompletionFunction  )
        {
            $convertToTabCompletionFunction  = {$_.Name}
        }

        $_ | % $convertToTabCompletionFunction 
    }

#Replace the final Invoke-TabItemSelector with: 
      $ChildItems | convertTypeToTabCompletionName |% {$container + "\" + $_}| Invoke-TabItemSelector $lastPath -SelectionHandler $SelectionHandler -return $lastword -ForceList |% {