[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[ruby-core:63415] [ruby-trunk - Feature #5010] Add Slop(-like) in stdlib and deprecate current OptionParser API
From:
shyouhei@...
Date:
2014-06-30 02:57:43 UTC
List:
ruby-core #63415
Issue #5010 has been updated by Shyouhei Urabe.
I'm neutral about that proposed #to_hash (so far, bit vague), but is definitely far better than removing optparse. Can you let your proposal be a new ticket? This thread is already too long to read through.
Rodrigo Rosenfeld Rosas wrote:
> Ok, what about introducing new methods to make it easier to work with OptionParser?
>
> Like:
>
> ~~~
> opts = OptionParser.parse do |p|
> p.banner "Usage: example.rb [options]"
> p.on :v, :verbose, "Run verbosely", :default => true
> end
>
> p opts.to_hash
> ~~~
>
> If you prefer I can create a new ticket to discuss the improvements and close this one.
----------------------------------------
Feature #5010: Add Slop(-like) in stdlib and deprecate current OptionParser API
https://bugs.ruby-lang.org/issues/5010#change-47457
* Author: Rodrigo Rosenfeld Rosas
* Status: Assigned
* Priority: Low
* Assignee: Yukihiro Matsumoto
* Category:
* Target version: next minor
----------------------------------------
I always found the OptionParser API not as well designed as it could be.
I've just found this gem:
http://lee.jarvis.co/slop/
Much better API and I think we should integrate it to Ruby 2.0.
Take a look at the minimal example shown in OptionParser :
<pre>
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
</pre>
This is the equivalent in Slop:
<pre>
require 'slop'
opts = Slop.parse do
banner "Usage: example.rb [options]"
on :v, :verbose, "Run verbosely", :default => true
end
p opts.to_hash
</pre>
--
https://bugs.ruby-lang.org/