Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

"gh open" without any args opens up the current repo page #88

Open
wants to merge 1 commit into from

1 participant

@kenn

Right now, gh open (no args) will lead us to the github top page. It is rather useless.

With this change, the same command will bring us to the origin's top page, when and only when you're in the repo's directory. If you're not in any repo, defaults to the previous behavior - go to https://github.com.

It is convenient when you have a prettified README.md as a quick reference for the project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 13, 2012
  1. @kenn
This page is out of date. Refresh to see the latest.
Showing with 6 additions and 0 deletions.
  1. +6 −0 lib/commands/commands.rb
View
6 lib/commands/commands.rb
@@ -46,6 +46,12 @@
desc 'Open the given user/project in a web browser'
usage 'github open [user/project]'
command :open do |arg|
+ if arg.nil?
+ origin = git('remote -v').split("\n").find{|i| i =~ /^origin/ }
+ if origin
+ arg = origin.split(/\s/)[1].sub('git@github.com:','').sub('https://github.com/','').sub('.git','')
+ end
+ end
helper.open "https://github.com/#{arg}"
end
Something went wrong with that request. Please try again.