Sha256: b3864c7ebf5a52e72b32072c244b4e3084b7029c44db542777afc30906a9dbcb

Contents?: true

Size: 1.18 KB

Versions: 3

Compression:

Stored size: 1.18 KB

Contents

module Heirloom
  module CLI
    class List

      def initialize
        @opts = read_options
        @logger = HeirloomLogger.new :log_level => @opts[:level]
        exit 1 unless CLI::Shared.valid_options? :provided => @opts,
                                                 :required => [:name],
                                                 :logger   => @logger
        @archive = Archive.new :name   => @opts[:name],
                               :logger => @logger
      end
      
      def list(count = @opts[:count])
        jj @archive.list(count)
      end

      private

      def read_options
        Trollop::options do
          version Heirloom::VERSION
          banner <<-EOS

List versions of archive.

Usage:

heirloom list -n NAME

EOS
          opt :help, "Display Help"
          opt :level, "Log level [debug|info|warn|error].", :type    => :string,
                                                            :default => 'info'
          opt :name, "Name of archive.", :type => :string
          opt :count, "Number of versions to return.", :type    => :integer,
                                                       :default => 10
        end
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
heirloom-0.3.1 lib/heirloom/cli/list.rb
heirloom-0.3.0 lib/heirloom/cli/list.rb
heirloom-0.3.0.rc1 lib/heirloom/cli/list.rb