Navigation Menu

Skip to content

Commit

Permalink
Break a long method
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Apr 21, 2014
1 parent ab2d1d9 commit f285fe7
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions lib/droonga/engine/command/droonga_engine.rb
Expand Up @@ -62,6 +62,16 @@ def run(command_line_arguments)
private
def parse_command_line_arguments!(command_line_arguments)
parser = OptionParser.new
add_connection_options(parser)
add_log_options(parser)
parser.parse!(command_line_arguments)

ENV["DROOGNA_LOG_LEVEL"] = @log_level
end

def add_connection_options(parser)
parser.separator("")
parser.separator("Connection:")
parser.on("--host=HOST",
"The host name of the Droonga engine",
"(#{@host})") do |host|
Expand All @@ -77,6 +87,11 @@ def parse_command_line_arguments!(command_line_arguments)
"(#{@tag})") do |tag|
@tag = tag
end
end

def add_log_options(parser)
parser.separator("")
parser.separator("Log:")
levels = Logger::Level::LABELS
levels_label = levels.join(",")
parser.on("--log-level=LEVEL", levels,
Expand All @@ -85,9 +100,6 @@ def parse_command_line_arguments!(command_line_arguments)
"(#{@log_level})") do |level|
@log_level = level
end
parser.parse!(command_line_arguments)

ENV["DROOGNA_LOG_LEVEL"] = @log_level
end

def run_engine(loop)
Expand Down

0 comments on commit f285fe7

Please sign in to comment.