Class: ThoriumCLI::Thorium
- Defined in:
- lib/thorium/base.rb
Overview
Top level tasks for thorium Includes routines that do not require packaging of subcomands
Constant Summary collapse
- SKIP =
''
- ALIAS =
'th'
- OS =
ENV['_system_type']
Instance Method Summary collapse
Instance Method Details
#pubkey ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/thorium/base.rb', line 29 def pubkey path = '~/.ssh/id_rsa.pub' file = Dir.glob(File.(path)).first if file say "Use `thorium pubkeys` if you want to select a specific key.", :yellow copy_to_clipboard file else say "File `#{path}` has not been found.", :red generate_pubkey? end end |
#pubkeys ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/thorium/base.rb', line 42 def pubkeys public_keys = Dir.glob(File.('~/.ssh') + '/*.pub') if public_keys.any? puts '', 'Public keys found:' puts '------------------' print_keys public_keys = { limited_to: ('1'..public_keys.size.to_s).to_a, skip: SKIP } index = ask('Which key do you want in your clipboard?', :green, ) copy_to_clipboard public_keys[index.to_i - 1] if index != [:skip] else say 'No public keys have been found.', :red generate_pubkey? end end |