Sha256: 23792d52827bc7218ed699e2d6aff939c1628df2f89ee0023785f0d41bf04d7b

Contents?: true

Size: 859 Bytes

Versions: 9

Compression:

Stored size: 859 Bytes

Contents

require 'sym/app/commands/base_command'
require 'sym/app/keychain'
require 'sym/errors'
module Sym
  module App
    module Commands
      class KeychainAddKey < BaseCommand

        required_options [:key, :interactive],
                         :keychain
        incompatible_options %i(examples help version bash_support)
        try_after :generate_key, :encrypt, :decrypt, :password_protect_key

        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
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sym-3.0.0 lib/sym/app/commands/keychain_add_key.rb
sym-2.10.0 lib/sym/app/commands/keychain_add_key.rb
sym-2.8.5 lib/sym/app/commands/keychain_add_key.rb
sym-2.8.4 lib/sym/app/commands/keychain_add_key.rb
sym-2.8.2 lib/sym/app/commands/keychain_add_key.rb
sym-2.8.1 lib/sym/app/commands/keychain_add_key.rb
sym-2.8.0 lib/sym/app/commands/keychain_add_key.rb
sym-2.7.0 lib/sym/app/commands/keychain_add_key.rb
sym-2.6.3 lib/sym/app/commands/keychain_add_key.rb