Skip to content

Commit

Permalink
Fix no PRs edge case (#258)
Browse files Browse the repository at this point in the history
* Fix no PRs edge case

* Fix PR ID extraction in Invoke-PsFzfGitPullRequests function

* Fix array edge case
  • Loading branch information
kelleyma49 authored Feb 19, 2024
1 parent 91eaf11 commit cba20d2
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions PSFzf.Git.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -362,8 +362,18 @@ function Invoke-PsFzfGitPullRequests() {
Where-Object { -not [string]::IsNullOrWhiteSpace($_) } | `
Invoke-Fzf @fzfArguments -Expect "ctrl-x,ctrl-u,ctrl-p" -Header $header -Preview "$previewCmd" -HeaderLines 2 -BorderLabel $borderLabel

$prId = $result.Split(' ')[1] # get the PR ID
$reloadPrList = $result[0] -eq 'ctrl-u' # reload if user filter toggled
if ($result -is [array]) {
if ($result.Length -ge 2) {
$prId = $result[1].Split(' ')[0] # get the PR ID
}
else {
$prId = $null
}
$reloadPrList = $result[0] -eq 'ctrl-u' # reload if user filter toggled
}
else {
$reloadPrList = $result -eq 'ctrl-u' # reload if user filter toggled
}
$checks = $null

# reload with user filter toggled:
Expand Down

0 comments on commit cba20d2

Please sign in to comment.