-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding tab-completion to your PowerShell Functions #35
Comments
I'm able to do tab completion for the parameter and the parameter values while running the command from the script pane. function Hello-World
{param( [ValidateSet('Green','Red','Blue')] $Color)
Write-Host "Hello world!" -Foreground $Color
} However, tab completion doesn't work when the file is in the Scripts folder like other scripts installed using $DestPath = [Environment]::GetFolderPath('MyDocuments')+"\PowerShell\Scripts"
(New-Object System.Net.WebClient).DownloadFile("https://github.com/Ayanmullick/test/raw/master/Hello-World.ps1","$DestPath\Hello-World.ps1")
Invoke-Expression "$DestPath\Hello-World.ps1" |
Removing the function wrapper in the file being downloaded and adding the default script folder path to
|
This was great, thank you on helping me get dynamic tab completion. One part that through me off was that I didn't realize that setting the dynamic param's name is important and must match the name of the variable in the begin. Set the dynamic parameters' name$ParameterName = 'Service' I thought it was just setting the initial value, but if you don't properly set this, the the dynamic portion will fail. |
Adding tab-completion to your PowerShell Functions
FoxDeploy.com, Stephen Owen's technical blog about
PowerShell, Systems Administration, GUI Design and Programming.
.
https://www.foxdeploy.com/blog/adding-tab-completion-to-your-powershell-functions.html
The text was updated successfully, but these errors were encountered: