Class: Diffcrypt::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/diffcrypt/cli.rb

Instance Method Summary collapse

Instance Method Details

#decrypt(path) ⇒ Object



11
12
13
14
15
# File 'lib/diffcrypt/cli.rb', line 11

def decrypt(path)
  file = File.new(path)
  ensure_file_exists(file)
  say file.decrypt(key)
end

#encrypt(path) ⇒ Object



20
21
22
23
24
# File 'lib/diffcrypt/cli.rb', line 20

def encrypt(path)
  file = File.new(path)
  ensure_file_exists(file)
  say file.encrypt(key, cipher: options[:cipher])
end

#generate_keyObject



28
29
30
# File 'lib/diffcrypt/cli.rb', line 28

def generate_key
  say Encryptor.generate_key(options[:cipher])
end

#versionObject



33
34
35
# File 'lib/diffcrypt/cli.rb', line 33

def version
  say Diffcrypt::VERSION
end