2023-09-02 15:24:48 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2023-09-08 14:41:48 +02:00
|
|
|
# Use with rofi -show "GitHub Starred" -modes "GitHub Starred:/home/jas/bin/rofistarred"
|
|
|
|
|
2023-09-02 15:24:48 +02:00
|
|
|
USERNAME="hyperreal64"
|
2023-09-08 14:41:48 +02:00
|
|
|
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")
|
2023-09-02 15:24:48 +02:00
|
|
|
|
2023-09-08 14:41:48 +02:00
|
|
|
if [ "$#" -eq 1 ]; then
|
|
|
|
xdg-open "https://github.com/$1"
|
|
|
|
else
|
|
|
|
echo "$starred_repos"
|
|
|
|
fi
|