- Existential Questions
- Usage Questions
Existential Questions
Why do we need another command line processing library?
Here is my best defense for this question. When the author was writing a script and needed a command line library, he found the existing libraries required too much rote code and memorization. They all appeared to make what _should_ be an easy task for the basic cases too difficult in order to account for the hard cases. Let me restate that: Command-line processing is not easy. And to fully accomodate the nuances of many possible scenarios, most command line libraries require you invest a significant amount of time to understand their API. But can't we use convention to make the simple cases simple (and still provide the functionality for the hard cases)?
The author thought that it should be possible to use metaprogramming to create an embeddable DSL (it's all the rage) to make declaring and using command-line interface as easy as possible. Convention would dictate the basic defaults such that a simple declaration like
module DBChecker extend OptiFlagSet flag "log" flag "password" flag "user" and_process! end
For everything else we will provide a DSL to modify this basic scenario.
Why is this library any more useful than other command line libraries?
Why can't I manually parse ARGV?
Do these other libraries have advantages compared to OptiFlag?
What is OptiFlag's history?
Usage Questions
How easy is it to use?
How long will it take to learn?
How do I make a flag optional?
module MyArgs extend OptiFlagSet optional_flag "verbose" end
How do I provide validation?
optional_flag "run_date" do value_matches ["run_date must be of the form mm/DD/YY",/^[0-9]{2}\/[0-9]{2}\/[0-9]{2,4}$/] end
optional_flag "mode" do # this is our second new clause-level modifier value_in_set ["read","write","execute"] end
