Reputation: 1285
Powershell has great autocomplete, allowing it to easily autocomplete parameters. Is it possible to provide this autocompletion when calling an application? E.g.
.\myscript.ps1 -Databa (pressing tab here will fill in Database)
but if you eventually decide to replace the script with a proper application
.\myapp.exe -Databa (pressing tab does nothing)
The application is a .NET application (if that helps). Is there any way for it to hook into whatever powershell is doing to determine the parameters?
Upvotes: 4
Views: 1167
Reputation: 47792
Sort of, yeah. But it's all within powershell; you wouldn't do anything within the .Net executable.
As @PetSerAl pointed out, PowerShell 5 has a much easier way to do it.
But it's still possible in earlier versions (though not well documented) by using a tab completer function.
posh-git makes use of this to autocomplete git parameters.
You might also want to look at TabExpansionPlusPlus.
Upvotes: 2