def self.start_command_line
STDOUT.sync = true
begin
version, help, help_build, help_task, help_template, task,
properties, dry_run, template, verbose, style, file, recursive,
logo, targets = parse_command_line
rescue
puts "ERROR: parsing command line (type 'bee -h' for help)"
exit(EXIT_PARSING_CMDLINE)
end
formatter = Formatter.new(style)
begin
if logo
puts BEE_LOGO
end
if version
copyright = Bee::Util::copyright
puts copyright if copyright
elsif help
puts HELP
elsif help_build
build = Build.load(file, recursive, properties)
build.evaluate_properties
puts formatter.help_build(build)
elsif help_task
puts formatter.help_task(task)
elsif help_template
puts formatter.help_template(template)
elsif template
file = Bee::Util::find_template(template)
listener = Listener.new(formatter, verbose)
build = Build.load(file, false, properties)
build.run(targets, listener, dry_run)
else
listener = Listener.new(formatter, verbose)
build = Build.load(file, recursive, properties)
build.run(targets, listener, dry_run)
end
rescue Bee::Util::BuildError => e
puts "#{formatter.format_error('ERROR')}: #{$!}"
puts e.backtrace.join("\n") if verbose
exit(EXIT_BUILD_ERROR)
rescue Exception => e
puts "#{formatter.format_error('ERROR')}: #{$!}"
puts e.backtrace.join("\n")
exit(EXIT_UNKNOWN_ERROR)
end
end