On Tue, Mar 15, 2005 at 07:51:16PM +0900, Wybo Dekker wrote:
> On Tue, 15 Mar 2005, Jos Backus wrote:
> Try [CLIENT] instead of CLIENT:
> 
> require 'optparse'
> 
> client = nil
> ARGV.options do |opt|
>   opt.on("-c [CLIENT]", String) do |s|
>     puts "client: #{s}"
>     client = s
>   end
>   opt.parse!
> end
> 
> puts "client is #{client}" if client
> 
> puts "done"

Thanks, but the problem with this is that when one adds the line

    opt.on("-h") do puts opt; exit 64 end

to the example, the help message will show `-c [CLIENT]', suggesting that the
CLIENT value is optional because of the brackets.

-- 
Jos Backus
jos at catnook.com