Skip to content
Browse files

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

  • Loading branch information...
1 parent 8ef0c30 commit 36bc9165456a7f3c5c53ae51f511869573aba891 @kenn committed Sep 13, 2012
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

0 comments on commit 36bc916

Please sign in to comment.
Something went wrong with that request. Please try again.