module Plankton::Command::Tags

Public Class Methods

included(base) click to toggle source
# 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

Public Instance Methods

tags(repo) click to toggle source
# File lib/plankton/commands/tags.rb, line 15
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