14.2. Command-Line Options and Arguments
Rumors of the death of the command line are greatly exaggerated. Although we live in the age of the GUI, every day thousands of us retreat to the older text-based interfaces for one reason or another.
Ruby has many of its roots in UNIX, as we’ve said. Yet even in the Windows world, there is such a thing as a command line, and, frankly, we don’t see it going away any time soon.
When operating at this level, parameters and switches are used to communicate with the program at the time of its invocation. This section shows how to deal with these parameters (or arguments) and switches (or options).
14.2.1. Parsing Command-Line Options
The getoptlong library is probably the most commonly used command-line parser. ...
Get The Ruby Way: Solutions and Techniques in Ruby Programming, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.