Skip to content

Commit

Permalink
bin/*: more consistent --help output
Browse files Browse the repository at this point in the history
This fixes a long-standing bug in the output of "unicorn_rails"
where the program name was missing.
  • Loading branch information
Eric Wong committed Aug 24, 2010
1 parent bdc7971 commit 096afc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions bin/unicorn
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ host, port = Unicorn::Const::DEFAULT_HOST, Unicorn::Const::DEFAULT_PORT
set_listener = false

opts = OptionParser.new("", 24, ' ') do |opts|
opts.banner = "Usage: #{File.basename($0)} " \
"[ruby options] [unicorn options] [rackup config file]"
cmd = File.basename($0)
opts.banner = "Usage: #{cmd} " \
"[ruby options] [#{cmd} options] [rackup config file]"

opts.separator "Ruby options:"

Expand Down Expand Up @@ -39,7 +40,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
require library
end

opts.separator "Unicorn options:"
opts.separator "#{cmd} options:"

# some of these switches exist for rackup command-line compatibility,

Expand Down Expand Up @@ -100,7 +101,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
end

opts.on_tail("-v", "--version", "Show version") do
puts "unicorn v#{Unicorn::Const::UNICORN_VERSION}"
puts "#{cmd} v#{Unicorn::Const::UNICORN_VERSION}"
exit
end

Expand Down
2 changes: 1 addition & 1 deletion bin/unicorn_rails
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ opts = OptionParser.new("", 24, ' ') do |opts|
end

opts.on_tail("-v", "--version", "Show version") do
puts " v#{Unicorn::Const::UNICORN_VERSION}"
puts "#{cmd} v#{Unicorn::Const::UNICORN_VERSION}"
exit
end

Expand Down

0 comments on commit 096afc1

Please sign in to comment.