Commit 22876493 authored by Dustin L. Howett's avatar Dustin L. Howett

devprofiles: add an argument completer

parent fd0f5cb0
......@@ -33,4 +33,18 @@ Function Enter-DevelopmentEnvironment {
}
}
Register-ArgumentCompleter -CommandName Enter-DevelopmentEnvironment -ParameterName Name -ScriptBlock {
Param($cmd, $param, $word, $ast, $pos)
Get-ChildItem (Split-Path $Profile | Join-Path -ChildPath "Dev") -EA SilentlyContinue |
Where-Object Name -Like "$word*" |
Sort-Object |
ForEach-Object {
$name = $_.Name
If ($name -Like "*.ps1") {
$name = $name -Replace "\.ps1$",""
}
[System.Management.Automation.CompletionResult]::new($name, $name, "ParameterValue", $name)
}
}
New-Alias -Name dev -Value Enter-DevelopmentEnvironment
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment