Creating Custom Tab Expansion

Apr 21, 2011 at 6:57 PM

I am trying to register custom functionality in PowerTab by creating a command handler. I am using the NetApp cmdlets and would like Get-Navol to be able to tab through all the volumes. I tried using the "get-service" example in help help about_PowerTab_handlers. I only have one parameter I need to try to tab complete on so I took out the switch statement. When i run the code below, I am still getting a list of files in the current directory instead of NaVolumes. Any idea what I am doing wrong ?

Register-TabExpansion "Get-NaVol" -Type Command {

 param ( $Context,
     $Argument = $Context.Argument
     $TabExpansionHasOutput.Value = $true  # 2:
     Get-NaVol -Name "$Argument*" |
     Select-Object -ExpandProperty Name  # 3:


Apr 22, 2011 at 10:36 PM

Make sure you are registering it every time you startup PowerShell.  Handlers are not saved.

Other than that, you can get some debug information about the $Context object by setting $PowerTabLog = $true.

Apr 27, 2011 at 3:47 PM

Not sure exactly what fixed it, but I downloaded the latest drop of PowerTab from SourceCode, and now my expansion works.