Skip to content
Browse files

Print proper "Usage:" messages for "rails plugin" command

* suppress outputting "Unknown command:" when no command were specified
* output the "Usage:" message when no plugin names were given

[#5043 state:committed]

Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
  • Loading branch information...
1 parent ff44cc2 commit bf5d15456757e63598575db42917d702af9da729 @amatsuda amatsuda committed with jeremy
Showing with 10 additions and 2 deletions.
  1. +10 −2 railties/lib/rails/commands/plugin.rb
View
12 railties/lib/rails/commands/plugin.rb
@@ -335,7 +335,7 @@ def parse!(args=ARGV)
command = Commands.const_get(command.capitalize).new(self)
command.parse!(sub)
else
- puts "Unknown command: #{command}"
+ puts "Unknown command: #{command}" unless command.blank?
puts options
exit 1
end
@@ -345,7 +345,7 @@ def split_args(args)
left = []
left << args.shift while args[0] and args[0] =~ /^-/
left << args.shift if args[0]
- return [left, args]
+ [left, args]
end
def self.parse!(args=ARGV)
@@ -410,6 +410,10 @@ def determine_install_method
def parse!(args)
options.parse!(args)
+ if args.blank?
+ puts options
+ exit 1
+ end
environment = @base_command.environment
install_method = determine_install_method
puts "Plugins will be installed using #{install_method}" if $verbose
@@ -438,6 +442,10 @@ def options
def parse!(args)
options.parse!(args)
+ if args.blank?
+ puts options
+ exit 1
+ end
root = @base_command.environment.root
args.each do |name|
::Plugin.new(name).uninstall

0 comments on commit bf5d154

Please sign in to comment.
Something went wrong with that request. Please try again.