Add Module Specific Tab Expansion Hooks - by StaffanGu

Status : 


Sign in
to vote
ID 778929 Comments
Status Active Workarounds
Type Suggestion Repros 0
Opened 2/11/2013 1:37:07 AM
Access Restriction Public


Today, it is difficult for module authors to provide completions that are specific to it's module. As an example, take a PowerShell module for Git or Svn that can expand a parameter 'BranchName' given it's knowledge about the current VCS.

I would like to be able to register (perhaps in a module manifest or by attributes) functions that provides completion for the current modules cmdlet parameters.

This would be very useful both for compiled cmdlets and for scripts.

Sign in to post a comment.
Posted by StaffanGu on 5/6/2013 at 3:50 AM
@S.K. I am aware of the existing mechanisms. And of the different open source projects that rewrites TabCompletion2 in different, incompatible ways.

What we need is a build-in way do to this, that is customizable by both module writers and users.

A module writer may have ways to complete parameters in a generic way for his module, but a user may have more knowledge about his domain.

As an example from the source control world, the module may know about branches, but the user about where his repositories are located.

Posted by S.K. _ on 2/15/2013 at 6:21 AM
Since PowerShell team don't try to open documents, we cannot notice easily, but you already have got it.
In v3's tab completion, you can define specific values for specific command parameters.

Dynamic Argument Completion in PSv3

Very regrettably there are no formal data.