diff options
author | Prem Sichanugrist <s@sikachu.com> | 2010-02-09 20:19:54 +0700 |
---|---|---|
committer | José Valim <jose.valim@gmail.com> | 2010-02-10 08:08:16 +0100 |
commit | af22c5b16a0f138969221e5a17fc159efb5ae347 (patch) | |
tree | b3ad40c829713815384fe2a8f6a455836a483f2f /railties | |
parent | 7d76474e5da6c1c06eb831fe436f12591cca4339 (diff) | |
download | rails-af22c5b16a0f138969221e5a17fc159efb5ae347.tar.gz rails-af22c5b16a0f138969221e5a17fc159efb5ae347.tar.bz2 rails-af22c5b16a0f138969221e5a17fc159efb5ae347.zip |
Add missing -h/--help flag to several rails command [#3909 status:resolved]
Signed-off-by: José Valim <jose.valim@gmail.com>
Diffstat (limited to 'railties')
-rw-r--r-- | railties/lib/rails/commands/console.rb | 2 | ||||
-rw-r--r-- | railties/lib/rails/commands/destroy.rb | 4 | ||||
-rwxr-xr-x | railties/lib/rails/commands/generate.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/commands/performance/benchmarker.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/commands/performance/profiler.rb | 4 | ||||
-rw-r--r-- | railties/lib/rails/generators.rb | 4 |
6 files changed, 11 insertions, 11 deletions
diff --git a/railties/lib/rails/commands/console.rb b/railties/lib/rails/commands/console.rb index 3fa4c939a8..50df6ba405 100644 --- a/railties/lib/rails/commands/console.rb +++ b/railties/lib/rails/commands/console.rb @@ -19,7 +19,7 @@ module Rails 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 diff --git a/railties/lib/rails/commands/destroy.rb b/railties/lib/rails/commands/destroy.rb index 92a06ebdd8..9023c61bf2 100644 --- a/railties/lib/rails/commands/destroy.rb +++ b/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 diff --git a/railties/lib/rails/commands/generate.rb b/railties/lib/rails/commands/generate.rb index 5e45d8ab46..7d05a30de8 100755 --- a/railties/lib/rails/commands/generate.rb +++ b/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 diff --git a/railties/lib/rails/commands/performance/benchmarker.rb b/railties/lib/rails/commands/performance/benchmarker.rb index ad84d94dbf..0432261802 100644 --- a/railties/lib/rails/commands/performance/benchmarker.rb +++ b/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 diff --git a/railties/lib/rails/commands/performance/profiler.rb b/railties/lib/rails/commands/performance/profiler.rb index 50ae411166..6d9717b5cd 100644 --- a/railties/lib/rails/commands/performance/profiler.rb +++ b/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 diff --git a/railties/lib/rails/generators.rb b/railties/lib/rails/generators.rb index 5779357226..c01018aab2 100644 --- a/railties/lib/rails/generators.rb +++ b/railties/lib/rails/generators.rb @@ -166,7 +166,7 @@ module Rails end # Show help message with available generators. - def self.help + def self.help(command = 'generate') lookup! namespaces = subclasses.map{ |k| k.namespace } @@ -178,7 +178,7 @@ module Rails 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" |