class Tagfish::CLI::TagsCommand

Public Instance Methods

execute() click to toggle source
# File lib/tagfish/cli/tags_command.rb, line 14
def execute

  docker_uri = DockerURI.parse(repository)
  docker_api = DockerRegistryClient.for(docker_uri, debug?)

  if latest?
    tags = docker_api.tags
    latest_tags = tags.latest_tags
    if latest_tags.empty?
      signal_error "No image explicitly tagged in this Repository, " +
              "only `latest` tag available."
    end
    tags_found = latest_tags

  else
    tags_found = docker_api.tag_names
  end

  tags_fqdn = tags_found.map do |tag_name|
    short? ? tag_name : docker_uri.with_tag(tag_name).to_s
  end

  puts tags_fqdn
end