From bf5d15456757e63598575db42917d702af9da729 Mon Sep 17 00:00:00 2001 From: Akira Matsuda Date: Sun, 4 Jul 2010 17:37:57 +0900 Subject: 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 --- railties/lib/rails/commands/plugin.rb | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'railties') diff --git a/railties/lib/rails/commands/plugin.rb b/railties/lib/rails/commands/plugin.rb index e0930cdcee..96b6f9c372 100644 --- a/railties/lib/rails/commands/plugin.rb +++ b/railties/lib/rails/commands/plugin.rb @@ -335,7 +335,7 @@ module Commands 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 @@ module Commands 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 @@ module Commands 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 @@ module Commands 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 -- cgit v1.2.3