Class: SshyGuy::CLI
- Inherits:
-
Object
- Object
- SshyGuy::CLI
- Defined in:
- lib/sshyguy/cli.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CLI
constructor
A new instance of CLI.
- #run ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CLI
Returns a new instance of CLI.
32 33 34 |
# File 'lib/sshyguy/cli.rb', line 32 def initialize( = {}) @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
31 32 33 |
# File 'lib/sshyguy/cli.rb', line 31 def @options end |
Class Method Details
.run ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sshyguy/cli.rb', line 11 def self.run = {} OptionParser.new do |opts| opts. = 'Usage: sshyguy [options]' opts.on('-h', '--help', 'Help') do |_v| [:help] = true end opts.on('-s', '--shortcut SHORTCUT', 'Shortcut') do |v| [:shortcut] = v end opts.on('--install') do |_v| [:install] = true end opts.on('-d', '--debug', 'Debug') do |_v| SshyGuy.config.debug = true end end.parse! new().run end |
Instance Method Details
#run ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/sshyguy/cli.rb', line 36 def run if [:install] puts "Writing to #{SshyGuy.config_file}" File.open(SshyGuy.config_file, 'w+') { |f| f.puts(File.read('lib/data/example.json')) } exit end SshyGuy.log('Loading config') SshyGuy.load_config! if [:help] Screens::HelpScreen.show() else Screens::MainScreen.show() end end |