bin/quiq in quiq-0.1.0 vs bin/quiq in quiq-0.2.0
- old
+ new
@@ -2,23 +2,29 @@
# frozen_string_literal: true
require_relative '../lib/quiq'
require 'optparse'
-options = {}
+options = { path: Dir.pwd, queues: %w[default], log_level: Logger::DEBUG }
OptionParser.new do |opts|
opts.banner = 'Usage: quiq [options]'
- opts.on('-p', '--path [PATH|DIR]", "Location of the workers to require') do |path|
- options[:path] = path
+ opts.on('-p', '--path PATH', 'Location of the workers to load') do |path|
+ options[:path] = File.expand_path(path)
end
- opts.on('-q', '--queues [NAMES]", "Comma-separated list of queues to fetch jobs from') do |queues|
- options[:queues] = queues.split(',')
+ opts.on('-q', '--queues NAMES', Array,
+ 'Comma-separated list of queues to poll') do |queues|
+ options[:queues] = queues
end
- opts.on '-v', '--version', 'Output version and exit' do |arg|
+ opts.on('-l', '--log-level LEVEL', %i[debug info warn error],
+ 'The logging level') do |level|
+ options[:log_level] = level
+ end
+
+ opts.on '-v', '--version', 'Output version and exit' do
puts "Quiq #{Quiq::VERSION}"
exit
end
opts.on_tail('-h', '--help', 'Show this message') do
@@ -26,11 +32,11 @@
exit
end
end.parse!
begin
- Quiq.run(options)
-rescue
- warn $!.message
- warn $!.backtrace.join("\n")
+ Quiq.boot(options)
+rescue StandardError => e
+ warn e.message
+ warn e.backtrace.join("\n")
exit 1
end