Class: Metacrunch::Cli

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

Instance Method Summary collapse

Instance Method Details

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/metacrunch/cli.rb', line 5

def run
  # Parse global options on order
  job_argv = global_parser.order(ARGV)
  # The first of the unparsed arguments is by definition the filename
  # of the job.
  job_file = job_argv[0]
  # Manipulate ARGV so that the option handling for the job can work
  ARGV.clear
  job_argv[1..-1]&.each {|arg| ARGV << arg}
  # Delete the old separator symbol for backward compatability
  ARGV.delete_if{|arg| arg == "@@"}
  # Finally run the job
  run!(job_file)
rescue OptionParser::ParseError => e
  error(e.message)
end