Handle scoop completion gracefully

This commit is contained in:
Kenneth Benzie 2024-11-07 14:31:34 +00:00
parent cb09d8bb11
commit f61e0768d2
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,11 @@
if (Get-Command scoop.ps1 -ErrorAction SilentlyContinue) {
$ScoopCompletion = "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion"
if (!(Test-Path $ScoopCompletion)) {
scoop bucket add extras
scoop install scoop-completion
}
}
if (!(Test-Path -PathType Container $env:LOCALAPPDATA\layouts)) {
New-Item -ItemType Directory -Path $env:LOCALAPPDATA\layouts
Write-Output "changed: created directory $env:LOCALAPPDATA\layouts"

View File

@ -8,7 +8,10 @@ $GitPromptSettings.BeforeStatus = ""
$GitPromptSettings.AfterStatus = ""
# Enable Scoop completions.
if (Get-Command scoop.ps1 -ErrorAction SilentlyContinue) {
Import-Module "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion"
$ScoopCompletion = "$($(Get-Item $(Get-Command scoop.ps1).Path).Directory.Parent.FullName)\modules\scoop-completion"
if (Test-Path $ScoopCompletion) {
Import-Module $ScoopCompletion
}
}
# Enable Chocolatey completions.
Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"