-
Notifications
You must be signed in to change notification settings - Fork 39
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
windows - explore powershell completion #26
Comments
http://powertab.codeplex.com/ Register-TabExpansion "Get-Service" -Type Command {
param($Context, [ref]$TabExpansionHasOutput, [ref]$QuoteSpaces) # 1:
$Argument = $Context.Argument
switch -exact ($Context.Parameter) {
'DisplayName' {
$TabExpansionHasOutput.Value = $true # 2:
Get-Service -DisplayName "*$Argument*" | Select-Object -ExpandProperty DisplayName # 3:
}
'Name' {
$TabExpansionHasOutput.Value = $true # 2:
Get-Service -Name "$Argument*" | Select-Object -ExpandProperty Name # 3:
}
}
} param handler Register-TabExpansion "PSDrive" -Type Parameter {
param($Argument, [ref]$TabExpansionHasOutput, [ref]$QuoteSpaces) # 1:
if ($Argument -notlike '^\$') {
$TabExpansionHasOutput.Value = $true # 2:
Get-PSDrive "$Argument*" | Select-Object -ExpandProperty Name # 3:
}
} register
|
PowerShell Core natively includes It can return an array of PowerShell can natively emit and parse JSON, so it should be easy to pass all the necessary data to and from tabtab without the need to write much PowerShell syntax. Tabtab can do all the work in JS and write JSON to stdout.
|
Do note that PowerShell is now also supported on Unix‑based operating systems, so this is no longer just for Windows. |
Here is how Cobra, a CLI framework for Go, supports it: Base on that, user @jcwillox has written a script to support PowerShell completion for pnpm: |
http://www.leeholmes.com/blog/2012/09/13/bash-like-tab-completion-in-powershell/
powershell became a very capable terminal emulator, see how we could support windows completion.
The text was updated successfully, but these errors were encountered: