lib/bundler/vendor/thor/lib/thor.rb in bundler-2.2.7 vs lib/bundler/vendor/thor/lib/thor.rb in bundler-2.2.8
- old
+ new
@@ -1,9 +1,9 @@
-require "set"
require_relative "thor/base"
class Bundler::Thor
+ $thor_runner ||= false
class << self
# Allows for custom "Command" package naming.
#
# === Parameters
# name<String>
@@ -321,11 +321,11 @@
# --verbose foo
#
# ==== Parameters
# Symbol ...:: A list of commands that should be affected.
def stop_on_unknown_option!(*command_names)
- stop_on_unknown_option.merge(command_names)
+ @stop_on_unknown_option = stop_on_unknown_option | command_names
end
def stop_on_unknown_option?(command) #:nodoc:
command && stop_on_unknown_option.include?(command.name.to_sym)
end
@@ -335,26 +335,26 @@
# to work, like help.
#
# ==== Parameters
# Symbol ...:: A list of commands that should be affected.
def disable_required_check!(*command_names)
- disable_required_check.merge(command_names)
+ @disable_required_check = disable_required_check | command_names
end
def disable_required_check?(command) #:nodoc:
command && disable_required_check.include?(command.name.to_sym)
end
protected
def stop_on_unknown_option #:nodoc:
- @stop_on_unknown_option ||= Set.new
+ @stop_on_unknown_option ||= []
end
# help command has the required check disabled by default.
def disable_required_check #:nodoc:
- @disable_required_check ||= Set.new([:help])
+ @disable_required_check ||= [:help]
end
# The method responsible for dispatching given the args.
def dispatch(meth, given_args, given_opts, config) #:nodoc: # rubocop:disable MethodLength
meth ||= retrieve_command_name(given_args)
@@ -396,10 +396,9 @@
# thor class by another ways which is not the Bundler::Thor::Runner. It receives
# the command that is going to be invoked and a boolean which indicates if
# the namespace should be displayed as arguments.
#
def banner(command, namespace = nil, subcommand = false)
- $thor_runner ||= false
command.formatted_usage(self, $thor_runner, subcommand).split("\n").map do |formatted_usage|
"#{basename} #{formatted_usage}"
end.join("\n")
end