From: Zouplaz Date: 2006-10-27T07:30:34+09:00 Subject: gem and optparse : help needed Hello, I want to use optparse on a gem packaged bin/ file (eg/usr/lib/ruby/gems/1.8/gems/mypackage/bin/foo) The goal is to make foo usable from the command line without anything else except the name of the file (no .rb, no ruby ./something) So, the Ruby file in bin/ directory don't have .rb extension and includes this as the first line of code #!/usr/bin/ruby So does several packages I've seen (rcov for example) But for a reason I don't understand the code above doesn't works... From the stdlib doc, tested on a mygem/bin/foo : #!/usr/bin/ruby require 'optparse' options = {} OptionParser.new do |opts| opts.banner = "Usage: example.rb [options]" opts.on("-v", "--[no-]verbose", "Run verbosely") do |v| options[:verbose] = v end end.parse! p options p ARGV foo --verbose displays {} [] Why ? What's wrong ?? Thanks