new: pwsh: use local completion file

This commit is contained in:
qwjyh 2023-02-19 06:29:15 +09:00
parent b3c40a3bb1
commit 6cdd51f11e
2 changed files with 27 additions and 10 deletions

View file

@ -0,0 +1,16 @@
# create completion scripts file
$script_location = "$HOME\.config\powershell\completions"
if (!(Test-Path $script_location)) {
echo "No existing completions"
echo "Creating ~/.config/powershell/completions..."
mkdir $script_location
}
# write
Get-ChildItem $script_location | Remove-Item
rclone completion powershell > (Join-Path $script_location "rclone_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")
chezmoi completion powershell > (Join-Path $script_location "chezmoi_completion.ps1")

View file

@ -169,10 +169,10 @@ Import-Module scoop-completion
#Import-Module "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion" #Import-Module "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion"
# chezmoi completion # chezmoi completion
$chezmoi_script = "$HOME\.config\powershell\chezmoi_completion.ps1" #$chezmoi_script = "$HOME\.config\powershell\chezmoi_completion.ps1"
if (Test-Path $chezmoi_script) { #if (Test-Path $chezmoi_script) {
. $chezmoi_script # . $chezmoi_script
} #}
# git completion # git completion
Import-Module posh-git Import-Module posh-git
@ -199,15 +199,16 @@ if (Test-Path($ChocolateyProfile)) {
} }
# rclone # rclone
rclone completion powershell | Out-String | Invoke-Expression #rclone completion powershell | Out-String | Invoke-Expression
# node # node
Import-Module npm-completion Import-Module npm-completion
# rustup completion # rustup completion
$rustup_script = "$HOME\.config\powershell\rustup_completion.ps1" #rustup completions powershell | Out-String | Invoke-Expression
if (Test-Path $rustup_script) {
. $rustup_script # wezterm
} #wezterm shell-completion --shell power-shell | Out-String | Invoke-Expression
Get-ChildItem ~\.config\powershell\completions\ | % { & $_ }