From de8f892b7b933d11062cfa417748ef88b6bd23c2 Mon Sep 17 00:00:00 2001 From: Jeffrey Serio <23226432+hyperreal64@users.noreply.github.com> Date: Fri, 8 Sep 2023 07:41:48 -0500 Subject: [PATCH] Add rofistarred --- rofistarred | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/rofistarred b/rofistarred index fbb8d60..1f8d024 100755 --- a/rofistarred +++ b/rofistarred @@ -1,6 +1,18 @@ #!/usr/bin/env bash -USERNAME="hyperreal64" -starred_repos=$(curl -s "https://api.github.com/users/${USERNAME}/starred?per_page=1000" | jq '.[] | .full_name' | tr -d '"') +# Use with rofi -show "GitHub Starred" -modes "GitHub Starred:/home/jas/bin/rofistarred" -echo "$starred_repos" | rofi -dmenu -p "GitHub Starred" -theme-str 'window { width: 40em; height: 40em; }' | xargs -I{} xdg-open "https://github.com/{}" +USERNAME="hyperreal64" +STARRED_FILE="${HOME}/.github-starred" + +if [ ! -f "$STARRED_FILE" ]; then + curl -s "https://api.github.com/users/${USERNAME}/starred?per_page=1000" | jq '.[] | .full_name' | tr -d '"' | tee "$STARRED_FILE" +fi + +starred_repos=$(cat "$STARRED_FILE") + +if [ "$#" -eq 1 ]; then + xdg-open "https://github.com/$1" +else + echo "$starred_repos" +fi