Class: Dockly::ListCommand

Inherits:
AbstractCommand show all
Defined in:
lib/dockly/cli.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/dockly/cli.rb', line 73

def execute
  super
  dockers = Dockly.dockers.dup
  debs = Dockly.debs
  rpms = Dockly.rpms

  puts "Debs" unless debs.empty?
  debs.each_with_index do |(name, package), index|
    puts "#{index + 1}. #{name}"
    if package.docker
      dockers.delete(package.docker.name)
      puts " - Docker: #{package.docker.name}"
    end
  end

  puts "RPMs" unless rpms.empty?
  rpms.each_with_index do |(name, package), index|
    puts "#{index + 1}. #{name}"
    if package.docker
      dockers.delete(package.docker.name)
      puts " - Docker: #{package.docker.name}"
    end
  end

  puts "Dockers" unless dockers.empty?
  dockers.each_with_index do |(name, docker), index|
    puts "#{index + 1}. #{name}"
  end
end