Class: SecretKeys::CLI::Decrypt

Inherits:
Base
  • Object
show all
Defined in:
lib/secret_keys/cli.rb

Constant Summary

Constants inherited from Base

Base::MAX_SUMMARY_LENGTH

Instance Attribute Summary

Attributes inherited from Base

#input, #secret_key

Instance Method Summary collapse

Methods inherited from Base

#format, #initialize, #parse_additional_options, #secrets

Constructor Details

This class inherits a constructor from SecretKeys::CLI::Base

Instance Method Details

#action_nameObject



232
233
234
# File 'lib/secret_keys/cli.rb', line 232

def action_name
  "decrypt"
end

#run!Object



236
237
238
239
240
241
242
# File 'lib/secret_keys/cli.rb', line 236

def run!
  decrypted = secrets.to_h
  string = ((format == :yaml) ? YAML.dump(decrypted) : JSON.pretty_generate(decrypted))
  string << $/ unless string.end_with?($/) # ensure file ends with system dependent new line
  $stdout.write(string)
  $stdout.flush
end