Sha256: 6aa3724a21da5752c839d1c642a3ef59c9f34ccc5080cf77ebeb36f6b849262e

Contents?: true

Size: 591 Bytes

Versions: 4

Compression:

Stored size: 591 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 run
          send(cli.action, content, cli.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
shhh-1.5.4 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.4.1 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.4.0 lib/shhh/app/commands/encrypt_decrypt.rb
shhh-1.3.0 lib/shhh/app/commands/encrypt_decrypt.rb