add & fix: pwsh: pip completion & completion load

This commit is contained in:
qwjyh 2023-04-08 23:23:38 +09:00
parent f09332e5c7
commit 965dcf5045
2 changed files with 11 additions and 1 deletions

View file

@ -13,6 +13,7 @@ rclone completion powershell > (Join-Path $script_location "rclone_completion.ps
rustup completions powershell > (Join-Path $script_location "rustup_completion.ps1") rustup completions powershell > (Join-Path $script_location "rustup_completion.ps1")
wezterm shell-completion --shell power-shell > (Join-Path $script_location "wezterm_completion.ps1") wezterm shell-completion --shell power-shell > (Join-Path $script_location "wezterm_completion.ps1")
chezmoi completion powershell > (Join-Path $script_location "chezmoi_completion.ps1") chezmoi completion powershell > (Join-Path $script_location "chezmoi_completion.ps1")
pip completion --powershell > (Join-Path $script_location "pip_completion.ps1")
# alias # alias
Set-Location $PSScriptRoot Set-Location $PSScriptRoot

View file

@ -190,6 +190,15 @@ Register-ArgumentCompleter -Native -CommandName winget -ScriptBlock {
} }
} }
# PowerShell parameter completion shim for the dotnet CLI
# https://learn.microsoft.com/en-us/dotnet/core/tools/enable-tab-autocomplete#powershell
Register-ArgumentCompleter -Native -CommandName dotnet -ScriptBlock {
param($commandName, $wordToComplete, $cursorPosition)
dotnet complete --position $cursorPosition "$wordToComplete" | ForEach-Object {
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
}
}
# Import the Chocolatey Profile that contains the necessary code to enable # Import the Chocolatey Profile that contains the necessary code to enable
# tab-completions to function for `choco`. # tab-completions to function for `choco`.
# Be aware that if you are missing these lines from your profile, tab completion # Be aware that if you are missing these lines from your profile, tab completion
@ -215,5 +224,5 @@ Import-Module npm-completion
# wsl.exe # wsl.exe
Import-Module WSLTabCompletion Import-Module WSLTabCompletion
Get-ChildItem ~\.config\powershell\completions\ | % { & $_ } Get-ChildItem ~\.config\powershell\completions\ | % { . $_ }