219 Commits

Author SHA1 Message Date
Nobuyoshi Nakada
265dcd1733 [ruby/optparse] bump up to 0.7.0.dev.2
https://github.com/ruby/optparse/commit/8c2c7a4903
2025-03-19 08:00:01 +00:00
Nobuyoshi Nakada
8f19f0aad5 [ruby/optparse] Fix completion of key-value pairs array
Enum array may be the list of pairs of key and value.  Check if only
key is completable, not pair.

Fix https://github.com/ruby/optparse/pull/93
Fix https://github.com/ruby/optparse/pull/94

https://github.com/ruby/optparse/commit/a8d0ba8dac
2025-03-17 10:18:49 +00:00
Nobuyoshi Nakada
97c133a859 [ruby/optparse] bump up to 0.7.0.dev.1 [ci skip]
https://github.com/ruby/optparse/commit/f4d64b0b17
2025-03-10 11:06:55 +00:00
Kouhei Yanagita
3cd3f76679 [ruby/optparse] Fix LESS environment variable setup in OptionParser#help_exit
If the original value of LESS ends with an option starting with "--",
simply appending "Fe" would result in an invalid option string.

https://github.com/ruby/optparse/commit/30571f91d3
2025-03-10 10:21:29 +00:00
Koichi ITO
f4c16c57aa [ruby/optparse] Make the result of tty? obtainable with flexible stdout
In mock testing for stdout, `StringIO.new` is sometimes used to redirect the output.
In such cases, the assignment is done with `$stdout = StringIO.new`, not the constant `STDOUT`.
e.g., https://github.com/rubocop/rubocop/blob/v1.71.1/lib/rubocop/rspec/shared_contexts.rb#L154-L164

After assigning `StringIO.new`, `$stdout.tty?` returns `false`,
allowing the standard output destination to be switched during test execution.

```ruby
STDOUT.tty?       # => true
StringIO.new.tty? # => false
```

However, since `STDOUT.tty?` returns `true`, a failure occurred in environments
where the environment variables `RUBY_PAGER` or `PAGER` are set.
e.g., https://github.com/rubocop/rubocop/pull/13784

To address this, `STDOUT` has been updated to `$stdout` so that the result of `tty?` can be flexibly overridden.

A potential concern is that `$stdout`, unlike `STDOUT`,
does not always represent the standard output at the time the Ruby process started.
However, no concrete examples of issues related to this have been identified.

`STDOUT.tty?` is the logic of optparse introduced in https://github.com/ruby/optparse/pull/70.

This PR replaces `STDOUT` with `$stdout` throughout, based on the assumption
that `$stdout` is sufficient for use with optparse.

https://github.com/ruby/optparse/commit/262cf6f9ac
2025-03-10 10:19:58 +00:00
Nobuyoshi Nakada
9e265b583b [ruby/optparse] Add post-check of value
Fix https://github.com/ruby/optparse/pull/80

https://github.com/ruby/optparse/commit/050a87d029
2025-03-10 09:55:29 +00:00
Nobuyoshi Nakada
b51450f3bd [ruby/optparse] Update argument check with save navigation operator
https://github.com/ruby/optparse/commit/71e2b31824
2025-03-10 08:03:55 +00:00
Nobuyoshi Nakada
dad0f876a9 [ruby/optparse] Remove extra blank lines [ci skip]
https://github.com/ruby/optparse/commit/d7dec6808f
2025-03-10 08:03:54 +00:00
Nobuyoshi Nakada
9de9cb53c0 [ruby/optparse] [DOC] Update documents to use single quotes instead of backqoutes
https://github.com/ruby/optparse/commit/5e71a70cb5
2025-03-10 07:56:44 +00:00
Nobuyoshi Nakada
cdf36d6bfd [ruby/optparse] Allow non-string enum list #79
Command line arguments are strings, convert enum list elements to
strings to match.

