summaryrefslogtreecommitdiff
path: root/doc/optparse/tutorial.rdoc
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/tutorial.rdoc
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/tutorial.rdoc')
-rw-r--r--doc/optparse/tutorial.rdoc23
1 files changed, 23 insertions, 0 deletions
diff --git a/doc/optparse/tutorial.rdoc b/doc/optparse/tutorial.rdoc
index b104379cf7..6f56bbf92d 100644
--- a/doc/optparse/tutorial.rdoc
+++ b/doc/optparse/tutorial.rdoc
@@ -351,6 +351,29 @@ Executions:
Omitting an optional argument does not raise an error.
+==== Argument Abbreviations
+
+Specify an argument list as an Array or a Hash.
+
+ :include: ruby/argument_abbreviation.rb
+
+When an argument is abbreviated, the expanded argument yielded.
+
+Executions:
+
+ $ ruby argument_abbreviation.rb --help
+ Usage: argument_abbreviation [options]
+ Usage: argument_abbreviation [options]
+ -x, --xxx=VALUE Argument abbreviations
+ -y, --yyy=VALUE Argument abbreviations
+ $ ruby argument_abbreviation.rb --xxx A
+ ["--xxx", "ABC"]
+ $ ruby argument_abbreviation.rb --xxx c
+ argument_abbreviation.rb:9:in `<main>': invalid argument: --xxx c (OptionParser::InvalidArgument)
+ $ ruby argument_abbreviation.rb --yyy a --yyy d
+ ["--yyy", "XYZ"]
+ ["--yyy", "FOO"]
+
=== Argument Values
Permissible argument values may be restricted