Sha256: 4c08661523cb49bbb7f6b8a704aa5613e7d9465c4e95d552fd2d37f43eb5814e

Contents?: true

Size: 611 Bytes

Versions: 6

Compression:

Stored size: 611 Bytes

Contents

require_relative 'command'
module Shhh
  module App
    module Commands
      class EncryptDecrypt < Command
        include Shhh

        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

6 entries across 6 versions & 1 rubygems

Version Path
shhh-1.7.0 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.6.5 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.6.4 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.6.3 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.6.2 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.6.1 lib/shhh/app/commands/encrypt_decrypt.rb