https://github.com/ruby/optparse/commit/c5ec052efc
2025-03-09 14:32:17 +00:00
Nobuyoshi Nakada
0c73328aff [ruby/optparse] Use \A instead of ^ as the beginning of string
https://github.com/ruby/optparse/commit/a3f1029815
2025-03-09 14:09:16 +00:00
Hiroshi SHIBATA
a698b5ebb8 [ruby/optparse] Bump up v0.6.0
https://github.com/ruby/optparse/commit/080360ffd4
2024-11-08 04:22:33 +00:00
Nobuyoshi Nakada
5fd3942466 [ruby/optparse] Prefer require_relative
https://github.com/ruby/optparse/commit/bb08cd47a8
2024-09-03 04:43:25 +00:00
fatkodima
a35d324862 [ruby/optparse] Fix parsing array arguments with :into option
https://github.com/ruby/optparse/commit/19700e96d8
2024-08-05 02:28:12 +00:00
Nobuyoshi Nakada
fc363944b4 [ruby/optparse] bump up to 0.5.0
https://github.com/ruby/optparse/commit/f5018a8b1c
2024-04-15 05:06:46 +00:00
Koichi Sasada
9180e33ca3 show warning for unused block
With verbopse mode (-w), the interpreter shows a warning if
a block is passed to a method which does not use the given block.

Warning on:

* the invoked method is written in C
* the invoked method is not `initialize`
* not invoked with `super`
* the first time on the call-site with the invoked method
  (`obj.foo{}` will be warned once if `foo` is same method)

[Feature #15554]

`Primitive.attr! :use_block` is introduced to declare that primitive
functions (written in C) will use passed block.

For minitest, test needs some tweak, so use
ea9caafc07
for `test-bundled-gems`.
2024-04-15 12:08:07 +09:00
Nobuyoshi Nakada
5d76fe6b2a [ruby/optparse] Invoke pager for --help
https://github.com/ruby/optparse/commit/77dccce37c
2024-03-01 07:10:08 +00:00
Nobuyoshi Nakada
7da3f8dcd3 [ruby/optparse] [DOC] About return value of OptionParser#new
https://github.com/ruby/optparse/commit/59b9fd7ddc
2024-02-23 12:50:08 +00:00
Nobuyoshi Nakada
41c0fb6991 [ruby/optparse] Add exact: keyword argument
https://github.com/ruby/optparse/commit/07e83673a8
2024-02-23 21:16:59 +09:00
Yusuke Endoh
25d74b9527 Do not include a backtick in error messages and backtraces
[Feature #16495]
2024-02-15 18:42:31 +09:00
Nobuyoshi Nakada
bbccabe6d6 [ruby/optparse] [DOC] Add missing documents
https://github.com/ruby/optparse/commit/33956ce93f
2024-02-11 16:08:14 +00:00
Nobuyoshi Nakada
f960fbc102 [ruby/optparse] Search exactly when require_exact
To work with options defined as `--[no]-something`.

Fix https://bugs.ruby-lang.org/issues/20252
Fix https://github.com/ruby/optparse/pull/60

https://github.com/ruby/optparse/commit/78afdab307
2024-02-11 00:47:41 +09:00
Nobuyoshi Nakada
db73226bf6 [ruby/optparse] Adjust arguments for lambda-callbacks
Rake uses [lambda] as callbacks.
Calling it without omitted argument raises an `ArgumentError`.

lambda: https://github.com/ruby/rake/blob/master/lib/rake/application.rb#L543

https://github.com/ruby/optparse/commit/213cb03b59
2024-02-09 19:58:31 +09:00
Nobuyoshi Nakada
2c6767b71e [ruby/optparse] Respect default values in block parameters
Fix https://github.com/ruby/optparse/pull/55

https://github.com/ruby/optparse/commit/9d53e74aa4
2024-02-09 19:58:19 +09:00
fatkodima
f7a407cabd [ruby/optparse] Fix require_exact to work with options defined as --[no]-something
https://github.com/ruby/optparse/commit/4e346ad337
2024-02-09 03:31:13 +00:00
Nobuyoshi Nakada
50bcaa6286 [ruby/optparse] Escape backslashes
https://github.com/ruby/optparse/commit/b14c2c644d
2024-02-09 03:21:24 +00:00
Nobuyoshi Nakada
e55a57af1e [ruby/optparse] [DOC] Add missing documents
https://github.com/ruby/optparse/commit/324ff21f04
2023-12-25 21:12:49 +09:00
Hiroshi SHIBATA
3f33bfa1e5 [ruby/optparse] Bump up 0.4.0
https://github.com/ruby/optparse/commit/acbf6e3e12
2023-11-07 01:40:53 +00:00
Nobuyoshi Nakada
dfad14d83f [ruby/optparse] [DOC] Mark up constant and method names as code
https://github.com/ruby/optparse/commit/e8bee0be8f
2023-07-30 02:35:22 +00:00
Jeremy Evans
bb927acd3b [ruby/optparse] Document requires needed for Date/DateTime/Time/URI/Shellwords support
Fixes [Bug #19566]

https://github.com/ruby/optparse/commit/fb91d97c10
2023-04-04 23:43:58 +00:00
Junichi Ito
cea6951ecf [ruby/optparse] Add symbolize_names to getopts
https://github.com/ruby/optparse/commit/3e63d878f8
2022-12-26 15:09:21 +09:00
Nobuyoshi Nakada
4c767c1354 [ruby/optparse] bump up to 0.4.0.pre.1
https://github.com/ruby/optparse/commit/73661899ad
2022-12-26 15:09:21 +09:00
Hiroshi SHIBATA
fe7190a8c1
[ruby/optparse] Bump version to 0.3.1
https://github.com/ruby/optparse/commit/2a1e157ae1
2022-12-22 17:48:22 +09:00
Nobuyoshi Nakada
502ca37dde [ruby/optparse] The encoding argument of Regexp.new has been ignored since 1.9
https://github.com/ruby/optparse/commit/766f567405
2022-12-21 14:09:12 +09:00
Hiroshi SHIBATA
71b4d35526 [ruby/optparse] Bump version to 0.3.0
https://github.com/ruby/optparse/commit/c80dfb1ebd
2022-12-05 07:17:23 +00:00
Nobuyoshi Nakada
0bfb185654 [ruby/optparse] Add raise_unknown flag
(https://github.com/ruby/optparse/pull/38)

https://github.com/ruby/optparse/commit/12529653cd
2022-11-28 14:24:06 +00:00
Nobuyoshi Nakada
e2b15461a7 [ruby/optparse] Use class methods of File over IO
https://github.com/ruby/optparse/commit/ab5073e4d8
2022-11-21 10:26:42 +00:00
Whyme Lyu
37291df91d [ruby/optparse] #load() into hash
(https://github.com/ruby/optparse/pull/42)

OptionParser#load learns .load(into: Hash)

https://github.com/ruby/optparse/commit/2ea626fcff

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2022-10-29 13:46:27 +00:00
Maciek Rząsa
0f231f2bab [ruby/optparse] Don't treat empty string as an option description
https://github.com/ruby/optparse/commit/078638ee6d
2022-10-08 19:30:34 +09:00
konsolebox
419ad1e13e [ruby/optparse] Also accept '-' as an optional argument (https://github.com/ruby/optparse/pull/35)
https://github.com/ruby/optparse/commit/f2b8318631
2022-07-29 19:10:10 +09:00
Nobuyoshi Nakada
de427c3ce0 [ruby/optparse] Define inspect and pretty_inspect
https://github.com/ruby/optparse/commit/a3f0ec21b1
2022-04-04 15:05:44 +09:00
Nobuyoshi Nakada
92630e2346
[ruby/optparse] Fix links to the page directory files [Bug #18468]
https://github.com/ruby/optparse/commit/dab72c543d
2022-01-12 21:16:02 +09:00
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