PowerShell - Parameter Value Tab Extension for Enum Types

Is it possible to implement parameter value tab extension for enum

parameter types?

Create a binary cmdlet with parameter definition:

[Parameter]
public SomeEnum Type {get;set;} 

      

Is there a way to enter:

Add-MyThing -Type S<tab> 

      

To obtain:

Add-MyThing -Type SomeEnumValue

      

Where:

public enum SomeEnum 
{
   SomeEnumValue,
   SomeEnumValue2
}

      

I know this is possible with function overrides TabExpansion

, but I was wondering if there is something I could do in my cmdlet to expose this type of functionality.

+2


a source to share


2 answers


Parameter parsing and tab stops are handled by PowerShell. The only extension hook for tab completion is the TabExpansion function you mentioned.



+2


a source


After examining the TabExpansion

default function , I think it can be said that this type of funcitonality does not exist by default in PowerShell. Capturing the advanced tab expansion feature is actually the way to go.



0


a source







All Articles