Class: GithubControl::Actions::Collaborators
Instance Method Summary
collapse
#initialize, #options, register, set
Instance Method Details
#add_options(parser) ⇒ Object
6
7
8
9
10
11
12
13
14
|
# File 'lib/github-control/actions/collaborators.rb', line 6
def add_options(parser)
parser.on("-R name", "--repository name", "The repository on Github") do |repository_name|
options[:repository_name] = repository_name
end
parser.on("-U name", "--user name", "The user on Github") do |user_name|
options[:user_name] = user_name
end
end
|
#call ⇒ Object
16
17
18
19
20
21
22
|
# File 'lib/github-control/actions/collaborators.rb', line 16
def call
puts "Listing the collaborators of #{repository.full_name}"
puts "-" * 40
repository.collaborators.each do |user|
puts "- #{user.name}"
end
end
|
#repository ⇒ Object
24
25
26
|
# File 'lib/github-control/actions/collaborators.rb', line 24
def repository
user.repositories.get(options[:repository_name] || raise(ProblemWithOptions, "Please specify a repository"))
end
|
#user ⇒ Object
28
29
30
31
32
33
34
|
# File 'lib/github-control/actions/collaborators.rb', line 28
def user
if options[:user_name]
@cli.console.user_for(options[:user_name])
else
@cli.console.current_user
end
end
|