command-line option parsing
[local-openid.git] / bin / local-openid
blob4b8f315bf7e1b6584df6453f209e571dda8ab83d
1 #!/usr/bin/env ruby
2 require 'local_openid'
3 require 'optparse'
4 require 'socket'
5 BasicSocket.do_not_reverse_lookup = true
6 opts = {
7 :server => 'webrick', # webrick is standard, and plenty fast enough
9 OptionParser.new { |op|
10 op.on('-s <mongrel|thin|webrick>') { |v| opts[:server] = v }
11 op.on('-p port') { |val| opts[:port] = val.to_i }
12 op.on('-o addr') { |val| opts[:bind] = val }
13 op.on('-h', '--help', 'Show this message') do
14 puts op.to_s
15 exit
16 end
17 }.parse!(ARGV)
19 LocalOpenID.run!(opts)