| 1 | require 'optparse' |
| 2 | parser = OptionParser.new |
| 3 | parser.on( |
| 4 | '--xxx', |
| 5 | 'Option with no argument', |
| 6 | ->(value) {p ['Handler proc for -xxx called with value:', value]} |
| 7 | ) |
| 8 | parser.on( |
| 9 | '--yyy YYY', |
| 10 | 'Option with required argument', |
| 11 | ->(value) {p ['Handler proc for -yyy called with value:', value]} |
| 12 | ) |
| 13 | parser.parse! |