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

Open
wants to merge 1 commit into
from
Jump to file
+6 −0
Split
View
@@ -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