33 lines
869 B
Ruby
Raw Normal View History

2020-10-10 14:16:11 +02:00
# typed: true
2020-08-06 16:14:07 +02:00
# frozen_string_literal: true
module Homebrew
module CLI
class Parser
module Compat
module DeprecatedArgs
# No need to define it as it's the default/superclass implementation.
2020-09-01 14:05:52 +01:00
# rubocop:disable Style/MissingRespondToMissing
2020-08-06 16:14:07 +02:00
def method_missing(method, *)
if ![:debug?, :quiet?, :verbose?, :value].include?(method) && !@printed_args_warning
2020-08-06 16:14:07 +02:00
odeprecated "Homebrew.args", "`args = <command>_args.parse` and pass `args` along the call chain"
@printed_args_warning = true
end
super
end
2020-09-01 14:05:52 +01:00
# rubocop:enable Style/MissingRespondToMissing
2020-08-06 16:14:07 +02:00
end
def parse(*)
args = super
Homebrew.args = args.dup.extend(DeprecatedArgs)
args
end
end
prepend Compat
end
end
end