Sha256: 5c36ddaafa25172336baa9f731bbed71c6b8876ddf9564166102c2fb9a41ba1d

Contents?: true

Size: 956 Bytes

Versions: 1

Compression:

Stored size: 956 Bytes

Contents

module Heirloom
  module CLI
    class Destroy

      def initialize
        @opts = read_options
        @name = @opts[:name]
        @id = @opts[:id]
        @logger = HeirloomLogger.new :log_level => @opts[:level]
        @archive = Archive.new :name   => @name,
                               :id     => @id,
                               :logger => @logger
      end
      
      def destroy
        @archive.destroy
      end

      private

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

Destroy an archive.

Usage:

heirloom destroy -n NAME -i ID [-l LOG_LEVEL]

EOS
          opt :help, "Display Help"
          opt :id, "ID of the archive to display.", :type => :string
          opt :level, "Log level.", :type    => :string,
                                    :default => 'info'
          opt :name, "Name of archive.", :type => :string
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heirloom-0.2.0 lib/heirloom/cli/destroy.rb