Class: SshKeySwitcher::Options::Remove
- Inherits:
-
Object
- Object
- SshKeySwitcher::Options::Remove
show all
- Extended by:
- Contains, Utils
- Defined in:
- lib/ssh_key_switcher/options/remove.rb
Constant Summary
Constants included
from Contains
Contains::SERVER_NAMES, Contains::SSH_DIR, Contains::STRING_DETECT_OPENSSH_KEY
Class Method Summary
collapse
Class Method Details
.del(path_open_ssh_keys) ⇒ Object
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/ssh_key_switcher/options/remove.rb', line 22
def del(path_open_ssh_keys)
is_no = prompt.no?('Are you sure you want to remove these keys?')
if is_no
prompt.say('Cancelled!')
else
path_open_ssh_keys.each do |path|
SshKeySwitcher::Utils::SshAgent.del(path)
Cmd.exec("rm #{path}")
Cmd.exec("rm #{path}.pub")
end
prompt.ok('OpenSSH key removed successfully!')
end
end
|
.display_select ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/ssh_key_switcher/options/remove.rb', line 7
def display_select
keys = Helper.find_open_ssh_keys
if keys.empty?
prompt.error('No OpenSSH keys found in ~/.ssh')
nil
else
prompt.multi_select('Choose the OpenSSH keys to delete. Press [CTRL+C] to exit.',
select_options) do ||
.enum '.'
select_choices(, keys)
end
end
end
|