Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 36 additions & 6 deletions bin/zorro
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
require 'rubygems'
require 'commander/import'
require 'yaml'
require 'launchy'

# Without .zorro.yml
#
Expand Down Expand Up @@ -31,7 +32,7 @@ command :bitbucket do |c|
c.description = 'Helps you interact with Bitbucket'
c.example 'Opens the repository branches', 'zorro --account bitbucket_username --repo my_repo --open branches'

c.option '--account STRING', String, 'You bitbucket account name'
c.option '--account STRING', String, 'Your bitbucket account name'
c.option '--repo STRING', String, 'Repository name'
c.option '--open STRING', String, 'You can use (branches, pulls or source)'

Expand All @@ -42,13 +43,42 @@ command :bitbucket do |c|

case options.open
when 'branches'
`open https://bitbucket.org/#{options.account}/#{options.repo}/branches`
Launchy.open "https://bitbucket.org/#{options.account}/#{options.repo}/branches"
when 'pulls'
`open https://bitbucket.org/#{options.account}/#{options.repo}/pull-requests`
Launchy.open "https://bitbucket.org/#{options.account}/#{options.repo}/pull-requests"
when 'source'
`open https://bitbucket.org/#{options.account}/#{options.repo}/src`
Launchy.open "https://bitbucket.org/#{options.account}/#{options.repo}/src`"
when 'root'
`open https://bitbucket.org/#{options.account}/#{options.repo}`
Launchy.open "https://bitbucket.org/#{options.account}/#{options.repo}"
end
end
end

command :github do |c|
c.syntax = 'zorro github [options]'
c.description = 'Helps you interact with Github'
c.example 'Opens up repository issues', 'zorro github --account github_username --repo github_repo --open issues'

c.option '--account STRING', String, 'Your Github Username'
c.option '--repo STRING', String, 'Repository name'
c.option '--open STRING', String, ' You can use (pulls, issues,settings,graphs,pulse,wiki)'
c.action do |args, options|
config_file = File.join(File.expand_path('.'),'.zorro.yml')
options.default YAML.load_file(config_file)['github'] if File.exists?(config_file)

case options.open
when 'pulls'
Launchy.open "https://github.com/#{options.account}/#{options.repo}/pulls"
when 'issues'
Launchy.open "https://github.com/#{options.account}/#{options.repo}/issues"
when 'wiki'
Launchy.open "https://github.com/#{options.account}/#{options.repo}/wiki"
when 'graphs'
Launchy.open "https://github.com/#{options.account}/#{options.repo}/graphs"
when 'pulse'
Launchy.open "https://github.com/#{options.account}/#{options.repo}/pulse"
when 'settings'
Launchy.open "https://github.com/#{options.account}/#{options.repo}/settings"
end
end
end
Expand All @@ -67,6 +97,6 @@ command :trello do |c|
config_file = File.join(File.expand_path('.'), '.zorro.yml')
options.default YAML.load_file(config_file)['trello'] if File.exists?(config_file)

`open https://trello.com/b/#{options.id}`
Launchy.open "https://trello.com/b/#{options.id}"
end
end