Sha256: 6f10d00a1fe821686480068ab49fb351e058981efcb2ed22f3886124fd90d775

Contents?: true

Size: 626 Bytes

Versions: 5

Compression:

Stored size: 626 Bytes

Contents

require 'sym/app/commands/base_command'
module Sym
  module App
    module Commands
      class EncryptDecrypt < BaseCommand
        include Sym

        required_options [ :private_key, :keyfile, :keychain, :interactive ],
                         [ :encrypt, :decrypt ],
                         [ :file, :string ]

        try_after :generate_key

        def execute
          send(application.action, content, application.key)
        end

        private

        def content
          @content ||= (opts[:string] || (opts[:file].eql?('-') ? STDIN.read : File.read(opts[:file])))
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
sym-2.2.1 lib/sym/app/commands/encrypt_decrypt.rb
sym-2.2.0 lib/sym/app/commands/encrypt_decrypt.rb
sym-2.1.2 lib/sym/app/commands/encrypt_decrypt.rb
sym-2.1.1 lib/sym/app/commands/encrypt_decrypt.rb
sym-2.1.0 lib/sym/app/commands/encrypt_decrypt.rb