Last active
October 29, 2015 13:06
-
-
Save nhoag/d94913adac425fec4e34 to your computer and use it in GitHub Desktop.
Returns a pretty list of trending repos from Github in your terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function gh-trend() { | |
local INTERVAL=${1:-'daily'} | |
echo -e "Github Trending: $INTERVAL" | |
curl -s https://github.com/trending\?since=${INTERVAL} \ | |
| xmllint --html --xpath '//h3/a/@href|//p[@class="repo-list-description"]/text()' - 2>/dev/null \ | |
| sed 's#href=\"#\'$'\nhttps://github.com#g' \ | |
| grep -Ev '^[ ]+$' \ | |
| grep -Ev '^$' \ | |
| sed 's/^[ ]*//;s/[ ]*$//;s/\"$//;s/^/* /;s/^* https/\'$'\n\033[0;32mhttps/;s#^* #\\'$'\n\t\033[0m* #' | |
echo | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment