Граф коммитов

177 Коммитов

Автор SHA1 Сообщение Дата
Hiroshi SHIBATA b8d49d0d01 [ruby/optparse] Bump up optparse version to 0.2.0
https://github.com/ruby/optparse/commit/1226b670e6
2021-10-21 21:01:34 +09:00
Burdette Lamar 27679b349e
[ruby/optparse] More on tutorial (https://github.com/ruby/optparse/pull/23)
- Removed a largish block of repeated text.
- Added sections "Top List and Base List" and "Methods for Defining Options" (on, define, etc.).
- Linked from class OptionParser doc to the tutorial.

https://github.com/ruby/optparse/commit/7f3195b9db
2021-07-28 20:13:39 +09:00
Nobuyoshi Nakada bf175e7ec2
[ruby/optparse] nodoc private methods
https://github.com/ruby/optparse/commit/f23d750d14
2021-07-28 20:13:38 +09:00
Nobuyoshi Nakada f89486965b [ruby/optparse] Moved rdoc files to doc/optparse
https://github.com/ruby/optparse/commit/cccb28e0de
2021-04-11 09:03:36 +09:00
BurdetteLamar a5ecce9187
[ruby/optparse] Make use of option_params.rdoc
https://github.com/ruby/optparse/commit/d55d9284c3
2021-04-08 12:11:42 +09:00
Nobuyoshi Nakada 190a57b168
[ruby/optparse] bump up to 0.1.1
https://github.com/ruby/optparse/commit/2fe984a603
2021-03-29 19:37:25 +09:00
Nobuyoshi Nakada e8317d90b0
[ruby/optparse] Fixed error message of unparsed non-option
Close https://github.com/ruby/optparse/issues/3

https://github.com/ruby/optparse/commit/94c5cf4032
2021-03-29 19:37:24 +09:00
BurdetteLamar 7846f3201a
[ruby/optparse] Change *opts to *params, to avoid confusion
https://github.com/ruby/optparse/commit/f5f5e202dd
2021-03-29 15:55:41 +09:00
Jeremy Evans eca8ffaa0b
[ruby/optparse] Add OptionParser#require_exact accessor
This allows you to disable allowing abbreviations of long options
and using short options for long options.

Implements Ruby Feature #11523

https://github.com/ruby/optparse/commit/dfefb2d2e2
2021-03-29 15:55:41 +09:00
Nobuyoshi Nakada 3198e7abd7
Separate `send` into `public_send` and `__send__` 2020-10-27 16:12:45 +09:00
Nobuyoshi Nakada f120e65200 [ruby/optparse] Define OptionParser::Version
https://github.com/ruby/optparse/commit/4c0021b5b2
2020-07-23 10:57:33 +09:00
Nobuyoshi Nakada fb6a489af2
Revert "Method reference operator"
This reverts commit 67c5747369.
[Feature #16275]
2019-11-12 17:24:48 +09:00
zverok f93cb6904c OptionParser: document into: argument 2019-10-26 10:24:20 -07:00
Nobuyoshi Nakada 263ee6639d
Make suggestions order stable [Bug #16263]
As the result order of `DidYouMean::SpellChecker#correct` is
undefined, keep the order of the original candidates.
2019-10-21 09:54:11 +09:00
Nobuyoshi Nakada e2b719bed6
Support DidYouMean by AmbiguousOption too 2019-10-18 17:46:53 +09:00
Nobuyoshi Nakada b4d308b419
Defer adding additional info until getting the message of an error 2019-10-18 17:39:16 +09:00
Nobuyoshi Nakada 46fa301e82
Use DidYouMean.formatter
Instead of building messages separately.
2019-10-18 15:18:36 +09:00
Yusuke Endoh c3b64a86bc lib/optparse.rb: Show a did_you_mean hint for unknown option
```
require 'optparse'

OptionParser.new do |opts|
  opts.on("-f", "--foo", "foo") {|v| }
  opts.on("-b", "--bar", "bar") {|v| }
  opts.on("-c", "--baz", "baz") {|v| }
end.parse!
```

```
$ ruby test.rb --baa
Traceback (most recent call last):
test.rb:7:in `<main>': invalid option: --baa (OptionParser::InvalidOption)
Did you mean?  baz
               bar
```
2019-10-18 12:20:58 +09:00
Jeremy Evans 3fcffceafd Fix default argument values for OptParse::Switch#summarize
The documentation describes these arguments being hashes, and the method
is called with hashes, so a hash default makes more sense.

The method would fail previously if called without arguments and @short
or @long contained a non-integer value.

Fixes [Bug #10928]
2019-07-07 13:49:47 -07:00
Nobuyoshi Nakada 7e72ce0f73
Load OptionParser defaults from XDG and Haiku standards 2019-05-06 15:30:44 +09:00
kazu c01a5ee85e Use delete_prefix instead of `sub(/\Afixed-pattern/, '')`
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-04 08:22:10 +00:00
nobu a7f1bcb2d6 optarse.rb: mention multiple descriptions [ci skip]
[ruby-list:50718]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-02 12:50:19 +00:00
nobu 2d67a3f4b1 Get rid of block-less Proc.new
* lib/optparse.rb (OptionParser::Switch#initialize): get rid of
  `Proc.new` without a block, which may be deprecated in the future.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-28 06:12:58 +00:00
nobu b7fccecf1c Remove useless backslash
* lib/optparse.rb (OptionParser::Switch#compsys): remove useless
  backslash which just confuse ruby-mode.el.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-28 06:12:57 +00:00
stomar db4cba88d9 lib/optparse.rb: improve docs
* lib/optparse.rb: [DOC] simplify shell prompt in examples;
  other minor improvements.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63445 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-16 18:55:28 +00:00
nobu 2c091f564c optparse.rb: Remove redundant `.freeze`
[Fix GH-1873]

From: Masataka Pocke Kuwabara <kuwabara@pocke.me>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-13 01:18:33 +00:00
nobu 5c0e6cc886 optparse.rb: [DOC] about into: option
* lib/optparse.rb: add documentation for "into" option of #parse
  and family, which stores options to a Hash.
  [ruby-core:87004] [Misc #14753]

From: pocke (Masataka Kuwabara) <kuwabara@pocke.me>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63410 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-12 14:41:24 +00:00
nobu 2ad7fb6dc1 optparse: Suppress warnings
Ruby warns "instance variable `@version` not initialized" for optparse when it receives `--version` option.

`test.rb`

```ruby
require 'optparse'
Version = '1'
OptionParser.new.parse(ARGV)
```

```
$ ruby -w test.rb --version
/home/pocke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/optparse.rb:1168: warning: instance variable @version not initialized
/home/pocke/.rbenv/versions/2.5.1/lib/ruby/2.5.0/optparse.rb:1175: warning: instance variable @release not initialized
test 1
```

This change will suppress the warnings.

[Fix GH-1871]

From: Masataka Pocke Kuwabara <kuwabara@pocke.me>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63342 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-06 09:53:33 +00:00
nobu db1de35a31 optparse.rb: froze string literals
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-26 03:41:04 +00:00
nobu 429e2abfad optparse.rb: literal newline
* lib/optparse.rb (OptionParser#summarize): use literal newline to
  join option summaries as IO#puts does, not the special gloval
  variable $/.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62035 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-25 01:48:41 +00:00
ko1 f8fa8dd9de revert r62032 because it refers to a undefined variable
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-25 00:42:08 +00:00
nobu 3010d5eeb9 optparse.rb: literal newline
* lib/optparse.rb (OptionParser#summarize): use literal newline to
  join option summaries as IO#puts does, not the special gloval
  variable $/.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62032 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-24 23:17:20 +00:00
nobu 3fe5d355a8 optparse.rb: case-sensitive candidate
* lib/optparse.rb (candidate): short options are case-sensitive by
  the default, should not match case-different options..
  https://github.com/mernen/completion-ruby/pull/9#issuecomment-317287946

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59412 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-24 01:56:04 +00:00
nobu 5f534b7d46 optparse.rb: [DOC] fix keys
* lib/optparse.rb (getopts): [DOC] parameter keys are strings, not
  symbols.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59383 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-21 08:31:47 +00:00
nobu 89bf90a370 optparse.rb: get rid of eval
* lib/optparse.rb: try Float() and Integer() instead of eval,
  which does too much things.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59312 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-12 02:49:53 +00:00
nobu 8ddf0263bb Fix DecimalInteger converting to octal bug
Previously if the input started with a '0' then it will be converted
as octal even though it has been specified as a decimal. This commit
forces the number to be interpreted as a decimal.

[ruby-core:81927] [Bug #13722] [Fix GH-1665]
Author:    william <william.mccumstie@outlook.com>

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-06 11:49:03 +00:00
stomar e9d6c6716f nodoc OptParse
* lib/optparse.rb: [DOC] nodoc OptParse, introduced with r46126,
  to avoid leaking of its documentation (OptionParser's docs) into
  the class documentation of Object.  [ruby-core:79909] [Bug #13281]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57775 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-03-04 19:52:30 +00:00
nobu 99ad512486 optparse.rb: hyphenize
* lib/optparse.rb (make_switch, parse_in_order): unify underscores
  to hyphens.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56419 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-10-14 08:20:26 +00:00
nobu 89e11e8833 optparse.rb: fix quote [ci skip]
* lib/optparse.rb (getopts): [DOC] fix missing quote.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-06-05 09:54:13 +00:00
nobu dd1be236d9 optparse.rb: fix char class option
* lib/optparse.rb (OptionParser::Completion.candidate): get rid of
  nil as key names.  [ruby-core:75773] [Bug #12438]
* lib/optparse.rb (OptionParser#make_switch): char class option
  cannot be NoArgument, default to RequiredArgument.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55228 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 08:28:48 +00:00
nobu e82df08b9f optparse.rb: no duplicate strings
* lib/optparse.rb (OptionParser#parse_in_order): get rid of making
  duplicate strings; $1 and others make a new string each times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-05-31 08:26:30 +00:00
nobu 38b756501f optparse.rb: [DOC] fix example code [ci skip]
* lib/optparse.rb: [DOC] fix example code.  base on the code by
  Semyon Gaivoronskiy in [ruby-core:75224].  [Bug #12323]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-28 07:33:43 +00:00
nobu 6860034546 get rid of ruby-mode.el bugs
* lib/optparse.rb: get rid of confusing ruby-mode.el of Emacs 24,
  - if-end expression inside an expression
  - a comma just followed by a bar

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53752 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-02-06 11:51:40 +00:00
nobu 49684589cd optparse.rb: into kwdarg
* lib/optparse.rb (OptionParser#order!): add `into` optional
  keyword argument to store the results.  [Feature #11191]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53444 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-06 08:23:10 +00:00
a_matsuda 3a05da1321 [DOC] Fix typos
* benchmark.rb
* getoptlong.rb
* irb.rb
* net/http.rb
* net/http/header.rb
* net/imap.rb
* optparse.rb
* pstore.rb
* webrick.rb
* xmlrpc.rb

[ci skip]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53261 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-23 03:43:23 +00:00
naruse 3e92b635fb Add frozen_string_literal: false for all files
When you change this to true, you may need to add more tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16 05:07:31 +00:00
nobu c84e62cd32 optparse.rb: Fix typo [ci skip]
* lib/optparse.rb: fix double word typo in the document.
  [Misc #10608] [Fix GH-1126]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-08 01:19:04 +00:00
nobu ec1d232f10 fix typo in OptionParser#complete docs [ci skip]
* lib/optparse.rb (complete): [DOC] fix typo.  [Fix GH-973]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-21 04:36:57 +00:00
nobu 9b37b750bd Fix typo in optparse library [ci skip] [Fix GH-956]
* lib/optparse.rb: [DOC] Fix typo.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-07-05 14:54:12 +00:00
nobu 031c46f83a optparse.rb: update --version example [ci skip]
* lib/optparse.rb (OptparseExample): [DOC] update example code for
  --version option, to print OptparseExample::Version.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49547 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-02-08 15:26:11 +00:00