Skip to content

Commit

Permalink
(app) simplify options parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
stakach committed Sep 1, 2018
1 parent e6b7988 commit 9976c68
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/app.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,8 @@ host = "127.0.0.1"
cluster = false
process_count = 1

# Option parser modifies ARGV
args = ARGV.dup

# Command line options
OptionParser.parse! do |parser|
OptionParser.parse(ARGV.dup) do |parser|
parser.banner = "Usage: #{PROGRAM_NAME} [arguments]"

parser.on("-b HOST", "--bind=HOST", "Specifies the server host") { |h| host = h }
Expand Down Expand Up @@ -43,7 +40,7 @@ puts "Launching #{APP_NAME} v#{VERSION}"
server = ActionController::Server.new(port, host)

# Start clustering
server.cluster(process_count, "-w", "--workers", args) if cluster
server.cluster(process_count, "-w", "--workers") if cluster

# Detect ctr-c to shutdown gracefully
Signal::INT.trap do |signal|
Expand Down

0 comments on commit 9976c68

Please sign in to comment.