summarylogtreecommitdiffstats
path: root/rofi-gh-issues
diff options
context:
space:
mode:
Diffstat (limited to 'rofi-gh-issues')
-rwxr-xr-xrofi-gh-issues38
1 files changed, 38 insertions, 0 deletions
diff --git a/rofi-gh-issues b/rofi-gh-issues
new file mode 100755
index 000000000000..fa717058108c
--- /dev/null
+++ b/rofi-gh-issues
@@ -0,0 +1,38 @@
+#!/bin/bash
+set -Ee
+set -u
+set -o pipefail
+
+issuesjson="${XDG_CACHE_HOME:-$HOME/.cache}/rofi-gh-issues/issues.json"
+mkdir -p "$(dirname "$issuesjson")"
+
+initial_call_list() {
+ gh api search/issues -X GET -f q='user:@me is:open' \
+ | jq '.items | map({url:.html_url, display:("[" + (.repository_url | split("/"))[-1] + "] " + .title)})' \
+ | tee "$issuesjson" \
+ | jq -r 'map(.display)[]' \
+ ;
+ return 0
+}
+
+selected_entry() {
+ selection="$1"
+ jq -r ".[] | select(.display==\"$selection\").url" "$issuesjson" \
+ | xargs xdg-open \
+ ;
+ return 0
+}
+
+case "$ROFI_RETV" in
+ 0)
+ initial_call_list
+ exit "$?"
+ ;;
+ 1)
+ selected_entry "$1"
+ exit "$?"
+ ;;
+ *)
+ exit 2
+ ;;
+esac