You can clone with
Currently all options are, well, optional. This is due to the fact that a default value must be given to set the required type.
It would be nice to be able to have options which must be given by the user, therefore have no default.
This is important for scripts which require a file to work on, since a default value would make no sense and lead to a crash if no counter-measurements are taken. (For example using "" as default and check for length > 0 or the like.)
Another idea: Parsing the last / the only command line parameter without an identifier like --file.
For example to parse a command line call like ruby program.rb -v --intensity 3 /path/to/file. Maybe even with the file anywhere between other options. This would require some thought, e.g. if only a single unidentified option should be allowed and so on.
ruby program.rb -v --intensity 3 /path/to/file
It never occurred to me, that all unparsed arguments are left in the ARGV array. Therefore one could use micro-optparse to handle all arguments & switches and use the remaining arguments as if they were the required arguments. The following example should explain my thoughts:
options = Parser.new do |p|
p.option :meal, "Choose Meal", :default => "CucumberSalad"
raise ArgumentError, "No files given!" unless ARGV.size > 0
file = ARGV.shift
Example call: ./script --meal BrainSandwich file1.txt file2.txt
./script --meal BrainSandwich file1.txt file2.txt