| 1 | require 'optparse' |
| 2 | parser = OptionParser.new |
| 3 | parser.on('-x', '--xxx', 'Short and long, no argument') |
| 4 | parser.on('-yYYY', '--yyy', 'Short and long, required argument') |
| 5 | parser.on('-z [ZZZ]', '--zzz', 'Short and long, optional argument') |
| 6 | options = {yyy: 'AAA', zzz: 'BBB'} |
| 7 | parser.parse!(into: options) |
| 8 | p options |