提交 073f4ecb 编写于 作者: Y yuuji.yaginuma

allow to pass describe option to rake

Since `Thor::HELP_MAPPINGS` contains `-D`, so `bin/rails -D` show
rails's help. But, in Rails 5.0.1, `bin/rails -D` show the description
of rake task. I think that it is better to have the same behavior.
上级 dc01a40e
......@@ -168,7 +168,7 @@ module Rails::Command
class << self
def invoke(namespace, args = [], **config)
namespace = namespace.to_s
namespace = "help" if namespace.blank? || Thor::HELP_MAPPINGS.include?(namespace)
namespace = "help" if namespace.blank? || HELP_MAPPINGS.include?(namespace)
namespace = "version" if %w( -v --version ).include? namespace
if command = find_by_namespace(namespace)
......
......@@ -15,6 +15,8 @@ module Command
include Behavior
HELP_MAPPINGS = %w(-h -? --help)
class << self
def hidden_commands # :nodoc:
@hidden_commands ||= []
......@@ -27,7 +29,7 @@ def environment # :nodoc:
# Receives a namespace, arguments and the behavior to invoke the command.
def invoke(namespace, args = [], **config)
namespace = namespace.to_s
namespace = "help" if namespace.blank? || Thor::HELP_MAPPINGS.include?(namespace)
namespace = "help" if namespace.blank? || HELP_MAPPINGS.include?(namespace)
namespace = "version" if %w( -v --version ).include? namespace
if command = find_by_namespace(namespace)
......
......@@ -56,7 +56,7 @@ def inherited(base) #:nodoc:
end
def perform(command, args, config) # :nodoc:
command = nil if Thor::HELP_MAPPINGS.include?(args.first)
command = nil if Rails::Command::HELP_MAPPINGS.include?(args.first)
dispatch(command, args.dup, nil, config)
end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册