Reputation: 5281
When I run the statement man tabexpansion
it shows that I simply need to provide -line and -lastword.
However, when I run a statement like this:
tabexpansion -line "c:/win" -lastword "c:/win"
It returns nothing.
Shouldn't it show at least C:\Windows? What am I doing wrong?
Upvotes: 0
Views: 672
Reputation: 3451
tabexpansion is a function involved in doing tab handling during manual command entry. It performs completion of various types of objects, like path names, variable names, function/cmdlet names, etc. The interface to this function is discussed at this SO post. The booked referenced describes overriding TabExpansion2.
I read elsewhere that TabExpansion is used in PS 2.0, whereas TabExpansion2 is used in 3.0.
As to why TabExpansion doesn't return anything, I can only answer for my system (which has PS 3.0). On my system cat function:tabexpansion
gives:
[CmdletBinding()]
param(
[String] $line,
[String] $lastWord
)
process {
if ($line -eq "Install-Module $lastword" -or $line -eq "inmo $lastword"
-or $line -eq "ismo $lastword" -or $line -eq "upmo $lastword"
-or $line -eq "Update-Module $lastword") {
Get-PsGetModuleInfo -ModuleName "$lastword*" | % { $_.Id } | sort -Unique
}
elseif ( Test-Path -Path Function:\$tabExpansionBackup ) {
& $tabExpansionBackup $line $lastWord
}
}
Unless $line begins with a few specific tokens it goes to the elseif statement. There if the variable $tabexpansionBackup
is not defined, the function is exited with no output. With the input in the OP, it gives the output you're seeing - none.
Upvotes: 1