Forum: Ruby question about converting Python to Ruby - getopt

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ce5990549a8185ad45643be2cfbff9b5?d=identicon&s=25 Mike Steiner (Guest)
on 2007-05-14 20:25
(Received via mailing list)
Is there an equivalent in Ruby of Python's getopt (it parses
command-line
arguments)?

Mike Steiner
0cb023654f46a6bd171405af6419baf6?d=identicon&s=25 darren kirby (Guest)
on 2007-05-14 20:39
(Received via mailing list)
quoth the Mike Steiner:
> Is there an equivalent in Ruby of Python's getopt (it parses command-line
> arguments)?
>
> Mike Steiner

There are two: GetOptLong and OptionParser. Both are in the Standard
Library.
I believe GetOptLong is closer to the Python implementation.

-d
4dea430d31b993abaf41cd9b54f8128d?d=identicon&s=25 Avdi Grimm (avdi)
on 2007-05-14 20:40
(Received via mailing list)
On 5/14/07, Mike Steiner <mikejaysteiner@gmail.com> wrote:
> Is there an equivalent in Ruby of Python's getopt (it parses command-line
> arguments)?

Look into the GetoptLong and optparse libraries.  They are both part
of the Ruby standard library.
This topic is locked and can not be replied to.