Skip to content

Maintenance Ruby 3.3 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

Gem::Command#deprecate_option

deprecate_option(name, version: nil, extra_msg: nil)

Mark a command-line option as deprecated, and optionally specify a deprecation horizon.

Note that with the current implementation, every version of the option needs to be explicitly deprecated, so to deprecate an option defined as

Example
add_option('-t', '--[no-]test', 'Set test mode') do |value, options|
  # ... stuff ...
end

you would need to explicitly add a call to deprecate_option for every version of the option you want to deprecate, like

Example
deprecate_option('-t')
deprecate_option('--test')
deprecate_option('--no-test')
See also #deprecated? #description #defaults_str #execute also in 4.1 · 4.0 · 3.4 · 3.2 · 3.1 · 3.0