Module: GitCurate::App

Defined in:
lib/git_curate/app.rb

Class Method Summary collapse

Class Method Details

.mainObject

Runs the application and returns an exit status which should be passed to exit() by the caller of this function.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/git_curate/app.rb', line 9

def self.main
  parser = GitCurate::CLIParser.new
  continue = parser.parse(ARGV) # will throw on error
  return EXIT_SUCCESS unless continue

  runner = GitCurate::Runner.new(parser.parsed_options)
  # Args not parsed by the CLIParser are passed to Runner.
  runner.run(ARGV)
rescue SystemCommandError => error
  $stderr.puts(error.message)
  error.exit_status
rescue OptionParser::InvalidOption
  puts "Unrecognized option"
  puts "For help, enter `git curate -h`"
  EXIT_FAILURE
end