diff options
author | Burdette Lamar <BurdetteLamar@Yahoo.com> | 2021-04-09 08:21:34 -0500 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2021-04-11 08:52:50 +0900 |
commit | c795f30ef00e5d428b4ffaf95e91d61f4a26a505 (patch) | |
tree | d287c0292e4a25859a241e648242be09a9e4c4c7 /doc/ruby/short_simple.rb | |
parent | 97abd0f6afeeab287b371e9ccc5dd28a33d13a83 (diff) |
[ruby/optparse] Reorganize Ruby example files for sharing (#14)
https://github.com/ruby/optparse/commit/9a2352c1c9
Diffstat (limited to 'doc/ruby/short_simple.rb')
-rw-r--r-- | doc/ruby/short_simple.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/ruby/short_simple.rb b/doc/ruby/short_simple.rb new file mode 100644 index 0000000000..d3d489e2dc --- /dev/null +++ b/doc/ruby/short_simple.rb @@ -0,0 +1,9 @@ +require 'optparse' +parser = OptionParser.new +parser.on('-x', 'One short name') do |value| + p ['-x', value] +end +parser.on('-1', '-%', 'Two short names (aliases)') do |value| + p ['-1 or -%', value] +end +parser.parse! |