Class: Awshucks::CLI

Inherits:
Object show all
Defined in:
lib/awshucks/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.executeObject



5
6
7
# File 'lib/awshucks/cli.rb', line 5

def self.execute
  new.execute(ARGV)
end

Instance Method Details

#execute(args) ⇒ Object

parses the options and runs the command



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/awshucks/cli.rb', line 10

def execute(args)
  
  option_parser.parse!(args) # changes args!
  
  if parsed_options.show_help || args.empty?
    puts help_message
  else        
    Command.parse_and_execute(args, config)        
  end
  
rescue CommandError => e
  error(e)
end

#help_messageObject



24
25
26
# File 'lib/awshucks/cli.rb', line 24

def help_message
  option_parser.to_s
end