Class: GithubControl::Actions::Repositories

Inherits:
GithubControl::Action show all
Defined in:
lib/github-control/actions/repositories.rb

Instance Method Summary collapse

Methods inherited from GithubControl::Action

#initialize, #options, register, set

Constructor Details

This class inherits a constructor from GithubControl::Action

Instance Method Details

#add_options(parser) ⇒ Object



6
7
8
9
10
# File 'lib/github-control/actions/repositories.rb', line 6

def add_options(parser)
  parser.on("-U name", "--user name", "The user to list the repositories") do |user_name|
    options[:user_name] = user_name
  end
end

#callObject



12
13
14
15
16
17
18
# File 'lib/github-control/actions/repositories.rb', line 12

def call
  puts "Repositories for #{user.name}"
  puts "-" * 40
  user.repositories.each do |repo|
    puts "- #{repo.name}"
  end
end

#userObject



20
21
22
# File 'lib/github-control/actions/repositories.rb', line 20

def user
  @cli.console.user_for(options[:user_name] || @cli.console.current_user.name)
end