Class: Pod::Command::RepoArt::List
- Inherits:
-
Pod::Command::RepoArt
- Object
- Pod::Command
- Pod::Command::RepoArt
- Pod::Command::RepoArt::List
- Defined in:
- lib/pod/command/repo_art/list.rb
Constant Summary collapse
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(argv) ⇒ List
constructor
A new instance of List.
- #print_art_repos(repos) ⇒ Object
- #print_art_repos_count(repos) ⇒ Object
- #run ⇒ Object
Methods inherited from Pod::Command::RepoArt
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
.options ⇒ Object
17 18 19 20 21 |
# File 'lib/pod/command/repo_art/list.rb', line 17 def self. [ ['--count-only', 'Show the total number of repos'] ].concat(super) end |
Instance Method Details
#print_art_repos(repos) ⇒ Object
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 |
#print_art_repos_count(repos) ⇒ Object
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 |
#run ⇒ Object
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 |