Sha256: 96704a7f0f1a5d59fdb793cc52a5ca806b41e7dec3ddc615b8bbbc27d4db5dbf

Contents?: true

Size: 609 Bytes

Versions: 4

Compression:

Stored size: 609 Bytes

Contents

require_relative 'command'
module Sym
  module App
    module Commands
      class EncryptDecrypt < Command
        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

4 entries across 4 versions & 1 rubygems

Version Path
sym-2.0.3 lib/sym/app/commands/encrypt_decrypt.rb
sym-2.0.2 lib/sym/app/commands/encrypt_decrypt.rb
sym-2.0.1 lib/sym/app/commands/encrypt_decrypt.rb
sym-2.0.0 lib/sym/app/commands/encrypt_decrypt.rb