summaryrefslogtreecommitdiff
path: root/doc/optparse/ruby
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2023-12-18 12:24:46 +0900
committerHiroshi SHIBATA <[email protected]>2023-12-25 21:12:49 +0900
commitaf4e839c4714fb7df57e76f0e33e69deca16bea1 (patch)
tree8efb3f3ae6c49389bc62ffb8aee1ec2bd4c36c0b /doc/optparse/ruby
parentdf941aa90dd2dd778224fdd60fc0f024a8f43f99 (diff)
[ruby/optparse] [DOC] Add missing secition
Fixes https://github.com/ruby/optparse/pull/51 https://github.com/ruby/optparse/commit/667ab35f59
Diffstat (limited to 'doc/optparse/ruby')
-rw-r--r--doc/optparse/ruby/argument_abbreviation.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/doc/optparse/ruby/argument_abbreviation.rb b/doc/optparse/ruby/argument_abbreviation.rb
new file mode 100644
index 0000000000..49007ebe69
--- /dev/null
+++ b/doc/optparse/ruby/argument_abbreviation.rb
@@ -0,0 +1,9 @@
+require 'optparse'
+parser = OptionParser.new
+parser.on('-x', '--xxx=VALUE', %w[ABC def], 'Argument abbreviations') do |value|
+ p ['--xxx', value]
+end
+parser.on('-y', '--yyy=VALUE', {"abc"=>"XYZ", def: "FOO"}, 'Argument abbreviations') do |value|
+ p ['--yyy', value]
+end
+parser.parse!