Module: Plankton::Command::Tags

Defined in:
lib/plankton/commands/tags.rb

Class Method Summary collapse

Class Method Details

.included(base) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/plankton/commands/tags.rb', line 2

def self.included(base)
  base.class_eval do
    option :limit,
           desc: 'How many tags to fetch (maximum)',
           default: 20,
           aliases: '-l',
           type: :numeric
    option :details,
           desc: 'Display details (created at date, full layer size)',
           default: true,
           aliases: '-d',
           type: :boolean
    desc 'tags REPO', 'List all tags of a given repository'
    def tags(repo)
      if opts.details
        tags = registry.tags(repo: repo,
                             details: true,
                             limit: opts.limit)
        detailed_tags_table(tags)
      else
        tags = registry.tags(repo: repo, limit: opts.limit)
        tags.each do |tag|
          puts tag
        end
      end
      puts 'No tags found.' if tags.size.zero?
    end
  end
end