Sha256: 48f4763346e618d44f28c3a4d58636173fbda1e7cd79ebf74d4d5117f78eb24b

Contents?: true

Size: 501 Bytes

Versions: 5

Compression:

Stored size: 501 Bytes

Contents

desc 'List available images'
arg_name '[image-id...]'
command [:list] do |c|
  c.action do |global_options, options, args|
    images = Image.find args

    snapshots = images.select { |i| i.source_type == 'snapshot' }

    images = images - snapshots

    images.sort! do |a,b|
      [a.official ? 0 : 1, a.name, a.arch] <=> [b.official ? 0 : 1, b.name, b.arch]
    end

    snapshots.sort! { |a, b| a.created_at <=> b.created_at }
    
    render_table(images + snapshots, global_options)
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
bbcloud-0.8.2 lib/bbcloud/commands/images-list.rb
bbcloud-0.8.1 lib/bbcloud/commands/images-list.rb
bbcloud-0.8 lib/bbcloud/commands/images-list.rb
bbcloud-0.7 lib/bbcloud/commands/images-list.rb
bbcloud-0.6.2 lib/bbcloud/commands/images-list.rb