Skip to content

Instantly share code, notes, and snippets.

@mckeed
Created June 14, 2024 19:39
Show Gist options
  • Save mckeed/43cfca05d724677cf139f18cf3ed3b8f to your computer and use it in GitHub Desktop.
Save mckeed/43cfca05d724677cf139f18cf3ed3b8f to your computer and use it in GitHub Desktop.
Open the homepage of an installed Ruby gem
#! /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