optparse is used by many programs, including other stdlib gems.

In my opinion, it would be best to keep backwards compatibility.

Why create a new gem, instead of improving the current standard library?

On Wed, Nov 21, 2012 at 10:48 AM, rosenfeld (Rodrigo Rosenfeld Rosas)
<rr.rosas / gmail.com> wrote:
>
> Issue #5010 has been updated by rosenfeld (Rodrigo Rosenfeld Rosas).
>
>
> Shyouhei, what if we create a separate mailing list to discuss and propos=
e a new gem to replace optparser? The idea would be to invite designers and=
 users of the current optparser alternatives (slop, clap, thor, etc) and tr=
y to come up with some gem that would satisfy most of us and put the new AP=
I in a new gem for consideration by ruby-core members.
>
> What restrictions should such a gem have to be part of stdlib? Should it =
remain backward compatible or could we just forget about the current optpar=
ser API? Maybe we can't get much traction from others if the former is requ=
ired. I would also prefer not having to design a backward compatible API.
>
> If this idea is accepted and no one steps up to create the mailing list I=
 could create a Google Group and invite developers to discuss a new API ext=
racting the good parts of the alternative solutions out there and start som=
e discussion about the pros and drawbacks of each solution and try to figur=
e out some API that would satisfy most of us.
>
> What do you think, shyouhei?
> ----------------------------------------
> Feature #5010: Add Slop(-like) in stdlib and deprecate current OptionPars=
er API
> https://bugs.ruby-lang.org/issues/5010#change-33402
>
> Author: rosenfeld (Rodrigo Rosenfeld Rosas)
> Status: Assigned
> Priority: Low
> Assignee: matz (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 =3D {}
>   OptionParser.new do |opts|
>     opts.banner =3D "Usage: example.rb [options]"
>
>     opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
>       options[:verbose] =3D v
>     end
>   end.parse!
>
>   p options
>   p ARGV
> </pre>
>
> This is the equivalent in Slop:
>
> <pre>
> require 'slop'
>
> opts =3D Slop.parse do
>   banner "Usage: example.rb [options]"
>   on :v, :verbose, "Run verbosely", :default =3D> true
> end
>
> p opts.to_hash
> </pre>
>
>
> --
> http://bugs.ruby-lang.org/
>