Class: Pod::Command::RepoArt::List

Inherits:
Pod::Command::RepoArt show all
Defined in:
lib/pod/command/repo_art/list.rb

Constant Summary collapse

UTIL =
Pod::RepoArt::RepoUtil

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Pod::Command::RepoArt

#init

Constructor Details

#initialize(argv) ⇒ List

Returns a new instance of List.



23
24
25
26
27
# File 'lib/pod/command/repo_art/list.rb', line 23

def initialize(argv)
  init
  @count_only = argv.flag?('count-only')
  super
end

Class Method Details

.optionsObject



17
18
19
20
21
# File 'lib/pod/command/repo_art/list.rb', line 17

def self.options
  [
      ['--count-only', 'Show the total number of repos']
  ].concat(super)
end

Instance Method Details



35
36
37
38
39
40
41
42
43
# File 'lib/pod/command/repo_art/list.rb', line 35

def print_art_repos(repos)
  for repo in repos
    UI.title repo.name do
      UI.puts "- URL: #{repo.url}"
      UI.puts "- Path: #{repo.path}"
    end
  end
  UI.puts "\n"
end


45
46
47
48
49
# File 'lib/pod/command/repo_art/list.rb', line 45

def print_art_repos_count(repos)
  number_of_repos = repos.length
  repo_string = number_of_repos != 1 ? 'repos' : 'repo'
  UI.puts "#{number_of_repos} #{repo_string}\n".green
end

#runObject



29
30
31
32
33
# File 'lib/pod/command/repo_art/list.rb', line 29

def run
  repos = UTIL.get_art_repos
  print_art_repos(repos) unless @count_only
  print_art_repos_count(repos)
end