Skip to content

Commit

Permalink
Add missing -h/--help flag to several rails command [#3909 status:res…
Browse files Browse the repository at this point in the history
…olved]

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
sikachu authored and josevalim committed Feb 10, 2010
1 parent 7d76474 commit af22c5b
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion railties/lib/rails/commands/console.rb
Expand Up @@ -19,7 +19,7 @@ def start
opt.banner = "Usage: console [environment] [options]"
opt.on('-s', '--sandbox', 'Rollback database modifications on exit.') { |v| options[:sandbox] = v }
opt.on("--debugger", 'Enable ruby-debugging for the console.') { |v| options[:debugger] = v }
opt.on('--irb') { |v| abort '--irb option is no longer supported. Invoke `/your/choice/of/ruby script/rails console` instead' }
opt.on('--irb', "DEPRECATED: Invoke `/your/choice/of/ruby script/rails console` instead") { |v| abort '--irb option is no longer supported. Invoke `/your/choice/of/ruby script/rails console` instead' }
opt.parse!(ARGV)
end

Expand Down
4 changes: 2 additions & 2 deletions railties/lib/rails/commands/destroy.rb
@@ -1,7 +1,7 @@
require 'rails/generators'

if ARGV.size == 0
Rails::Generators.help
if [nil, "-h", "--help"].include?(ARGV.first)
Rails::Generators.help 'destroy'
exit
end

Expand Down
4 changes: 2 additions & 2 deletions railties/lib/rails/commands/generate.rb
@@ -1,7 +1,7 @@
require 'rails/generators'

if ARGV.size == 0
Rails::Generators.help
if [nil, "-h", "--help"].include?(ARGV.first)
Rails::Generators.help 'generate'
exit
end

Expand Down
4 changes: 2 additions & 2 deletions railties/lib/rails/commands/performance/benchmarker.rb
@@ -1,5 +1,5 @@
if ARGV.empty?
puts "Usage: benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..."
if [nil, "-h", "--help"].include?(ARGV.first)
puts "Usage: rails benchmarker [times] 'Person.expensive_way' 'Person.another_expensive_way' ..."
exit 1
end

Expand Down
4 changes: 2 additions & 2 deletions railties/lib/rails/commands/performance/profiler.rb
@@ -1,5 +1,5 @@
if ARGV.empty?
$stderr.puts "Usage: profiler 'Person.expensive_method(10)' [times] [flat|graph|graph_html]"
if [nil, "-h", "--help"].include?(ARGV.first)
$stderr.puts "Usage: rails profiler 'Person.expensive_method(10)' [times] [flat|graph|graph_html]"
exit(1)
end

Expand Down
4 changes: 2 additions & 2 deletions railties/lib/rails/generators.rb
Expand Up @@ -166,7 +166,7 @@ def self.invoke(namespace, args=ARGV, config={})
end

# Show help message with available generators.
def self.help
def self.help(command = 'generate')
lookup!

namespaces = subclasses.map{ |k| k.namespace }
Expand All @@ -178,7 +178,7 @@ def self.help
groups[base] << namespace
end

puts "Usage: rails generate GENERATOR [args] [options]"
puts "Usage: rails #{command} GENERATOR [args] [options]"
puts
puts "General options:"
puts " -h, [--help] # Print generators options and usage"
Expand Down

0 comments on commit af22c5b

Please sign in to comment.