Class: LoadRunner::CommandLine

Inherits:
Object
  • Object
show all
Includes:
Colsole, Singleton
Defined in:
lib/load_runner/command_line.rb

Overview

Handles the command line interface

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



12
13
14
# File 'lib/load_runner/command_line.rb', line 12

def args
  @args
end

Instance Method Details

#execute(argv = []) ⇒ Object

Gets an array of arguments (e.g. ARGV), executes the command if valid and shows usage patterns / help otherwise.



16
17
18
19
20
21
22
23
24
# File 'lib/load_runner/command_line.rb', line 16

def execute(argv=[])
  doc = File.read File.dirname(__FILE__) + '/docopt.txt'
  begin
    @args = Docopt::docopt(doc, argv: argv, version: VERSION)
    handle
  rescue Docopt::Exit => e
    puts e.message
  end
end