Skip to content

Commit

Permalink
Provides more helpful output when no options are specified
Browse files Browse the repository at this point in the history
  • Loading branch information
alindeman committed Oct 16, 2011
1 parent 0cdc75e commit 8a2cc83
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions sunspot_solr/bin/sunspot-solr
Expand Up @@ -15,8 +15,8 @@ end

server = Sunspot::Solr::Server.new

OptionParser.new do |opts|
opts.banner = "Usage: sunspot-solr start [options]"
opts = OptionParser.new do |opts|
opts.banner = "Usage: sunspot-solr (start|stop|run) [options]"

opts.on '-p', '--port=PORT', 'Port on which to run Solr (default 8983)' do |p|
server.port = p
Expand Down Expand Up @@ -57,7 +57,9 @@ OptionParser.new do |opts|
opts.on '--min-memory=MEMORY', 'Specify the initial size of the memory allocation pool' do |mm|
server.min_memory = mm
end
end.parse!
end

opts.parse!

begin
case ARGV[0]
Expand All @@ -71,7 +73,7 @@ begin
server.stop
server.start
else
abort("Usage: sunspot-solr (start|stop|run)")
abort(opts.help)
end
rescue Sunspot::Solr::Server::ServerError => e
abort(e.message)
Expand Down

0 comments on commit 8a2cc83

Please sign in to comment.