Files
dotfiles/.functions/ghpr.sh
Stefan Imhoff a41290c297 feat(nix): nix and back again
I tried Nix, but it had too many downsides so I removed it.

1. Didn't like that all files are immutable and simple config changes
need a complete rebuild.
2. Setting up a new Mac didn't work as smoothly as promised. Not worth
the effort.
3. It sucked a lot to always have to type in the password twice on each
darwin-rebuild
4. It solves problems I never had.
2024-08-07 17:49:02 +02:00

19 lines
570 B
Bash
Executable File

# Search and preview GitHub pull requests
ghpr() {
# Force GitHub CLI to use colors
export GH_FORCE_TTY=100%
# List pull requests and pipe to fzf for selection
selected_pr=$(gh pr list | fzf --ansi --preview 'GH_FORCE_TTY=100% gh pr view {1}' --preview-window down --header-lines 3)
# Check if a PR was selected
if [ -n "$selected_pr" ]; then
# Extract the PR number and checkout
pr_number=$(echo "$selected_pr" | awk '{print $1}')
gh pr checkout "$pr_number"
else
echo "No pull request selected."
fi
}