1
0
Fork 0
mirror of https://github.com/mperham/sidekiq.git synced 2022-11-09 13:52:34 -05:00

Extract #option_parser method in CLI for better extensibility

This commit is contained in:
fatkodima 2019-09-25 23:14:57 +03:00 committed by Mike Perham
parent 78f11fba26
commit 52ccaf82b8

View file

@ -283,8 +283,13 @@ module Sidekiq
def parse_options(argv)
opts = {}
@parser = option_parser(opts)
@parser.parse!(argv)
opts
end
@parser = OptionParser.new { |o|
def option_parser(opts)
parser = OptionParser.new { |o|
o.on "-c", "--concurrency INT", "processor threads to use" do |arg|
opts[:concurrency] = Integer(arg)
end
@ -336,15 +341,13 @@ module Sidekiq
end
}
@parser.banner = "sidekiq [options]"
@parser.on_tail "-h", "--help", "Show help" do
logger.info @parser
parser.banner = "sidekiq [options]"
parser.on_tail "-h", "--help", "Show help" do
logger.info parser
die 1
end
@parser.parse!(argv)
opts
parser
end
def initialize_logger