Created
June 14, 2024 19:39
-
-
Save mckeed/43cfca05d724677cf139f18cf3ed3b8f to your computer and use it in GitHub Desktop.
Open the homepage of an installed Ruby gem
This file contains 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
#! /usr/bin/env zsh | |
[[ -n $1 ]] || { echo "Usage: $(basename $0) <gem_name>"; exit 1; } | |
url=$(gem info $1 | sed -En '/ *Homepage: (.*)/{s//\1/p; q;}') | |
[[ -n $url ]] || { echo "Couldn't find homepage for $1"; gem info $1; exit 2; } | |
echo "Opening $url" | |
open $url # if not using macOS, replace open with xdg-open or whatever |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment