Created
November 16, 2023 02:11
-
-
Save searls/7a54ba1efc3733f7e2ce9c0000718e7d to your computer and use it in GitHub Desktop.
I got sick of going through multiple steps to visit the current directory's github URL when I'm looking at a terminal, but I don't necessarily want to install `gh` or `hub` just for this feature.
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 ruby | |
begin | |
repo = `git remote -v`.split("\n").find { |line| | |
line.include?("github.com") | |
}.split("\t")[1].match(/git@github.com:(.*).git/)[1] | |
system "open https://github.com/#{repo}" | |
rescue | |
warn "No github remote found" | |
exit 1 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment