2
這是VS PowerShell的腳本。第一次選擇後不顯示數組的Tab完成
function global:Add-Shape { param([string]$Shape, [string[]]$Colors)
Write-Host "Shape Name:$Shape"
foreach ($i in $Colors) {
Write-Host "Color Name:$i"
}
}
Register-TabExpansion 'Add-Shape' @{
'Shape' = {
"Circle",
"Square",
"Triangle"
}
'Colors' = {
"Brown",
"Red",
"Blue"
}
}
在包管理器控制檯當我嘗試這個命令來運行腳本,我可以使用Tab鍵選擇選項,然後從TabExpansion每個選項的值:
Add-Shape -Shape Circle -Colors Red,...
的問題是後爲陣列選項選項卡填充選擇第一個值再也不會顯示以選擇附加。