275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
|
# File 'lib/deb/s3/cli.rb', line 275
def list
configure_s3_client
release = Deb::S3::Release.retrieve(options[:codename])
archs = release.architectures
archs &= [options[:arch]] if options[:arch] && options[:arch] != "all"
widths = [0, 0]
rows = archs.map { |arch|
manifest = Deb::S3::Manifest.retrieve(options[:codename], component,
arch, options[:cache_control],
false, false)
manifest.packages.map do |package|
if options[:long]
package.generate(options[:codename])
else
[package.name, package.full_version, package.architecture].tap do |row|
row.each_with_index do |col, i|
widths[i] = [widths[i], col.size].max if widths[i]
end
end
end
end
}.flatten(1)
if options[:long]
$stdout.puts rows.join("\n")
else
rows.each do |row|
$stdout.puts "% -#{widths[0]}s % -#{widths[1]}s %s" % row
end
end
end
|