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:
parent
78f11fba26
commit
52ccaf82b8
1 changed files with 10 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue