aboutsummaryrefslogtreecommitdiffstats
path: root/lib/optparse.rb
Commit message (Collapse)AuthorAgeFilesLines
* Separate `send` into `public_send` and `__send__`Nobuyoshi Nakada2020-10-271-1/+1
|
* [ruby/optparse] Define OptionParser::VersionNobuyoshi Nakada2020-07-231-0/+2
| | | | https://github.com/ruby/optparse/commit/4c0021b5b2
* Revert "Method reference operator"Nobuyoshi Nakada2019-11-121-1/+1
| | | | | This reverts commit 67c574736912003c377218153f9d3b9c0c96a17b. [Feature #16275]
* OptionParser: document into: argumentzverok2019-10-261-3/+12
|
* Make suggestions order stable [Bug #16263]Nobuyoshi Nakada2019-10-211-1/+1
| | | | | As the result order of `DidYouMean::SpellChecker#correct` is undefined, keep the order of the original candidates.
* Support DidYouMean by AmbiguousOption tooNobuyoshi Nakada2019-10-181-2/+3
|
* Defer adding additional info until getting the message of an errorNobuyoshi Nakada2019-10-181-13/+20
|
* Use DidYouMean.formatterNobuyoshi Nakada2019-10-181-1/+1
| | | | Instead of building messages separately.
* lib/optparse.rb: Show a did_you_mean hint for unknown optionYusuke Endoh2019-10-181-2/+16
| | | | | | | | | | | | | | | | | | | | ``` 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 ```
* Fix default argument values for OptParse::Switch#summarizeJeremy Evans2019-07-071-1/+1
| | | | | | | | | | 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]
* Load OptionParser defaults from XDG and Haiku standardsNobuyoshi Nakada2019-05-061-5/+18
|
* Use delete_prefix instead of `sub(/\Afixed-pattern/, '')`kazu2018-12-041-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optarse.rb: mention multiple descriptions [ci skip]nobu2018-12-021-0/+2
| | | | | | [ruby-list:50718] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66134 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Get rid of block-less Proc.newnobu2018-11-281-1/+2
| | | | | | | * 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
* Remove useless backslashnobu2018-11-281-1/+1
| | | | | | | * 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
* lib/optparse.rb: improve docsstomar2018-05-161-14/+17
| | | | | | | * 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
* optparse.rb: Remove redundant `.freeze`nobu2018-05-131-8/+8
| | | | | | | | [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
* optparse.rb: [DOC] about into: optionnobu2018-05-121-0/+23
| | | | | | | | | | * 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
* optparse: Suppress warningsnobu2018-05-061-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* optparse.rb: froze string literalsnobu2018-01-261-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62047 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: literal newlinenobu2018-01-251-1/+2
| | | | | | | | * 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
* revert r62032 because it refers to a undefined variableko12018-01-251-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62034 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: literal newlinenobu2018-01-241-1/+1
| | | | | | | | * 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
* optparse.rb: case-sensitive candidatenobu2017-07-241-4/+4
| | | | | | | | * 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
* optparse.rb: [DOC] fix keysnobu2017-07-211-5/+5
| | | | | | | * 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
* optparse.rb: get rid of evalnobu2017-07-121-7/+13
| | | | | | | * 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
* Fix DecimalInteger converting to octal bugnobu2017-07-061-1/+1
| | | | | | | | | | | 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
* nodoc OptParsestomar2017-03-041-1/+2
| | | | | | | | * 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
* optparse.rb: hyphenizenobu2016-10-141-4/+8
| | | | | | | * 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
* optparse.rb: fix quote [ci skip]nobu2016-06-051-1/+1
| | | | | | * 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
* optparse.rb: fix char class optionnobu2016-05-311-1/+7
| | | | | | | | | * 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
* optparse.rb: no duplicate stringsnobu2016-05-311-1/+2
| | | | | | | * 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
* optparse.rb: [DOC] fix example code [ci skip]nobu2016-04-281-78/+79
| | | | | | | * 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
* get rid of ruby-mode.el bugsnobu2016-02-061-2/+2
| | | | | | | | * 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
* optparse.rb: into kwdargnobu2016-01-061-13/+14
| | | | | | | * 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
* [DOC] Fix typosa_matsuda2015-12-231-2/+2
| | | | | | | | | | | | | | | | | * 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
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | 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
* optparse.rb: Fix typo [ci skip]nobu2015-12-081-1/+1
| | | | | | | * 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
* fix typo in OptionParser#complete docs [ci skip]nobu2015-07-211-1/+1
| | | | | | * 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
* Fix typo in optparse library [ci skip] [Fix GH-956]nobu2015-07-051-1/+1
| | | | | | * lib/optparse.rb: [DOC] Fix typo. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51152 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: update --version example [ci skip]nobu2015-02-081-1/+3
| | | | | | | * 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
* * lib/optparse.rb: improvements for OptionParser documentation.hsbt2015-01-121-77/+218
| | | | | | [misc #10608][ruby-core:66901][ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: getopts message improvementnobu2014-07-211-3/+5
| | | | | | | * lib/optparse.rb (getopts): print default values and descriptions in the help message. [fix GH-676] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/gserver.rb: remove redundant use of to_s in interpolation.hsbt2014-06-241-1/+1
| | | | | | | | | | * lib/logger.rb: ditto. * lib/optparse.rb: ditto. * lib/rbconfig/obsolete.rb: ditto. * lib/resolv.rb: ditto. * lib/webrick/httpresponse.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46543 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* lib/optionparser.rbnobu2014-05-261-0/+2
| | | | | | | * lib/optionparser.rb, lib/optparse.rb (OptParse): aliases. [ruby-core:62751] [Feature #9864] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46126 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/optparse.rb: [DOC] Add example of generating help with optparse.zzak2014-02-271-0/+37
| | | | | | | | Patch by @joelmccracken documenting-ruby/ruby#19 https://github.com/documenting-ruby/ruby/pull/19 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: regexp at lhsnobu2013-11-281-1/+1
| | | | | | | * lib/optparse.rb (OptionParser::Switch#compsys): regexp literal should be lhs of =~. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* optparse.rb: remove $Id$nobu2013-09-081-13/+1
| | | | | | | * lib/optparse.rb (OptionParser): remove constants depending on $Id$. [Bug #8877] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42889 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/optparse.rb: The Integer acceptable now allows binary anddrbrain2013-09-051-9/+34
| | | | | | | | | | | | | hexadecimal numbers per the documentation. [ruby-trunk - Bug #8865] DecimalInteger, OctalInteger, DecimalNumeric now validate their input before converting to a number. [ruby-trunk - Bug #8865] * test/optparse/test_acceptable.rb: Tests for the above, tests for all numeric acceptables for existing behavior. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42844 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * lib/optparse.rb: nodoc Object::Version and SPLAT_PROCzzak2013-05-191-2/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e