Sha256: f54fffe1c23e2ecb92414b2f0177e6974138181a46ba78178f70df5bad43eeee

Contents?: true

Size: 749 Bytes

Versions: 3

Compression:

Stored size: 749 Bytes

Contents

# frozen_string_literal: true

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-1.5.0 lib/gemirro/cli/list.rb
gemirro-1.4.0 lib/gemirro/cli/list.rb
gemirro-1.3.0 lib/gemirro/cli/list.rb