Class: Sym::App::Commands::GenerateKey
- Includes:
- Sym
- Defined in:
- lib/sym/app/commands/generate_key.rb
Constant Summary
Constants included from Sym
Instance Method Summary collapse
Constructor Details
This class inherits a constructor from Sym::App::Commands::Command
Instance Method Details
#execute ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/sym/app/commands/generate_key.rb', line 11 def execute retries ||= 0 new_private_key = self.class.create_private_key new_private_key = encr_password(new_private_key, application.input_handler.new_password) if opts[:password] clipboard_copy(new_private_key) if opts[:copy] Sym::App::KeyChain.new(opts[:keychain], opts). add(new_private_key) if opts[:keychain] && Sym::App.is_osx? new_private_key rescue Sym::Errors::PasswordsDontMatch, Sym::Errors::PasswordTooShort => e STDERR.puts e..bold retry if (retries += 1) < 3 end |