lib/thor/base.rb in thor-1.2.1 vs lib/thor/base.rb in thor-1.2.2
- old
+ new
@@ -504,11 +504,11 @@
# public_command :foo
# public_command :foo, :bar, :baz
#
def public_command(*names)
names.each do |name|
- class_eval "def #{name}(*); super end"
+ class_eval "def #{name}(*); super end", __FILE__, __LINE__
end
end
alias_method :public_task, :public_command
def handle_no_command_error(command, has_namespace = $thor_runner) #:nodoc:
@@ -556,12 +556,11 @@
# Receives a set of options and print them.
def print_options(shell, options, group_name = nil)
return if options.empty?
list = []
- padding = options.map { |o| o.aliases.size }.max.to_i * 4
-
+ padding = options.map { |o| o.aliases_for_usage.size }.max.to_i
options.each do |option|
next if option.hide
item = [option.usage(padding)]
item.push(option.description ? "# #{option.description}" : "")
@@ -608,18 +607,18 @@
# class, just return it, otherwise dup it and add the fresh copy to the
# current command hash.
def find_and_refresh_command(name) #:nodoc:
if commands[name.to_s]
commands[name.to_s]
- elsif command = all_commands[name.to_s] # rubocop:disable AssignmentInCondition
+ elsif command = all_commands[name.to_s] # rubocop:disable Lint/AssignmentInCondition
commands[name.to_s] = command.clone
else
raise ArgumentError, "You supplied :for => #{name.inspect}, but the command #{name.inspect} could not be found."
end
end
alias_method :find_and_refresh_task, :find_and_refresh_command
- # Everytime someone inherits from a Thor class, register the klass
+ # Every time someone inherits from a Thor class, register the klass
# and file into baseclass.
def inherited(klass)
super(klass)
Thor::Base.register_klass_file(klass)
klass.instance_variable_set(:@no_commands, 0)