1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/optparse] Removed a duplicate section

7ef3d89e78
This commit is contained in:
Nobuyoshi Nakada 2021-04-16 12:57:55 +09:00 committed by Hiroshi SHIBATA
parent 98ccb49ac3
commit a10db32003
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2

View file

@ -84,42 +84,6 @@ From these defined options, the parser automatically builds help text:
When an option is found during parsing, When an option is found during parsing,
the block defined for the option is called with the argument value. the block defined for the option is called with the argument value.
Executions:
$ ruby basic.rb -x -z
["x", true]
["z", true]
$ ruby basic.rb -z -y -x
["z", true]
["y", true]
["x", true]
=== To Begin With
To use \OptionParser:
1. Require the \OptionParser code.
2. Create an \OptionParser object.
3. Define one or more options.
4. Parse the command line.
File +basic.rb+ defines three options, <tt>-x</tt>,
<tt>-y</tt>, and <tt>-z</tt>, each with a descriptive string,
and each with a block.
:include: ruby/basic.rb
From these defined options, the parser automatically builds help text:
$ ruby basic.rb --help
Usage: basic [options]
-x Whether to X
-y Whether to Y
-z Whether to Z
When an option is found during parsing,
the block defined for the option is called with the argument value.
Executions: Executions:
$ ruby basic.rb -x -z $ ruby basic.rb -x -z