Class: Sym::App::Commands::KeychainAddKey

Inherits:
BaseCommand show all
Defined in:
lib/sym/app/commands/keychain_add_key.rb

Constant Summary

Constants included from Sym

DESCRIPTION, VERSION

Instance Method Summary collapse

Methods included from Sym

config, default_key, default_key?, default_key_file

Constructor Details

This class inherits a constructor from Sym::App::Commands::BaseCommand

Instance Method Details

#executeObject



14
15
16
17
18
19
20
21
# File 'lib/sym/app/commands/keychain_add_key.rb', line 14

def execute
  if Sym.default_key? && Sym.default_key == self.key
    raise "Refusing to import key specified in the default key file #{Sym.default_key_file.italic}"
  end
  raise Sym::Errors::NoPrivateKeyFound.new("Unable to resolve private key from argument '#{opts[:key]}'") if self.key.nil?
  add_to_keychain_if_needed(self.key)
  self.key unless opts[:quiet]
end