Sha256: 02c639272d0c14704da03e1fa2d80fb781121b965f952e12862c6f035804a50f

Contents?: true

Size: 742 Bytes

Versions: 3

Compression:

Stored size: 742 Bytes

Contents

# -*- coding: utf-8 -*-
Gemirro::CLI.options.command 'list' do
  banner 'Usage: gemirro list [OPTIONS]'
  description 'List available gems.'
  separator "\nOptions:\n"

  on :c=, :config=, 'Path to the configuration file'
  on :l=, :log_level=, 'Set logger level'

  run do |opts, _args|
    Gemirro::CLI.load_configuration(opts[:c])
    config = Gemirro.configuration
    config.logger_level = opts[:l] if opts[:l]

    unless File.directory?(config.destination)
      config.logger.error("The directory #{config.destination} does not exist")
      abort
    end

    gems = Gemirro::Utils.gems_collection.group_by(&:name).sort
    gems.each do |name, versions|
      puts "#{name}: (#{versions.map(&:number).join(', ')})"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
gemirro-0.13.5 lib/gemirro/cli/list.rb
gemirro-0.13.4 lib/gemirro/cli/list.rb
gemirro-0.13.3 lib/gemirro/cli/list.rb