-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgh_close
More file actions
executable file
·28 lines (22 loc) · 800 Bytes
/
gh_close
File metadata and controls
executable file
·28 lines (22 loc) · 800 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
# Check if gh CLI is installed
if ! command -v gh &> /dev/null; then
echo "GitHub CLI (gh) is not installed. Please install it first."
exit 1
fi
# Check if fzf is installed
if ! command -v fzf &> /dev/null; then
echo "fzf is not installed. Please install it first."
exit 1
fi
# List all issues and pipe to fzf for selection
selected_issue=$(gh issue list --limit 100 | fzf --header="Select an issue to close (use arrow keys, press enter to select)")
if [ -z "$selected_issue" ]; then
echo "No issue selected. Exiting."
exit 0
fi
# Extract the issue number from the selected line (first column)
issue_number=$(echo "$selected_issue" | awk '{print $1}')
# Close the selected issue
echo "Closing issue #$issue_number..."
gh issue close "$issue_number"