mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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.
This commit is contained in:
parent
dc01a40eac
commit
073f4ecb14
3 changed files with 5 additions and 3 deletions
|
@ -168,7 +168,7 @@ module Rails::Command
|
||||||
class << self
|
class << self
|
||||||
def invoke(namespace, args = [], **config)
|
def invoke(namespace, args = [], **config)
|
||||||
namespace = namespace.to_s
|
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
|
namespace = "version" if %w( -v --version ).include? namespace
|
||||||
|
|
||||||
if command = find_by_namespace(namespace)
|
if command = find_by_namespace(namespace)
|
||||||
|
|
|
@ -15,6 +15,8 @@ module Rails
|
||||||
|
|
||||||
include Behavior
|
include Behavior
|
||||||
|
|
||||||
|
HELP_MAPPINGS = %w(-h -? --help)
|
||||||
|
|
||||||
class << self
|
class << self
|
||||||
def hidden_commands # :nodoc:
|
def hidden_commands # :nodoc:
|
||||||
@hidden_commands ||= []
|
@hidden_commands ||= []
|
||||||
|
@ -27,7 +29,7 @@ module Rails
|
||||||
# Receives a namespace, arguments and the behavior to invoke the command.
|
# Receives a namespace, arguments and the behavior to invoke the command.
|
||||||
def invoke(namespace, args = [], **config)
|
def invoke(namespace, args = [], **config)
|
||||||
namespace = namespace.to_s
|
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
|
namespace = "version" if %w( -v --version ).include? namespace
|
||||||
|
|
||||||
if command = find_by_namespace(namespace)
|
if command = find_by_namespace(namespace)
|
||||||
|
|
|
@ -56,7 +56,7 @@ module Rails
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform(command, args, config) # :nodoc:
|
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)
|
dispatch(command, args.dup, nil, config)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue