Skip to content

Commit

Permalink
🔨 chore: make all git related completions run asynchronously | move a…
Browse files Browse the repository at this point in the history
…lias for lazygit to this file
  • Loading branch information
jacquindev committed Dec 8, 2024
1 parent af47a66 commit 657e6b6
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions dotposh/Config/posh-git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,27 @@ if (-not (Get-Module -ListAvailable -Name git-aliases -ErrorAction SilentlyConti
if (Get-Command scoop -ErrorAction SilentlyContinue) {
if (!($(scoop bucket list).Name -eq "extras")) { scoop bucket add extras }
scoop install git-aliases
}
else {
} else {
Install-Module git-aliases -Scope CurrentUser -Force
}
}
Register-EngineEvent -SourceIdentifier PowerShell.OnIdle -MaxTriggerCount 1 -Action { Import-Module git-aliases -Global -DisableNameChecking } | Out-Null

# lazygit alias
if (Get-Command lazygit -ErrorAction SilentlyContinue) {
Set-Alias -Name 'lg' -Value 'lazygit'
}

# github cli
if (Get-Command gh -ErrorAction SilentlyContinue) {
Invoke-Expression -Command $(gh completion -s powershell | Out-String)
Register-EngineEvent -SourceIdentifier PowerShell.OnIdle -MaxTriggerCount 1 -Action {
Invoke-Expression -Command $(gh completion -s powershell | Out-String)
} | Out-Null
}

# gitleaks
if (Get-Command gitleaks -ErrorAction SilentlyContinue) {
gitleaks completion powershell | Out-String | Invoke-Expression
}
Register-EngineEvent -SourceIdentifier PowerShell.OnIdle -MaxTriggerCount 1 -Action {
gitleaks completion powershell | Out-String | Invoke-Expression
} | Out-Null
}

0 comments on commit 657e6b6

Please sign in to comment.