private/Register-VexaArgComps.ps1
function Register-VexaArgComps { Register-ArgumentCompleter -CommandName "New-VexaInventory" -ParameterName "Server" -ScriptBlock { param ($CommandName, $ParameterName, $WordToComplete, $CommandAst, $FakeBoundParameters) $global:DefaultVIServers.Where({$_.Name -like "$WordToComplete*"}).ForEach({"'$_'"}) } $PathScript = [scriptblock] { param ($CommandName, $ParameterName, $WordToComplete, $CommandAst, $FakeBoundParameters) switch ($PSVersionTable.Platform) { "Unix" {$Slash = "./"} Default {$Slash = ".\"} } (Get-ChildItem -Path $PWD).Where({$_.Name -like "$WordToComplete*.xml"}).Name.ForEach({"'$Slash$_'"}) } Register-ArgumentCompleter -CommandName "Import-VexaInventory" -ParameterName "Path" -ScriptBlock $PathScript Register-ArgumentCompleter -CommandName "Invoke-Vexa" -ParameterName "Path" -ScriptBlock $PathScript } |