#7 Command-Line Interface (uses_cli.rb and simple_cli.rb)
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
--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
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 ...