From 209010e90e6f4f3e329a951c137518c93c7e734d Mon Sep 17 00:00:00 2001 From: "Kenneth Benzie (Benie)" Date: Tue, 25 Jul 2023 23:46:21 +0100 Subject: [PATCH] Check before attempting to load things --- profile.ps1 | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/profile.ps1 b/profile.ps1 index 57b058a..79c2506 100644 --- a/profile.ps1 +++ b/profile.ps1 @@ -9,9 +9,13 @@ $GitPromptSettings.AfterStatus = "" # Enable Chocolatey completions. Import-Module "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1" # Enable op completions. -Import-Module "$env:LOCALAPPDATA\1Password\cli\opProfile.psm1" +if (Test-Path "$env:LOCALAPPDATA\1Password\cli\opProfile.psm1") { + Import-Module "$env:LOCALAPPDATA\1Password\cli\opProfile.psm1" +} # Enable gh completions. -Invoke-Expression -Command $(gh completion -s powershell | Out-String) +if (Get-Command "gh" -ErrorAction SilentlyContinue) { + Invoke-Expression -Command $(gh completion -s powershell | Out-String) +} # Customize PowerShell prompt. function Prompt {