June 2007
Intermediate to advanced
294 pages
8h 6m
English
The program uses_cli.rb understands command-line options, which are configuration options that you can use to make the script behave in different ways, depending on the specific values chosen. It uses specific options that have become somewhat standard, such as -h or --help. Options in the form with a single hyphen and a single letter are short options, while those with a double hyphen and a full word are (unsurprisingly) called long options. Let’s look at the code for uses_cli.rb.
I think there is enough pedagogical value to rolling your own command-line parser to make it worthwhile, especially in a book like this. However, I should note that there are two fine built-in CLI parsers ...
Read now
Unlock full access